# Find root of non-continuous function using a numerical method

Given the formula (source) $$M = P \times \frac{J}{1 - (1 + J)^{-N}}$$ Assume $P$ and $J$ remain constant. I want to be able to find $N$ for given $M.$

Could you please give an example of a numeric method (like secant to solve the same)? [My] problem is how to find initial 2 values for the secant formula.

-

If I understood your question correctly, we're given, $M,P,J$ and we're trying to find $N.$
Well, we have $$1 - (1+J)^{-N} = \frac{PJ}{M} \\ (1+J)^{-N} = 1 - \frac{PJ}{M}$$ Take $\log$ both sides: $$-N \log{(1+J)} = \log{(1 - \frac{PJ}{M})} \\ N = - \frac{\log{(1 - \frac{PJ}{M})}}{\log{(1+J)}}$$ Since $M, P, J$ are given, we can very well compute the RHS, and hence compute $N.$
Of course, assuming $\dfrac{PJ}{M} < 1$ and $J > -1.$ –  user2468 Mar 25 '12 at 5:47