Heath - Scientific Computing (523150), страница 83
Текст из файла (страница 83)
The coordinatesystem is shown in the accompanying diagram,spacecraft•y.............. .......................................................................................................... ............. 12 ........... ........................................ ............. ............................................................................................................................................................................................................................................................................... ............................................................... ...............................................................................................................................................................................................rearth•drmoonx•0Dwhere D is the distance from earth to moon, dis the distance from the center of earth to thecenter of mass, r1 is the distance from earth tospacecraft, and r2 is the distance from moonto spacecraft.
The mass of the spacecraft isCOMPUTER PROBLEMSassumed to be negligible compared with theother masses.By using Newton’s laws of motion and gravitation, and allowing for the centrifugal and Coriolis forces due to the rotating coordinate system, the motion of the spacecraft is describedby the system of second-order ODEsx00y 00= − G [M (x + µD)/r13+ m(x − µ∗ D)/r23 ]+ Ω2 x + 2Ωy 0 ,= − G [M y/r13 + my/r23 ]+ Ω2 y − 2Ωx0 ,where G is the gravitational constant, M andm are the masses of earth and moon, µ∗ andµ are the mass fractions of earth and moon,and Ω is the angular velocity of rotation of themoon about the earth (and hence of the coordinate system). The numerical values of thesequantities are given in the following table:GMmµ∗µDdr1r2Ω6.67259 × 10−11 m3 /(kg s2 )5.974 × 1024 kg7.348 × 1022 kgM/(m + M )m/(m + M )3.844 × 108 m4.669 × 106 m[(x + d)2 + y 2 ]1/2[(D − d − x)2 + y 2 ]1/22.661 × 10−6 /s307Use a library routine to solve this system ofODEs with the initial conditionsx(0) = 4.613 × 108 ,x0 (0) = 0,y(0) = 0,y 0 (0) = −1074.Plot the resulting solution trajectory(x(t), y(t)) in the plane as a function of time.Indicate the positions of earth and moon onthe graph.
Compute the solution for at leastone complete orbit (i.e., until the spacecraftreturns to its original location), which is fromt = 0 until approximately t = 2.4 × 106 s.Experiment with various error tolerances tosee how much difference they make in whetherthe orbit is actually closed. Try to monitorthe stepsize used by the ODE routine as theintegration progresses. When does the stepsize become smaller or larger? How close doesthe spacecraft come to the surface of earth?(Earth’s radius is 6.378 × 106 m, so the centerof mass of the earth-moon system is actuallyinside the earth.)308CHAPTER 9.
INITIAL VALUE PROBLEMS FOR ODESChapter 10Boundary Value Problems for OrdinaryDifferential Equations10.1Boundary Value ProblemsThus far we have considered only initial value problems for ordinary differential equations.We will now broaden our view to consider boundary value problems. A boundary valueproblem for a differential equation specifies more than one point at which the solution orits derivatives must have given values. For example, a two-point boundary value problemfor a second-order ODE has the formy 00 = f (t, y, y 0 ),a ≤ t ≤ b,with boundary conditionsy(a) = α,y(b) = β.An initial value problem for such a second-order equation would have specified both y andy 0 at a single point, say, t0 . These initial data would have supplied all the informationnecessary to begin a numerical solution method at t0 , stepping forward to advance thesolution in time (or whatever the independent variable might be).More generally, to single out a particular solution there must as many conditions specified as the order of a scalar ODE, or as the number of components in a first-order systemof ODEs.
If all the conditions are specified at the same point, then we have an initial valueproblem; otherwise, we have a boundary value problem. For example, a boundary valueproblem for a system of two first-order ODEs has the form 0 y1f1 (t, y)=, a ≤ t ≤ b,y20f2 (t, y)with boundary conditionsy1 (a) = α,y2 (b) = β.The specification of boundary conditions at more than one point in a boundary valueproblem does not permit as simple a numerical approach as for initial value problems and309310CHAPTER 10. BOUNDARY VALUE PROBLEMS FOR ODESalso can make the existence and uniqueness of a solution more problematic.
We will focus onthe simplest case, that of two-point boundary problems for second-order ODEs, and we willconsider several approaches for solving them numerically. These methods can be generalizedto higher-order ODEs, and some of them carry over to partial differential equations as well(see Chapter 11).10.2Shooting MethodThe shooting method replaces a given boundary value problem with a sequence of initialvalue problems whose solutions converge to that of the original boundary value problem. Inthe statement of a two-point boundary value problem for a second-order ODE, we are giventhe value of y(a).
If we also knew the value of y 0 (a), then we would have an initial valueproblem that we could solve by one of the methods discussed in Chapter 9. Lacking thatinformation, however, we can try a sequence of increasingly accurate guesses until we find avalue for y 0 (a) such that when we solve the resulting initial value problem, the approximatesolution value at t = b matches the desired boundary value, y(b) = β.The basic idea of the shooting method is illustrated in Fig. 10.1. Each curve representsa solution of the same second-order ODE, with different values for the initial slope givingdifferent solution curves. All of the solutions start with the given initial value y(a) = α,but for only one value of the initial slope does the resulting solution curve hit the desiredboundary condition y(b) = β................
........... .......... .................................. ............ ............. ................... .............. ....................................... ................. ............... ....... ............................. ................. ............... ................ .................... ..................... .......... .................................................. ....... ................................. ........... ........ .........
....................................................................... ............................................. ....... ........ ........................................................................................ ........... .......................................................................................................................................................
..... ...... ........................................................................................................................................................................................................................................................ .... ..... .................................................................. ........................................................................................................................................................................
..................................... ........................................................................................................................................................................................................................................................................ ................ ............................................................................................................................................................................................................................................................................•βα•abFigure 10.1: Shooting method for a two-point boundary value problem.Putting this approach more formally, for a given s, the value at the point b of thesolution y(b) to the initial value problemy 00 = f (t, y, y 0 ),with initial conditionsy(a) = α,y 0 (a) = s,can be considered as a function of s, say, g(s). Then the boundary value problem becomesthe problem of solving the equation g(s) = β.
A one-dimensional zero finder (see Section 5.2)can be used to solve this scalar equation.Example 10.1 Shooting Method. We illustrate the shooting method by solving the10.2. SHOOTING METHOD311two-point boundary value problem for the second-order ordinary differential equationy 00 = 6t,0 ≤ t ≤ 1,with boundary conditionsy(0) = 0and y(1) = 1.For each guess for y 0 (0), we will integrate the ODE using the classical fourth-order RungeKutta method to determine how close we come to hitting the desired solution value at t = 1.Before doing so, however, we must first transform the second-order ODE into a system oftwo first-order ODEs 0 y1y= 2 .0y26tWe first try an initial slope of y 0 (0) = 1.