pdemagic
State a partial differential equation as you would write it down. pdemagic chooses the method, the grid and every setting, solves it, and tells you what it did.
Waves from two antennas · a flash of light · a pattern from a reaction.
Each is a few lines of sympy and one call to pm.solve.
An example
Two sources send out waves of one frequency. This is the Helmholtz equation in free space, and the first picture above:
import sympy as sp
import pdemagic as pm
x, y = sp.symbols("x y", real=True)
w = sp.Function("w")(x, y)
def antenna(centre):
return sp.exp(-8 * ((x - centre) ** 2 + y**2))
problem = pm.Problem(
sp.Eq(pm.laplacian(w) + 36 * w, -(antenna(-1.5) + antenna(1.5))),
domain=pm.FreeSpace(x, y),
)
solution = pm.solve(problem)
solution.plot(part="real")
There is no box to choose here, no boundary condition to invent, and no grid to set up. pdemagic did all of that, and says how:
print(solution.plan)
method:
kind: fourier
grid:
lower: [-5.454052280232192, -3.952980960979054]
upper: [5.454052280232192, 3.952980960979054]
shape: [192, 139]
periodic: [False, False]
notes:
- The equation is a Helmholtz equation with the wavelength 1.0472, in 2-dimensional free space.
- Box: chosen so that the source falls to 1e-12 of the maximum at the faces.
- The box is 2 wavelengths wider than the source on every free side, and the grid has at least 6 points per wavelength, so that the waves around the source can be seen. The solution is the outgoing one, and is complex.
- Grid: the coarsest candidate on which the spectrum of the source falls below 1e-10 at high frequencies.
The plan is data. Change any entry and solve again:
plan = pm.plan(problem)
plan.grid.shape = (384, 278)
finer = pm.solve(problem, plan)
Why
- Symbolic in, numbers out. A problem is a set of sympy equations on a domain. The solution is a set of numpy arrays, with the grid they live on.
- Free space is free space. An unbounded domain is solved as exactly that, with no artificial boundary: the potential that vanishes at infinity, the wave that leaves and does not come back.
- Accurate by default. Most methods are spectral, and linear equations in time are propagated exactly. Ten digits on a modest grid are common, and every solution reports how far it can be trusted.
- Nothing is hidden. Every choice the planner makes is an entry of the plan, with a note that says why.
- A fast core. The numerics are written in Rust. Python is the first frontend, and the core is built to be called from other languages.
What it solves
| Poisson's equation | free space in any dimension, periodic directions, disks, balls, cylinders, dielectrics, conductors |
| Screened Poisson and Helmholtz | free space, with the right condition at infinity for each, also in a medium that bends the waves |
| Coefficients that vary in space | a medium, a potential: any linear stationary equation on periodic boxes, and in free space where the coefficients settle |
| Nonlinear stationary equations | Poisson–Boltzmann, ground states: Newton's method, from a starting value you can give |
| Boundary value problems | boxes in any dimension, disks, rings, balls, spherical shells and cylinders, with values, derivatives or a mix on each face, stationary and in time |
| Shapes of your own | a region of the plane bounded by lines and arcs, with holes: any elliptic equation of second order, also in a medium, with drift, or with a nonlinear term, with a condition on each piece of the boundary, and heat, waves and Schrödinger in time |
| Heat, waves, Schrödinger | free space, periodic boxes, and between walls: boxes, round domains and shapes of your own. Exact in time |
| Nonlinear equations in time | Burgers, Korteweg–de Vries, nonlinear Schrödinger, sine-Gordon, on periodic boxes. Equations of first order in time also between the walls of boxes, round domains and shapes of your own |
| Systems | Maxwell's equations in vacuum, reaction–diffusion, a Schrödinger equation with its own potential |
Unknowns may be real or complex. Sources, coefficients, initial states and boundary values are formulas or arrays, and on a shape of your own formulas. The documentation has a gallery, a guide, and a page on what is covered and what is not.
Install
pip install pdemagic
or, with matplotlib for solution.plot() and solution.animate():
pip install "pdemagic[plot]"
There are packages for Linux, macOS and Windows, for Python 3.11 and later. Nothing has to be compiled.
Status
pdemagic is young: this is version 0.1. What it solves, it solves carefully: every method is verified against exact solutions, with the order of convergence asserted, and test coverage is above 95 % in both languages. The interface may still change from one 0.x version to the next, and the changes say where.
The largest gap is what can be solved on a shape of your own: equations for one unknown in the plane so far, and nothing in space. The roadmap says what comes next.
Documentation
- Getting started: a first solve, step by step.
- Gallery: problems with their pictures.
- Guide: domains, boundaries, shapes, data, bodies, equations, time, systems, plans, plotting.
- Methods: how each problem is solved, and how accurately.
License
pdemagic is proprietary software. You may install it and use it free of
charge, for any purpose. You may not pass it on, change it, or take it
apart. The source code of its core is not published. The terms are in the file
LICENSE that comes with the package, and hold for the versions 0.1.x:
later versions may come under other terms.
Metadata
Release files for pdemagic 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pdemagic-0.1.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for pdemagic-0.1.0-cp311-abi3-win_amd64.whl |
| pdemagic-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details for pdemagic-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| pdemagic-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details for pdemagic-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| pdemagic-0.1.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for pdemagic-0.1.0-cp311-abi3-macosx_11_0_arm64.whl |
| pdemagic-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for pdemagic-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 12.2 MB
Release files / pdemagic-0.1.0-cp311-abi3-win_amd64.whl
| Download URL | pdemagic-0.1.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f375c9fc1907d30595a61987ddfb9e8fa3f9f0845b4a8ffdbe4e35ac55d37900
|
|
BLAKE2b-256 checksum How to use checksums |
97092b810e0f4bb7ad4b74798999332bd1b9867dbdd8047f0934a80cc3d62961
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / pdemagic-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | pdemagic-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c19991516a1c5449c790aeb55c46ceea1916237d395bff7485a78ced0352883f
|
|
BLAKE2b-256 checksum How to use checksums |
1c7e9967c1d7ff8c1f4935c659cbb0b232915dae18d5248adbc113cca2e80bb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / pdemagic-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | pdemagic-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
abd99c23df6524cded0cc9bf0fd491d8538fc9d0dee71e56f25051fbd9ddca05
|
|
BLAKE2b-256 checksum How to use checksums |
fd88d6793d2a7aa393e66aa7a648b6042017f58337231d3c485308a597bfff4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / pdemagic-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | pdemagic-0.1.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
35bb9de0f9b8144062548a57a8d489cd24058211930e3aea0d6c1a1a4a49566b
|
|
BLAKE2b-256 checksum How to use checksums |
2ea72dd53fa859b38b94df16f3b487bf22baa43a718bb9f3dc9e298f0aef5c62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / pdemagic-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | pdemagic-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
1cc1152e82e8cafbcf2fda9705d2e379fff758d50e5646d6fae066dc812232d9
|
|
BLAKE2b-256 checksum How to use checksums |
99c7fd05a23be5154d9a3a662626c7fdadc2d5077850678f9798519b54c92b4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for pdemagic 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for pdemagic-0.1.0-cp311-abi3-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.