Number of Periods for a loan
Periods( nLoan, nPayment, nInterest ) --> nPeriods
<nLoan> amount of money you get from the bank <nPayment> amount of money you pay back per period <nInterest> rate of interest per period, 1 == 100%
<nPeriods> number of Periods you need to pay the loan back
Periods() calculates the number of Periods one needs to pay back a loan of <nLoan> with periodical payments of <nPayment> and for a rate of interest <nInterest> per period.
debt in period 0 = <nLoan>
debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)
debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100) etc…
debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)
-> has to be 0, so
<nPeriods> = -log(1-<nLoan>*(<nInterest>/100)/<nPayment>)/log(1+<nInterest>/100))
Note, however that in the case of nPayment <= <nLoan>*(<nInterest>/100), one would need infinite time to pay the loan back. The functions does then return -1.
// You get a loan of 5172.56 at a interest rate of 0.5% per // month (6% per year). // You can afford to pay 100 back every month, so you need ? Periods( 5172.56, 100, 0.005 ) // --> 60.0 // months to cancel the loan.
Periods( 5172.56, 100, 0.005 ) == 60.0 Periods( 5172.56, 100, 0.0 ) == 51.7256
Periods() is compatible with CT3’s Periods().
Source is finan.c, library is libct.
PV(), FV(), PAYMENT(), RATE()