Next:
Laplace Equation in Electrostatics
Up:
Boundary Value Problems
Previous:
Boundary Value Problems
Contents
Trial-and-Error (Linear Shooting) Method
Figure 5.5:
First guess.
Figure 5.6:
Second guess.
...
Figure 5.7:
Expected result.
The basic approach in solving
boundary value
and
eigenvalue problems
is known as the
trial-and-error method
.
At one boundary, the solution is started by giving an estimated value to the missing initial condition,
A trial solution is then found with either Euler or Runge-Kutta method at the other boundary (
First guess
),
How much deviation from the given boundary condition is determined,
Taking this deviation into account, a new solution is restarted with a new estimation (
Second guess
),
This process is repeated (
) until the other boundary condition is satisfied (
Expected result
).
Let's see this method on an example:
This differential equation has the solution of
(Gaussian function).
First, let's transform this boundary value problem into a first-order system of equations:
Notice that the boundary conditions are given only for
:
and
.
Notice that there is no initial condition for
.
Now, we have a set of equations.
Here, let's take an estimated initial value of
:
Now, find the solutions
and
(by let's say RK4) with these
and
values.
Denote the value obtained for
in the other boundary with
and find the difference (
) with the real one
(here, 0.368):
Now, let's make a
second (another) guess
of
and calculate the error again at the other boundary:
Remind the secant methods for root finding.
After these two estimated shoots, the most accurate starting value to choose will be the extension of the line passing through two points:
Then, the calculation (RK4) is repeated with this selected value by secant method.
Finally, the solution is found when the margin of error in the other boundary is smaller than a certain tolerance.
(
Example py-file:
mylinearshooting.py
)
Figure 5.8:
Solution for the Boundary Value Problem for the ODE:
.
Figure 5.9:
Solution for the Boundary Value Problem for the ODE:
.
Next:
Laplace Equation in Electrostatics
Up:
Boundary Value Problems
Previous:
Boundary Value Problems
Contents