# Compounded interest calculation with SAGE

Suppose you deposit $5000 in an account that earns 4.5% compounded monthly. You are curious when your total will reach $ 7000. Using the formula A = P(1+i)^{n}, where P is the principal, A is the amount at the end, i is the interest rate per month, and n is the number of compounding periods (number of months), we have

```
7000 = 5000(1+0.045/12)^n
1.4=(1+0.0045/12)^n
log 1.4 = log (1+0.0045/12)^n
log 1.4 = n log (1+0.0045/12)
SAGE: n = log(1.4)/log(1+0.045/12)
```