### 14 Poisson PDE in Cartesian coordinates

_______________________________________________________________________________________

#### 14.1 Poisson equation in a rectangle, all boundaries are zero

problem number 109

Solve for $$u(x,y)$$

\begin{align*} \frac{u_{xx}}{A} + \frac{u_{xx}}{B} = -2 \theta \end{align*}

Where $$A,B,\theta$$ are constants, and the boundary conditions are

\begin{align*} u(x, -b) &= 0\\ u(x, b) &= 0\\ u(-a, y) &= 0\\ u(a, y) &= 0 \end{align*}

Mathematica

$\text{DSolve}\left [\left \{\frac{u^{(2,0)}(x,y)}{A}+\frac{u^{(0,2)}(x,y)}{B}=-2 \theta ,\{u(x,-b)=0,u(x,b)=0,u(-a,y)=0,u(a,y)=0\}\right \},u(x,y),\{x,y\}\right ]$

Maple

$\text{ sol=() }$

Hand solution

solve \begin{align*} \frac{u_{xx}}{A}+\frac{u_{yy}}{B} & =-2\theta \\ Bu_{xx}+Au_{yy} & =-2\theta AB\\ & =C \end{align*}

Where $$C=-2\theta AB$$ is a new constant. With boundary conditions\begin{align*} u\left ( x,-b\right ) & =0\\ u\left ( x,b\right ) & =0\\ u\left ( -a,y\right ) & =0\\ u\left ( a,y\right ) & =0 \end{align*}

To simplify solution, shift the rectangle so its lower left corner on the origin. Let $$\tilde{x}=x+a$$, and $$\tilde{y}=y+b$$. The boundary conditions becomes\begin{align*} u\left ( \tilde{x},0\right ) & =0\\ u\left ( \tilde{x},2b\right ) & =0\\ u\left ( 0,\tilde{y}\right ) & =0\\ u\left ( 2a,\tilde{y}\right ) & =0 \end{align*}

And the pde becomes $$Bu_{\tilde{x}\tilde{x}}+Au_{\tilde{y}\tilde{y}}=C$$. Instead of keep writing $$\tilde{x},\tilde{y}$$, will use $$x,y$$, but remember that these are shifted version. At the end, we shift back.

Hence the PDE to solve is  $$Bu_{xx}+Au_{yy}=C$$ with BC\begin{align*} u\left ( x,0\right ) & =0\\ u\left ( x,2b\right ) & =0\\ u\left ( 0,y\right ) & =0\\ u\left ( 2a,y\right ) & =0 \end{align*}

Using eigenfunction expansion method. Let $$u\left ( x,y\right ) =\sum _{n=1}^{\infty }b_{n}\left ( y\right ) X_{n}\left ( x\right ) \tag{1}$$ Where $$X_{n}\left ( x\right )$$ is eigenfunctions for $$X^{\prime \prime }\left ( x\right ) +\lambda _{n}X\left ( x\right ) =0$$ with boundary conditions $$X\left ( 0\right ) =X\left ( 2a\right ) =0$$. This has eigenfunctions as $$X_{n}\left ( x\right ) =\sin \left ( \sqrt{\lambda _{n}}x\right )$$ with eigenvalues $$\lambda _{n}=\left ( \frac{n\pi }{2a}\right ) ^{2}$$  for $$n=1,2,\cdots$$.

Substituting (1) into the PDE $$Bu_{xx}+Au_{yy}=C$$ gives$B\sum _{n=1}^{\infty }b_{n}\left ( y\right ) X_{n}^{\prime \prime }\left ( x\right ) +A\sum _{n=1}^{\infty }b_{n}^{\prime \prime }\left ( y\right ) X_{n}\left ( x\right ) =C$ Expanding $$C$$ (a constant) as Fourier sine series the above becomes$B\sum _{n=1}^{\infty }b_{n}\left ( y\right ) X_{n}^{\prime \prime }\left ( x\right ) +A\sum _{n=1}^{\infty }b_{n}^{\prime \prime }\left ( y\right ) X_{n}\left ( x\right ) =\sum _{n=1}^{\infty }q_{n}X_{n}\left ( x\right )$ But $$X_{n}^{\prime \prime }\left ( x\right ) =-\lambda _{n}X_{n}\left ( x\right )$$, hence the above becomes\begin{align} -B\sum _{n=1}^{\infty }\lambda _{n}b_{n}\left ( y\right ) X_{n}\left ( x\right ) +A\sum _{n=1}^{\infty }b_{n}^{\prime \prime }\left ( y\right ) X_{n}\left ( x\right ) & =\sum _{n=1}^{\infty }q_{n}X_{n}\left ( x\right ) \nonumber \\ Ab_{n}^{\prime \prime }\left ( y\right ) -B\lambda _{n}b_{n}\left ( y\right ) & =q_{n}\tag{1A} \end{align}

But \begin{align*} C & =\sum _{n=1}^{\infty }q_{n}X_{n}\left ( x\right ) \\ \int _{0}^{2a}CX_{n}\left ( x\right ) dx & =q_{n}\int _{0}^{2a}X_{n}^{2}\left ( x\right ) dx\\ \int _{0}^{2a}C\sin \left ( \sqrt{\lambda _{n}}x\right ) dx & =q_{n}\int _{0}^{2a}\sin ^{2}\left ( \sqrt{\lambda _{n}}x\right ) dx\\ \frac{-C}{\sqrt{\lambda _{n}}}\left ( \left ( -1\right ) ^{n}-1\right ) & =q_{n}a\\ q_{n} & =\frac{-C}{a\sqrt{\lambda _{n}}}\left ( \left ( -1\right ) ^{n}-1\right ) \end{align*}

Hence (1A) becomes$Ab_{n}^{\prime \prime }\left ( y\right ) -B\lambda _{n}b_{n}\left ( y\right ) =\frac{-C}{a\sqrt{\lambda _{n}}}\left ( \left ( -1\right ) ^{n}-1\right )$ This is standard second order linear ODE. The solution is$b_{n}\left ( y\right ) =D_{n}e^{\sqrt{\frac{B}{A}\lambda _{n}}y}+E_{n}e^{-\sqrt{\frac{B}{A}\lambda _{n}}y}+\frac{C}{aB\lambda _{n}^{\frac{3}{2}}}\left ( \left ( -1\right ) ^{n}-1\right )$ Using the above in (1) gives the solution$$u\left ( x,y\right ) =\sum _{n=1}^{\infty }\left ( D_{n}e^{\sqrt{\frac{B}{A}\lambda _{n}}y}+E_{n}e^{-\sqrt{\frac{B}{A}\lambda _{n}}y}+\frac{C}{aB\lambda _{n}^{\frac{3}{2}}}\left ( \left ( -1\right ) ^{n}-1\right ) \right ) X_{n}\left ( x\right ) \tag{1A}$$ We now need to ﬁnd $$D_{n},E_{n}$$.

Case $$n$$ even

When $$n$$ is even $$\left ( \left ( -1\right ) ^{n}-1\right ) =0$$ and the solution (1A) becomes$u\left ( x,y\right ) =\sum _{n=1}^{\infty }\left ( D_{n}e^{\sqrt{\frac{B}{A}\lambda _{n}}y}+E_{n}e^{-\sqrt{\frac{B}{A}\lambda _{n}}y}\right ) X_{n}\left ( x\right )$ At $$y=0$$ the above gives$0=\sum _{n=1}^{\infty }\left ( D_{n}+E_{n}\right ) \sin \left ( \sqrt{\lambda _{n}}x\right )$ Therefore$$D_{n}+E_{n}=0\tag{2}$$ And at $$y=2b$$$0=\sum _{n=1}^{\infty }\left ( D_{n}e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}+E_{n}e^{-\sqrt{\frac{B}{A}\lambda _{n}}2b}\right ) \sin \left ( \sqrt{\lambda _{n}}x\right )$ Therefore$$D_{n}e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}+E_{n}e^{-\sqrt{\frac{B}{A}\lambda _{n}}2b}=0\tag{3}$$ From (2,3) we see that $$D_{n}=E_{n}=0$$, Hence $$u\left ( x,y\right ) =0$$ when $$n$$ even.

Case $$n$$ odd

When $$n$$ is odd $$\left ( \left ( -1\right ) ^{n}-1\right ) =-2$$ and the solution (1A) becomes$u\left ( x,y\right ) =\sum _{n=1}^{\infty }\left ( D_{n}e^{\sqrt{\frac{B}{A}\lambda _{n}}y}+E_{n}e^{-\sqrt{\frac{B}{A}\lambda _{n}}y}-\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\right ) X_{n}\left ( x\right )$ At $$y=0$$ the above gives$0=\sum _{n=1}^{\infty }\left ( D_{n}+E_{n}-\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\right ) \sin \left ( \sqrt{\lambda _{n}}x\right )$ Therefore$$D_{n}+E_{n}-\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}=0\tag{4}$$ And at $$y=2b$$$0=\sum _{n=1}^{\infty }\left ( D_{n}e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}+E_{n}e^{-\sqrt{\frac{B}{A}\lambda _{n}}2b}-\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\right ) \sin \left ( \sqrt{\lambda _{n}}x\right )$ Therefore$$D_{n}e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}+E_{n}e^{-\sqrt{\frac{B}{A}\lambda _{n}}2b}-\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}=0\tag{5}$$ Solving (4,5) for $$D_{n},E_{n}$$ gives\begin{align*} D_{n} & =\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\frac{1}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}\\ E_{n} & =\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\frac{e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}} \end{align*}

Therefore the ﬁnal solution from (1A) becomes\begin{align*} u\left ( x,y\right ) & =\sum _{n=1,3,5,\cdots }^{\infty }\left ( D_{n}e^{\sqrt{\frac{B}{A}\lambda _{n}}y}+E_{n}e^{-\sqrt{\frac{B}{A}\lambda _{n}}y}-\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\right ) X_{n}\left ( x\right ) \\ & =\sum _{n=1,3,5,\cdots }^{\infty }\left ( \left ( \frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\frac{1}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}\right ) e^{\sqrt{\frac{B}{A}\lambda _{n}}y}+\left ( \frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\frac{e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}\right ) e^{-\sqrt{\frac{B}{A}\lambda _{n}}y}-\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\right ) \sin \left ( \sqrt{\lambda _{n}}x\right ) \end{align*}

Where $$\lambda _{n}=\left ( \frac{n\pi }{2a}\right ) ^{2}$$. Switching back to original coordinates using $$\tilde{x}=x+a$$, and $$\tilde{y}=y+b$$, then the above is$u\left ( x,y\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\left ( \left ( \frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\frac{1}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}\right ) e^{\sqrt{\frac{B}{A}\lambda _{n}}\left ( y+b\right ) }+\left ( \frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\frac{e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}\right ) e\left ( ^{-\sqrt{\frac{B}{A}\lambda _{n}}y+b}\right ) -\frac{2C}{aB\lambda _{n}^{\frac{3}{2}}}\right ) \sin \left ( \sqrt{\lambda _{n}}\left ( x+a\right ) \right )$ Where $$C=-2\theta AB$$, hence\begin{align*} u\left ( x,y\right ) & =\sum _{n=1,3,5,\cdots }^{\infty }\left ( \left ( \frac{-4\theta AB}{aB\lambda _{n}^{\frac{3}{2}}}\frac{1}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}\right ) e^{\sqrt{\frac{B}{A}\lambda _{n}}\left ( y+b\right ) }+\left ( \frac{-4\theta AB}{aB\lambda _{n}^{\frac{3}{2}}}\frac{e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}\right ) e^{-\sqrt{\frac{B}{A}\lambda _{n}}\left ( y+b\right ) }+\frac{4\theta AB}{aB\lambda _{n}^{\frac{3}{2}}}\right ) \sin \left ( \sqrt{\lambda _{n}}\left ( x+a\right ) \right ) \\ & =\sum _{n=1,3,5,\cdots }^{\infty }\left ( \left ( \frac{-4\theta A}{a\lambda _{n}^{\frac{3}{2}}}\frac{1}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}\right ) e^{\sqrt{\frac{B}{A}\lambda _{n}}\left ( y+b\right ) }+\left ( \frac{-4\theta A}{a\lambda _{n}^{\frac{3}{2}}}\frac{e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}{1+e^{\sqrt{\frac{B}{A}\lambda _{n}}2b}}\right ) e^{-\sqrt{\frac{B}{A}\lambda _{n}}\left ( y+b\right ) }+\frac{4\theta A}{a\lambda _{n}^{\frac{3}{2}}}\right ) \sin \left ( \sqrt{\lambda _{n}}\left ( x+a\right ) \right ) \end{align*}

_______________________________________________________________________________________

#### 14.2 Dirichlet problem for the Poisson equation in a rectangle

problem number 110

Taken from Mathematica DSolve help pages.

Solve for $$u\left ( x,y\right )$$

\begin{align*} \frac{\partial ^{2}u}{\partial x^{2}} +\frac{\partial ^{2}u}{\partial y^2} & = 6x - 6y \end{align*}

Boundary conditions

\begin{align*} u(x, 0) &= 1 + 11 x + x^3\\ u(x, 2) &= -7 + 11 x + x^3\\ u(0, y) &= 1 - y^3\\ u(4, y) &= 109 - y^3 \end{align*}

Mathematica

$\left \{\left \{u(x,y)\to x^3+11 x-y^3+1\right \}\right \}$

Maple

$u \left ( x,y \right ) ={x}^{3}-{y}^{3}+11\,x+1$