c17-1 (779601), страница 2
Текст из файла (страница 2)
1970, Numerical Methods That Work; 1990, corrected edition (Washington: Mathematical Association of America).Keller, H.B. 1968, Numerical Methods for Two-Point Boundary-Value Problems (Waltham, MA:Blaisdell).Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited.
To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).y=vector(1,nvar);kmax=0;h1=(x2-x1)/100.0;load(x1,v,y);odeint(y,nvar,x1,x2,EPS,h1,hmin,&nok,&nbad,derivs,rkqs);score(x2,y,f);free_vector(y,1,nvar);760Chapter 17.Two Point Boundary Value Problems17.2 Shooting to a Fitting Pointyi (x1 ) = yi (x1 ; V(1)1 , . . . , V(1)n2 )i = 1, . . .
, N(17.2.1)Likewise we can define an n1 -vector V(2) of starting parameters at x2 , and aprescription load2(x2,v2,y) for mapping V(2) into a y that satisfies the boundaryconditions at x2 ,yi (x2 ) = yi (x2 ; V(2)1 , . . . , V(2)n1 )i = 1, . . . , N(17.2.2)We thus have a total of N freely adjustable parameters in the combination ofV(1) and V(2) . The N conditions that must be satisfied are that there be agreementin N components of y at xf between the values obtained integrating from one sideand from the other,yi (xf ; V(1) ) = yi (xf ; V(2) )i = 1, .
. . , N(17.2.3)In some problems, the N matching conditions can be better described (physically,mathematically, or numerically) by using N different functions Fi , i = 1 . . . N , eachpossibly depending on the N components yi . In those cases, (17.2.3) is replaced byFi [y(xf ; V(1))] = Fi [y(xf ; V(2))]i = 1, . .
. , N(17.2.4)Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).The shooting method described in §17.1 tacitly assumed that the “shots” wouldbe able to traverse the entire domain of integration, even at the early stages ofconvergence to a correct solution.
In some problems it can happen that, for verywrong starting conditions, an initial solution can’t even get from x1 to x2 withoutencountering some incalculable, or catastrophic, result. For example, the argumentof a square root might go negative, causing the numerical code to crash. Simpleshooting would be stymied.A different, but related, case is where the endpoints are both singular pointsof the set of ODEs. One frequently needs to use special methods to integrate nearthe singular points, analytic asymptotic expansions, for example. In such cases it isfeasible to integrate in the direction away from a singular point, using the specialmethod to get through the first little bit and then reading off “initial” values forfurther numerical integration.
However it is usually not feasible to integrate intoa singular point, if only because one has not usually expended the same analyticeffort to obtain expansions of “wrong” solutions near the singular point (those notsatisfying the desired boundary condition).The solution to the above mentioned difficulties is shooting to a fitting point.Instead of integrating from x1 to x2 , we integrate first from x1 to some point xf thatis between x1 and x2 ; and second from x2 (in the opposite direction) to xf .If (as before) the number of boundary conditions imposed at x1 is n1 , and thenumber imposed at x2 is n2 , then there are n2 freely specifiable starting values atx1 and n1 freely specifiable starting values at x2 .
(If you are confused by this, goback to §17.1.) We can therefore define an n2 -vector V(1) of starting parametersat x1 , and a prescription load1(x1,v1,y) for mapping V(1) into a y that satisfiesthe boundary conditions at x1 ,.















