How exactly does the shooting method work?

In summary, the conversation discusses the use of the shooting method in solving initial value and boundary value problems in differential equations. The method involves taking an initial value and adjusting it through multiple iterations to match the desired boundary value. The conversation also mentions the use of numerical integration schemes to solve these problems.
  • #1
Cinimod
34
0
I have an assignment which requires using the shooting method, but the problem is, I've read numerous things on the internet about exactly how the shooting method works, and I still don't understand it. I was hoping that someone would be kind enough to explain to me the fundamentals of how it works.
 
Mathematics news on Phys.org
  • #2
First a description of the difference between "initial value" problems and "boundary value" problems. In an initial value problem, you are told the value of the function and enough of its derivatives at some "initial" value of the independent variable. For a second order differential equation that would mean that you are given the value of both y and y' at some specific value of x. As long as the functions in the differential equation are "nice", there exists a unique solution no matter what the initial conditions are.
For a "boundary value" problem you are given the value of y at more than one value of x. For a second order differential equation, you would be given the y value at two different values of x (the "boundary" of the interval in question). Even for a very simple differential equation, there might not exist a unique solution, or any solution at all for different boundary conditions.
For example, the differential equation y"+ y= 0 has y= Ccos(x)+ Dsin(x) as "general solution". Given y(0)= A, y'(0)= B, y= Acos(x)+ Dsin(x) is the unique solution. However, y"+ y= 0, with y(0)= 0, [itex]y(\pi)= 0[/itex] has an infinite number of solutions (y= C sin(x) satisfies the differential equation and the boundary conditions for every value of C) while the boundary value problem y"+ y= 0, with y(0)= 0, [itex]y(\pi)= 0[/itex] has NO solution at all.

Now, for "shooting".

Imagine setting a rifle on an "aiming block" where you can adjust the angle of fire. An "initial value problem" would be where you are given the initial position (on the aiming block) and given an initial angle, which you can set. You then fire the bullet and wherever the bullet goes, its trajectory is the solution to that "intial value problem".

A "boundary value problem", however, would correspond to aiming at a specific target. One "boundary" is the position of the rifle on the aiming block and the other is the target. Since the bullet flies in an arc, not a straight line, you cannot just "point" the rifle at the target. Of course, you can set your sights up so that, for that particular distance, aiming the sights at the target makes the bullet hit the target but how do you set the sights correctly?

You "aim" the gun at the target, fire, and see where the bullet hits. Use that information to correct your aiming slightly (in this case, if the bullet is high, aim slightly lower). Fire again, and again use the information about where the bullet its the target to adjust your sights. (Of course, the target might be beyond the range of the rifle- the boundary value problem might not have a solution. And, in general, there are two different angles at which you could fire and hit the same target- there is no unique solution.)

The basic idea of the "shooting method" is that you take one of your given "boundary values", y(a) for some a, and add an arbitrarily chosen y'(a) and do any of many numerical integration schemes (4th order Runge-Kutta is most popular) to solve that "initial value problem". You then check to see how close you came to the other "boundary value" (the "target") and use that information to decide how to change y'(a). After altering y'(a), you "shoot again" and see how close that came.
What you really want to know, I suspect, is that last part- how do you use the information from your first "shot" to correct y'(a)? Unfortunately that depends strongly on the precise differential equation! From the "shooting" analogy, it might seem reasonable that if, after your first "shot", you are too high (y(b) as calculated is larger than the y(b) you want) then you "lower your sights"- choose y'(a) slightly smaller. However, it is easy to make up example differential equations where that would make the next "shot" worse. The best I can suggest for complete generality is that you "shoot" 3 times. First pick an arbitrary (but "reasonable") y'(a), do your numerical integration, and see how far off the target y(b) it is. Reduce y'(a) a little and repeat. Increase y'(a) a little and repeat. Use that information- whether increasing or decreasing y'(a) gets you closer to your "target" to decide how to change y'(a).
Using that new y'(a), repeat: "shoot" three times, once with that y'(a), once with a little larger, once with y'(a) a little lower and use that information to adjust y'(a) again.
"Repeat as desired."
 
  • #3
wow. That was a great post. It makes a lot more sense now. (he says that, and then talks a load of crap, lol)
I have to write a program to do calculate the wavefunction of an electron. so, I understand it in principle, and it makes a lot of sense, but now an attempt to put that into mathematical form:

[tex] y_{n+1} = \int y_n + y'(a)) dy [/tex]

Where [itex] 0< n < \frac{x_1 - x_0}{a} [/itex], where the x values represent the limits of the range (technically there should be equals signs on those equalities, but I don't know how to put them on). I take a value [itex] y_0 [/itex], and then by using guessed (or rather, estimated) values of y'(a), I have to try and get [itex] y_N [/itex] equal what it should, as defined by the boundary conditions defined in the problems. ([itex] y_N [/itex] is the last value to calculate).

If that's how it works, It doesn't seem too bad, but have I got the right idea as how it works?
I've got a feeling that the maths I wrote above isn't right, just because it doesn't make sense dimensionally, nm.
 
Last edited:
  • #4
I have to agree with the person who originally asked about the shooting method: great post!

Could you extend your explanation to direct multiple shooting methods? How does the direct multiple shooting method work?
 
  • #5


The shooting method is a numerical technique used to solve boundary value problems, which are mathematical problems that involve finding a solution to a differential equation with specified values at both the initial and final boundaries. This method works by breaking down the problem into a series of initial value problems, each of which can be solved using standard numerical techniques such as Euler's method or Runge-Kutta methods.

To use the shooting method, we first need to transform the boundary value problem into an equivalent initial value problem. This is done by introducing a parameter, usually denoted as alpha, and treating it as an initial condition. The value of alpha is then varied until the solution satisfies the boundary conditions at the final boundary.

The shooting method then involves solving the initial value problem using a numerical technique and checking if the solution satisfies the boundary conditions at the final boundary. If it does not, the value of alpha is adjusted and the process is repeated until the solution satisfies the boundary conditions.

In simpler terms, the shooting method essentially "shoots" an initial value for the parameter alpha and iteratively adjusts it until the solution satisfies the desired boundary conditions. This process is repeated until an accurate solution is obtained.

It is important to note that the success of the shooting method depends on the choice of initial value for alpha and the numerical technique used to solve the initial value problem. Therefore, it is crucial to carefully select these parameters to ensure the accuracy and convergence of the solution.

I hope this explanation has helped you understand the fundamentals of the shooting method. As with any numerical technique, practice and further study of the method will help you gain a better understanding of its workings.
 

FAQ: How exactly does the shooting method work?

1. How does the shooting method work?

The shooting method is a numerical method used to solve boundary value problems. It involves guessing an initial value for the solution and using an iterative process to adjust the initial guess until a satisfactory solution is obtained.

2. What kind of problems can the shooting method solve?

The shooting method can solve boundary value problems, which are problems that involve finding a solution that satisfies certain conditions at the boundaries of the problem domain. Examples of boundary value problems include heat transfer, fluid flow, and quantum mechanics problems.

3. How is the shooting method different from other numerical methods?

The shooting method is different from other numerical methods, such as the finite difference method or the finite element method, because it does not require the problem to be discretized into a set of equations. Instead, it uses an initial guess for the solution and iteratively adjusts it until a satisfactory solution is obtained.

4. What are the advantages of using the shooting method?

The shooting method is often preferred over other numerical methods for solving boundary value problems because it is relatively easy to implement and can handle a wide range of problems. It also does not require the problem to be discretized, which can save time and computational resources.

5. Are there any limitations to the shooting method?

While the shooting method is a useful tool for solving boundary value problems, it does have some limitations. It may not always converge to a solution, especially if the initial guess is too far from the true solution. It also requires some trial and error in choosing the initial guess, which can be time-consuming.

Back
Top