Problem:
An interesting polynomial rootfinding problem occurs in the computation of annuities. An amount of Pi dollar is put into account at the beginning of years 1,2,...N. It is compounded annually at a rate of r (e.g. r=.05 means a 5 percent rate of interest). At the beginning of years N1+1...N1+N2, a payment of P2 dollars is removed from the account. After the last payment, the account is exactly zero.
The relationship of the variable is P1[(1+r)^(N1) - 1]=P2[1 - (1+r)^(-N2)]
If N1=30, N2=30, P1=2000, P2=8000, then what is r? Use a rootfinding method of your choice.