• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Calling math people!

Kntx

Platinum Member
I wish I could have a chat with my 17 year old self right now. He'd know how to do this...

So I have to implement an IRR (internal rate of return) calc for a system I'm working on. This is a sample problem I came up with from my stock portfolio 🙂

-3712/(1-r) + 256/(1-r)^2 + 286/(1-r)^3 + 298/(1-r)^4 + 6930/(1-r)^5 = 0

The gist is you want to find the discount rate at which the net present value of a cash flow from an investment is 0. The variable "r" is the discount rate we are looking for. So I sketch it all out and realize I have no clue how to solve for r, doh!

So... who loves math?



 
Anyway, I have it mostly figured out.

The real equation is

?cash_flow<i>/(1+rate)^t<i> = 0

Which you can rewrite as...

?cash_flow<i>(1+rate)^-t<i> = 0

Cash flow is known, the rate is unknown. A a root finding method can be used to determine the rate. Newton?s method seems to be the best candidate. May I say thank god for wikipedia.

edited to use angle brackets for my <i> becuase sqaure ones made things italic.
 

Substitute x = 1-r into your equation, and then multiply both sides by x^5:

(-3712) x^4 + (256) x^3 + (286) x^2 + (248) x + 6930 = 0.

This is, of course, a simply polynomial that you can solve using the normal methods.

Throwing this into an online polynomial root finder shows that the two real solutaton to this
are approximately x~=-1.156 and x~=1.216, or r~=2.156 and r~=-0.216.

 
Back
Top