# Mortgage calculation with SAGE

- PMT: Payment
- PV: Present Value (loan’s principal, amount barrowed)
- r: monthly interest rate (compounded monthly)
- t: number of years of the loan
- m: 12 (compounding period)
- i: r/m=r/12 (intereset rate per compounding period)
- n: mt=12*t (loan’s term, number of monthly payments)

PMT(PV, i, n) = (PV*i)/(1-(1+i)^(-n))

PMT(PV, r, t) = (PV*r/12)/(1-(1+r/12)^(-12*t))

or with building functions on top of functions

PMT1(PV, r, t) = PMT(PV, i=r/12, n=12*t)

Example: 200,000 USD for a 30-year mortgage at 6.5% compounded monthly PMT(200000, 0.065, 30)