正在加载图片...
784 Chapter 17.Two Point Boundary Value Problems where o()is chosen by us.Written in terms of the mesh variable g,this equation is dx 西=石 (17.5.7) Notice that ()should be chosen to be positive definite,so that the density of mesh points is everywhere positive.Otherwise (17.5.7)can have a zero in its denominator. To use automated mesh spacing,you add the three ODEs (17.5.5)and (17.5.7)to your set of equations,i.e.,to the array y[j][k].Now r becomes a dependent variable!Q and also become new dependent variables.Normally,evaluating o requires little extra work since it will be composed from pieces of the g's that exist anyway.The automated procedure allows one to investigate quickly how the numerical results might be affected by various strategies for mesh spacing.(A special case occurs if the desired mesh spacing function Q can be found 81 analytically,i.e.,dQ/dr is directly integrable.Then,you need to add only two equations, those in 17.5.5,and two new variables . As an example of a typical strategy for implementing this scheme,consider a system with one dependent variable y(r).We could set ICAL dQ=+dm到 (17.5.8) △ 6 or )=9=1+/ RECIPES dx 4+ y6 (17.5.9) where A and 6 are constants that we choose.The first term would give a uniform spacing in if it alone were present.The second term forces more grid points to be used where y is changing rapidly.The constants act to make every logarithmic change in y of an amount o about as "attractive"to a grid point as a change in of amount A.You adjust the constants according to taste.Other strategies are possible,such as a logarithmic spacing in replacing de in the first term with dIn x. IENTIFIC CITED REFERENCES AND FURTHER READING: Eggleton,P.P.1971,Monthly Notices of the Royal Astronomical Society.vol.151,pp.351-364. 6 Kippenhan,R.,Weigert,A.,and Hofmeister,E.1968,in Methods in Computational Physics, vol.7 (New York:Academic Press),pp.129ff. 17.6 Handling Internal Boundary Conditions Numerical 色 or Singular Points 431086 Singularities can occur in the interiors of two point boundary value problems.Typically, (outside there is a point s at which a derivative must be evaluated by an expression of the form North Software. N(xs,y) S(xs)=Dxs习) (17.6.1) where the denominator D(s,y)=0.In physical problems with finite answers,singular points usually come with their own cure:Where D-0,there the physical solution y must be such as to make N-0 simultaneously,in such a way that the ratio takes on a meaningful value.This constraint on the solution y is often called a regularity condition.The condition that D(,y)satisfy some special constraint at is entirely analogous to an extra boundary condition,an algebraic relation among the dependent variables that must hold at a point. We discussed a related situation earlier,in $17.2,when we described the"fitting point method"to handle the task of integrating equations with singular behavior at the boundaries. In those problems you are unable to integrate from one side of the domain to the other784 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). where φ(x) is chosen by us. Written in terms of the mesh variable q, this equation is dx dq = ψ φ(x) (17.5.7) Notice that φ(x) should be chosen to be positive definite, so that the density of mesh points is everywhere positive. Otherwise (17.5.7) can have a zero in its denominator. To use automated mesh spacing, you add the three ODEs (17.5.5) and (17.5.7) to your set of equations, i.e., to the array y[j][k]. Now x becomes a dependent variable! Q and ψ also become new dependent variables. Normally, evaluating φ requires little extra work since it will be composed from pieces of the g’s that exist anyway. The automated procedure allows one to investigate quickly how the numerical results might be affected by various strategies for mesh spacing. (A special case occurs if the desired mesh spacing function Q can be found analytically, i.e., dQ/dx is directly integrable. Then, you need to add only two equations, those in 17.5.5, and two new variables x, ψ.) As an example of a typical strategy for implementing this scheme, consider a system with one dependent variable y(x). We could set dQ = dx ∆ + |d ln y| δ (17.5.8) or φ(x) = dQ dx = 1 ∆ +     dy/dx yδ     (17.5.9) where ∆ and δ are constants that we choose. The first term would give a uniform spacing in x if it alone were present. The second term forces more grid points to be used where y is changing rapidly. The constants act to make every logarithmic change in y of an amount δ about as “attractive” to a grid point as a change in x of amount ∆. You adjust the constants according to taste. Other strategies are possible, such as a logarithmic spacing in x, replacing dx in the first term with d ln x. CITED REFERENCES AND FURTHER READING: Eggleton, P. P. 1971, Monthly Notices of the Royal Astronomical Society, vol. 151, pp. 351–364. Kippenhan, R., Weigert, A., and Hofmeister, E. 1968, in Methods in Computational Physics, vol. 7 (New York: Academic Press), pp. 129ff. 17.6 Handling Internal Boundary Conditions or Singular Points Singularities can occur in the interiors of two point boundary value problems. Typically, there is a point xs at which a derivative must be evaluated by an expression of the form S(xs) = N(xs, y) D(xs, y) (17.6.1) where the denominator D(xs, y)=0. In physical problems with finite answers, singular points usually come with their own cure: Where D → 0, there the physical solution y must be such as to make N → 0 simultaneously, in such a way that the ratio takes on a meaningful value. This constraint on the solution y is often called a regularity condition. The condition that D(xs, y) satisfy some special constraint at xs is entirely analogous to an extra boundary condition, an algebraic relation among the dependent variables that must hold at a point. We discussed a related situation earlier, in §17.2, when we described the “fitting point method” to handle the task of integrating equations with singular behavior at the boundaries. In those problems you are unable to integrate from one side of the domain to the other
<<向上翻页
©2008-现在 cucdc.com 高等教育资讯网 版权所有