 numeric first order - Maple Help

Conversion of High Time Order PDE to First Order Description

 • As mentioned on the pdsolve/numeric page, before numerical solution of time based PDE systems containing higher than first order derivatives, the system is converted to an equivalent first order system for solution.
 The standard method of doing this is to introduce new variables that take the place of the derivatives that are higher than first order in time, and by defining these new variables through equations that are first order in time.
 • The primary reason for this page is to explain that though this approach is straightforward to automate, it is not always the best solution. Other solutions, however, require reformulation of the input PDE or system, including any initial or boundary conditions, so often this is best done manually.  See the second example below.
 • From the examples below, it appears as though the choice of lowering the maximal differential order in $x$ is the best strategy for the first case, while lowering the error introduced in the boundary conditions is the best strategy for the second case.
 This behavior can vary based on any aspect of the problem, the PDE, the initial conditions, or the boundary conditions.
 In addition, in some cases the lowering of the differential order may be difficult due to mixed derivative terms or difficult boundary and initial conditions. Examples

The PDE

 > $\frac{{\partial }^{2}}{\partial {t}^{2}}u\left(x,t\right)=\frac{{\partial }^{2}}{\partial {x}^{2}}u\left(x,t\right)+\frac{{\partial }^{2}}{\partial t\partial x}u\left(x,t\right)$
 $\frac{{{\partial }}^{{2}}}{{\partial }{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){=}\frac{{{\partial }}^{{2}}}{{\partial }{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){+}\frac{{{\partial }}^{{2}}}{{\partial }{t}{\partial }{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right)$ (1)

is converted to first order by introducing a new variable $v\left(x,t\right)$ which is defined by

 > $v\left(x,t\right)=\frac{\partial }{\partial t}u\left(x,t\right)$
 ${v}{}\left({x}{,}{t}\right){=}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right)$ (2)

Use of this new variable in the input system results in the first order system:

 > $\frac{\partial }{\partial t}u\left(x,t\right)=v\left(x,t\right),\frac{\partial }{\partial t}v\left(x,t\right)=\frac{{\partial }^{2}}{\partial {x}^{2}}u\left(x,t\right)+\frac{\partial }{\partial x}v\left(x,t\right)$
 $\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){=}{v}{}\left({x}{,}{t}\right){,}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{v}{}\left({x}{,}{t}\right){=}\frac{{{\partial }}^{{2}}}{{\partial }{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){+}\frac{{\partial }}{{\partial }{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{v}{}\left({x}{,}{t}\right)$ (3)

As a further example, for a PDE containing a fourth time derivative of a dependent variable, three new variables need to be introduced to bring the system to first order.

Consider the following PDE, initial conditions, and boundary conditions (the linear biharmonic equation for a bar with rigidly fixed ends):

 > $\mathrm{PDE}≔\frac{{\partial }^{2}}{\partial {t}^{2}}u\left(x,t\right)=-\frac{1\left(\frac{{\partial }^{4}}{\partial {x}^{4}}u\left(x,t\right)\right)}{10}$
 ${\mathrm{PDE}}{≔}\frac{{{\partial }}^{{2}}}{{\partial }{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){=}{-}\frac{\frac{{{\partial }}^{{4}}}{{\partial }{{x}}^{{4}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right)}{{10}}$ (4)
 > $\mathrm{Init}≔u\left(x,0\right)=\mathrm{uv}\left(x\right),{\mathrm{D}}_{2}\left(u\right)\left(x,0\right)=0$
 ${\mathrm{Init}}{≔}{u}{}\left({x}{,}{0}\right){=}{\mathrm{uv}}{}\left({x}\right){,}{{\mathrm{D}}}_{{2}}{}\left({u}\right){}\left({x}{,}{0}\right){=}{0}$ (5)
 > $\mathrm{Bdry}≔u\left(0,t\right)=0,{\mathrm{D}}_{1}\left(u\right)\left(0,t\right)=0,u\left(1,t\right)=0,{\mathrm{D}}_{1}\left(u\right)\left(1,t\right)=0$
 ${\mathrm{Bdry}}{≔}{u}{}\left({0}{,}{t}\right){=}{0}{,}{{\mathrm{D}}}_{{1}}{}\left({u}\right){}\left({0}{,}{t}\right){=}{0}{,}{u}{}\left({1}{,}{t}\right){=}{0}{,}{{\mathrm{D}}}_{{1}}{}\left({u}\right){}\left({1}{,}{t}\right){=}{0}$ (6)

The automatic approach reformulates this input as follows.

 > $\mathrm{PDE1}≔\frac{\partial }{\partial t}u\left(x,t\right)=v\left(x,t\right),\frac{\partial }{\partial t}v\left(x,t\right)=-\frac{1\left(\frac{{\partial }^{4}}{\partial {x}^{4}}u\left(x,t\right)\right)}{10}$
 ${\mathrm{PDE1}}{≔}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){=}{v}{}\left({x}{,}{t}\right){,}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{v}{}\left({x}{,}{t}\right){=}{-}\frac{\frac{{{\partial }}^{{4}}}{{\partial }{{x}}^{{4}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right)}{{10}}$ (7)
 > $\mathrm{Init1}≔u\left(x,0\right)=\mathrm{uv}\left(x\right),v\left(x,0\right)=0$
 ${\mathrm{Init1}}{≔}{u}{}\left({x}{,}{0}\right){=}{\mathrm{uv}}{}\left({x}\right){,}{v}{}\left({x}{,}{0}\right){=}{0}$ (8)
 > $\mathrm{Bdry1}≔u\left(0,t\right)=0,{\mathrm{D}}_{1}\left(u\right)\left(0,t\right)=0,u\left(1,t\right)=0,{\mathrm{D}}_{1}\left(u\right)\left(1,t\right)=0$
 ${\mathrm{Bdry1}}{≔}{u}{}\left({0}{,}{t}\right){=}{0}{,}{{\mathrm{D}}}_{{1}}{}\left({u}\right){}\left({0}{,}{t}\right){=}{0}{,}{u}{}\left({1}{,}{t}\right){=}{0}{,}{{\mathrm{D}}}_{{1}}{}\left({u}\right){}\left({1}{,}{t}\right){=}{0}$ (9)

Alternatively, you can reformulate this system as follows:

 > $\mathrm{PDE2}≔\frac{\partial }{\partial t}v\left(x,t\right)=\frac{3\left(\frac{\partial }{\partial x}u\left(x,t\right)\right)}{10},\frac{\partial }{\partial t}u\left(x,t\right)=-\frac{1\left(\frac{{\partial }^{3}}{\partial {x}^{3}}v\left(x,t\right)\right)}{3}$
 ${\mathrm{PDE2}}{≔}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{v}{}\left({x}{,}{t}\right){=}\frac{{3}{}\frac{{\partial }}{{\partial }{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right)}{{10}}{,}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){=}{-}\frac{\frac{{{\partial }}^{{3}}}{{\partial }{{x}}^{{3}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{v}{}\left({x}{,}{t}\right)}{{3}}$ (10)
 > $\mathrm{Init2}≔u\left(x,0\right)=\mathrm{uv}\left(x\right),v\left(x,0\right)=0$
 ${\mathrm{Init2}}{≔}{u}{}\left({x}{,}{0}\right){=}{\mathrm{uv}}{}\left({x}\right){,}{v}{}\left({x}{,}{0}\right){=}{0}$ (11)
 > $\mathrm{Bdry2}≔u\left(0,t\right)=0,v\left(0,t\right)=0,u\left(1,t\right)=0,v\left(1,t\right)=0$
 ${\mathrm{Bdry2}}{≔}{u}{}\left({0}{,}{t}\right){=}{0}{,}{v}{}\left({0}{,}{t}\right){=}{0}{,}{u}{}\left({1}{,}{t}\right){=}{0}{,}{v}{}\left({1}{,}{t}\right){=}{0}$ (12)

which may be a good choice as all boundary conditions are of the 'point'='value' form (so there will be no error introduced by discretization).

As yet another alternative:

 > $\mathrm{PDE3}≔\frac{\partial }{\partial t}v\left(x,t\right)=\frac{3\left(\frac{{\partial }^{2}}{\partial {x}^{2}}u\left(x,t\right)\right)}{10},\frac{\partial }{\partial t}u\left(x,t\right)=-\frac{1\left(\frac{{\partial }^{2}}{\partial {x}^{2}}v\left(x,t\right)\right)}{3}$
 ${\mathrm{PDE3}}{≔}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{v}{}\left({x}{,}{t}\right){=}\frac{{3}{}\frac{{{\partial }}^{{2}}}{{\partial }{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right)}{{10}}{,}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){=}{-}\frac{\frac{{{\partial }}^{{2}}}{{\partial }{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{v}{}\left({x}{,}{t}\right)}{{3}}$ (13)
 > $\mathrm{Init3}≔u\left(x,0\right)=\mathrm{uv}\left(x\right),v\left(x,0\right)=0$
 ${\mathrm{Init3}}{≔}{u}{}\left({x}{,}{0}\right){=}{\mathrm{uv}}{}\left({x}\right){,}{v}{}\left({x}{,}{0}\right){=}{0}$ (14)
 > $\mathrm{Bdry3}≔u\left(0,t\right)=0,{\mathrm{D}}_{1}\left(u\right)\left(0,t\right)=0,u\left(1,t\right)=0,{\mathrm{D}}_{1}\left(u\right)\left(1,t\right)=0$
 ${\mathrm{Bdry3}}{≔}{u}{}\left({0}{,}{t}\right){=}{0}{,}{{\mathrm{D}}}_{{1}}{}\left({u}\right){}\left({0}{,}{t}\right){=}{0}{,}{u}{}\left({1}{,}{t}\right){=}{0}{,}{{\mathrm{D}}}_{{1}}{}\left({u}\right){}\left({1}{,}{t}\right){=}{0}$ (15)

which may be a good choice because the system has the lowest possible maximal differential order in $x$.

Compare the error of the solutions obtained from these equivalent systems over the range $t=0..5$ for fixed step sizes.

Note: Use a $\mathrm{uv}\left(x\right)$ for which you have an approximate solution.

 > $\mathrm{apxsol}≔0.504413\left(\mathrm{cosh}\left(4.73x\right)-\mathrm{cos}\left(4.73x\right)\right)\mathrm{cos}\left(7.07505t\right)+0.495587\left(\mathrm{sin}\left(4.73x\right)-\mathrm{sinh}\left(4.73x\right)\right)\mathrm{cos}\left(7.07505t\right)$
 ${\mathrm{apxsol}}{≔}{0.504413}{}\left({\mathrm{cosh}}{}\left({4.73}{}{x}\right){-}{\mathrm{cos}}{}\left({4.73}{}{x}\right)\right){}{\mathrm{cos}}{}\left({7.07505}{}{t}\right){+}{0.495587}{}\left({\mathrm{sin}}{}\left({4.73}{}{x}\right){-}{\mathrm{sinh}}{}\left({4.73}{}{x}\right)\right){}{\mathrm{cos}}{}\left({7.07505}{}{t}\right)$ (16)
 > $\mathrm{uv}\left(x\right)≔\genfrac{}{}{0}{}{\mathrm{apxsol}}{\phantom{t=0}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{\mathrm{apxsol}}}{t=0}$
 ${\mathrm{uv}}{}\left({x}\right){≔}{0.504413}{}{\mathrm{cosh}}{}\left({4.73}{}{x}\right){-}{0.504413}{}{\mathrm{cos}}{}\left({4.73}{}{x}\right){+}{0.495587}{}{\mathrm{sin}}{}\left({4.73}{}{x}\right){-}{0.495587}{}{\mathrm{sinh}}{}\left({4.73}{}{x}\right)$ (17)
 > $\mathrm{pds1}≔\mathrm{pdsolve}\left(\left\{\mathrm{PDE1}\right\},\left\{\mathrm{Init1},\mathrm{Bdry1}\right\},\mathrm{numeric},\mathrm{timestep}=\frac{1}{32},\mathrm{spacestep}=\frac{1}{64}\right)$
 ${\mathrm{pds1}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{plot}}{,}{\mathrm{plot3d}}{,}{\mathrm{animate}}{,}{\mathrm{value}}{,}{\mathrm{settings}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (18)
 > $\mathrm{pds2}≔\mathrm{pdsolve}\left(\left\{\mathrm{PDE2}\right\},\left\{\mathrm{Init2},\mathrm{Bdry2}\right\},\mathrm{numeric},\mathrm{timestep}=\frac{1}{32},\mathrm{spacestep}=\frac{1}{64}\right)$
 ${\mathrm{pds2}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{plot}}{,}{\mathrm{plot3d}}{,}{\mathrm{animate}}{,}{\mathrm{value}}{,}{\mathrm{settings}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (19)
 > $\mathrm{pds3}≔\mathrm{pdsolve}\left(\left\{\mathrm{PDE3}\right\},\left\{\mathrm{Init3},\mathrm{Bdry3}\right\},\mathrm{numeric},\mathrm{timestep}=\frac{1}{32},\mathrm{spacestep}=\frac{1}{64}\right)$
 ${\mathrm{pds3}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{plot}}{,}{\mathrm{plot3d}}{,}{\mathrm{animate}}{,}{\mathrm{value}}{,}{\mathrm{settings}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (20)
 > $\mathrm{pl1}≔\mathrm{pds1}:-\mathrm{plot}\left(\left[u\left(x,t\right)-\mathrm{apxsol},\mathrm{color}=\mathrm{red}\right],t=5\right):$$\mathrm{pl2}≔\mathrm{pds2}:-\mathrm{plot}\left(\left[u\left(x,t\right)-\mathrm{apxsol},\mathrm{color}=\mathrm{blue}\right],t=5\right):$$\mathrm{pl3}≔\mathrm{pds3}:-\mathrm{plot}\left(\left[u\left(x,t\right)-\mathrm{apxsol},\mathrm{color}=\mathrm{green}\right],t=5\right):$${\mathrm{plots}}_{\mathrm{display}}\left(\left\{\mathrm{pl1},\mathrm{pl2},\mathrm{pl3}\right\}\right)$ Now using a different approximate solution:

 > $\mathrm{apxsol}≔0.5000168\left(\mathrm{cosh}\left(10.99561x\right)-\mathrm{cos}\left(10.99561x\right)\right)\mathrm{cos}\left(38.23301t\right)+0.5\left(\mathrm{sin}\left(10.99561x\right)-\mathrm{sinh}\left(10.99561x\right)\right)\mathrm{cos}\left(38.23301t\right)$
 ${\mathrm{apxsol}}{≔}{0.5000168}{}\left({\mathrm{cosh}}{}\left({10.99561}{}{x}\right){-}{\mathrm{cos}}{}\left({10.99561}{}{x}\right)\right){}{\mathrm{cos}}{}\left({38.23301}{}{t}\right){+}{0.5}{}\left({\mathrm{sin}}{}\left({10.99561}{}{x}\right){-}{\mathrm{sinh}}{}\left({10.99561}{}{x}\right)\right){}{\mathrm{cos}}{}\left({38.23301}{}{t}\right)$ (21)
 > $\mathrm{uv}\left(x\right)≔\genfrac{}{}{0}{}{\mathrm{apxsol}}{\phantom{t=0}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{\mathrm{apxsol}}}{t=0}$
 ${\mathrm{uv}}{}\left({x}\right){≔}{0.5000168}{}{\mathrm{cosh}}{}\left({10.99561}{}{x}\right){-}{0.5000168}{}{\mathrm{cos}}{}\left({10.99561}{}{x}\right){+}{0.5}{}{\mathrm{sin}}{}\left({10.99561}{}{x}\right){-}{0.5}{}{\mathrm{sinh}}{}\left({10.99561}{}{x}\right)$ (22)
 > $\mathrm{pds1}≔\mathrm{pdsolve}\left(\left\{\mathrm{PDE1}\right\},\left\{\mathrm{Init1},\mathrm{Bdry1}\right\},\mathrm{numeric},\mathrm{timestep}=\frac{1}{64},\mathrm{spacestep}=\frac{1}{64}\right)$
 ${\mathrm{pds1}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{plot}}{,}{\mathrm{plot3d}}{,}{\mathrm{animate}}{,}{\mathrm{value}}{,}{\mathrm{settings}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (23)
 > $\mathrm{pds2}≔\mathrm{pdsolve}\left(\left\{\mathrm{PDE2}\right\},\left\{\mathrm{Init2},\mathrm{Bdry2}\right\},\mathrm{numeric},\mathrm{timestep}=\frac{1}{64},\mathrm{spacestep}=\frac{1}{64}\right)$
 ${\mathrm{pds2}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{plot}}{,}{\mathrm{plot3d}}{,}{\mathrm{animate}}{,}{\mathrm{value}}{,}{\mathrm{settings}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (24)
 > $\mathrm{pds3}≔\mathrm{pdsolve}\left(\left\{\mathrm{PDE3}\right\},\left\{\mathrm{Init3},\mathrm{Bdry3}\right\},\mathrm{numeric},\mathrm{timestep}=\frac{1}{64},\mathrm{spacestep}=\frac{1}{64}\right)$
 ${\mathrm{pds3}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{plot}}{,}{\mathrm{plot3d}}{,}{\mathrm{animate}}{,}{\mathrm{value}}{,}{\mathrm{settings}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (25)
 > $\mathrm{pl1}≔\mathrm{pds1}:-\mathrm{plot}\left(\left[u\left(x,t\right)-\mathrm{apxsol},\mathrm{color}=\mathrm{red}\right],t=5\right):$$\mathrm{pl2}≔\mathrm{pds2}:-\mathrm{plot}\left(\left[u\left(x,t\right)-\mathrm{apxsol},\mathrm{color}=\mathrm{blue}\right],t=5\right):$$\mathrm{pl3}≔\mathrm{pds3}:-\mathrm{plot}\left(\left[u\left(x,t\right)-\mathrm{apxsol},\mathrm{color}=\mathrm{green}\right],t=5\right):$${\mathrm{plots}}_{\mathrm{display}}\left(\left\{\mathrm{pl1},\mathrm{pl2},\mathrm{pl3}\right\}\right)$ 