Module 1 · Mathematical Language and Quantitative Reasoning Lesson 8 of 120

Inequalities, Bounds, and Constraints

A lending limit that is a constraint, not an opinion.

2:34 clip26:29–29:03 in the full courseWatch on YouTube

Transcript

22 sentences · select one to jump there

Check your understanding

Is 1,000 accepted by exposure < 1,000?

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.

008-inequalities-bounds-and-constraints.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 008 of 120
 * Inequalities, Bounds, and Constraints
 * Module 01: Mathematical Language and Quantitative Reasoning
 *
 * Scenario: A lending limit that is a constraint, not an opinion
 * Rule:     0 ≤ exposure ≤ limit
 *
 * Try it:   Is 1,000 accepted by exposure < 1,000?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/mathematical-language-and-quantitative-reasoning/inequalities-bounds-and-constraints/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson008() {
  const limit = 1000;
  const requests = [-10, 0, 800, 1000, 1200];
  const result = requests.map(x => ({
    amount: x,
    allowed: Number.isFinite(x) && x >= 0 && x <= limit
  }));
  return result;
}

export const checkedResult = [{"amount":-10,"allowed":false},{"amount":0,"allowed":true},{"amount":800,"allowed":true},{"amount":1000,"allowed":true},{"amount":1200,"allowed":false}];

// Run this file directly: npx tsx lessons/01-mathematical-language-and-quantitative-reasoning/008-inequalities-bounds-and-constraints.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson008(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

[
  {
    "amount": -10,
    "allowed": false
  },
  {
    "amount": 0,
    "allowed": true
  },
  {
    "amount": 800,
    "allowed": true
  },
  {
    "amount": 1000,
    "allowed": true
  },
  {
    "amount": 1200,
    "allowed": false
  }
]

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

Lesson notes

The rule

0 ≤ exposure ≤ limit