I don't have much training in financial math and was unsure of where to start tackling the following...
Given a series of payments $P_1, P_2, ..., P_{60}$ which are increasing sporadically from one period to the next, is it possible to solve the following equation for some rate of return $R$ discretely, given a fixed amount $B$:
$$ B = \sum_{i=1}^{60}P_i\left(1+R\right)^{60-i} $$
So far I've considered writing out the sum, which results in a nasty polynomial. Is there some clean way to solve for $R$?
Question part II:
If there is no way to solve discretely, what is the most efficient way to estimate an $R$ that results in the sum being within some small error of $B$?
If its helpful with regards to considering efficiency, I'd like to solve the above equation in JavaScript in as little time as possible.
I ended up going for numerical approximation using the secant method which is basically defining
$$ f(R) = \sum_{i=1}^{60}P_i\left(1+R\right)^{60-i} - B $$
setting $f(R) = 0$ and finding the zero of the function within a given initial range.
For kicks, here is the javascript implementation: