#
Brownian Motion SimutationsIn this article, you’ll find two simulations I’ve created to explore the behavior of Brownian motion in different contexts. The first video starts with a simple random walk and increases the number of steps until it reaches the limit of Brownian motion, demonstrated in both one and three dimensions.
The second animation illustrates numerous Brownian motion paths, where you can observe the emergence of a normal distribution.
These visualizations aim to provide a clear and detailed look at the dynamic processes underlying Brownian motion.
#
Simulation (1D)#
Code (3D)Below is a snippet of code showcasing a 3D Brownian motion animation using Manim (this code is used in Part 1 of the Stochastip serie):
from manim import *
class BrownianMotion3D(ThreeDScene): def construct(self): # Setup axes self.camera.background_color = "#050521" np.random.seed(2)
axes = ThreeDAxes() x_label = axes.get_x_axis_label(Tex("x")) y_label = axes.get_y_axis_label(Tex("y")).shift(UP * 1.8) z_label = axes.get_z_axis_label(Tex("z")).shift(OUT * 1.8)
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES, zoom=1) dot = Dot3D() self.add(axes, dot, x_label, y_label, z_label)
num_steps = 500 positions = [dot.get_center()] for _ in range(num_steps): last_position = positions[-1] new_position = last_position + np.array([ 2 * np.random.normal(0, 0.2), np.random.normal(0, 0.2), np.random.normal(0, 0.2) ]) positions.append(new_position) self.begin_ambient_camera_rotation(rate=0.1)
brownian_motion_3d = VGroup() for i in range(len(positions) - 1): line_segment = Line(positions[i], positions[i + 1]) color = interpolate_color(BLUE, RED, i / num_steps) line_segment.set_color(color) brownian_motion_3d.add(line_segment)
self.play(Create(brownian_motion_3d), run_time=5) self.wait(1) self.play(FadeOut(brownian_motion_3d), FadeOut(axes), FadeOut(dot), FadeOut(x_label), FadeOut(y_label), FadeOut(z_label)) self.wait(1)
This project has been an exciting way to delve into visualizing complex mathematical concepts and making them more accessible. Stay tuned for more updates and detailed explorations into the world of stochastic processes and animations with Manim!
#
StochastipWelcome on Stochastip! On this channel, you'll find videos about Stochastic Calculus, Brownian motion, and Options Pricing.
#
Stochastic Process, Filtration | Part 1In this video, we will look at stochastic processes. We will cover the fundamental concepts and properties of stochastic processes, exploring topics such as filtration and adapted processes, which are crucial for option pricing and financial modeling.
Reference: Éléments de calcul stochastique pour l’évaluation et la couverture des actifs dérivés by Imen Ben Tahar, José Trashorras, and Gabriel Turinici.
#
Stochastic Process, Filtration | Part 2In this video, we will look at Moment Generating Functions, Characteristic Functions, Martingales and Gaussian Vectors.
Reference:
- Éléments de calcul stochastique pour l’évaluation et la couverture des actifs dérivés by Imen Ben Tahar, José Trashorras, and Gabriel Turinici.
- Stochastic Calculus for Finance II: Continuous-Time Models by Steven Shreve
- Brownian Motion, Martingales, and Stochastic Calculus by Jean-François Le Gall