Author 
Topic: The Time/Payment Formula (Loan Amortization) (Read 5329 times) 

Welopez
Moderator
member is offline
Never let your beliefs get in the way of learning.
Gender:
Posts: 4407


The Time/Payment Formula (Loan Amortization)
« Thread started on: Nov 29^{th}, 2008, 12:06pm » 

Some people do not fully understand the time payment formula. Only three values are needed: A = the amount borrowed N = the number of payments to be made R = the interest rate for repayment.
The formula is: payment = A*R/(1(1+R)^(N*1))
A simple program might look like: Code:INPUT "Amount? "; A
INPUT "Yearly Rate? "; R
IF R > 1 THEN R=R/100
R=R/12
INPUT "Months to Repay? "; N
payment = A*R/(1(1+R)^(N*1))
PRINT payment
END
Entering the amount borrowed should be simple for any user. The yearly rate might be entered at 12.9, but more properly should be .129. The IF/THEN comparison checks to see if the amount entered is greater than 1, if so it is divided by 100. Since payments will be made every month, we want to divide the yearly rate by 12 to obtain the monthly rate. In the time payment formula, N is the number of months, and to obtain a decreasing value, N*1 is used.
The time payment formula shows the user how much each payment will be. To make our program more informative, we'll use a FOR/NEXT loop and display the number of the payment, the interest paid for this month, the amount to reduce the amount owed for this month, and the remaining balance. Code:'Amortization Schedule
INPUT "Amount? "; A
INPUT "Yearly Rate? "; R
IF R > 1 THEN R=R/100
R=R/12
INPUT "Months to Repay? "; N
payment = A*R/(1(1+R)^(N*1))
PRINT "Monthly payment equals $"; USING("#####.##",payment)
PRINT
PRINT "Month", "Int. Pd.", "Prin. Pd.", "Balance" 'Column headings
FOR k=1 TO N
curInt=A*R 'This months interest payment
curPrin=paymentcurInt 'This months principle payment
A=AcurPrin 'Balance minus this months principle
PRINT k,_
USING("#####.##", curInt),_
USING("#####.##", curPrin),_
USING("#####.##", A)
NEXT k
END
Now that we know how much we will pay every month, we can calculate how much of that payment will go for renting the money, curInt, how much will go to reduce the debt, curPrin, and how much the balance will be after subtracting this month's curPrin.
Notice the amount of interest will decrease every month as the length of time we will rent the money decreases; also the amount toward principle will increase, though monthly payments remain the same. Payment = curInt + curPrin.
For those without experience in printing tables, PRINT means to advance to the next line. It is not necessary to tell the computer what to print. PRINT k, curInt, curPrin, A tells the computer to print multiple values, beginning with the next print zone (14 spaces when using Just Basic) on the same line.
The logical line extension (_) allows us to place the code for each value on a separate program line, but when printed to the screen they will be treated as a single line.
PRINT USING("#####.##", curInt) means the value current interest will be printed with a maximum of five digits plus two decimal digits. The same format is used for curPrin and A (balance remaining) with every pass through the FOR/NEXT loop.

« Last Edit: Nov 30^{th}, 2008, 1:58pm by Welopez » 
Logged

JB 1.01 Win7 64bit, 4 GB RAM, Pentium 6200@2.13 GHz (laptop) WinXP, 1 GB RAM, Intel N270@1.6 GHz (netbook)



Ralph
New Member
member is offline
Posts: 12


Re: The Time/Payment Formula (Loan Amortization)
« Reply #1 on: Oct 17^{th}, 2011, 09:54am » 

Well done Welopez! Can you show us your code for using it in GUI, as you said you'd done? Appreciated.

« Last Edit: Oct 17^{th}, 2011, 09:55am by Ralph » 
Logged




Jimmu
Junior Member
member is offline
Gender:
Posts: 119


Re: The Time/Payment Formula (Loan Amortization)
« Reply #2 on: Oct 17^{th}, 2011, 11:54am » 

I did something like this and found it didn't match with what the bank calculated because they did daily compounding of interest for 28, 29, 30, or 31 days depending on how many days in the month. Life is never as simple as it should be. :>


Logged

I know many things. Some of them are even true!



