Compounding
If accumulated interest is added back to the principal, it is called compounding [1].
Compound Interest
Compound interest is interest on interest. Compound interest is not the result of paying it out, in contrast, it is the result of investing interest again (reinvesting) [2]. Compound interest is an important topic in finance and economics.
Let
				\( P \) = Principal Amount 
				\( PMT \) = Monthly Payment 
				\( R \) = Annual Rate 
				\( T \) = Number of Years 
				\( N \) = Compounding
			
				\( I \) = Rate compounded monthly 
				\( B_i \) = Balance at the month i 
				\( B \) = Final Balance 
				\( P_f \) = Total Principal 
				\( C \) = Interest Amount 
				\( APY \) = Annual Percentage yield
			
First, calculate the rate compounded monthly:
If payments are made at the beginning of the period, then
If payments are made at the end of the period, then
Finally,
Example 1
Input
				Principal Amount = 5000 
				Monthly Payment = 100 
				Annual Rate = 5% 
				Number of Years = 10 
				Compounding = 4 (Quarterly) 
				Mode = BEG
			
Output
				Total Principal = 17000 
				Interest Amount = 6793.511 
				Balance = 23793.511 
				Apy = 5.095%
			
Example 2
Input
				Principal Amount = 1000 
				Monthly Payment = 200 
				Annual Rate = 3% 
				Number of Years = 6 
				Compounding = 12 (Monthly) 
				Mode = END
			
Output
				Total Principal = 15400 
				Interest Amount = 1552.826 
				Balance = 16952.826 
				Apy = 3.042%
			
1. A Basic Course in the Theory of Interest and Derivatives Markets (n.d). http://faculty.atu.edu/mfinan/actuarieshall/mainf.pdf
2. Compound Interest (n.d.). Retrieved August 18, 2016, from https://en.wikipedia.org/wiki/Compound_interest