# Time integration of wave equation

My question is: how come that certain formulations of the wave equation can be time integrated more efficiently then others?

Le me expand a bit on that. Consider the wave equation:

$$\frac{d^2 p(t,x)}{dt^2} -c^2 \frac{d p(t,x)}{dx^2} = 0$$

with boundary conditions $$p(t,0) = \sin(\omega t)$$ and initial conditions $$p(0,x) = 0$$ and $$p'(0,x) = 0$$. One thing that is a bit of a concern is that these ics and bcs are not consistent.

This equation can be written as a system of first order equations. In fact, there are multiple versions the of systems of first order equations the original equation can be re-written in. Here is a system of first order equations that is equivalent to the above equation, let's call it A. We introduce an auxiliary variable $$v$$:

$$\frac{d p(t,x)}{dt} - v(t,x) = 0$$ $$\frac{d v(t,x)}{dt} -c^2 \frac{d p(t,x)}{dx^2} = 0$$

with boundary conditions $$p(t,0) = \sin(\omega t)$$ and $$v(t,0) = \omega \cos(\omega t)$$ and initial conditions $$p(0,x) = 0$$ and $$v(0,x) = 0$$.

Next, is a second version the original equation can be re-written as, let's call that B:

$$\frac{d p(t,x)}{dt} + c^2 \frac{d v(t,x)}{dx} = 0$$ $$\frac{d v(t,x)}{dt} + \frac{d p(t,x)}{dx} = 0$$

with boundary conditions $$p(t,0) = \sin(\omega t)$$ and $$v(t,0) = 1/c \sin(\omega t)$$ and initial conditions $$p(0,x) = 0$$ and $$v(0,x) = 0$$.

I am observing that B can be time integrated much more efficiently than A. Let me show that in Mathematica code.

We generate a single FEM mesh that is used in all cases. We set up some constants: