σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
Stochastic Calculus skill›Module 5 · Simulation and practice›Topic 5.1·~55 minAdvanced

Euler-Maruyama and Milstein schemes

Skill positionModule 5 of 5 · Topic 1 of 2
5.1 Euler-Maruyama and Milstein schemes
—Lab score— / 100Total XP—Streak—

Simulating a random equation

Most stochastic equations have no formula for their solution, so we simulate them. Cut time into steps of size hhh. The Euler-Maruyama scheme moves the state by the drift for one step plus the volatility times a random step ΔW\Delta WΔW, a normal number with mean 000 and variance hhh. For dX=a(X) dt+b(X) dWdX=a(X)\,dt+b(X)\,dWdX=a(X)dt+b(X)dW it reads Xn+1=Xn+a(Xn) h+b(Xn) ΔWX_{n+1}=X_n+a(X_n)\,h+b(X_n)\,\Delta WXn+1​=Xn​+a(Xn​)h+b(Xn​)ΔW. It is the simplest rule: the stochastic version of Euler's method.

Xn+1=Xn+a(Xn) h+b(Xn) ΔWX_{n+1}=X_n+a(X_n)\,h+b(X_n)\,\Delta WXn+1​=Xn​+a(Xn​)h+b(Xn​)ΔW(1)

The Milstein scheme adds one term, 12 b b′(ΔW2−h)\tfrac12\,b\,b'(\Delta W^{2}-h)21​bb′(ΔW2−h). It comes from the quadratic variation and fixes the part of the error that Euler ignores. For geometric Brownian motion b=σxb=\sigma xb=σx, so b b′=σ2xb\,b'=\sigma^{2}xbb′=σ2x. How good are the schemes? The strong error measures how close each simulated path is to the true path: Euler is of order 12\tfrac1221​ (the error shrinks like h\sqrt hh​) and Milstein of order 111 (like hhh). The weak error measures how close averages are, such as an option price: both are of order 111. So to price a European option, Euler with many paths is usually enough. For hedging tests or path-dependent products, Milstein pays off.

Xn+1=Xn+a h+b ΔW+12 b b′ (ΔW2−h)X_{n+1}=X_n+a\,h+b\,\Delta W+\tfrac12\,b\,b'\,(\Delta W^{2}-h)Xn+1​=Xn​+ah+bΔW+21​bb′(ΔW2−h)(2)
One step, three answersTake x=100x=100x=100, μ=0.05\mu=0.05μ=0.05, σ=0.2\sigma=0.2σ=0.2, h=0.01h=0.01h=0.01 and a draw ΔW=0.2\Delta W=0.2ΔW=0.2. Euler gives 100+0.05+4=104.05100+0.05+4=104.05100+0.05+4=104.05. Milstein adds 12×0.04×100×(0.04−0.01)=0.06\tfrac12\times0.04\times100\times(0.04-0.01)=0.0621​×0.04×100×(0.04−0.01)=0.06 and gives 104.11104.11104.11. The exact solution of geometric Brownian motion is 100 e(0.05−0.02)×0.01+0.2×0.2=104.1123100\,e^{(0.05-0.02)\times0.01+0.2\times0.2}=104.1123100e(0.05−0.02)×0.01+0.2×0.2=104.1123. Milstein is much closer.
  • Euler-Maruyama: drift for one step plus volatility times a normal step. Strong order 12\tfrac1221​.
  • Milstein: adds 12 b b′(ΔW2−h)\tfrac12\,b\,b'(\Delta W^{2}-h)21​bb′(ΔW2−h) and reaches strong order 111.
  • Strong vs weak error: paths versus averages. Pricing needs the weak error, which is order 111 for both.

Lab · what's graded

  • One Euler step15 pts
  • One Milstein step15 pts
  • Euler error when the step is cut15 pts
  • Milstein error when the step is cut15 pts
  • Which error matters for pricing15 pts
  • Match the vocabulary10 pts
  • Why Milstein beats Euler15 pts
0/ 7 answered
Tasks
1Numeric answer15 ptsNot answered

For dX=μX dt+σX dWdX=\mu X\,dt+\sigma X\,dWdX=μXdt+σXdW take x=100x=100x=100, μ=0.05\mu=0.05μ=0.05, σ=0.2\sigma=0.2σ=0.2, h=0.01h=0.01h=0.01 and ΔW=0.2\Delta W=0.2ΔW=0.2. What does one Euler-Maruyama step give, x+μx h+σx ΔWx+\mu x\,h+\sigma x\,\Delta Wx+μxh+σxΔW? Give two decimals.

x=x =x=accepted: ± 0.01
2Numeric answer15 ptsNot answered

Add the Milstein term 12 σ2x (ΔW2−h)\tfrac12\,\sigma^{2}x\,(\Delta W^{2}-h)21​σ2x(ΔW2−h) to the Euler result of the last task. What is the Milstein step? Give two decimals.

m=m =m=accepted: ± 0.01
3Numeric answer15 ptsNot answered

The strong error of Euler is of order 12\tfrac1221​, so it scales like h\sqrt hh​. It is 0.040.040.04 at h=0.01h=0.01h=0.01. What is it at h=0.0025h=0.0025h=0.0025?

e=e =e=accepted: ± 0.0005
4Numeric answer15 ptsNot answered

The strong error of Milstein is of order 111, so it scales like hhh. It is 0.010.010.01 at h=0.01h=0.01h=0.01. What is it at h=0.0025h=0.0025h=0.0025?

e=e =e=accepted: ± 0.0001
5Choice15 ptsNot answered

You price a European option as the average payoff over simulated paths. Which error matters most?

6Match10 ptsNot answered

Match each item with its meaning.

Pick the partner of each item on the left.

ΔW\Delta WΔW
Euler-Maruyama
Milstein
Weak error
7Explain in words15 ptsNot answered

In one or two sentences, explain what the extra Milstein term does and why it helps.

Math modeKeyboard or LaTeX inputTask 1 of 7 · Ctrl ⏎ to check

Log in to run your code.

Every lecture is free to read. Create an account or log in to run code, run tests and submit this lab.

  • In-browser IDE with a bash terminal — nothing to install
  • Instant grading, XP and your place on the skill
Create an accountLog in
OR
Continue with GitHub