# A pulse between walls A pulse of excitation runs along a fibre between two closed ends, at five times. ```python import sympy as sp import pdemagic as pm x, t = sp.symbols("x t", real=True) u = sp.Function("u")(x, t) w = sp.Function("w")(x, t) fibre = pm.Problem( sp.Eq(u.diff(t), u.diff(x, 2) + u - u**3 / 3 - w), sp.Eq(w.diff(t), sp.Rational(2, 25) * (u + sp.Rational(7, 10) - 4 * w / 5)), domain=pm.Box({x: (0, 40)}), time=(t, 0, 40), initial={u: 3 * sp.exp(-(x**2) / 8) - sp.Rational(6, 5), w: -sp.Rational(5, 8)}, boundary=sp.Eq(u.diff(x), 0), ) plan = pm.plan(fibre) plan.method.tolerance = 1e-6 pm.solve(fibre, plan).plot(unknown=u) ``` ## What it shows The model of FitzHugh and Nagumo for a nerve fibre. The voltage $u$ spreads along the fibre and excites itself, and a slow recovery $w$ pulls it back down. A kick at the left end starts a pulse, which runs to the right at a steady speed of about 0.8 and keeps its shape, with the fibre at rest again behind it. Only $u$ diffuses. The recovery $w$ has no derivative in space: it changes at each point by what $u$ is there. So it has no condition at the ends, and the one condition of the problem, no current through either end, is for $u$. ## What pdemagic decided Two unknowns in time between walls are stepped together (`exponential_runge_kutta`). The diffusion of $u$ is exact, in the modes of the box with its closed ends. For $w$ the points of the grid are the modes, and its linear part is the number $-\tfrac{8}{125}$. The grid has 128 Chebyshev points. The example loosens the tolerance of a step to $10^{-6}$, which is plenty for a picture and takes 293 steps where the planner's $10^{-10}$ takes 1 549. ## More - [Systems of equations](../topics/systems.md) - [Nonlinear equations in time](../topics/nonlinear-time.md) - [Systems between walls, the method](../methods/systems-between-walls.md) - [What is solved on boxes with walls](../ref/equations-boxes.md)