.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_gallery/simple_pdes/stochastic_simulation.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_gallery_simple_pdes_stochastic_simulation.py: Stochastic simulation ===================== This example illustrates how a stochastic simulation can be done. .. GENERATED FROM PYTHON SOURCE LINES 7-17 .. image-sg:: /examples_gallery/simple_pdes/images/sphx_glr_stochastic_simulation_001.png :alt: stochastic simulation :srcset: /examples_gallery/simple_pdes/images/sphx_glr_stochastic_simulation_001.png :class: sphx-glr-single-img .. code-block:: Python from pde import KPZInterfacePDE, MemoryStorage, ScalarField, UnitGrid, plot_kymograph grid = UnitGrid([64]) # generate grid state = ScalarField.random_harmonic(grid) # generate initial condition eq = KPZInterfacePDE(noise=1) # define the SDE storage = MemoryStorage() eq.solve(state, t_range=10, dt=0.01, tracker=storage.tracker(0.5)) plot_kymograph(storage) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.731 seconds) .. _sphx_glr_download_examples_gallery_simple_pdes_stochastic_simulation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: stochastic_simulation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: stochastic_simulation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: stochastic_simulation.zip `