# 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.** Every choice it makes can be inspected and overridden. ```python 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)) # Waves of one frequency from two sources, radiating into free space. problem = pm.Problem( sp.Eq(pm.laplacian(w) + 36 * w, -(antenna(-1.5) + antenna(1.5))), domain=pm.FreeSpace(x, y), ) pm.solve(problem).plot(part="real") ``` No box was chosen here, no boundary condition invented and no grid set up. pdemagic recognised the equation, found where the sources are, left room for the waves, and picked a grid that resolves them. `pm.plan(problem)` shows all of it, and lets you change any of it. ## First steps New to pdemagic? Start here. - **From scratch:** [pdemagic at a glance](intro/overview.md) · [Installation](intro/install.md) - **Tutorial:** [1: A first problem](intro/tutorial-1-first-problem.md) · [2: A heated plate](intro/tutorial-2-boundaries.md) · [3: Heat and waves](intro/tutorial-3-time.md) · [4: What pdemagic decided](intro/tutorial-4-plans.md) · [5: A shape of your own](intro/tutorial-5-shapes.md) · [6: Tones and states](intro/tutorial-6-modes.md) - **See what it can do:** the [gallery](gallery/index.md), with one page for each example ## How the documentation is organized There are four kinds of pages, and each kind does one thing. - The [tutorial](intro/index.md) takes you by the hand through a series of problems. Start here if pdemagic is new to you. - [Topics](topics/index.md) explain one concept each: what a domain is, how a boundary condition is stated, what the planner decides. - [How-to guides](howto/index.md) are recipes. They take you through the steps of one task, and assume that you know what you want. - The [reference](ref/index.md) is complete and dry: every class and function, every equation that is solved on every domain, every setting of a plan, and what does not work yet. Beside them stand the [gallery](gallery/index.md), where every picture is drawn by the code above it, and the [methods](methods/index.md), which say how each problem is solved and how accurate that is. ## Stating a problem - **Equations:** [Problems, unknowns and equations](topics/problems.md) · [`pm.Problem`](ref/problem.md) - **Domains:** [the families](topics/domains.md) · [free space and periodic directions](topics/free-space.md) · [boxes with walls](topics/boxes.md) · [disks, balls and cylinders](topics/round.md) · [shapes in the plane](topics/regions.md) · reference: [domains](ref/domains.md), [regions and curves](ref/regions.md) · how to: [make one direction periodic](howto/periodic-direction.md), [draw a shape with holes](howto/draw-a-shape-with-holes.md), [name the pieces of a boundary](howto/name-the-pieces-of-a-boundary.md) - **Boundary conditions:** [values, slopes and mixes](topics/boundary-conditions.md) · how to: [one condition for all faces](howto/one-condition-for-all-faces.md), [different conditions on each face](howto/different-conditions-on-each-face.md), [a wall that lets waves out](howto/a-wall-that-lets-waves-out.md), [clamp a plate](howto/clamp-a-plate.md) - **What a problem is given:** [data from arrays](topics/data.md) · [bodies](topics/bodies.md) · reference: [data and bodies](ref/data-and-bodies.md) · how to: [use measured data as a source](howto/use-measured-data-as-a-source.md), [start from an array](howto/start-from-an-array.md), [put a conductor in a field](howto/put-a-conductor-in-a-field.md) ## Kinds of problems - **Stationary:** [stationary equations](topics/stationary.md) · [waves of one frequency](topics/helmholtz.md) · [media and potentials](topics/varying.md) · [nonlinear equations](topics/nonlinear.md) · [beams and plates](topics/plates.md) · how to: [pick the solution that Newton's method finds](howto/pick-the-solution-newton-finds.md) - **In time:** [problems in time](topics/time.md) · [nonlinear equations in time](topics/nonlinear-time.md) - **Eigenproblems:** [bound states](topics/eigen.md) · [modes of cavities, drums and waveguides](topics/modes.md) · how to: [ask for more modes](howto/ask-for-more-modes.md) - **More than one real unknown:** [systems](topics/systems.md) · [complex unknowns](topics/complex.md) - **What is solved where:** [the overview](ref/equations.md) · [free space](ref/equations-free-space.md) · [boxes](ref/equations-boxes.md) · [round domains](ref/equations-round.md) · [shapes](ref/equations-regions.md) · [known limits](dev/limits.md) ## The solve and its result - **The plan:** [the planner and its plan](topics/planner.md) · reference: [`pm.plan` and `pm.solve`](ref/plan-and-solve.md), [the methods of a plan](ref/methods-of-a-plan.md) · how to: [read what was decided](howto/read-what-was-decided.md), [choose the grid yourself](howto/choose-the-grid-yourself.md), [choose the times that are recorded](howto/choose-the-times-that-are-recorded.md), [reuse a plan](howto/reuse-a-plan.md), [set the number of threads](howto/use-several-threads.md) - **Accuracy:** [accuracy and diagnostics](topics/accuracy.md) · reference: [diagnostics](ref/diagnostics.md), [how accurate it is](ref/accuracy.md), [errors](ref/errors.md) · how to: [get more digits](howto/get-more-digits.md), [what to do when a plan says NOT resolved](howto/what-to-do-when-not-resolved.md) - **Results:** [solutions](topics/solutions.md) · [plotting](topics/plotting.md) · reference: [`Solution`](ref/solution.md) · how to: [evaluate at a point](howto/evaluate-at-a-point.md), [get the arrays and the grid](howto/get-the-arrays-and-the-grid.md), [integrate a solution](howto/integrate-a-solution.md), [save and load a solution](howto/save-and-load-a-solution.md), [plot a section in three dimensions](howto/plot-a-section-in-three-dimensions.md), [animate a solution](howto/animate-a-solution.md), [draw into your own figure](howto/draw-into-your-own-figure.md) ## How it works - **Methods:** [which method is used when](methods/index.md), and a page for each: how it works, how accurate it is, what it costs, and where its limits are. ## The project - **Help:** [questions that come up](faq.md) · [glossary](glossary.md) - **Over time:** [release notes](releases/index.md) · [roadmap](dev/roadmap.md) - **Inside:** [the project](dev/index.md): architecture, decisions, backlog and the records of its milestones :::{note} pdemagic is young: this is version 0.1. [What is solved where](ref/equations.md) has the details, and the [known limits](dev/limits.md) say what does not work yet. ::: ```{toctree} :caption: First steps :hidden: intro/index ``` ```{toctree} :caption: Using pdemagic :hidden: topics/index howto/index gallery/index faq ``` ```{toctree} :caption: Reference :hidden: ref/index methods/index glossary releases/index ``` ```{toctree} :caption: The project :hidden: dev/index ```