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

Click For Summary
SUMMARY

The discussion focuses on solving the Laplace equation in 2D using the method of separation of variables, specifically for a hollow tube with varying potentials along its walls. The boundary conditions are defined as V(x=0, y) = 0, V(x=L, y) = 0, V(x, y=0) = 0, and V(x, y=L) = V_0(x). The solution is expressed in terms of Fourier coefficients, leading to the formulation V(x,y) = ∑(C_n * sin(nπx/L) * [e^(nπy/L) - e^(-nπy/L)]). A Python program is suggested to compute V(x,y) for any given function V_0(x).

PREREQUISITES
  • Understanding of Laplace's equation and boundary value problems.
  • Familiarity with Fourier series and Fourier coefficients.
  • Knowledge of separation of variables technique in partial differential equations.
  • Basic programming skills in Python for numerical computation.
NEXT STEPS
  • Implement a Python program to compute V(x,y) using the derived Fourier coefficients.
  • Explore the properties of hyperbolic functions to simplify the expression for V(x,y).
  • Study the convergence of Fourier series for different boundary conditions.
  • Learn about numerical methods for solving partial differential equations, such as finite difference methods.
USEFUL FOR

Mathematicians, physicists, and engineers involved in solving partial differential equations, particularly those working with boundary value problems in two dimensions.

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   Reactions: Selveste

Similar threads

  • · Replies 19 ·
Replies
19
Views
3K
Replies
4
Views
1K
Replies
1
Views
1K
  • · Replies 15 ·
Replies
15
Views
4K
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
12
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K