Fourier & COS pricing
Price from the characteristic function while controlling truncation.
01Connect density and characteristic function
02Implement a COS expansion
03Diagnose damping and truncation errors
Name the mathematical target and the approximation error.
Fourier methods trade path simulation for deterministic integration in frequency space.
Characteristic functions are often closed form when densities are not.
Payoff transforms may require damping.
Interval and mode count control error.
Tie accuracy to the decision the number supports.
Fast grids of vanilla prices and calibration objectives are central to stochastic-volatility workflows.
equity vanillas
FX vanillas
calibration grids
x=log(Sₜ/K); the transform convention and damping sign are displayed.
Separate estimator, discretization, truncation, and convergence.
Characteristic function
The transform uniquely identifies the law under regular conditions.
COS approximation
Density coefficients and analytic payoff coefficients meet in a finite cosine sum.
Full derivation
From information set to computable quantity
Each line states the information, measure and unit before manipulating the expression.
- 01
Move to log state
Express payoff and density on a finite interval [a,b].
- 02
Expand the density
Approximate cosine coefficients from φ at discrete frequencies.
- 03
Project the payoff
Compute Uₖ analytically for calls or puts.
- 04
Control truncation
Increase [a,b] and N independently and compare to a reference price.
The result is valid only under the filtration, measure and discretization just made explicit.
Inputs
φ(u)=E[e^{iuX}]N: COS mode count
Assumptions and limits
- Discontinuous densities and far tails need larger domains.
- Branch conventions can destabilize complex logarithms.
Benchmark the algorithm against a controlled reference.
Evaluate the risk-neutral characteristic function, multiply by analytic payoff coefficients and sum a controlled frequency grid.
Use a shared strike/maturity transform grid and weight residuals by liquidity and price scale.
06PYTHON IMPLEMENTATIONOpen the implementation and checks.
- Typed domain validation
- Deterministic seeded computation
- Readout plus invariant
Fourier & COS pricing
Reproduce the governing quantity, then challenge it with an invariant.
import numpy as np def varphixumathbbeeiu(x: np.ndarray) -> float: x = np.asarray(x, dtype=float) assert np.isfinite(x).all() return float(np.mean(x)) sample = np.array([0.8, 1.0, 1.2])value = varphixumathbbeeiu(sample)assert sample.min() <= value <= sample.max()print(f"value={value:.6f}")Change the error budget, not just the picture.
Fourier & COS pricing
Use a fixed seed to separate discretization, sampling and truncation effects.
Real characteristic-function coefficients by frequency.
- Re φ(u)
Use Left/Right or Up/Down arrows to inspect values; Home and End jump to the bounds.
Model → algorithm → evidence
Each numerical approximation has an independent control and a reference diagnostic.
Q / GBMMeasure and SDE fixed
32 modesDiscretization or transform control
φ(0)=1Visible convergence evidence
Where the model meets the book.
“Fast is useful only when truncation error stays visible.”
characteristic function
frequency grid
Use a shared strike/maturity transform grid and weight residuals by liquidity and price scale.
RISKtruncation error
complex branch errors
- Validate market state and timestamp
- Recompute the baseline
- Run a controlled perturbation
- Explain P&L and residuals
Production failure modes
- Silent convention or measure changes
- Unstable numerics hidden by plausible prices
09MACRO CONNECTIONOpen the transmission channel.
Transmission from state to valuation
The causal chain separates the economic shock from the modelling response.
transmitsshape φ(u)
transmitsrecovers prices
outputfeeds parameters back
10COMMON PITFALLSOpen the failure checklist.
Changing transform conventions mid-derivation
Checking only one mode count
11SOURCES / FURTHER READINGOpen sources and continue the track.
Measure theory, simulation and computational-finance lectures
The lesson uses original prose and a fresh typed implementation; the linked material is a research map, not copied product code.
- Source
- Computational Finance Course
- Author
- L. A. Grzelak
- Ref
- main