Categories

## Simple Interest

The concept of Simple Interest is one of the first things anyone learns in Financial Mathematics.

It isn’t really hard to program.

The formula I am using is given below:

The code to program this is shown below:

```# Print out the purpose of the program
print("This program computes the compound amount using simple interest")
print("Reference: An Undergraduate Introduction to Financial Mathematics (Page 2)\n")

# Ask the user for the initial deposit
principal = float(input("Please enter the initial deposit: "))

# Ask the user for the rate as a percentage
rate = float(input("Please enter the rate: "))

# Ask the user for the number of years
years = float(input("Please enter the number of years: "))

# Compute the compounded amount
rate = rate / 100
compounded_amount = principal * ((1 + rate)**years)
print("\nThe compounded amount is:", round(compounded_amount, 2))
```

You can also find the code on GitHub.

Categories

## Introduction

I live in Lagos, Nigeria the poverty capital of the world.

This year, I decided to study Financial Mathematics.

I am an Engineer with a BSc in Systems Engineering from the University of Lagos.

My decision to study Financial Mathematics stems from the knowledge that to solve a problem, I must thoroughly understand it.

## Programming with Python

Whilst reading the book An Undergraduate Introduction to Financial Mathematics I realized that the formulas where jumping over my head.

Besides, its been a long time since I have done any Mathematics.

So I decided to write the compounding formula as a program. You can find the program below:

```# Print out the purpose of the program
print("This program computes the compound amount using monthly compounding")
print("Reference: An Undergraduate Introduction to Financial Mathematics (Page 3)\n")

# Ask the user for the principal amount
principal = float(input("Please enter the principal amount: "))

# Ask the user for the rate as a percentage
rate = float(input("Please enter the rate: "))

# Ask the user for the number of years as a decimal value
years = float(input("Please enter the number of years as a decimal value: "))

# Compute the compound amount (Page 3)
r_n = rate / (12 * 100)
nt = years * 12
factor = (1 + r_n) ** nt
compound_amount = principal * factor
print("\nThe compound amount is:", round(compound_amount, 2))
```

In doing so, I have a ready made program that I can use to solve the exercises in the book without having to use a calculator.

## Conclusion

The essence of code is to replace human rigour and tedium.

In creating this program, I had to study the formula and come up with my own program.

Now I understand the formula.

You can also find it on GitHub.