The method is called fixed-point iteration; see, for example, the Wikipedia article http://en.wikipedia.org/wiki/Fixed_point_iteration .
The idea is that if rate contains the correct value (i.e. IRR), then NPV is zero, so the statement
rate *= (1 - npv(rate, cashflows) / investment)
rate will not change. This way, once you find the IRR, the iteration will not change it. A fixed-point hierarchy sometimes converges to the correct value, and sometimes not. Examples @Gareth and @unutbu show that here it does not always converge.
The convergence criterion is as follows. Write the update statement in a loop like
rate = rate * (1 - npv(rate, cashflows) / investment)
Now, if the derivative of the right-hand side with respect to rate is between 1 and -1, then the method converges. I cannot immediately see under what circumstances this is happening.
You may wonder why iteration doesn't
rate *= (1 - npv(rate, cashflows))
without the strange variable investment . In fact, I also wondered; it will also be a fixed point method that converges to IRR if the derivative condition is met. I assume that the derivative condition is satisfied in some cases for the method that you gave, and not for the method without investment .
source share