Method Deck / finance

Amortization schedule row

Computes the interest, principal, and remaining balance for a single payment number of a fixed-payment amortizing loan.

Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.

Try it

Inputs

Outputs

Steps

  1. Convert the annual rate to a decimal: r = annual_rate_percent / 100; monthly rate i = r / 12.
  2. Compute the fixed monthly payment using the standard annuity formula: payment = principal * i * (1+i)^months / ((1+i)^months - 1) (or principal/months if i = 0).
  3. Starting from balance = principal, iterate payment by payment: interest_this = balance * i; principal_this = payment - interest_this; balance = balance - principal_this.
  4. Stop at payment_number and report that payment's interest_portion, principal_portion, and the resulting remaining_balance.
  5. Round every reported amount to 2 decimals (money to cents); the final row's remaining_balance is clamped to 0 if within half a cent.

Constants

None.

Sources

Worked example and test vectors

NameInputsAnswer
worked example{"principal":200000,"annual_rate_percent":6,"months":360,"payment_number":1}Interest $1,000.00, principal $199.10, remaining balance $199,800.90
test vector: last payment fully retires balance{"principal":12000,"annual_rate_percent":0,"months":12,"payment_number":12}Interest $0.00, principal $1,000.00, remaining balance $0.00

Published card