How to calculate the monthly interest rate?

  • Thread starter Thread starter h1a8
  • Start date Start date
  • Tags Tags
    Interest Rate
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
12 replies · 2K views
h1a8
Messages
86
Reaction score
4
Homework Statement
Given the monthly payment A, loan amount P, and the number of months to payoff loan n, calculate the monthly interest rate i.
Relevant Equations
A = [Pi(1+i)^n] /[(1+i)^n-1]
First, I'm not sure if this is the right forum to post this question. It's not a homework problem or any assignment. Just doing this as an exercise. Ill just post it here just in case.

I’m trying to write a c++ program to calculate the monthly interest rate 'i' given the loan amount 'P' , number of monthly payments to payoff loan 'n' , and monthly payment 'A'. My background is a BA in mathematics.

Im familiar with the amortization formula
1) A = [Pi(1+i)^n] /[(1+i)^n-1]
I rearrange
->2) A/P = [i(1+i)^n] /[(1+i)^n-1]
Let c = A/P
->3) c = [i(1+i)^n] /[(1+i)^n-1]
->4) c(1+i)^n-c= i(1+i)^n
->5) c = c(1+i)^n-i(1+i)^n
->6) c = [(1+i)^n] (c-i)

I just don’t see an elementary way to solve for the rate i. Maybe some numerical technique? Taylor series perhaps?

I attempted 2nd degree Taylor series centered at 0, but the accuracy wasn't good enough. In higher order polynomials wasn't able to solve without computer software.

I Haven't tried Newton's method yet though.

So the question is what method(s) can I use to accurately get the rate i, given A, n, and P, so that I can apply it to a c++ program (or just in general)? And what algorithm do typical financial calculators use?
 
Physics news on Phys.org
Chestermiller said:
Continuous compounding is a pretty good approximation, with the formula $$\frac{P}{nA}=\frac{1-e^{-x}}{x}$$where x = n i. So first solve that to get a first approximation to i. Then do a Newton iteration on the non-linear actual equation.
Thanks. But how do I solve the continuous compounding equation you posted for the approximation?
 
h1a8 said:
Thanks. But how do I solve the continuous compounding equation you posted for the approximation?
Newton method also, starting with Taylor series to linear or quadratic terms.
Or, you can make a general table of the left hand side vs x, and, to get your initial guess for i , interpolate in the table.
 
Last edited:
Chestermiller said:
Where is i in your equation?
Edit: That's not an equation, that's an expression stated two different ways.
Made a hash of that didn't I? Hang on a bit...
 
pbuk said:
Edit: That's not an equation, that's an expression stated two different ways.
Made a hash of that didn't I? Hang on a bit...
Not too much of a hash, missed out a factor of 2.

$$ i \approx \frac{2(nA-P)}{nP} = 2 \left( \frac{A}{P} -\dfrac{1}{n} \right) $$
 
Chestermiller said:
From Eqn. 1, $$\frac{P}{nA}=\frac{1-(1+i)^{-n}}{ni}$$To linear terms in i, this gives $$i=\frac{2}{n+1}\left(1-\frac{P}{nA}\right)$$
Yes that is mathematically more sound than my approximaiton (once I remembered the factor of 2!) however for large ## n ## e.g. ## n = 300 ## (i.e. a 25 year loan) my approximation is closer. I think I prefer yours though.
 
Thanks!
Using f(x) = (1+x)^n*(P*x/A-1) +1
I worked out that f(x) is both increasing and concave up when x > (An - P)/[P*(n+1)]
and that f{(An - P)/[P*(n+1)] } < 0 and f(A/P) = 1 > 0.
So f(x) = 0 implies that A/P < x < (An - P)/[P*(n+1)] .
Therefore, x is approximately the average of the two endpoints or 1/2 * {A/P + (An - P)/[P*(n+1)] } and is guaranteed to converge with Newton's Method.

I know this expression is not as simple looking as the linear ones you two gave, but it works well in my program after 10 iterations (for even the craziest of numbers). I had a few issues with the other two approximations in some cases but that could have been the programming and not the theory.