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 machine-readable 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).Numerical
Recipes in CThe
Art of Scientific ComputingSecond EditionWilliam H. PressHarvard-Smithsonian Center for AstrophysicsSaul A. TeukolskyDepartment
of Physics, Cornell UniversityWilliam T. VetterlingPolaroid CorporationBrian P. FlanneryEXXON Research and Engineering CompanyCAMBRIDGE UNIVERSITY PRESSCambridge New York Port Chester Melbourne SydneySample 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 machine-readable 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).Published by
the Press Syndicate
of the University
of CambridgeThe Pitt Building, Trumpington Street, Cambridge CB2 1RP40 West 20th Street, New York, NY 10011-4211, USA10 Stamford Road, Oakleigh, Melbourne 3166, AustraliaCopyrightc Cambridge University Press 1988, 1992except for §13.10 and Appendix B, which are placed into
the public domain,and except for all other computer programs and procedures, which areCopyrightc
Numerical Recipes Software 1987, 1988, 1992, 1997All Rights Reserved.Some sections
of this book were originally published,
in different form,
in Computersin Physics magazine, Copyrightc American Institute
of Physics, 1988–1992.First Edition originally published 1988; Second Edition originally published 1992.Reprinted with corrections, 1993, 1994, 1995, 1997.This reprinting is corrected to software version 2.08Printed
in the United States
of AmericaTypeset
in TEXWithout an additional license to use
the contained software, this book is intended asa text and reference book, for reading purposes only. A free license for limited use
of thesoftware by
the individual owner
of a copy
of this book who personally types one or moreroutines into a single computeris granted under terms described on p. xvii. See
the section“License Information” (pp. xvi–xviii) for information on obtaining more general licensesat low cost.Machine-readablemedia containing
the softwarein this book,with includedlicensesfor use on a single screen, are available from Cambridge University Press. See theorder form at
the back
of the book, email to “orders@cup.org” (North America) or“trade@cup.cam.ac.uk” (rest
of world), or write to Cambridge University Press, 110Midland Avenue, Port Chester, NY 10573 (USA), for further information.The software may also be downloaded, with immediate purchase
of a licensealso possible, from
the Numerical Recipes Software Web Site (http://www.nr.com).Unlicensedtransferof NumericalRecipes programsto any otherformat, orto anycomputerexcept one that is speciﬁcally licensed, is strictly prohibited. Technical questions,corrections, and requests for information should be addressed to
Numerical RecipesSoftware, P.O. Box 243, Cambridge, MA 02238 (USA), email “info@nr.com”, or fax781 863-1739.Library
of Congress Cataloging
in Publication DataNumerical
recipes in C :
the art of scientiﬁc
computing / William H. Press [et al.]. –
2nd ed.Includes bibliographical references (p. ) and index.ISBN 0-521-43108-51.
Numerical analysis–Computer programs. 2. Science–Mathematics–Computerprograms.3.
C (Computer program language) I. Press, William H.QA297.N866 1992519.4028553–dc20 92-8876A catalog record for this book is available from
the British Library.ISBN 0 521 43108 5 BookISBN 0 521 43720 2 Example book
in CISBN 0 521 43724 5
C diskette (IBM 3.5, 1.44M)ISBN 0 521 57608 3 CDROM (IBM PC/Macintosh)ISBN 0 521 57607 5 CDROM (UNIX)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 machine-readable 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).ContentsPreface to
the Second Edition xiPreface to
the First Edition xivLicense Information xviComputer Programs by Chapter and Section xix1 Preliminaries 11.0 Introduction 11.1 Program Organization and Control Structures 51.2 Some
C Conventions for Scientiﬁc
Computing 151.3 Error, Accuracy, and Stability 282 Solution
of Linear Algebraic Equations 322.0 Introduction 322.1 Gauss-Jordan Elimination 362.2 Gaussian Elimination with Backsubstitution 412.3 LU Decomposition and Its Applications 432.4 Tridiagonal and Band Diagonal Systems
of Equations 502.5 Iterative Improvement
of a Solution to Linear Equations 552.6 Singular Value Decomposition 592.7 Sparse Linear Systems 712.8 Vandermonde Matrices and Toeplitz Matrices 902.9 Cholesky Decomposition 962.10 QR Decomposition 982.11 Is Matrix Inversion an N3Process? 1023 Interpolation and Extrapolation 1053.0 Introduction 1053.1 Polynomial Interpolation and Extrapolation 1083.2 Rational Function Interpolation and Extrapolation 1113.3 Cubic Spline Interpolation 1133.4 How to Search an Ordered Table 1173.5 Coefﬁcients
of the Interpolating Polynomial 1203.6 Interpolation
in Two or More Dimensions 123vviContentsSample 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 machine-readable 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).4 Integration
of Functions 1294.0 Introduction 1294.1 Classical Formulas for Equally Spaced Abscissas 1304.2 Elementary Algorithms 1364.3 Romberg Integration 1404.4 Improper Integrals 1414.5 Gaussian Quadratures and Orthogonal Polynomials 1474.6 Multidimensional Integrals 1615 Evaluation
of Functions 1655.0 Introduction 1655.1 Series and Their Convergence 1655.2 Evaluation
of Continued Fractions 1695.3 Polynomials and Rational Functions 1735.4 Complex Arithmetic 1765.5 Recurrence Relations and Clenshaw’s Recurrence Formula 1785.6 Quadratic and Cubic Equations 1835.7
Numerical Derivatives 1865.8 Chebyshev Approximation 1905.9 Derivatives or Integrals
of a Chebyshev-approximated Function 1955.10 Polynomial Approximation from Chebyshev Coefﬁcients 1975.11 Economization
of Power Series 1985.12 Pad´e Approximants 2005.13 Rational Chebyshev Approximation 2045.14 Evaluation
of Functions by Path Integration 2086 Special Functions 2126.0 Introduction 2126.1 Gamma Function, Beta Function,Factorials, Binomial Coefﬁcients 2136.2 Incomplete Gamma Function, Error Function, Chi-SquareProbability Function, Cumulative Poisson Function 2166.3 Exponential Integrals 2226.4 Incomplete Beta Function, Student’s Distribution, F-Distribution,Cumulative Binomial Distribution 2266.5 Bessel Functions
of Integer Order 2306.6 Modiﬁed Bessel Functions
of Integer Order 2366.7 Bessel Functions
of Fractional Order, Airy Functions, SphericalBessel Functions 2406.8 Spherical Harmonics 2526.9 Fresnel Integrals, Cosine and Sine Integrals 2556.10 Dawson’s Integral 2596.11 Elliptic Integrals and Jacobian Elliptic Functions 2616.12 Hypergeometric Functions 2717 Random Numbers 2747.0 Introduction 2747.1 Uniform Deviates 275ContentsviiSample 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 machine-readable 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).7.2 Transformation Method: Exponential and Normal Deviates 2877.3 Rejection Method: Gamma, Poisson, Binomial Deviates 2907.4 Generation
of Random Bits 2967.5 Random Sequences Based on Data Encryption 3007.6 Simple Monte Carlo Integration 3047.7 Quasi- (that is, Sub-) Random Sequences 3097.8 Adaptive and Recursive Monte Carlo Methods 3168 Sorting 3298.0 Introduction 3298.1 Straight Insertion and Shell’s Method 3308.2 Quicksort 3328.3 Heapsort 3368.4 Indexing and Ranking 3388.5 Selecting
the M th Largest 3418.6 Determination
of Equivalence Classes 3459 Root Finding and Nonlinear Sets
of Equations 3479.0 Introduction 3479.1 Bracketing and Bisection 3509.2 Secant Method, False Position Method, and Ridders’ Method 3549.3 Van Wijngaarden–Dekker–Brent Method 3599.4 Newton-Raphson Method Using Derivative 3629.5 Roots
of Polynomials 3699.6 Newton-Raphson Method for Nonlinear Systems
of Equations 3799.7 Globally Convergent Methods for Nonlinear Systems
of Equations 38310 Minimization or Maximization
of Functions 39410.0 Introduction 39410.1 Golden Section Search
in One Dimension 39710.2 Parabolic Interpolation and Brent’s Method
in One Dimension 40210.3 One-Dimensional Search with First Derivatives 40510.4 Downhill Simplex Method
in Multidimensions 40810.5 Direction Set (Powell’s) Methods
in Multidimensions 41210.6 Conjugate Gradient Methods
in Multidimensions 42010.7 Variable Metric Methods
in Multidimensions 42510.8 Linear Programming and
the Simplex Method 43010.9 Simulated Annealing Methods 44411 Eigensystems 45611.0 Introduction 45611.1 Jacobi Transformations
of a Symmetric Matrix 46311.2 Reduction
of a Symmetric Matrix to Tridiagonal Form:Givens and Householder Reductions 46911.3 Eigenvalues and Eigenvectors
of a Tridiagonal Matrix 47511.4 Hermitian Matrices 48111.5 Reduction
of a General Matrix to Hessenberg Form 482viiiContentsSample 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 machine-readable 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).11.6
The QR Algorithm for Real Hessenberg Matrices 48611.7 Improving Eigenvalues and/or Finding Eigenvectors byInverse Iteration 49312 Fast Fourier Transform 49612.0 Introduction 49612.1 Fourier Transform
of Discretely Sampled Data 50012.2 Fast Fourier Transform (FFT) 50412.3 FFT
of Real Functions, Sine and Cosine Transforms 51012.4 FFT
in Two or More Dimensions 52112.5 Fourier Transforms
of Real Data
in Two and Three Dimensions 52512.6 External Storage or Memory-Local FFTs 53213 Fourier and Spectral Applications 53713.0 Introduction 53713.1 Convolution and Deconvolution Using
the FFT 53813.2 Correlation and Autocorrelation Using
the FFT 54513.3 Optimal (Wiener) Filtering with
the FFT 54713.4 Power Spectrum Estimation Using
the FFT 54913.5 Digital Filtering
in the Time Domain 55813.6 Linear Prediction and Linear Predictive Coding 56413.7 Power Spectrum Estimation by
the Maximum Entropy(All Poles) Method 57213.8 Spectral Analysis
of Unevenly Sampled Data 57513.9
Computing Fourier Integrals Using
the FFT 58413.10 Wavelet Transforms 59113.11
Numerical Use
of the Sampling Theorem 60614 Statistical Description
of Data 60914.0 Introduction 60914.1 Moments
of a Distribution: Mean, Variance, Skewness,and So Forth 61014.2 Do Two Distributions Have
the Same Means or Variances? 61514.3 Are Two DistributionsDifferent? 62014.4 Contingency Table Analysis
of Two Distributions 62814.5 Linear Correlation 63614.6 Nonparametric or Rank Correlation 63914.7 Do Two-Dimensional Distributions Differ? 64514.8 Savitzky-Golay Smoothing Filters 65015 Modeling
of Data 65615.0 Introduction 65615.1 Least Squares as a Maximum Likelihood Estimator 65715.2 Fitting Data to a Straight Line 66115.3 Straight-Line Data with Errors
in Both Coordinates 66615.4 General Linear Least Squares 67115.5 Nonlinear Models 681ContentsixSample 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 machine-readable 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).15.6 Conﬁdence Limits on Estimated Model Parameters 68915.7 Robust Estimation 69916 Integration
of Ordinary Differential Equations 70716.0 Introduction 70716.1 Runge-Kutta Method 71016.2 Adaptive Stepsize Control for Runge-Kutta 71416.3 Modiﬁed Midpoint Method 72216.4 Richardson Extrapolation and
the Bulirsch-Stoer Method 72416.5 Second-Order Conservative Equations 73216.6 Stiff Sets
of Equations 73416.7 Multistep, Multivalue, and Predictor-Corrector Methods 74717 Two Point Boundary Value Problems 75317.0 Introduction 75317.1
The Shooting Method 75717.2 Shooting to a Fitting Point 76017.3 Relaxation Methods 76217.4 A Worked Example: Spheroidal Harmonics 77217.5 Automated Allocation
of Mesh Points 78317.6 Handling Internal Boundary Conditions or Singular Points 78418 Integral Equations and Inverse Theory 78818.0 Introduction 78818.1 Fredholm Equations
of the Second Kind 79118.2 Volterra Equations 79418.3 Integral Equations with Singular Kernels 79718.4 Inverse Problems and
the Use
of A Priori Information 80418.5 Linear Regularization Methods 80818.6 Backus-Gilbert Method 81518.7 Maximum Entropy Image Restoration 81819 Partial Differential Equations 82719.0 Introduction 82719.1 Flux-Conservative Initial Value Problems 83419.2 Diffusive Initial Value Problems 84719.3 Initial Value Problems
in Multidimensions 85319.4 Fourier and Cyclic Reduction Methods for BoundaryValue Problems 85719.5 Relaxation Methods for Boundary Value Problems 86319.6 Multigrid Methods for Boundary Value Problems 87120 Less-Numerical Algorithms 88920.0 Introduction 88920.1 Diagnosing Machine Parameters 88920.2 Gray Codes 894xContentsSample 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 machine-readable 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).20.3 Cyclic Redundancy and Other Checksums 89620.4 Huffman Coding and Compression
of Data 90320.5 Arithmetic Coding 91020.6 Arithmetic at Arbitrary Precision 915References 926Appendix A: Table
of Prototype Declarations 930Appendix B: Utility Routines 940Appendix C: Complex Arithmetic 948Index
of Programs and Dependencies 951General Index 965Sample 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 machine-readable 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).Preface to
the Second EditionOur aim
in writing
the original edition
of Numerical Recipes was to provide abook that combined general discussion, analytical mathematics, algorithmics, andactual working programs.
The success
of the ﬁrst edition puts us now
in a difﬁcult,though hardly unenviable, position. We wanted, then and now, to write a bookthat is informal, fearlessly editorial, unesoteric, and above all useful. There is adanger that, if we are not careful, we might produce a second edition that is weighty,balanced, scholarly, and boring.It is a mixed blessing that we know more now than we did six years ago. Then,we were making educated guesses, based on existing literature and ourown research,aboutwhichnumerical techniqueswerethemostimportantand robust. Now, we havethe beneﬁt
of direct feedback from a large reader community. Letters to our alter-egoenterprise,
Numerical Recipes Software, are
in the thousands per year. (Please, don’ttelephone us.) Our post ofﬁce box has become a magnet for letters pointing outthat we have omitted some particular technique, well known to be important
in aparticular ﬁeld
of science or engineering. We value such letters, and digest themcarefully, especially when they point us to speciﬁc references
in the literature.The inevitable result
of this input is that this Second Edition
of NumericalRecipes is substantially larger than its predecessor,
in fact about 50% larger both inwords and number
of included programs (the latter now numbering well over 300).“Don’t let
the book grow
in size,” is
the advice that we received from several wisecolleagues. We have tried to follow
the intended spirit
of that advice, even as weviolate
the letter
of it. We have not lengthened, or increased
in difﬁculty,
the book’sprincipal discussions
of mainstream topics. Many new topics are presented at thissame accessible level. Some topics, both from
the earlier edition and new to thisone, are now set
in smaller type that labels them as being “advanced.”
The readerwho ignores such advanced sections completely will not, we think, ﬁnd any lack ofcontinuity
in the shorter volume that results.Here are some highlights
of the new material
in this Second Edition:• a new chapter on integral equations and inverse methods• a detailed treatment
of multigrid methods for solving elliptic partialdifferential equations• routines for band diagonal linear systems• improved routines for linear algebra on sparse matrices• Cholesky and QR decomposition• orthogonal polynomials and Gaussian quadratures for arbitrary weightfunctions• methods for calculating
numerical derivatives• Pad´e approximants, and rational Chebyshev approximation• Bessel functions, and modiﬁed Bessel functions,
of fractional order; andseveral other new special functions• improved random number routines• quasi-random sequences• routines for adaptive and recursive Monte Carlo integration
in high-dimensional spaces• globally convergent methods for sets
of nonlinear equationsxixiiPreface to
the Second EditionSample 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 machine-readable 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).• simulated annealing minimization for continuous control spaces• fast Fourier transform (FFT) for real data
in two and three dimensions• fast Fourier transform (FFT) using external storage• improved fast cosine transform routines• wavelet transforms• Fourier integrals with upper and lower limits• spectral analysis on unevenly sampled data• Savitzky-Golay smoothing ﬁlters• ﬁtting straight line data with errors
in both coordinates• a two-dimensional Kolmogorov-Smirnoff test•
the statistical bootstrap method• embedded Runge-Kutta-Fehlberg methods for differential equations• high-order methods for stiff differential equations• a new chapter on “less-numerical” algorithms, including Huffman andarithmetic coding, arbitrary precision arithmetic, and several other topics.Consult
the Preface to
the First Edition, following, or
the Table
of Contents, for alist
of the more “basic” subjects treated.AcknowledgmentsIt is not possible for us to list by name here all
the readers who have madeuseful suggestions; we are grateful for these.
In the text, we attempt to give speciﬁcattribution for ideas that appear to be original, and not known
in the literature. Weapologize
in advance for any omissions.Some readers and colleagues have been particularly generous
in providingus with ideas, comments, suggestions, and programs for this Second Edition.We especially want to thank George Rybicki, Philip Pinto, Peter Lepage, RobertLupton, Douglas Eardley, Ramesh Narayan, David Spergel, Alan Oppenheim, SallieBaliunas, Scott Tremaine, Glennys Farrar, Steven Block, John Peacock, ThomasLoredo, Matthew Choptuik, Gregory Cook, L. Samuel Finn, P. Deuﬂhard, HaroldLewis, Peter Weinberger, David Syer, Richard Ferch, Steven Ebstein, BradleyKeister, and William Gould. We have been helped by Nancy Lee Snyder’s masteryof a complicated TEX manuscript. We express appreciation to our editors LaurenCowles and Alan Harvey at Cambridge University Press, and to our productioneditor Russell Hahn. We remain,
of course, grateful to theindividuals acknowledgedin
the Preface to
the First Edition.Special acknowledgment is due to programming consultant Seth Finkelstein,who wrote, rewrote, or inﬂuenced many
of the routines
in this book, as well as inits FORTRAN-language twin and
the companion Example books. Our project hasbeneﬁted enormously fromSeth’s talentfor detecting, and followingthetrail of, evenvery slight anomalies (often compiler bugs, but occasionally our errors), and fromhis good programming sense. To
the extent that this edition
of Numerical Recipesin
C has a more graceful and “C-like” programming style than its predecessor, mostof
the credit goes to Seth. (Of course, we accept
the blame for
the FORTRANishlapses that still remain.)We prepared this book for publication on DEC and Sun workstations run-ning
the UNIX operating system, and on a 486/33 PC compatible runningMS-DOS 5.0/Windows 3.0. (See §1.0 for a list
of additional computers used in[...]... structure; (f) switch structure Sample page from
NUMERICAL RECIPES IN C:
THE ART OF SCIENTIFIC COMPUTING (ISBN 0-5 2 1-4 310 8-5 ) Copyright (C) 198 8-1 992 by Cambridge University Press.Programs Copyright (C) 198 8-1 992 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... from
NUMERICAL RECIPES IN C:
THE ART OF SCIENTIFIC COMPUTING (ISBN 0-5 2 1-4 310 8-5 ) Copyright (C) 198 8-1 992 by Cambridge University Press.Programs Copyright (C) 198 8-1 992 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... any compiler that implements
the older, de facto K&R standard [2] An example
of the kind
of trivial incompatibility to watch out for is that ANSI
C requires
the memory allocation functions malloc() Sample page from
NUMERICAL RECIPES IN C:
THE ART OF SCIENTIFIC COMPUTING (ISBN 0-5 2 1-4 310 8-5 ) Copyright (C) 198 8-1 992 by Cambridge University Press.Programs Copyright (C) 198 8-1 992 by
Numerical Recipes Software... chstwo, covsrt, dfpmin, laguer, lfit, memcof, mrqcof, mrqmin, pzextr, ran4, realft, rzextr, shoot, shootf There may be others (depending
in part on which printing
of the First Edition is taken for
the comparison) If you have written software
of any appreciable complexity Sample page from
NUMERICAL RECIPES IN C:
THE ART OF SCIENTIFIC COMPUTING (ISBN 0-5 2 1-4 310 8-5 ) Copyright (C) 198 8-1 992 by Cambridge... from
NUMERICAL RECIPES IN C:
THE ART OF SCIENTIFIC
COMPUTING (ISBN 0-5 2 1-4 310 8-5 ) Copyright (C) 198 8-1 992 by Cambridge University Press.Programs Copyright (C) 198 8-1 992 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... America) or http://www.cup.cam.ac.uk (rest
of world) xvi Sample page from
NUMERICAL RECIPES IN C:
THE ART OF SCIENTIFIC
COMPUTING (ISBN 0-5 2 1-4 310 8-5 ) Copyright (C) 198 8-1 992 by Cambridge University Press.Programs Copyright (C) 198 8-1 992 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... 20.6 machar igray icrc1 icrc decchk hufmak hufapp hufenc hufdec arcmak arcode arcsum mpops mpmul mpinv mpdiv mpsqrt mp2dfr mppi diagnose computer’s ﬂoating arithmetic Gray code and its inverse cyclic redundancy checksum, used by icrc cyclic redundancy checksum decimal check digit calculation or veriﬁcation construct a Huffman code append bits to a Huffman code, used by hufmak use Huffman code to encode... common circulation is often unclear We would be grateful to readers for new or corrected information regarding attributions, which we will attempt to incorporate
in subsequent printings Sample page from
NUMERICAL RECIPES IN C:
THE ART OF SCIENTIFIC
COMPUTING (ISBN 0-5 2 1-4 310 8-5 ) Copyright (C) 198 8-1 992 by Cambridge University Press.Programs Copyright (C) 198 8-1 992 by
Numerical Recipes Software Permission... methods complex or double root
of a polynomial, Bairstow Sample page from
NUMERICAL RECIPES IN C:
THE ART OF SCIENTIFIC
COMPUTING (ISBN 0-5 2 1-4 310 8-5 ) Copyright (C) 198 8-1 992 by Cambridge University Press.Programs Copyright (C) 198 8-1 992 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... transform
of two real functions fast Fourier transform
of a single real function fast sine transform fast cosine transform with endpoints “staggered” fast cosine transform Sample page from
NUMERICAL RECIPES IN C:
THE ART OF SCIENTIFIC
COMPUTING (ISBN 0-5 2 1-4 310 8-5 ) Copyright (C) 198 8-1 992 by Cambridge University Press.Programs Copyright (C) 198 8-1 992 by
Numerical Recipes Software Permission is granted for internet