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, so, despite them being good suggestions, I cannot use PERL or the Excel IRR function. I didn't mention the languages before as I didn't think that they were too important due to the fact that I am looking for an increase in mathematical efficiency, not computational.


You could try Brent's method, it works well.

  • $\begingroup$ I have been looking at this and it potentially could be the best solution. I think I will implement this and then do some speed tests, thank you $\endgroup$ – Jamie1596 Jul 4 '14 at 15:28

I've worked with calculating an IRR for a couple of weeks now. I have implemented 5 different methods and have come to the conclusion that Halley's Method is the most efficient (in my case, using Python) thus far. Brent's method works pretty well too!

Denote the Net Present value function as $P(r)$. We know that finding the IRR requires finding $r_{*} \in \mathbb{R}$ such that $P(r_{*}) = 0$.

Since $P(r)$ is a polynomial, we can take advantage of utilizing the second derivative. According to Wikipedia, we obtain cubic convergence as opposed to Newton-Raphson's quadratic (in general) convergence.


No reputation for comments (sorry). What programming language / libraries are you using?

I think that the Excel library just does 20 iterations.

You might find it useful to look at the Perl module Finance::Math::IRR That particular library uses a secant method. The Gnumeric gnumeric.org apparently uses Newton's.

There is a very short paper by Moten & Thron that offers an improvment to the secant method that they claim is more efficient.

  • $\begingroup$ Sorry, I'll update my question to let you know what technology that I am using. I'll take a look at the Secant method, thanks for that. $\endgroup$ – Jamie1596 Jul 4 '14 at 7:52
  • $\begingroup$ Also, how much do you know about the Secant method? Do you how efficient it is in comparison to the Newton-Raphson method or the Interval Bisection method? $\endgroup$ – Jamie1596 Jul 4 '14 at 8:05
  • $\begingroup$ The question on language/library was not meant to suggest changing anything. Even when you have very compelling reasons to write a routine from scratch it is helpful to use a reference model to verify your results and to make sure that your performance is reasonable. $\endgroup$ – Bill Jul 4 '14 at 18:07
  • $\begingroup$ As a gross generalization, the Secant method is probably a bit faster than Newton-Raphson. However, as a general method for finding roots it is not guaranteed. Brent's method, as suggested by experquiste is guaranteed. $\endgroup$ – Bill Jul 4 '14 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.