An archived instance of discourse for discussion in undergraduate PDE.

Laplace on the square

Mark

Consider Laplace's equation $u_{x x}+u_{y y}=0$ on the unit square with boundary conditions
$$u(0,y)=u(x,0)=u(1,y)=0\; \text{and}\; u(x,1)=f(x).$$

  1. Show that any function of the form
    $$u_n(x,y)=\sin (n \pi x)\left(e^{n \pi y}-e^{-n \pi y}\right)$$
    satisfies the PDE and the first three boundary conditions.

  2. Describe a technique to find a linear combination of the $u_n$s that satisfies remaining boundary conditions as well.

  3. Apply your technique in the specific case $f(x)=x(4x-1)(4x-3)(1-x)$
    This is probably harder than I'd put on the in class without some computational assistance.

jradford

Can someone explain how to do this problem? I'm lost.

dwillia2

For the first part you check that Laplace's eq is satisfied ($u_{xx}+y_{yy}=0$) and then you plug in the $x$ and $y$ values for each boundary to check that they are satisfied as well.

For the second part you are describing using Fourier series to solve this for any given $f(x)$

For the third part you are actually using Fourier series to solve the problem with the specified $f(x)$

Here is how I would desribe problem 2 mathematically (not necessarily a description of my technique)

===================================

To do the second part we must know that $u_n(x,y)=\sin(n\pi x)(e^{n\pi y}-e^{-n\pi y})$ is in fact a solution to Laplace's equation and the first three boundary conditions. Since it is a solution we can safely say
$$u(x,y)=\sum_{n=0}^\infty a_nu_n(x,y)$$
Namely that since it works for any n then any linear combination of the $u_n$s should also be a solution (to Laplace's equation and the first three boundary conditions). We then can apply the final boundary condition $u(x,1)=f(x)$.
$$\begin{align}u(x,1)=\sum_{n=0}^\infty a_nu_n(x,1)&=f(x)
\\ \sum_{n=0}^\infty a_n\sin (n \pi x)\left(e^{n \pi}-e^{-n \pi}\right)&=f(x)\end{align}$$
We can make a substitution here if we introduce a new set of coefficients $b_n=a_n\left(e^{n \pi}-e^{-n \pi}\right)$. This gives




$$\sum_{n=0}^\infty b_n\sin (n \pi x)=f(x)$$

But we know this to be a Fourier series meaning we also know what the coefficients must be! Namely
$b_n=2\int_0^1f(x)\sin(n\pi x)dx$ which gives us

$$a_n=\frac{2}{e^{n \pi}-e^{-n \pi}}\int_0^1f(x)sin(n\pi x)dx$$
and putting it all together
$$\begin{align*}u(x,y)&=\,\,\,\sum_{n=0}^\infty \frac{2}{e^{n \pi}-e^{-n \pi}}u_n(x,y)\int_0^1f(x)\sin(n\pi x)dx
\\&=2\sum_{n=0}^\infty \frac{e^{n \pi y}-e^{-n \pi y}}{e^{n \pi}-e^{-n \pi}}\sin(n\pi x)\int_0^1f(x){\sin}(n\pi x)dx
\end{align*}$$



rjensen

Just to clear up some of the steps that were applied here and to work the problem using the general technique. If we let $u(x,0) = f(x)$ and $u(x,1) = g(x)$ then the general solution is:

$$u(x,y) = \sum_{n=1}^{\infty} sin(n\pi x)(c_ne^{n\pi y} + d_ne^{-n\pi y}).$$

Let $y=0$ and we get:

$$u(x,0) = \sum_{n=1}^{\infty} sin(n\pi x)(c_n + d_n) = f(x).$$

Let $y=1$ and we get:

$$u(x,1) = \sum_{n=1}^{\infty} sin(n\pi x)(c_ne^{n\pi} + d_ne^{-n\pi}) = g(x).$$

This implies that $c_n + d_n$ are the Fourier Sine coefficients of $f(x)$ and $(c_ne^{n\pi} + d_ne^{-n\pi})$ are the Fourier Sine coefficients of $g(x)$.

In this particular problem $f(x)=0$ and $g(x)=1$ so we can find $c_n + d_n$ easily by letting,

$$c_n + d_n = 2\int_0^1 f(x)\cdot sin(n\pi x)dx = 2\int_0^1 0\cdot sin(n\pi x)dx = 0.$$

So $d_n = -c_n$.

Now we can substitute and get $(c_ne^{n\pi} + d_ne^{-n\pi}) = (c_ne^{n\pi} - c_ne^{-n\pi}) = (c_n(e^{n\pi} -e^{-n\pi}))$. Since that expression is the Fourier Sine coefficient of $g(x)$ we will use that fact to figure out what $c_n$ is. Thus,

$$(c_n(e^{n\pi} -e^{-n\pi})) = 2\int_0^1 g(x)sin(n\pi x)dx = 2\int_0^11\cdot sin(n\pi x)dx = \frac{2((-1)^{n+1}+1)}{n\pi} .$$

Therefore,

$$c_n = \frac{2((-1)^{n+1}+1)}{n\pi(e^{n\pi} -e^{-n\pi})} .$$

Once again using the substitution $d_n = -c_n$ our general formula becomes,

$$u(x,y) = \sum_{n=1}^{\infty} sin(n\pi x)(c_ne^{n\pi y} + d_ne^{-n\pi y}) = \sum_{n=1}^{\infty} c_nsin(n\pi x)(e^{n\pi y} - e^{-n\pi y}) .$$

By plugging in the value for $c_n$, the final fully qualified answer becomes,

$$ u(x,y) = \sum_{n=1}^{\infty} \frac{2((-1)^{n+1}+1)}{n\pi(e^{n\pi} -e^{-n\pi})} sin(n\pi x)(e^{n\pi y} - e^{-n\pi y}) .$$

I hope this helps anyone who struggled as much as I did to understand how we were supposed to find $c_n$ and $d_n$ in a more general 2D Laplace problem!

dwillia2

So I liked your post because it was detailed and pointed out specifics that might otherwise have been lost, but looking at the problem again you aren't completely solving the problem given. You are however answering the question posed here. While I think the stuff you've done is solid, you used $u(x,0)=0$ and $u(x,1)=1$ but for the problem here we should have $$u(x,1)=x(4x-1)(4x-3)(1-x)$$

'Cause I couldn't resist, here's what a quick check with Mathematica and the equation I ended with gives me. I suspect it isn't completely correct though since I discovered an error in what I had previously written.
$$u(x,y)=\sum_{n=1,3,5...}^\infty -\frac{8}{n^5\pi^5}\left(192-19\,n^2\pi^2\right)\frac{e^{n \pi y}-e^{-n \pi y}}{e^{n \pi}-e^{-n \pi}}\sin(n\pi x)$$

Mark

If you suspect it's not completely correct, I suppose you could check against an NDSolve solution.

dwillia2

It seems to check out!
$f(x)$


Orange is from NDSolve, blue is from 7 terms of the result I gave above.
$u(x,y)$

wbartoli

This is really cool! What code are you using to plot these figures and double-check the Laplace solutions?

dwillia2

Here's just the bare minimum for how to do the graphs, sorry I'm not adding much info on this:

For the function $f(x)$

Plot[x (4 x - 1) (4 x - 3) (1 - x), {x, 0, 1}, 
 PlotRange -> {-.26, .26}]

For the blue plot, the series answer with 7 terms, (it's only blue because I made it in mathematica 9 instead of 10)

soln[x_, y_] = -Sum[8/(n^5 Pi^5) (192 - 19 n^2 Pi^2) (E^(n Pi y) - E^(-n Pi y))/(E^(n Pi) - E^(-n Pi)) Sin[n Pi x], {n, 1, 13, 2}];

Plot3D[soln[x, y], {x, 0, 1}, {y, 0, 1}, PlotRange -> {-.25, .25}]

There are ways to make it prettier, but I don't know how to put formatting in here (if there even is a way).

The orange plot:

solnsN = NDSolveValue[{D[u[x, y], x, x] == -D[u[x, y], y, y], 
   u[0, y] == 0, 
   u[1, y] == 0, 
   u[x, 0] == 0,
   u[x, 1] == x (4 x - 1) (4 x - 3) (1 - x)}, 
   u, {x, 0, 1}, {y, 0, 1}]

Plot3D[solnsN[x, y], {x, 0, 1}, {y, 0, 1}, PlotRange -> {-.25, .25}]