# Installation pdemagic is installed with pip. This page says what to install, and how to see that it works. ## Install it ```bash pip install "pdemagic[plot]" ``` This installs pdemagic with numpy and sympy, and matplotlib for the plots of the tutorial. Without plots, `pip install pdemagic` is enough. There are packages for Linux, macOS and Windows, for Python 3.11 and later, and nothing has to be compiled. ## What is optional pdemagic itself needs numpy and sympy only. Two extras add what some of its functions need: | Extra | Installs | Needed for | |---|---|---| | `plot` | matplotlib | `solution.plot()` and `solution.animate()` | | `xarray` | xarray | `solution.to_xarray()` | Both at once: `pip install "pdemagic[plot,xarray]"`. pdemagic imports matplotlib only when a plot is asked for. ## See that it works Solve a small problem: the potential of a charge on a line. ```python import sympy as sp import pdemagic as pm x = sp.symbols("x", real=True) u = sp.Function("u")(x) problem = pm.Problem(sp.Eq(u.diff(x, 2), -sp.exp(-(x**2))), domain=pm.FreeSpace(x)) print(pm.solve(problem)) ``` ```text Solution(unknowns=['u'], grid=64) ``` If you see this line, pdemagic is installed. The tutorial starts with [a first problem](tutorial-1-first-problem.md).