how to calculate the internal rate of return [closed]
According to Keynes the internal rate of return is the $r$ value which solve $0 = -I + A_1/(1+r) + A_2/(1+r)^2 + ...+A_1/(1+r)^n$ for $I$ and the list of the $A_i$ given .
It is evident that we gain in in changing variables for $\alpha = 1/(1+r)$ to obtain : $0 = A_1\alpha + A_2\alpha^2 + ...+A_1\alpha^n$. And in a last operation after that we have find a solution to solve on $r$ $\alpha = 1/(1+r)$ or directly to calculate $r = (1/\alpha)-1$.
My frist attempt to solve this problem whose solution is $7.7138$ (after Excel) is the following. First I plot the rhs of the equation to see if there is a solution. It seems to exist in the good interval.
fr =-250+100*x+150*x^2+200*x^3+250*x^4+300*x^5
plot(fr,(x,0,1))
Then I try
sol=fr.find_root(0.001, 1)
show(sol)
show((1/sol)-1)
which returns $sol= 0.6380683030615047$ and $r = \frac{1}{sol}-1 = 0.567230334435854$. But this solution differs too much from Excel's one. I do not understand from where comes the problem.
This is irrelevant to Sage. Better ask at math.stackexchange