Skip to content

Commit c5c097c

Browse files
committed
adjusting bumped mc example
1 parent 772ae9a commit c5c097c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

examples/bumped_montecarlo.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,21 @@ tspan = (t0, T)
1212
N = 250
1313
dt = (T - t0) / N
1414

15-
# Step 1: Simulate base GBM and save the noise
15+
# Step 1: Simulate GBM with a fixed seed
1616
gbm = GeometricBrownianMotionProcess(μ, σ, t0, W0)
1717
gbm_noise = NoiseProblem(gbm, tspan, seed=1)
1818
sol = DifferentialEquations.solve(gbm_noise, dt=dt)
1919

20-
# Step 2: Reuse the noise and simulate with bumped μ
20+
# Step 2: Reuse the same seed with bumped σ
2121
μ_bumped = μ
22-
σ_bumped = σ + 0.1
22+
σ_bumped = σ + 0.05
2323
gbm_bumped = GeometricBrownianMotionProcess(μ_bumped, σ_bumped, t0, W0)
2424
gbm_bumped_noise = NoiseProblem(gbm_bumped, tspan, seed=1)
25-
ensemble_problem_bumped = EnsembleProblem(gbm_bumped_noise)
2625
sol_bumped = DifferentialEquations.solve(gbm_bumped_noise, dt=dt)
2726

2827
# Step 3: Plot both
2928
plot(sol.t, sol.u, label="μ = ", linewidth=2)
3029
plot!(sol_bumped.t, sol_bumped.u, label="μ = $μ_bumped", linestyle=:dash, linewidth=2)
3130
xlabel!("Time")
3231
ylabel!("GBM Value")
33-
title!("GBM with Drift Bump and Reused Noise")
32+
title!("GBM with Drift Bump and Reused Seed")

0 commit comments

Comments
 (0)