Compound Interest Calculation Function with Variables
To write a function for the amount that will be in the account after \( t \) years, we can use the formula for compound interest:
\[
A = P \left(1 + \frac{r}{n}\right)^{nt}
\]
Where:
- \( A \) is the amount of money accumulated after \( n \) years, including interest.
- \( P \) is the principal amount (the initial amount of money).
- \( r \) is the annual interest rate (decimal).
- \( n \) is the number of times that interest is compounded per year.
- \( t \) is the time the money is invested for, in years.
Given:
- \( P = \$5,280 \)
- the annual interest rate \( r = 4.2\% = 0.042 \) (as a decimal)
- interest is compounded monthly, so \( n = 12 \)
Substitute these values into the compound interest formula to define the function for \( A \):
\[
A(t) = 5280 \left(1 + \frac{0.042}{12}\right)^{12t}
\]
This function can be used to calculate the amount in the account after any number of years \( t \).