These four loan calculators will automatically calculate everything for you:
Us Mortgage Calculator With Amortization
Accelerated Bi-weekly Mortgage vs Monthly Mortgage Calculator
Small US Mortgage Calculator
How Much Can I Borrow – Mortgage Calculator
FV (future value of the mortgage loan)
IN (interest rate of the mortgage loan)
The interest rate is a needed variable. It is usually known, however, when we have all the other variables, it’s easy to calculate. See this mortgage rate calculator for an interest calculator example.
PE (number of periods of the mortgage loan)
The number of periods of the mortgage loan (either in years, in months or weeks) is how many payments will be made to repay the loan.
PAY (regular payment to apply to the mortgage loan)
This is what people is really looking for: the regular mortgage payment to apply to the mortgage loan.
PR(present value of the mortgage loan)
The present value of the mortgage loan… or mortgage principal, or loan principal) (how much ia borrowed).
How to code a mortgage calculator:
PAY = PR x IN / (1 – (1 + IN)–PE)
PAY = (PR * IN) / (1 – Math.pow(1 + IN, -PE))
In Math.pow (x, y) x is the base number and y is the exponent (the power to which the base number is raised). For example, Math.pow(3, 2) raises 3 to the power of 2, which gives 9.
The mortgage calculator will also have to convert the number of periods (PE) into monthly mortgage loan payment periods by multiplying it by 12.
PR (present value of the mortgage loan or principal amount)
IN (annual interest rate of the mortgage loan)
PE (number of periods of the mortgage loan in years, or loan term in years)