For protocols like compound which compound interest, there is an index for measuring each period the interest compounds. Using compound v2 protocol as an example, which compounds interest every block.
Simple Interest = $P(1+rt)$
Compound Interest = $P(1 + \frac{r}{n})^{nt}$
P : Principal
1 : Representing 100% of the principal when the principal multiplies the bracket
r: rate
n: number of compounding times in a year.
t: number of years.
Ex.
A loan of 100$ for 10% interest per annum for 1yr, that compounds 12 times a year.
Compound Interest = $P * (1 + \frac{r}{n})^{nt} = 100 * (1 + \frac{0.1}{12})^{12*1} = 110.5\$$
Ex.
A loan of 100$ for 10% interest per annum for 1yr, compounding each second.
Compound Interest = $P * (1 + \frac{r}{n})^{nt} = 100 * (1 + \frac{0.1}{31556952})^{31556952*1} = 110.517 = 110.5\$$