This is much more complicated that seems to be.
If you don't have any background in finance, I advise you try to start in some financial material independent of SAP. It is usually much easier to understand.
Talking about SAP
The calculation is carry-out by Financial Mathematics Area on SAP.
Which The Interest is calculated for the FIMA functions, talking about the interest we have few variables such methods, amount, days, and base days.
Furthermore, the SAP uses the same function to calculate cash flows, positions, and present values.
Some documentation that you start:
Financial Mathematics (CA-FIM-FMA) - SAP Library
Interest Calculation Methods - Financial Mathematics (CA-FIM-FMA) - SAP Library