# The Tribulations of Calculations

81 days until exam FM.  I am spending most of my time plowing head-first into derivatives  markets, but I am also working random interest theory problems each day, as well as finishing up a thorough study of duration, volatility, and convexity.  Most of these problems present a calculation challenge.  For instance, as soon as a solution requires calculating an increasing annuity, trouble is near:

$\displaystyle (Ia)_{\overline{n}\lvert }=\frac{\ddot a_{\overline{n}\lvert }-nv^n}{i}=\frac{\frac{1-v^n}{i}(1+i)-nv^n}{i}$

This looks even prettier once you put some numbers into it (suppose that n=20 and i=0.09):

$\displaystyle (Ia)_{\overline{20}\lvert }=\frac{\frac{1-(1.09)^{-20}}{0.09}(1.09)-20(1.09)^{-20}}{0.09}$

For the duration of a bond, this calculation is just a small piece of the whole numerical birds-nest.  You might know just what needs to be calculated for a solution, but it is trouble to coax the right number out of the other end of a calculator.  It seems silly to get wrong answers for this reason, so I have been putting a little thought into the best ways to arrive at numerically correct answers.  My initial guess was that the best technique is to store a bunch of intermediate values in the calculator.

Let’s look the duration of a bond.  This quantity is

$\displaystyle \frac{\sum tv^tCF_t}{\sum v^tCF_t}=\frac{Fr(Ia)_{\overline{n}\lvert }+Cnv^n}{Fra_{\overline{n}\lvert }+Cv^n}$

The way I figure it, you are better off using the definition on the left for a bond with only a few coupon periods. Lets take a 4 year par value 1000 bond with 8% coupons and a 7% yield rate.  The left hand formula produces:

 t vt CF 1 1.07-1 80 2 1.07-2 80 3 1.07-3 80 4 1.07-4 1080

Which yields: (technique #1)

$\displaystyle \frac{1(1.07)^{-1}(80)+2(1.07)^{-2}(80)+3(1.07)^{-3}(80)+2(1.07)^{-4}(1080)}{(1.07)^{-1}(80)+(1.07)^{-2}(80)+(1.07)^{-3}(80)+(1.07)^{-4}(1080)}$

That looks a little hairy.  But our alternative is this:  (technique #2)

$\displaystyle \frac {80 (\frac{\frac{1-1.07^{-4}}{0.07}(1.07)-4(1.07)^{-4}}{0.07})+1000(4)(1.07)^{-4}} {80 (\frac{1-1.07^{-4}}{0.07})+1000(1.07)^{-4}}$

That is much worse.

The moral of the story is: just because your TI-30XS multiview calculator allows you to create nice looking nesting fractions on the screen, doesn’t mean that you should always actually make those fractions.  To find durations, or convexities, using technique #1, we simply make a chart on paper, then multiply across the rows.  Using technique #2, we create a monstrous mess that is nearly impossible to trouble-shoot.  If we absolutely need to compute using technique #2, we need to store some intermediate values in calculator memories.  I usually store 1+i, a angle n, and v^n.  It is still treacherous.  I think I will post some practice exercises tomorrow.