正在加载图片...
762 Chapter 17.Two Point Boundary Value Problems for(i=1;i<=n;i+)f[i]=f1[i]-f2[1]: free_vector(y,1,nvar); free_vector(f2,1,nvar); free_vector(f1,1,nvar); There are boundary value problems where even shooting to a fitting point fails -the integration interval has to be partitioned by several fitting points with the solution being matched at each such point.For more details see [1]. CITED REFERENCES AND FURTHER READING: Acton,F.S.1970,Numerica/Methods That Work;1990,corrected edition (Washington:Mathe- matical Association of America). Keller,H.B.1968,Numerical Methods for Two-Point Boundary-Value Problems (Waltham,MA: Blaisdell). Stoer.J.,and Bulirsch.R.1980.Introduction to Numerical Analysis(New York:Springer-Verlag). 397.3.5-7.3.6.[1] RECIPES 17.3 Relaxation Methods 6 Press. In relaxation methods we replace ODEs by approximate finite-difference equations (FDEs)on a grid or mesh of points that spans the domain of interest.As a typical example, we could replace a general first-order differential equation IENTIFIC dy =g(x,y) (17.3.1) dx 6 with an algebraic equation relating function values at two points k,k-1: 张-k-1-(xk-xk-1)g[2(xk+xk-1,(十张-1】=0 (17.3.2) The form of the FDE in (17.3.2)illustrates the idea,but not uniquely:There are many ways to turn the ODE into an FDE.When the problem involves N coupled first-order ODEs represented by FDEs on a mesh of M points,a solution consists of values for N dependent 10621 functions given at each of the M mesh points,or Nx M variables in all.The relaxation Numerica method determines the solution by starting with a guess and improving it,iteratively.As the 43106 iterations improve the solution,the result is said to relax to the true solution. While several iteration schemes are possible,for most problems our old standby,multi- Recipes dimensional Newton's method,works well.The method produces a matrix equation that must be solved,but the matrix takes a special,"block diagonal"form,that allows it to be inverted far more economically both in time and storage than would be possible for a general North Software. matrix of size (MN)x (MN).Since MN can easily be several thousand,this is crucial for the feasibility of the method Our implementation couples at most pairs of points,as in equation (17.3.2).More points can be coupled,but then the method becomes more complex. We will provide enough background so that you can write a more general scheme if you have the patience to do so. Let us develop a general set ofalgebraic equations that represent the ODEs by FDEs.The ODE problem is exactly identical to that expressed in equations(17.0.1)(17.0.3)where we had N coupled first-order equations that satisfy n boundary conditions at and n2=N-n boundary conditions at 2.We first define a mesh or grid by a set ofk=1,2,...,M points at which we supply values for the independent variable r.In particular,1 is the initial boundary,and is the final boundary.We use the notation y to refer to the entire set of762 Chapter 17. Two Point Boundary Value Problems Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copyin Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) g of machine￾readable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America). for (i=1;i<=n;i++) f[i]=f1[i]-f2[i]; free_vector(y,1,nvar); free_vector(f2,1,nvar); free_vector(f1,1,nvar); } There are boundary value problems where even shooting to a fitting point fails — the integration interval has to be partitioned by several fitting points with the solution being matched at each such point. For more details see [1]. CITED REFERENCES AND FURTHER READING: Acton, F.S. 1970, Numerical Methods That Work; 1990, corrected edition (Washington: Mathe￾matical Association of America). Keller, H.B. 1968, Numerical Methods for Two-Point Boundary-Value Problems (Waltham, MA: Blaisdell). Stoer, J., and Bulirsch, R. 1980, Introduction to Numerical Analysis (New York: Springer-Verlag), §§7.3.5–7.3.6. [1] 17.3 Relaxation Methods In relaxation methods we replace ODEs by approximate finite-difference equations (FDEs) on a grid or mesh of points that spans the domain of interest. As a typical example, we could replace a general first-order differential equation dy dx = g(x, y) (17.3.1) with an algebraic equation relating function values at two points k, k − 1: yk − yk−1 − (xk − xk−1) g  1 2 (xk + xk−1), 1 2 (yk + yk−1) =0 (17.3.2) The form of the FDE in (17.3.2) illustrates the idea, but not uniquely: There are many ways to turn the ODE into an FDE. When the problem involves N coupled first-order ODEs represented by FDEs on a mesh of M points, a solution consists of values for N dependent functions given at each of the M mesh points, or N × M variables in all. The relaxation method determines the solution by starting with a guess and improving it, iteratively. As the iterations improve the solution, the result is said to relax to the true solution. While several iteration schemes are possible, for most problems our old standby, multi￾dimensional Newton’s method, works well. The method produces a matrix equation that must be solved, but the matrix takes a special, “block diagonal” form, that allows it to be inverted far more economically both in time and storage than would be possible for a general matrix of size (MN) × (MN). Since MN can easily be several thousand, this is crucial for the feasibility of the method. Our implementation couples at most pairs of points, as in equation (17.3.2). More points can be coupled, but then the method becomes more complex. We will provide enough background so that you can write a more general scheme if you have the patience to do so. Let us develop a general set of algebraic equations that represent the ODEs by FDEs. The ODE problem is exactly identical to that expressed in equations (17.0.1)–(17.0.3) where we had N coupled first-order equations that satisfy n1 boundary conditions at x1 and n2 = N − n1 boundary conditions at x2. We first define a mesh or grid by a set of k = 1, 2, ..., M points at which we supply values for the independent variable xk. In particular, x1 is the initial boundary, and xM is the final boundary. We use the notation yk to refer to the entire set of
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有