.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_gallery/simple_pdes/poisson_eq_1d.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_poisson_eq_1d.py: Solving Poisson's equation in 1d ================================ This example shows how to solve a 1d Poisson equation with boundary conditions. .. GENERATED FROM PYTHON SOURCE LINES 7-15 .. image-sg:: /examples_gallery/simple_pdes/images/sphx_glr_poisson_eq_1d_001.png :alt: poisson eq 1d :srcset: /examples_gallery/simple_pdes/images/sphx_glr_poisson_eq_1d_001.png :class: sphx-glr-single-img .. code-block:: Python from pde import CartesianGrid, ScalarField, solve_poisson_equation grid = CartesianGrid([[0, 1]], 32, periodic=False) field = ScalarField(grid, 1) result = solve_poisson_equation(field, bc={"x-": {"value": 0}, "x+": {"derivative": 1}}) result.plot() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.051 seconds) .. _sphx_glr_download_examples_gallery_simple_pdes_poisson_eq_1d.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: poisson_eq_1d.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: poisson_eq_1d.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: poisson_eq_1d.zip `