Module 2 · Financial Arithmetic, Time Value, and Returns Lesson 11 of 120

Simple Interest

A fixed-rate invoice financing illustration.

2:30 clip37:33–40:04 in the full courseWatch on YouTube

Transcript

24 sentences · select one to jump there

Check your understanding

What base earns interest in this example?

Choose one answer

Code lab

Run it yourself

The lesson source in 7 languages. Edit it, run TypeScript and Python right here, and compare with the expected output.

011-simple-interest.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 011 of 120
 * Simple Interest
 * Module 02: Financial Arithmetic, Time Value, and Returns
 *
 * Scenario: A fixed-rate invoice financing illustration
 * Rule:     I = P × r × t
 *
 * Try it:   What base earns interest in this example?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/financial-arithmetic-time-value-and-returns/simple-interest/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson011() {
  const principal = 1000;
  const annualRate = 0.05;
  const years = 3;
  const interest = principal * annualRate * years;
  const result = {interest, total: principal + interest};
  return result;
}

export const checkedResult = {"interest":150,"total":1150};

// Run this file directly: npx tsx lessons/02-financial-arithmetic-time-value-and-returns/011-simple-interest.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson011(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "interest": 150,
  "total": 1150
}

Prefer your own machine? Every file is in the course repository · open it in Codespaces.

Lesson notes

The rule

I = P × r × t