From the original source: http://www.rubyquiz.com/quiz156.html
NPV = Σ ————
t=0 (1 + IRR)**t
Keep in mind that the IRR higher than 100% is possible. Extra charge if you can correctly handle input that produces rates , ignoring the fact that they make no more sense.
Internal Rate of Return (IRR — http://en.wikipedia.org/wiki/Internal_rate_of_return) is a common financial metric, used by investment firms to predict the sustainability of a company or project. Choosing the IRR of a Business amounts to solving for it in the equation for Net Present Value (NPV — http://en.wikipedia.org/wiki/Net_present_value), another invaluable decision-making metric:
This week’s suggestion is to figure out the IRR for just about any specific variable-length listing of numbers, which represent annual income flows, the C_t’s in the formula : C_0, C_1, etc. (C_0 is usually a poor value, corresponding to its initial investment in to the endeavor.) By the example in the Wikipedia essay (http://en.wikipedia.org/wiki/Internal_rate_of_return), for instance, you should be able to Make a rate of 17.09percent (to four decimal places, let’s say) from a comparable command:
by Harrison Reiser… Read More