I’m working on converting a mortgage calculator in PHP, but I don’t necessarily need a PHP solution. I’m looking for the logic needed to replicate the Excel RATE function. I’ve found a solution which uses bisection, and if worse comes to worse, I use that.
I know someone out there in the interwebs world has knowledge of such a function, so I’d love to have an easy answer instead of creating a solution from scratch.
References:
- http://office.microsoft.com/en-us/excel-help/rate-HP005209232.aspx
- http://en.wikipedia.org/wiki/Newton%27s_method
Thanks
Implementation of the MS Excel RATE() function using the secant method (a finite difference approximation of Newton’s method) taken from PHPExcel: