Affine diffusion bond pricing (source code)

= Affine diffusion bond pricing
{title2=$P=A(\tau)e^{-B(\tau)r}$}

When $\mu_Q=a(b-r)$ and $\eta(r)^2=\eta_0^2+\eta_1^2r$, substituting $P=A(\tau)e^{-B(\tau)r}$ gives $B'=1-aB-\eta_1^2B^2/2$ and $(\log A)'=-abB+\eta_0^2B^2/2$, with $B(0)=0$, $A(0)=1$. The <Vasicek model> uses $\eta_1=0$, and the <CIR model> uses $\eta_0=0$.