c9-0 (779530), страница 2
Текст из файла (страница 2)
If the function is continuous, then at least one root must lie inthat interval (the intermediate value theorem). If the function is discontinuous, butbounded, then instead of a root there might be a step discontinuity which crosseszero (see Figure 9.1.1). For numerical purposes, that might as well be a root, sincethe behavior is indistinguishable from the case of a continuous function whose zerocrossing occurs in between two “adjacent” floating-point numbers in a machine’sfinite-precision representation. Only for functions with singularities is there thepossibility that a bracketed root is not really there, as for examplef(x) =1x−c(9.1.1)Some root-finding algorithms (e.g., bisection in this section) will readily convergeto c in (9.1.1).
Luckily there is not much possibility of your mistaking c, or anynumber x close to it, for a root, since mere evaluation of |f(x)| will give a verylarge, rather than a very small, result.If you are given a function in a black box, there is no sure way of bracketingits roots, or of even determining that it has roots. If you like pathological examples,think about the problem of locating the two real roots of equation (3.0.1), which dipsbelow zero only in the ridiculously small interval of about x = π ± 10−667.In the next chapter we will deal with the related problem of bracketing afunction’s minimum. There it is possible to give a procedure that always succeeds;in essence, “Go downhill, taking steps of increasing size, until your function startsback uphill.” There is no analogous procedure for roots.
The procedure “go downhilluntil your function changes sign,” can be foiled by a function that has a simpleextremum. Nevertheless, if you are prepared to deal with a “failure” outcome, thisprocedure is often a good first start; success is usual if your function has oppositesigns in the limit x → ±∞.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).CITED REFERENCES AND FURTHER READING:.















