I have built a program that prices financial assets and it does this in part by calculating the IRR. The problem is that it does not run as quickly as I would like it to.
I currently use the Newton-Raphson method of calculating roots of equations, but then switch to the Interval Bisection method after a set number of tries. This is because there is a chance that the Newton-Raphson method cannot find the IRR, for instance, due to asymptotes. My understanding is that the Newton-Raphson method is more efficient for the cases that it actually works with, which is why my system is currently set up like this.
Is there a more efficient formula or algorithm that I can use to calculate the IRR of a financial asset than the ones that I am currently employing? Or, if there is none, is there a way I can change my current order of calculations to make it more efficient?
If you are in need of any of the formulas that I use to actually be written in this question, please let me know. Thank you for your time.
The pricing software that I have designed is a PHP extension written in the C language. This is because it is a web based program. I cannot change languages due to reasons to do with the company that I work for. I didn't mention the languages before as I didn't think that they were too important due to the fact that I was looking for an increase in mathematical efficiency, not computational.
Also, someone has brought to my attention the fact that the Secant method could also be used in the place of the Interval Bisection one or the Newton-Raphson one. Can anyone tell me how the Secant method compares to the other two in regards to efficiency?