How Do You Solve the Laplace Equation in 2D Using Separation of Variables?

Selveste
Messages
7
Reaction score
0

Homework Statement



Solve the Laplace equation in 2D by the method of separation of variables. The problem is to determine the potential in a long, square, hollow tube, where four walls have different potential. The boundary conditions are as follows:

V(x=0, y) = 0
V(x=L, y) = 0
V(x, y=0) = 0
V(x, y=L) = V_0(x)

Formulate a solution in terms of the Fourier coefficients, in a way suitable for numerical calculation. Write a computer program that takes any function V_0(x) and calculates V(x,y) inside the square tube.

Homework Equations



\nabla^2 V = 0

The Attempt at a Solution



\frac{\partial^2V}{\partial x^2} + \frac{\partial^2V}{\partial y^2} = 0
Separation of variables
V(x, y) = A(x)B(y)
Laplace becomes
\frac{1}{A(x)}\frac{\partial^2A(x)}{\partial x^2}+\frac{1}{B(y)}\frac{\partial^2B(y)}{\partial y^2}=0
which gives
\frac{\partial^2A(x)}{\partial x^2}= k^2A(x); \frac{\partial^2B(y)}{\partial y^2}= -k^2B(y)
solving the ODE's gives
A(x)=A\sin{kx}+B\cos{kx}
B(y)=Ce^{ky}+De^{-ky}
V(x,y) = [A\sin{kx}+B\cos{kx}][Ce^{ky}+De^{-ky}]
Boundary conditions
V=0 when x=0 \implies B=0.
V=0 when x=L \implies k=n\pi/L : n\in\mathbb{R}
V=0 when y=0 \implies C=-D.
which gives
V(x,y) = A\sin{(\frac{n\pi x}{L})}[e^{\frac{n\pi y}{L}}-e^{-\frac{n\pi y}{L}}]
Here I think the term with the exponentials look a little fishy, but can't see a mistake so I move on. Laplace equation is linear, so we have
V(x,y) = \sum_{n=1}^{\infty}C_n\sin{(\frac{n\pi x}{L})}[e^{\frac{n\pi y}{L}}-e^{-\frac{n\pi y}{L}}]
V(x,L) = \sum_{n=1}^{\infty}C_n\sin{(\frac{n\pi x}{L})} = V_0(x)
To find the Fourier coefficients we multiply both sides by \sin{(n'\pi x/L)} and integrate from 0 to L:
\sum_{n=1}^{\infty}C_n \int_0^L \sin{(\frac{n'\pi x}{L})}\sin{(\frac{n\pi x}{L})}dx = \int_0^LV_0(x)\sin{(\frac{n'\pi x}{L})}dx
Solution to the integral on the left side is
0, if n \ne n'
L/2, if n = n'
so the left side reduces to (L/2)C_{n'}, which implies
C_n = \frac{2}{L}\int_0^LV_0(x)\sin{(\frac{n\pi x}{L})}dx
So the solution to the problem is
V(x,y) = \sum_{n=1}^{\infty}C_n\sin{(\frac{n\pi x}{L})}[e^{\frac{n\pi y}{L}}-e^{-\frac{n\pi y}{L}}]
with C_n as above. Correct?

I now want to write a python program that takes any function V_0(x) and calculates V inside the square tube. I first make it dimensionless by introducing \xi =x/L and \gamma= y/L as variables instead of x, y.
V(\xi,\gamma) = \sum_{n=1}^{\infty}C_n\sin{(n\pi \xi)}[e^{n\pi \gamma}-e^{-n\pi \gamma}]
C_n = \frac{2}{L}\int_0^1V_0(\xi)\sin{(n\pi \xi)}d\xi
Is this correct? Otherwise, where did it all go wrong? And what should I do with the 2/L term in C_n? Maybe I ought to have introduced the new variables at the very beginning? Thanks.
 
Physics news on Phys.org
You're definitely on the right track.

Selveste said:
V(x,y) = A\sin{(\frac{n\pi x}{L})}[e^{\frac{n\pi y}{L}}-e^{-\frac{n\pi y}{L}}]
Here I think the term with the exponentials look a little fishy, but can't see a mistake so I move on.
This looks correct. You might consider replacing the two exponentials by one hyperbolic trig function.
Laplace equation is linear, so we have
V(x,y) = \sum_{n=1}^{\infty}C_n\sin{(\frac{n\pi x}{L})}[e^{\frac{n\pi y}{L}}-e^{-\frac{n\pi y}{L}}]
V(x,L) = \sum_{n=1}^{\infty}C_n\sin{(\frac{n\pi x}{L})} = V_0(x)
In going from the first to the second equation, what happened to the contributions from the exponential functions evaluated at y = L? If you absorbed them into the expansion coefficients, then you need to make sure that you realize that the ##C_n## in the first equation are not the same as the ##C_n## in the second equation.
C_n = \frac{2}{L}\int_0^LV_0(x)\sin{(\frac{n\pi x}{L})}dx

introducing \xi =x/L and \gamma= y/L as variables instead of x, y
C_n = \frac{2}{L}\int_0^1V_0(\xi)\sin{(n\pi \xi)}d\xi
The change of variables was not done correctly here. I'm not sure there is much of an advantage in introducing the new variables, but it is certainly OK to do so.
 
Last edited:
  • Like
Likes Selveste
Thread 'Need help understanding this figure on energy levels'
This figure is from "Introduction to Quantum Mechanics" by Griffiths (3rd edition). It is available to download. It is from page 142. I am hoping the usual people on this site will give me a hand understanding what is going on in the figure. After the equation (4.50) it says "It is customary to introduce the principal quantum number, ##n##, which simply orders the allowed energies, starting with 1 for the ground state. (see the figure)" I still don't understand the figure :( Here is...
Thread 'Understanding how to "tack on" the time wiggle factor'
The last problem I posted on QM made it into advanced homework help, that is why I am putting it here. I am sorry for any hassle imposed on the moderators by myself. Part (a) is quite easy. We get $$\sigma_1 = 2\lambda, \mathbf{v}_1 = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix} \sigma_2 = \lambda, \mathbf{v}_2 = \begin{pmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \\ 0 \end{pmatrix} \sigma_3 = -\lambda, \mathbf{v}_3 = \begin{pmatrix} 1/\sqrt{2} \\ -1/\sqrt{2} \\ 0 \end{pmatrix} $$ There are two ways...
Back
Top