Bond convexity closed-form formula

Bond convexity closed-form formula (Blake and Orszag):

Conv=-\frac{D}{P}\begin{Bmatrix}\frac{(m-1+a+1)(m-1+a+2)(1/(1+i))^{(m-1+a+2)}}{i}+\\2\frac{(m-1+a+2)(1/(1+i))^{(m-1+a+2)}-(1/(1+i))}{i^2}+\\2\frac{(1/(1+i))^{(m-1+a+2)}-(1/(1+i)}{i^3}\end{Bmatrix}+\frac{B}{P}\frac{(m-1+a)(m-1+a+1)}{(1+i)^{(m-1+a+2)}}


D = coupon payment per period
P = present value (price)
B = face value
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 duration closed-form formula