Tackling Boundary Conditions in Python (Griffins Example)

In summary: Third, you can use the Euler-Lagrange equation. In summary, if you have a boundary condition like "V(x,y) = 0 when x becomes infinity", you can approximate it with a distant boundary, use the Euler-Lagrange equation to solve for the solution at a finite interval on the distant boundary, or transform the equation to a new coordinate.
  • #1
zhuang382
10
2
How to run a numerical simulation of Laplace equation if one of the boundary condition is like this: $$V(x,y) = 0 \text{ when } x \to \infty$$

I am trying to use Python to plot the solution of this Example 3.5. in Griffins EM
 
Technology news on Phys.org
  • #2
The example works out the solutions, and you say "run a numerical simulation" which to my mind means numerically solving for a solution. I'm not sure I understand which you mean.

If you merely mean plotting the solutions then I'm not sure why you are asking about x->infinity boundary conditions. You obviously can't make an infinite plot and so would merely graph the function for a finite range at a sufficient scale to see the important features.

If you are actually tackling the numerical solution then I would a.) hope you are using the separability to solve 3 coupled ODE's instead of the whole pde. The latter would involve using finite elements which is involved and not ideal given the boundary conditions are compatible with a separable solution.

If you are working with the seperable ODE's then there are three approaches I would suggest for dealing with the boundary at infinity.

First You can, approximate the case with a distant but finite boundary with V=0 there as your condition.

Second You can transform the equation to a new coordinate which maps a finite interval to ##x\in [0,\infty)##. For example ##x=\frac{\xi}{c-\xi}, \xi\in[0,c)## or ##x=\ln(\xi/c)/k## or ##x = \tan(2\xi/\pi c)##. You will of course have to transform the 2nd derivative operator to the new coordinate, a nice exercise in calculus.

For example: Using ## x = -\ln(\xi/c)\to \xi = ce^{-kx}## you get ##\partial_x = -kc e^{-kx}\cdot\partial_\xi = -k\xi\cdot\partial_\xi## and so ##\partial_x^2 = k^2\xi\cdot\partial_\xi (\xi\cdot\partial_\xi)##.
Just be aware, in this example, that ##\xi=c \leftrightarrow x=0, \xi\to0 \leftrightarrow x\to \infty##.
 

1. What are boundary conditions in Python?

Boundary conditions in Python refer to the specifications or constraints that are set at the boundaries of a problem or system. In other words, they define the behavior or properties of the system at its edges or limits.

2. How are boundary conditions typically handled in Python?

Boundary conditions are typically handled by using conditional statements or functions, such as if/else statements or try/except blocks, to check for and handle any potential boundary cases that may arise during program execution.

3. Can you give an example of tackling boundary conditions in Python?

Sure, one example of tackling boundary conditions in Python is the Griffins example, where we have to calculate the flight path of a griffin (a mythical creature) based on certain boundary conditions, such as its weight, wingspan, and wind speed. The program would need to account for any potential boundary cases, such as if the griffin's weight exceeds a certain limit, or if the wind speed is too strong.

4. Why is it important to consider boundary conditions in Python?

Considering boundary conditions is important because it ensures that our programs are robust and can handle all possible scenarios, even those at the edges or limits of the problem. By accounting for boundary cases, we can prevent errors or unexpected behavior in our code.

5. Are there any tools or libraries available in Python for tackling boundary conditions?

Yes, there are various tools and libraries available in Python that can help with tackling boundary conditions, such as the NumPy and SciPy libraries for scientific computing, which have functions specifically designed for handling boundary cases in mathematical calculations.

Similar threads

  • Differential Equations
Replies
22
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
Replies
4
Views
871
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
3
Views
932
Replies
3
Views
2K
Replies
1
Views
846
  • Advanced Physics Homework Help
Replies
5
Views
1K
  • Advanced Physics Homework Help
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
19
Views
1K
Back
Top