How to calculate the monthly interest rate?

  • Thread starter Thread starter h1a8
  • Start date Start date
  • Tags Tags
    Interest Rate
Click For Summary

Homework Help Overview

The discussion revolves around calculating the monthly interest rate 'i' in the context of loan amortization. The original poster is exploring methods to derive 'i' given the loan amount 'P', the number of monthly payments 'n', and the monthly payment 'A', using a C++ program as a practical application.

Discussion Character

  • Exploratory, Mathematical reasoning, Assumption checking

Approaches and Questions Raised

  • Participants discuss various methods to solve for 'i', including Newton's method and Taylor series. There is exploration of continuous compounding as an approximation and the implications of different equations and expressions related to the problem.

Discussion Status

Multiple approaches have been suggested, including numerical techniques and approximations. Some participants have provided specific equations and expressions, while others have raised questions about the clarity and correctness of these formulations. There is an ongoing exchange of ideas without a clear consensus on the best method.

Contextual Notes

Participants are working within the constraints of a non-homework context, focusing on theoretical understanding and practical implementation in programming. There is mention of potential issues with accuracy in approximations and the need for iterative methods.

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
Use Newton's method to solve Eqn. 3.
 
Chestermiller said:
Use Newton's method to solve Eqn. 3.
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.
 
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:
It converges quickly and surely so the initial guess doesn't really matter: ## \dfrac{nA-P}{nP} = \dfrac{A}{P} -\dfrac{1}{n} ## is where I'd start.
 
pbuk said:
It converges quickly and surely so the initial guess doesn't really matter: ## \dfrac{nA-P}{nP} = \dfrac{A}{P} -\dfrac{1}{n} ## is where I'd start.
Where is i in your equation?
 
The linearized solution for continuous compounding is $$x=ni=2\left(1-\frac{P}{nA}\right)$$
 
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...
 
  • #10
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)$$
 
  • Like
Likes   Reactions: pbuk
  • #11
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) $$
 
  • #12
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.
 
  • #13
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.
 

Similar threads

Replies
1
Views
1K
Replies
2
Views
1K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 20 ·
Replies
20
Views
3K
Replies
6
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K