January 13, 2012 We studied numerical integration in a previous
exercise. In today’s exercise we will look at the inverse
operation of numerically calculating a derivative. The function
that interests us in today’s exercise is the XIRR function from
Excel, which computes the internal rate of return of a series of
cash flows that are not necessarily periodic. The XIRR function
calculates the value of x that makes the following equation go
to 0, where pi is the ith cash flow, di is the date of the ith
cash flow, and d0 is the date of the first cash flow: The method
used to estimate x was devised by Sir Isaac Newton about three
hundred years ago. If xn is an approximation to a function, then
a better approximation xn+1 is given by where f'(xn) is the
derivative of f at n. Mathematically, the derivative of a
function at a given point is the slope of the tangent line at
that point. Arithmetically, we calculate the slope of the
tangent line by knowing the value of the function at a point x
and a nearby point x+ε, t