numpy.ipmt(rate,per,nper,pv,fv=0,when='end')[source]¶Compute the interest portion of a payment.
| Parameters: |
|
|---|---|
| Returns: |
|
Notes
The total payment is made up of payment against principal plus interest.
pmt=ppmt+ipmt
Examples
What is the amortization schedule for a 1 year loan of $2500 at8.24% interest per year compounded monthly?
>>>principal=2500.00
The ‘per’ variable represents the periods of the loan. Remember thatfinancial equations start the period count at 1!
>>>per=np.arange(1*12)+1>>>ipmt=np.ipmt(0.0824/12,per,1*12,principal)>>>ppmt=np.ppmt(0.0824/12,per,1*12,principal)
Each element of the sum of the ‘ipmt’ and ‘ppmt’ arrays should equal‘pmt’.
>>>pmt=np.pmt(0.0824/12,1*12,principal)>>>np.allclose(ipmt+ppmt,pmt)True
>>>fmt='{0:2d}{1:8.2f}{2:8.2f}{3:8.2f}'>>>forpaymentinper:...index=payment-1...principal=principal+ppmt[index]...print(fmt.format(payment,ppmt[index],ipmt[index],principal)) 1 -200.58 -17.17 2299.42 2 -201.96 -15.79 2097.46 3 -203.35 -14.40 1894.11 4 -204.74 -13.01 1689.37 5 -206.15 -11.60 1483.22 6 -207.56 -10.18 1275.66 7 -208.99 -8.76 1066.67 8 -210.42 -7.32 856.25 9 -211.87 -5.88 644.3810 -213.32 -4.42 431.0511 -214.79 -2.96 216.2612 -216.26 -1.49 -0.00
>>>interestpd=np.sum(ipmt)>>>np.round(interestpd,2)-112.98