Main Content

As explained in Equations You Can Solve Using PDE Toolbox, Partial Differential Equation Toolbox™ solvers address equations of the form

$$-\nabla \cdot \left(c\nabla u\right)+au=f$$

or variants that have derivatives with respect to time, or that
have eigenvalues, or are systems of equations. These equations are
in *divergence form*, where the differential
operator begins $$\nabla \xb7$$. The coefficients *a*, *c*,
and *f* are functions of position (*x*, *y*, *z*)
and possibly of the solution *u*.

However, you can have equations in a form with all the derivatives explicitly expanded, such as

$$\left(1+{x}^{2}\right)\frac{{\partial}^{2}u}{\partial {x}^{2}}-3xy\frac{{\partial}^{2}u}{\partial x\partial y}+\frac{\left(1+{y}^{2}\right)}{2}\frac{{\partial}^{2}u}{\partial {y}^{2}}=0$$

In order to transform this expanded equation into toolbox format, you can try to match the coefficients of the equation in divergence form to the expanded form. In divergence form, if

$$c=\left(\begin{array}{cc}{c}_{1}& {c}_{3}\\ {c}_{2}& {c}_{4}\end{array}\right)$$

then

$$\begin{array}{c}\nabla \xb7\left(c\nabla u\right)={c}_{1}{u}_{xx}+\left({c}_{2}+{c}_{3}\right){u}_{xy}+{c}_{4}{u}_{yy}\\ +\left(\frac{\partial {c}_{1}}{\partial x}+\frac{\partial {c}_{2}}{\partial y}\right){u}_{x}+\left(\frac{\partial {c}_{3}}{\partial x}+\frac{\partial {c}_{4}}{\partial y}\right){u}_{y}\end{array}$$

Matching coefficients in the *u _{xx}* and

$$\begin{array}{l}{c}_{1}=-\left(1+{x}^{2}\right)\\ {c}_{4}=-\left(1+{y}^{2}\right)/2\end{array}$$

Then looking at the coefficients of *u _{x}* and

$$\begin{array}{l}\left(\frac{\partial {c}_{1}}{\partial x}+\frac{\partial {c}_{2}}{\partial y}\right)=-2x+\frac{\partial {c}_{2}}{\partial y}\\ \text{so}\\ {c}_{2}=2xy.\\ \left(\frac{\partial {c}_{3}}{\partial x}+\frac{\partial {c}_{4}}{\partial y}\right)=\frac{\partial {c}_{3}}{\partial x}-y\\ \text{so}\\ {c}_{3}=xy\end{array}$$

This completes the conversion of the equation to the divergence form

$$-\nabla \cdot \left(c\nabla u\right)=0$$

The `c`

coefficient appears in the generalized
Neumann condition

$$\overrightarrow{n}\text{\hspace{0.17em}}\xb7\text{\hspace{0.17em}}\left(c\nabla u\right)+qu=g$$

So when you derive a divergence form of the `c`

coefficient,
keep in mind that this coefficient appears elsewhere.

For example, consider the 2-D Poisson equation –*u _{xx}* –

$$\begin{array}{c}\nabla \text{\hspace{0.17em}}\xb7\text{\hspace{0.17em}}\left(c\nabla u\right)=\nabla \text{\hspace{0.17em}}\xb7\text{\hspace{0.17em}}\left(\left(\begin{array}{cc}{c}_{1}& {c}_{3}\\ {c}_{2}& {c}_{4}\end{array}\right)\left(\begin{array}{c}{u}_{x}\\ {u}_{y}\end{array}\right)\right)\\ =\frac{\partial}{\partial x}\left({c}_{1}{u}_{x}+{c}_{3}{u}_{y}\right)+\frac{\partial}{\partial y}\left({c}_{2}{u}_{x}+{c}_{4}{u}_{y}\right)\\ ={c}_{1}{u}_{xx}+{c}_{4}{u}_{yy}+\left({c}_{2}+{c}_{3}\right){u}_{xy}\end{array}$$

So there is freedom in choosing a *c* matrix.
If you have a Neumann boundary condition such as

$$\overrightarrow{n}\text{\hspace{0.17em}}\xb7\text{\hspace{0.17em}}\left(c\nabla u\right)=2$$

the boundary condition depends on which version of *c* you
use. In this case, make sure that you take a version of *c* that
is compatible with both the equation and the boundary condition.

Sometimes it is not possible to find a conversion to a divergence form such as

$$-\nabla \cdot \left(c\nabla u\right)+au=f$$

For example, consider the equation

$$\frac{{\partial}^{2}u}{\partial {x}^{2}}+\frac{\mathrm{cos}(x+y)}{4}\frac{{\partial}^{2}u}{\partial x\partial y}+\frac{1}{2}\frac{{\partial}^{2}u}{\partial {y}^{2}}=0$$

By simple coefficient matching, you see that the coefficients *c*_{1} and *c*_{4} are
–1 and –1/2 respectively. However, there are no *c*_{2} and *c*_{3} that
satisfy the remaining equations,

$$\begin{array}{c}{c}_{2}+{c}_{3}=\frac{-\mathrm{cos}(x+y)}{4}\\ \frac{\partial {c}_{1}}{\partial x}+\frac{\partial {c}_{2}}{\partial y}=\frac{\partial {c}_{2}}{\partial y}=0\\ \frac{\partial {c}_{3}}{\partial x}+\frac{\partial {c}_{4}}{\partial y}=\frac{\partial {c}_{3}}{\partial x}=0\end{array}$$