# KAlgebra/Credit payment

## This is tutorial how to calculate the compound interest with KAlgebra

**Let's first recall what the compound interest is:**

Compound interest arises when interest is added to the principal, so that from that moment on, the interest that has been added also itself earns interest. This addition of interest to the principal is called compounding. A bank account, for example, may have its interest compounded every year: in this case, an account with $1000 initial principal and 20% interest per year would have a balance of $1200 at the end of the first year, $1440 at the end of the second year, and so on.

**Formula for calculating compound interest:**

Where,

A = final amount

P = principal amount (initial investment)

r = annual nominal interest rate (as a decimal)

n = number of times the interest is compounded per year(12 times)

t = number of years

Example usage: An amount of $ 1,500.00 a loan from the bank with an annual interest rate of 4.3 percent, which complicates the quarter. Find the value of the amount due after 6 years.

A. Using the formula above, with P = 1500, r = 4.3/100 = 0.043, n = 4, and t = 6:

So, the value of the amount due after 6 years is approximately $1,938.op

*Write all these functions in* **Console Mode**

**1.This Function calculates the monthly interest rate by given yearly interest rate.**

monthlyInterestRate:= yearlyInterestRate-> yearlyInterestRate/1200

**2.This function calculates the monthly payment**

- mir=monthlyInterestRate

monthlyPayment:=(sum, mir, months)->(sum*(1+mir)^months*mir)/((1+mir)^months-1)

**3.This Function calculates the whole amount you have to return to the bank**

amount:=(monthlyPayment,months)->monthlyPayment*months