Simulation of 1D Diffusion Using the Monte Carlo Method

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

This Demonstration simulates the diffusion process in one dimension, which obeys the equation , using a Monte Carlo method.

Contributed by: Quang-Dao Trinh (March 2011)
Open content licensed under CC BY-NC-SA



At time , there are 1000 points at the left edge of the box, representing the initial condition at . At each time step, these 1000 points will diffuse by a random walk (Monte Carlo simulation) along the box. The concentration at distance is the density (number of points) at that position.

The analytical solution of the equation is , where is the diffusion coefficient and is the initial concentration, shown as the red curve. The concentration profiles using Monte Carlo simulation are shown as blue dots.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.