Yield curve fitting example in Wilmott on Quant Finance p.528

In Wilmott on Quantitative Finance Vol. 2, p. 528, Section 31.4.2, is given a power series expansion for a zero coupon bond

$$Z(r,t;T)=1+a(r)(T-t)+b(r)(T-t)^2+c(r)(T-t)^3+\dots$$

then it says to substitute this into the bond pricing equation, which is, of course

$$Z_t+\frac{1}{2}w^2Z_{rr}+(u+\lambda w)Z_r-rZ=0$$

the result of which is given as

$$-a-2b(T-t)-3c(T-t)^{2}+\frac{1}{2}\left(w^{2}-2(T-t)w\frac{\partial w}{\partial t}\right)\left(\left(T-t\right)\frac{\partial^{2}a}{\partial r^{2}}+(T-t)^{2}\frac{\partial^{2}b}{\partial r^{2}}\right)$$ $$\text{ }+\left(\left(u-\lambda w)-(T-t\right)\frac{\partial\left(u-\lambda w\right)}{\partial t}\right)(T-t)\left(\frac{da}{dr}+\left(T-t\right)^{2}\frac{db}{dr}\right)-r\left(1+a(T-t)+c(T-t)^{2}\right)+\dots=0$$

My conundrum, for starters, is that I don't know how the first parenthical grouping in each of

$$\left(w^{2}-2(T-t)w\frac{\partial w}{\partial t}\right)\left(\left(T-t\right)\frac{\partial^{2}a}{\partial r^{2}}+(T-t)^{2}\frac{\partial^{2}b}{\partial r^{2}}\right)$$

and

$$\left(\left(u-\lambda w)-(T-t\right)\frac{\partial\left(u-\lambda w\right)}{\partial t}\right)(T-t)\left(\frac{da}{dr}+\left(T-t\right)^{2}\frac{db}{dr}\right)$$

terms came to be (and the latter line, it seems like errata for the partial in $r$, shouldn't it be $\left((T-t)\frac{da}{dr}+\left(T-t\right)^{2}\frac{db}{dr}\right)$ not preceded by the $(T-t)$ term (because when it distributes it will give the wrong power for $(T-t)$ on the $\frac{db}{dr}$ term?

When I compute partial derivatives with respect to $t$, $r$, and $rr$ of $Z$ I don't get the same result for the partials of $r$ and $rr$. Obviously, some steps are missing. I do get the same first three terms as that given above, due to $Z_t$, but after that it diverges from the answer given until the $-rZ$ term at the end of the bond pricing equation (though, again, I do think it should have been a $b(T-t)^2$ instead of $c(T-t)^2$ in that last term.

I know this is asking a bit much perhaps, but any help is appreciated. Thanks in advance.

Your observations are pretty much correct.

The groupings are because of the fine print "Note how I have expanded the drift and volatility terms at $t = T$; in the above these are evaluated at $r$ and $T$." on the same page (p.528).

Basically, $w$ is a function of both $r$ and $t$. Since we want to use $w(r,T)$ instead of $w(r,t)$, we taylor expand $w(r,t)$ around $w(r,T)$ with respect to $t$. The same is true for functions of $w(r,t).$ Thus,

\begin{align} w(r,t)^2 &= w(r,T)^2 + (t-T)\frac{\partial w(r,T)^2}{\partial t}\\ & = w(r,T)^2 -2 (T-t)w(r,T)\frac{\partial w(r,T)}{\partial t} \end{align}

The same is true for $u(r,t) - \lambda w(r,t)$ where now $u$ may also be a function of $r$ and $t$: \begin{align} u - \lambda w(r,t) &= (u(r,T) - \lambda w(r,T)) + (t-T)\frac{\partial (u(r,T) - \lambda w(r,T))}{\partial t}\\ &= (u(r,T) - \lambda w(r,T)) - (T-t)\frac{\partial (u(r,T) - \lambda w(r,T))}{\partial t} \end{align}

I hope this solves your conundrum.

Other points

1. Yes there is an errata: it should be $\left((T-t)\frac{da}{dr}+\left(T-t\right)^{2}\frac{db}{dr}\right)$.

2. It should have been a $b(T-t)^2$ instead of $c(T-t)^2$ in the last term as you point out at the end of your question.

• Thank you so much Theja. More conundrums to follow, I promise.
– Joe
Oct 11, 2013 at 18:58