Skip to episode

How Quants Think · Numerical Thinking · Episode 15 of 30

How Quants Debug Numerical Algorithms

Learn a systematic way to debug pricing algorithms using simpler cases, mathematical invariants and independent benchmarks.

Why this question matters

A pricing engine may run without crashing and still disagree with a trusted result. Finding the cause is difficult when model choices, payoff logic and numerical approximations are all entangled.

How a quant approaches it

Experienced quants simplify the failing case, test intermediate quantities and exploit known identities before inspecting thousands of lines of code. Debugging is a sequence of controlled experiments, not random parameter changes.

A practical perspective

For a Monte Carlo Black–Scholes pricer, check whether the discounted simulated stock is a martingale before investigating the option payoff. That can localize a mistake in simulated dynamics or discounting.

What you will learn

Watch the video above for the complete explanation, reasoning and worked examples.

Slides and related lessons

How Quants Think slides on GitHub ↗ · Computations in Finance on YouTube ↗

Related study: Computational Finance, Lecture 3 — Option Pricing and Simulation in Python; Computational Finance, Lecture 9 — Monte Carlo Simulation. Browse Computational Finance or all 30 episodes.