In this section, we will examine computation of a straight bond's YTM
using a popular technique called bisection.
Inherent limitation of this model is that, it assumes reinvestment of bond coupons
at that very bond's yield-to-maturity level. (not realistic, but let's examine the calc procedure).
The algorithm here starts with a bottom yield assumption and we then find
the upper bound by increasing the interest rate until the
bond price turns negative (annual compounding assumed). With that starting point, we operate a For..while loop,
taking an average of the bottom and top guestimates, until we can refine to a
point where the clean price is equal to the calculated bond price (subject to a
pre-defined accuracy level).
Bond YTM calculation using Bisection Method