A small quantitative finance project comparing several numerical approaches to pricing European options under the Black–Scholes model.
The project implements and compares three fundamental approaches to derivative pricing:
- Analytical solution (Black–Scholes closed form)
- Monte Carlo simulation of the underlying stochastic process
- Finite-difference PDE solvers (explicit scheme and Crank–Nicolson)
The goal is to illustrate how different mathematical formulations of the same pricing problem lead to consistent results while exhibiting different numerical properties.
Under the risk-neutral measure, the stock price follows geometric Brownian motion:
where
-
$r$ is the risk-free interest rate -
$\sigma$ is volatility -
$W_t$ is standard Brownian motion
Under these dynamics, the price of a European derivative with payoff
For a European call option:
This expectation can be computed in several ways.
Black and Scholes derived a closed-form solution:
where
Using the exact solution of the GBM SDE:
with
Simulating many such paths allows the expectation to be approximated numerically.
The option price also satisfies the Black–Scholes PDE:
with terminal condition:
This PDE can be solved numerically using finite-difference methods.
| Method | Description |
|---|---|
| Analytical | Closed-form Black–Scholes formula |
| Monte Carlo | Risk-neutral simulation of GBM paths |
| Explicit finite difference | Direct discretization of the Black–Scholes PDE |
| Crank–Nicolson | Stable semi-implicit finite-difference scheme |
For the following parameters:
$S_0 = 100$ $K = 100$ $T = 1$ $r = 0.05$ $\sigma = 0.20$
The computed option prices are:
| Method | Price |
|---|---|
| Analytical | 10.4506 |
| Monte Carlo | 10.4876 (sampling noise) |
| Crank–Nicolson | 10.4481 |
| Explicit FD | 10.4482 |
This illustrates that:
- Monte Carlo converges slowly but is flexible
- Crank–Nicolson provides stable and accurate PDE solutions
- Explicit finite differences are conditionally stable
Approximate runtimes for the above configuration:
| Method | Runtime |
|---|---|
| Analytical | 0.000007 s |
| Monte Carlo | 0.010647 s |
| Crank–Nicolson | 0.084510 s |
| Explicit FD | 0.738353 s |
This highlights the tradeoffs between pricing methods:
- Analytical solutions are fastest when available.
- Monte Carlo is flexible but converges slowly.
- PDE solvers are deterministic and accurate, though computationally heavier.
Monte Carlo pricing error decreases with the expected rate
where
Example convergence plot:
Example sample paths under the risk-neutral measure:
Pricing methods remain consistent across a range of strike prices.
Install the project in editable mode:
pip install -e .Generate all figures:
python experiments/generate_all.pyblack_scholes_methods/
analytic_black_scholes.py
monte_carlo_pricing.py
gbm_simulation.py
finite_difference_pricing.py
crank_nicolson_pricing.py
experiments/
convergence_tests.py
runtime_comparison.py
strike_sweep.py
gbm_paths.pyThis project highlights the relationship between three perspectives on derivative pricing:
Stochastic calculus → Monte Carlo simulation
PDE methods → finite difference solvers
Closed-form analysis → Black–Scholes formula
These approaches are mathematically connected through the Feynman–Kac theorem, which links stochastic expectations to solutions of parabolic PDEs.
Future work could include:
- American option pricing
- stochastic volatility models (Heston)
- implied volatility surface construction
- variance reduction techniques for Monte Carlo


