- #1

h1a8

- 87

- 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?

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?