mercoledì 3 dicembre 2025

Homework 11

Homework 11 – Simulation of a Wiener Process via Euler–Maruyama and Connection to the Counting Process Approximation

1. Introduction

In Homework 10 we constructed a counting process on the interval [0,1][0,1], where events occurred independently and uniformly with average rate λ\lambda. Using a fine discretization—dividing the time interval into many small subintervals—we showed that the total number of events converges in distribution to a Poisson random variable with parameter λ\lambda. The process itself, when viewed as a function of time, is a jump process with independent and stationary increments.

This homework extends that framework into the domain of continuous stochastic processes, specifically the Wiener process (Brownian motion). While the counting process in Homework 10 had Poisson-distributed increments, Brownian motion instead has Gaussian-distributed increments with variance proportional to time. Both processes share the key idea of building the evolution in time through independent increments over small subintervals.

The aim of this assignment is to use the Euler–Maruyama method, a standard numerical scheme for stochastic differential equations (SDEs), to construct approximate realizations of a Wiener process on [0,T][0,T]. Because JavaScript does not provide a built-in Gaussian generator, the simulation must use the Box–Muller transform to produce increments that follow a N(0,1)\mathcal{N}(0,1) distribution.

2. From Counting Processes to Brownian Motion

The simulation strategy developed in Homework 10 already introduced the idea of dividing time into very small steps and generating random events independently in each step.

In that context:

  • Each subinterval produced either 0 or 1 event with probability λ/n\lambda/n.

  • Summing those Bernoulli increments produced a counting process converging to a Poisson process.

The Wiener process shares the same constructive philosophy:

  • Divide the time interval into nn small subintervals of length Δt\Delta t.

  • Generate random increments in each subinterval.

  • Ensure the increments are independent.

  • Scale the increments to match the theoretical behavior of the model.

The crucial difference is the distribution of the increments.
For Brownian motion:



instead of a Poisson or Bernoulli increment.

Thus, while HW10 built a counting process, HW11 builds a diffusion process.

Both methods rely on the same computational idea to simulate random increments on a fine time grid and accumulate them.

3. The Wiener Process

A standard Wiener process WtW_t is defined by the following properties:

  1. W0=0W_0 = 0.

  2. Independent increments:
    The increments over non-overlapping intervals are independent.

  3. Gaussian increments: WtWsN(0,ts).

  4. Continuous sample paths: The trajectories are continuous almost surely.

These properties encode the behavior of a particle undergoing pure random motion, and they form the foundation of modern stochastic calculus.


4. Euler–Maruyama Simulation Scheme

To simulate a stochastic differential equation of the form 



the Euler–Maruyama discretization is:


where ZkN(0,1)Z_k \sim \mathcal{N}(0,1) are independent normal variables obtained from the Box–Muller transform.

For a Wiener process, the simplest SDE is:

dXt=dWtX0=0,

which has:

  • drift a(x,t)=,

  • diffusion b(x,t)=1.

Thus, the update rule is simply:


This ensures that the increment from tkt_k to tk+1t_{k+1} is Gaussian with zero mean and variance Δt\Delta t, as required.

5. Box–Muller Transform for Gaussian Noise

Because JavaScript's Math.random() generates uniform samples, we need an explicit method to obtain normal random variables. The Box–Muller transform converts two independent uniform variables U1,U2Uniform(0,1)U_1,U_2 \sim \text{Uniform}(0,1) into two independent standard normal variables:


In the simulation below we use only Z1Z_1.

6. JavaScript Implementation

6.1 Box–Muller Normal Generator

Here's a snippet from the JavaScript code.


6.2 Simulation of a Wiener Path

Here's another snippet of the JavaScript code:

6.3 Empirical Verification of the Theory

To confirm that the simulation behaves correctly, we:

  1. Generate many independent Wiener paths.

  2. Collect the values at time TT.

  3. Compute their empirical mean and variance.

  4. Compare with the theoretical values

E[WT]=0Var(WT)=T.

Here's another snippet from the code, where the empirical example is set up:



The empirical results obtained from the simulation are:


As we can see, the mean è vicino a 0 (-0.0037), as it should be. The variance is also near 1 (1.0124), and the first 10 values clearly show a distribution which is borad and symmetrical, typical of the Brownian process.

7. Conceptual Link to Homework 10

This homework is a direct conceptual continuation of Homework 10.

  • In HW10 we approximated a Poisson counting process by generating Bernoulli events on small time slices.

  • In HW11 we approximate a Wiener process by generating Gaussian increments on small time slices.

Both processes:

  • rely on independent increments,

  • are constructed by discretizing time,

  • converge in distribution as the number of time steps increases,

  • and illustrate how continuous stochastic processes can be built from simple local randomness.

In HW10 the increments were Bernoulli(λ/n), producing a jump process.
In HW11 the increments are Gaussian, producing a diffusion process.

Thus, the philosophy is the same, only the increment distribution changes.

8. Conclusion

Using the Euler–Maruyama method and the Box–Muller transform, we successfully simulated trajectories of a Wiener process. The empirical analysis confirms that the numerical approximation preserves the fundamental properties of Brownian motion: zero mean, variance proportional to time, independent increments, and continuous-like sample paths.

The methodology used in Homework 10 to approximate Poisson processes naturally extends to this homework, highlighting how stochastic processes—whether jump-based or diffusion-based—can be constructed via time discretization and random independent increments.

This completes the simulation framework for Wiener processes and prepares the ground for general stochastic differential equations.










Homework 11

Homework 11 – Simulation of a Wiener Process via Euler–Maruyama and Connection to the Counting Process Approximation 1. Introduction In Home...