Tham khảo tài liệu 'lập trình c# all chap "numerical recipes in c" part 171', công nghệ thông tin phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | One-Dimensional Search with FirstDerivatives 405 etemp e e d if fabs p fabs q etemp p q a-x p q b-x d CGOLD e x xm a-x b-x The above conditions determine the acceptability of the parabolic fit. Here we take the golden section step into the larger of the two segments. else d p q Take the parabolic step. u x d if u-a tol2 b-u tol2 d SIGN tol1 xm-x else d CGOLD e x xm a-x b-x u fabs d toll fu f u This is the one function if fu fx x d x SIGN tol1 d evaluation per iteration. Now decide what to do with our func- if u x a x else b x SHFT v w x u SHFT fv fw fx fu else if u x a u else b u if fu fw w x tion evaluation. Housekeeping follows v w w u fv fw fw fu else if fu fv v x v w v u fv fu nrerror Too many iterations in brent xmin x return fx Done with housekeeping. Back for another iteration. Never get here. CITED REFERENCES AND FURTHER READING Brent . 1973 AlgorithmsforMinimizationwithoutDerivatives Englewood Cliffs NJ PrenticeHall Chapter 5. 1 Forsythe . Malcolm . and Moler . 1977 Computer Methods for Mathematical Computations Englewood Cliffs NJ Prentice-Hall . One-Dimensional Search with First Derivatives Sample page from NUMERICAL RECIPES IN C THE ART OF SCIENTIFIC COMPUTING ISBN 0-521-43108-5 Here we want to accomplish precisely the same goal as in the previous section namely to isolate a functional minimum that is bracketed by the triplet of abscissas a b c but utilizing an additional capability to compute the function s first derivative as well as its value. 406 Chapter 10. Minimization orMaximization of Functions In principle we might simply search for a zero of the derivative ignoring the function value information using a root finder like rtflsp or zbrent . It doesn t take long to reject that idea How do we distinguishmaxima from minima Where do we go from initial conditions where the derivatives on one or both of the outer bracketing points indicate that downhill is in the direction out of the bracketed interval We don t .