Sixth Edition Features include: which are based on exciting new areas such as bioengineering. and differential equations. students using this text will be able to apply their new skills to their chosen field. Electronic Textbook Options an online resource where students can purchase the complete text in a digital format at almost half the cost of the traditional textbook. Students can access the text online for one year. learning, which include full text search, notes and highlighting, and email tools for sharing contact your sales representative or visit www.coursesmart.com. Sixth Edition Numerical Methods for Engineers Chapra Canale Steven C. Chapra Raymond P. Canale MD DALIM #1009815 03/12/09 CYAN MAG YELO BLK For more information, please visit www.mhhe.com/chapra for Engineers adaptive quadrature. Numerical Methods The sixth edition of Numerical Methods for Engineers offers an innovative and accessible presentation of numerical methods; the book has earned the Meriam-Wiley award, which is given by the American Society for Engineering Education for the best textbook. Because software packages are now regularly used for numerical analysis, this eagerly anticipated revision maintains its strong focus on appropriate use of computational tools.
cha01064_fm.qxd 3/25/09 10:51 AM Page i Numerical Methods for Engineers S I X TH ED I TION Steven C. Chapra Berger Chair in Computing and Engineering Tufts University Raymond P. Canale Professor Emeritus of Civil Engineering University of Michigan
cha01064_fm.qxd 3/25/09 10:51 AM Page ii NUMERICAL METHODS FOR ENGINEERS, SIXTH EDITION Published by McGraw-Hill, a business unit of The McGraw-Hill Companies, Inc., 1221 Avenue of the Americas, New York, NY 10020. Copyright 2010 by The McGraw-Hill Companies, Inc. All rights reserved. Previous editions 2006, 2002, and 1998. No part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written consent of The McGraw-Hill Companies, Inc., including, but not limited to, in any network or other electronic storage or transmission, or broadcast for distance learning. Some ancillaries, including electronic and print components, may not be available to customers outside the United States. This book is printed on acid-free paper. 1 2 3 4 5 6 7 8 9 0 VNH/VNH 0 9 ISBN 978 0 07 340106 5 MHID 0 07 340106 4 Global Publisher: Raghothaman Srinivasan Sponsoring Editor: Debra B. Hash Director of Development: Kristine Tibbetts Developmental Editor: Lorraine K. Buczek Senior Marketing Manager: Curt Reynolds Project Manager: Joyce Watters Lead Production Supervisor: Sandy Ludovissy Associate Design Coordinator: Brenda A. Rolwes Cover Designer: Studio Montage, St. Louis, Missouri (USE) Cover Image: BrandX/JupiterImages Compositor: Macmillan Publishing Solutions Typeface: 10/12 Times Roman Printer: R. R. Donnelley Jefferson City, MO All credits appearing on page or at the end of the book are considered to be an extension of the copyright page. MATLAB is a registered trademark of The MathWorks, Inc. Library of Congress Cataloging-in-Publication Data Chapra, Steven C. Numerical methods for engineers / Steven C. Chapra, Raymond P. Canale. 6th ed. p. cm. Includes bibliographical references and index. ISBN 978 0 07 340106 5 ISBN 0 07 340106 4 (hard copy : alk. paper) 1. Engineering mathematics Data processing. 2. Numerical calculations Data processing 3. Microcomputers Programming. I. Canale, Raymond P. II. Title. TA345.C47 2010 2008054296 518.02462 dc22 www.mhhe.com
To Margaret and Gabriel Chapra Helen and Chester Canale
CONTENTS PREFACE xiv GUIDED TOUR xvi ABOUT THE AUTHORS xviii PART ONE MODELING, PT1.1 Motivation 3 COMPUTERS, AND PT1.2 Mathematical Background 5 ERROR ANALYSIS 3 PT1.3 Orientation 8 CHAPTER 1 Mathematical Modeling and Engineering Problem Solving 11 1.1 A Simple Mathematical Model 11 1.2 Conservation Laws and Engineering 18 Problems 21 CHAPTER 2 Programming and Software 25 2.1 Packages and Programming 25 2.2 Structured Programming 26 2.3 Modular Programming 35 2.4 Excel 37 2.5 MATLAB 41 2.6 Mathcad 45 2.7 Other Languages and Libraries 46 Problems 47 CHAPTER 3 Approximations and Round-Off Errors 52 3.1 Significant Figures 53 3.2 Accuracy and Precision 55 3.3 Error Definitions 56 3.4 Round-Off Errors 62 Problems 76 iv
CONTENTS v CHAPTER 4 Truncation Errors and the Taylor Series 78 4.1 The Taylor Series 78 4.2 Error Propagation 94 4.3 Total Numerical Error 98 4.4 Blunders, Formulation Errors, and Data Uncertainty 103 Problems 105 EPILOGUE: PART ONE 107 PT1.4 Trade-Offs 107 PT1.5 Important Relationships and Formulas 110 PT1.6 Advanced Methods and Additional References 110 PART TWO ROOTS OF PT2.1 Motivation 113 EQUATIONS 113 PT2.2 Mathematical Background 115 PT2.3 Orientation 116 CHAPTER 5 Bracketing Methods 120 5.1 Graphical Methods 120 5.2 The Bisection Method 124 5.3 The False-Position Method 132 5.4 Incremental Searches and Determining Initial Guesses 138 Problems 139 CHAPTER 6 Open Methods 142 6.1 Simple Fixed-Point Iteration 143 6.2 The Newton-Raphson Method 148 6.3 The Secant Method 154 6.4 Brent s Method 159 6.5 Multiple Roots 164 6.6 Systems of Nonlinear Equations 167 Problems 171 CHAPTER 7 Roots of Polynomials 174 7.1 Polynomials in Engineering and Science 174 7.2 Computing with Polynomials 177 7.3 Conventional Methods 180
vi CONTENTS 7.4 Müller s Method 181 7.5 Bairstow s Method 185 7.6 Other Methods 190 7.7 Root Location with Software Packages 190 Problems 200 CHAPTER 8 Case Studies: Roots of Equations 202 8.1 Ideal and Nonideal Gas Laws (Chemical/Bio Engineering) 202 8.2 Greenhouse Gases and Rainwater (Civil/Environmental Engineering) 205 8.3 Design of an Electric Circuit (Electrical Engineering) 207 8.4 Pipe Friction (Mechanical/Aerospace Engineering) 209 Problems 213 EPILOGUE: PART TWO 223 PT2.4 Trade-Offs 223 PT2.5 Important Relationships and Formulas 224 PT2.6 Advanced Methods and Additional References 224 PART THREE LINEAR ALGEBRAIC PT3.1 Motivation 227 EQUATIONS 227 PT3.2 Mathematical Background 229 PT3.3 Orientation 237 CHAPTER 9 Gauss Elimination 241 9.1 Solving Small Numbers of Equations 241 9.2 Naive Gauss Elimination 248 9.3 Pitfalls of Elimination Methods 254 9.4 Techniques for Improving Solutions 260 9.5 Complex Systems 267 9.6 Nonlinear Systems of Equations 267 9.7 Gauss-Jordan 269 9.8 Summary 271 Problems 271 CHAPTER 10 LU Decomposition and Matrix Inversion 274 10.1 LU Decomposition 274 10.2 The Matrix Inverse 283 10.3 Error Analysis and System Condition 287 Problems 293
CONTENTS vii CHAPTER 11 Special Matrices and Gauss-Seidel 296 11.1 Special Matrices 296 11.2 Gauss-Seidel 300 11.3 Linear Algebraic Equations with Software Packages 307 Problems 312 CHAPTER 12 Case Studies: Linear Algebraic Equations 315 12.1 Steady-State Analysis of a System of Reactors (Chemical/Bio Engineering) 315 12.2 Analysis of a Statically Determinate Truss (Civil/Environmental Engineering) 318 12.3 Currents and Voltages in Resistor Circuits (Electrical Engineering) 322 12.4 Spring-Mass Systems (Mechanical/Aerospace Engineering) 324 Problems 327 EPILOGUE: PART THREE 337 PT3.4 Trade-Offs 337 PT3.5 Important Relationships and Formulas 338 PT3.6 Advanced Methods and Additional References 338 PART FOUR OPTIMIZATION 341 PT4.1 Motivation 341 PT4.2 Mathematical Background 346 PT4.3 Orientation 347 CHAPTER 13 One-Dimensional Unconstrained Optimization 351 13.1 Golden-Section Search 352 13.2 Parabolic Interpolation 359 13.3 Newton s Method 361 13.4 Brent s Method 364 Problems 364 CHAPTER 14 Multidimensional Unconstrained Optimization 367 14.1 Direct Methods 368 14.2 Gradient Methods 372 Problems 385
viii CONTENTS CHAPTER 15 Constrained Optimization 387 15.1 Linear Programming 387 15.2 Nonlinear Constrained Optimization 398 15.3 Optimization with Software Packages 399 Problems 410 CHAPTER 16 Case Studies: Optimization 413 16.1 Least-Cost Design of a Tank (Chemical/Bio Engineering) 413 16.2 Least-Cost Treatment of Wastewater (Civil/Environmental Engineering) 418 16.3 Maximum Power Transfer for a Circuit (Electrical Engineering) 422 16.4 Equilibrium and Minimum Potential Energy (Mechanical/Aerospace Engineering) 426 Problems 428 EPILOGUE: PART FOUR 436 PT4.4 Trade-Offs 436 PT4.5 Additional References 437 PART FIVE CURVE FITTING 439 PT5.1 Motivation 439 PT5.2 Mathematical Background 441 PT5.3 Orientation 450 CHAPTER 17 Least-Squares Regression 454 17.1 Linear Regression 454 17.2 Polynomial Regression 470 17.3 Multiple Linear Regression 474 17.4 General Linear Least Squares 477 17.5 Nonlinear Regression 481 Problems 484 CHAPTER 18 Interpolation 488 18.1 Newton s Divided-Difference Interpolating Polynomials 489 18.2 Lagrange Interpolating Polynomials 500 18.3 Coefficients of an Interpolating Polynomial 505 18.4 Inverse Interpolation 505 18.5 Additional Comments 506 18.6 Spline Interpolation 509 18.7 Multidimensional Interpolation 519 Problems 522
CONTENTS ix CHAPTER 19 Fourier Approximation 524 19.1 Curve Fitting with Sinusoidal Functions 525 19.2 Continuous Fourier Series 531 19.3 Frequency and Time Domains 534 19.4 Fourier Integral and Transform 538 19.5 Discrete Fourier Transform (DFT) 540 19.6 Fast Fourier Transform (FFT) 542 19.7 The Power Spectrum 549 19.8 Curve Fitting with Software Packages 550 Problems 559 CHAPTER 20 Case Studies: Curve Fitting 561 20.1 Linear Regression and Population Models (Chemical/Bio Engineering) 561 20.2 Use of Splines to Estimate Heat Transfer (Civil/Environmental Engineering) 565 20.3 Fourier Analysis (Electrical Engineering) 567 20.4 Analysis of Experimental Data (Mechanical/Aerospace Engineering) 568 Problems 570 EPILOGUE: PART FIVE 580 PT5.4 Trade-Offs 580 PT5.5 Important Relationships and Formulas 581 PT5.6 Advanced Methods and Additional References 583 PART SIX NUMERICAL PT6.1 Motivation 585 DIFFERENTIATION PT6.2 Mathematical Background 595 AND PT6.3 Orientation 597 INTEGRATION 585 CHAPTER 21 Newton-Cotes Integration Formulas 601 21.1 The Trapezoidal Rule 603 21.2 Simpson s Rules 613 21.3 Integration with Unequal Segments 622 21.4 Open Integration Formulas 625 21.5 Multiple Integrals 625 Problems 627
x CONTENTS CHAPTER 22 Integration of Equations 631 22.1 Newton-Cotes Algorithms for Equations 631 22.2 Romberg Integration 632 22.3 Adaptive Quadrature 638 22.4 Gauss Quadrature 640 22.5 Improper Integrals 648 Problems 651 CHAPTER 23 Numerical Differentiation 653 23.1 High-Accuracy Differentiation Formulas 653 23.2 Richardson Extrapolation 656 23.3 Derivatives of Unequally Spaced Data 658 23.4 Derivatives and Integrals for Data with Errors 659 23.5 Partial Derivatives 660 23.6 Numerical Integration/Differentiation with Software Packages 661 Problems 668 CHAPTER 24 Case Studies: Numerical Integration and Differentiation 671 24.1 Integration to Determine the Total Quantity of Heat (Chemical/Bio Engineering) 671 24.2 Effective Force on the Mast of a Racing Sailboat (Civil/Environmental Engineering) 673 24.3 Root-Mean-Square Current by Numerical Integration (Electrical Engineering) 675 24.4 Numerical Integration to Compute Work (Mechanical/Aerospace Engineering) 678 Problems 682 EPILOGUE: PART SIX 692 PT6.4 Trade-Offs 692 PT6.5 Important Relationships and Formulas 693 PT6.6 Advanced Methods and Additional References 693 PART SEVEN ORDINARY PT7.1 Motivation 697 DIFFERENTIAL PT7.2 Mathematical Background 701 EQUATIONS 697 PT7.3 Orientation 703
CONTENTS xi CHAPTER 25 Runge-Kutta Methods 707 25.1 Euler s Method 708 25.2 Improvements of Euler s Method 719 25.3 Runge-Kutta Methods 727 25.4 Systems of Equations 737 25.5 Adaptive Runge-Kutta Methods 742 Problems 750 CHAPTER 26 Stiffness and Multistep Methods 752 26.1 Stiffness 752 26.2 Multistep Methods 756 Problems 776 CHAPTER 27 Boundary-Value and Eigenvalue Problems 778 27.1 General Methods for Boundary-Value Problems 779 27.2 Eigenvalue Problems 786 27.3 Odes and Eigenvalues with Software Packages 798 Problems 805 CHAPTER 28 Case Studies: Ordinary Differential Equations 808 28.1 Using ODEs to Analyze the Transient Response of a Reactor (Chemical/Bio Engineering) 808 28.2 Predator-Prey Models and Chaos (Civil/Environmental Engineering) 815 28.3 Simulating Transient Current for an Electric Circuit (Electrical Engineering) 819 28.4 The Swinging Pendulum (Mechanical/Aerospace Engineering) 824 Problems 828 EPILOGUE: PART SEVEN 838 PT7.4 Trade-Offs 838 PT7.5 Important Relationships and Formulas 839 PT7.6 Advanced Methods and Additional References 839 PART EIGHT PARTIAL PT8.1 Motivation 843 DIFFERENTIAL PT8.2 Orientation 846 EQUATIONS 843
xii CONTENTS CHAPTER 29 Finite Difference: Elliptic Equations 850 29.1 The Laplace Equation 850 29.2 Solution Technique 852 29.3 Boundary Conditions 858 29.4 The Control-Volume Approach 864 29.5 Software to Solve Elliptic Equations 867 Problems 868 CHAPTER 30 Finite Difference: Parabolic Equations 871 30.1 The Heat-Conduction Equation 871 30.2 Explicit Methods 872 30.3 A Simple Implicit Method 876 30.4 The Crank-Nicolson Method 880 30.5 Parabolic Equations in Two Spatial Dimensions 883 Problems 886 CHAPTER 31 Finite-Element Method 888 31.1 The General Approach 889 31.2 Finite-Element Application in One Dimension 893 31.3 Two-Dimensional Problems 902 31.4 Solving PDEs with Software Packages 906 Problems 910 CHAPTER 32 Case Studies: Partial Differential Equations 913 32.1 One-Dimensional Mass Balance of a Reactor (Chemical/Bio Engineering) 913 32.2 Deflections of a Plate (Civil/Environmental Engineering) 917 32.3 Two-Dimensional Electrostatic Field Problems (Electrical Engineering) 919 32.4 Finite-Element Solution of a Series of Springs (Mechanical/Aerospace Engineering) 922 Problems 926 EPILOGUE: PART EIGHT 929 PT8.3 Trade-Offs 929 PT8.4 Important Relationships and Formulas 929 PT8.5 Advanced Methods and Additional References 930
CONTENTS xiii APPENDIX A: THE FOURIER SERIES 931 APPENDIX B: GETTING STARTED WITH MATLAB 933 APPENDIX C: GETTING STARTED WITH MATHCAD 941 BIBLIOGRAPHY 952 INDEX 955