Bond duration closed-form formula:
C = coupon payment per period (half-year)
P = present value (price)
i = discount rate per period (half-year)
a = fraction of a period remaining until next coupon payment
m = number of coupon dates until maturity
Look up Bond convexity closed-form formula