Numeri Chapra
Numeri Chapra
Numeri Chapra
^kfil
for Engineers
FIFTH EDITION
Steven C. Chapra
Berger Chair in Computing and Engineering
Tufts University
Raymond P. Canale
Professor Emeritus of Civil Engineering
:
University of Michigan
ULB Darmstadt
Illlllllllllll
17107445
Boston Burr Ridge, IL Dubuque, JA Madison, WI New York San Francisco St. Louis
Bangkok Bogota Caracas Kuala Lumpur Lisbon London Madrid Mexico City •
Milan Montreal New Delhi Santiago Seoul Singapore Sydney Taipei Toronto
CONTENTS
PREFACE xiii
PART ONE
MODELING, PT1.1 Motivation 3
COMPUTERS, AND PT 1.2 Mathematical Background
ERROR ANALYSIS PT 1.3 Orientation 8
CHAPTER 1
Mathematical Modeling and Engineering Problem Solving 11
1.1 A Simple Mathematical Model 1 1
1.2 Conservation Laws and Engineering 1 8
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 Other Languages and Libraries 45
Problems 46
CHAPTER 3
Approximations and Round-Off Errors 50
3.1 Significant Figures 51
3.2 Accuracy and Precision 53
3.3 Error Definitions 54
3.4 Round-Off Errors 57
Problems 72
IV
CONTENTS
CHAPTER 4
Truncation Errors and the Taylor Series 73
4.1 The Taylor Series 73
4.2 Error Propagation 89
4.3 Total Numerical Error 93
4.4 Blunders, Formulation Errors; and,Data Uncertainty 95
.Problems- 97. ' . . ,r, .
PART TWO
ROOTS OF PT2.1 Motivation 105
EQUATIONS 105 PT 2.2 Mathematical Background 107
PT2.3 Orientation "108 "
CHAPTER 5
Bracketing Methods 112
5.1 Graphical Methods 112 '
5.2 The Bisection Method 116
5.3 The False-Position Method 124
5.4 Incremental Searches and Determining Initial Guesses 130
Problems 131 - ' '
CHAPTER 6
Open Methods 133
6.1 Simple Fixed-Point Iteration 134 .
6.2 The Newron-Raphson Method 139..
6.3 The Secant Method 145
6.4 Multiple Roots 150
6.5 Systems of Nonlinear Equations 153
Problems 157
CHAPTER 7 ; ^ ;
Roots of Polynomials ,160
7.1 Polynomials in Engineering and Science 160
7.2 Computing with Polynomials 163
7.3 Conventional Methods 166
7.4 Mullen's Method. 167
7.5 Bairstow's Method 171
7.6 Other Methods 176
VI CONTENTS
CHAPTER 8
Case Studies: Roots of Equations 187
8.1 Ideal and Nonideal Gas Laws (Chemical/Bio Engineering) 187
8.2 Open-Channel Flow (Civil/Environmental Engineering) 190
8.3 Design of an Electric Circuit (Electrical Engineering) 194
8.4 Vibration Analysis (Mechanical/Aerospace Engineering) 196
Problems 203
PART THREE
LINEAR ALGEBRAIC PT3.1 Motivation 217
EQUATIONS 2 1 7 PT 3.2 Mathematical Background 219
PT3.3 Orientation 227
CHAPTER 9
Gauss Elimination 231
9.1 Solving Small Numbers of Equations 231
9.2 Naive Gauss Elimination 238
9.3 Pitfalls of Elimination Methods 244
9.4 Techniques for Improving Solutions 250
9.5 Complex Systems 257
9.6 Nonlinear Systems of Equations 257
9.7 Gauss-Jordan 259
9.8 Summary 261
Problems 261
CHAPTER 10
LU Decomposition and Matrix Inversion 264
10.1 LU Decomposition 264
10.2 The Matrix Inverse 273
10.3 Error Analysis and System Condition 277
Problems 283 . . : ,
CHAPTER 11
Special Matrices and Gauss-Seidel 285
11.1 Special Matrices 285
11.2 Gauss-Seidel 289
CONTENTS VII
CHAPTER 12
Case Studies: Linear Algebraic Equations 305
12.1 Steady-State Analysis of a System of Reactors (Chemical/Bio
Engineering) 305
12.2 Analysis of a Statically Determinate Truss (Civil/Environmental Engineering) 308
1 2.3 Currents and Voltages in Resistor Circuits (Electrical Engineering) 312
12.4 Spring-Mass Systems (Mechanical/Aerospace Engineering) 314
Problems 317
PART FOUR
OPTIMIZATION 331 PT4.1 Motivation 331
PT 4.2 Mathematical Background 336
PT4.3 Orientation 337
CHAPTER 13
One-Dimensional Unconstrained Optimization 341
13.1 Golden-Section Search 342
13.2 Quadratic Interpolation 349
13.3 Newton's Method 351
Problems 353
CHAPTER 14
Multidimensional Unconstrained Optimization 355
14.1 Direct Methods 356
14.2 Gradient Methods 360
Problems 373
CHAPTER 15
Constrained Optimization 375
15.1 Linear Programming 375
15.2 Nonlinear Constrained Optimization 386
15.3 Optimization with Packages 387
Problems 398
VIII CONTENTS
CHAPTER 16
Case Studies: Optimization 400
16.1 Least-Cost Design of a Tank (Chemical/Bio Engineering) 400
16.2 Least-Cost Treatment of Wastewater (Civil/Environmental Engineering) 405
16.3 Maximum Power Transfer for a Circuit (Electrical Engineering) 409
16.4 Mountain Bike Design (Mechanical/Aerospace Engineering)o^413
:
Problems 415. %
PART FIVE
CURVE FITTING 425 PT5.1 'Motivation .425, ''."..
PT 5.2 Mathematical Background 427
PT5.3 Orientation 436
CHAPTER 17
Least-Squares Regression 440
17.1 Linear Regression 440 .
17.2 Polynomial Regression 456
17.3 Multiple Linear Regression 460
17.4 General Linear Least Squares 463
17.5 Nonlinear Regression 468
Problems 471 ; .,-S
CHAPTER 18
Interpolation 474
18.1 Newton's Divided-Difference Interpolating Polynomials 475
18.2 Lagrange Interpolating Polynomials 486
18.3 Coefficients of an Interpolating Polynomial 491
18.4 Inverse Interpolation 491 '
1 8.5 Additional Comments' 492
18.6 Spline Interpolation 495
Problems 505
CHAPTER 19
Fourier Approximation 507 .
19.1 Curve.Fitting with Sinusoidal. Functions 508
19.2 Continuous Fourier Series 51,4 .. ,
19.3 Frequency and Time Domains 517 .'.
CONTENTS IX
CHAPTER 2 0
Case Studies: Curve Fitting 544
20.1 Linear Regression and Population Models (Chemical/Bio Engineering) 544
20.2 Use of Splines to Estimate Heat Transfer (Civil/Environmental Engineering) 548
20.3 Fourier Analysis (Electrical Engineering) 550
'20.4 Analysis of Experimental Data (Mechanical/Aerospace Engineering) 551
Problems 553 ' '
PART SIX
NUMERICAL PT6.1 Motivation 569
DIFFERENTIATION PT 6.2 Mathematical Background 578
AND PT6.3 Orientation 581
INTEGRATION 5 6 9
CHAPTER 21
Newton-Cotes Integration Formulas 584
21.1 The Trapezoidal Rule 586 -.
21.2 Simpson's Rules 5,96.
21.3 Integration with Unequal Segments 605
21.4 Open Integration Formulas 608
21.5 Multiple Integrals 608
A Problems 610
CHAPTER 2 2
Integration of Equations 613
22.1 Newton-Cotes Algorithms for Equations 613
22.2 Romberg Integration 615
22.3 Gauss Quadrature 620
22.4 Improper Integrals 627
Problems 631
CONTENTS
CHAPTER 23
Numerical- Differentiation 632
23.1 High-Accuracy Differentiation Formulas 632
23.2 Richardson Extrapolation 635
23.3 Derivatives of Unequally Spaced Data 637
23.4 Derivatives and Integrals for Data with Errors 638
23.5 Numerical Integration/Differentiation with Libraries and Packages 639
Problems 643
CHAPTER 2 4
Case Studies: Numerical Integration and Differentiation 646
.24.1 Integration to, Determine the Total Quantity of Heat (Chemical/Bio
Engineering) 646
24.2 Effective Force on the Mast of a Racing Sailboat (Civil/Environmental
Engineering) 648
24.3 Root-Mean-Square Current by Numerical Integration (Electrical
Engineering) 650 -'
24.4 Numerical Integration to Compute Work (Mechanical/Aerospace
Engineering) 653 ' '
Problems 657
PART SEVEN
ORDINARY PT7.1 Motivation 671
DIFFERENTIAL PT 7.2 Mathematical Background 675
EQUATIONS 6 7 1 PT 7.3 Orientation 677
CHAPTER 25
Runge-Kutta Methods 681
25.1 Euler's Method 682
25.2 Improvements of Euler's Method 693
25.3 Runge-Kutta Methods 701
25.4 Systems of Equations 711
25.5 Adaptive Runge-Kutta Methods 716
Problems 724'
CONTENTS xi
CHAPTER 26
Stiffness and Multistep Methods 726
26.1 Stiffness 7 2 6
26.2 Multistep Methods 730
Problems 7 5 0 : .
CHAPTER 2 7
Boundary-Value and Eigenvalue Problems 752
27.1 General Methods for Boundary-Value Problems 753
27.2 Eigenvalue Problems 759
27.3 ODEs and Eigenvalues with Libraries and Packages 771
Problems 779
CHAPTER 2 8
Case Studies: Ordinary Differential Equations 781
28.1 Using ODEs to Analyze the Transient Response of a Reactor (Chemical/Bio
Engineering) 781
28.2 Predator-Prey Models and Chaos (Civil/Environmental Engineering) 788
28.3 Simulating Transient Current for an Electric Circuit (Electrical Engineering) 792
''>'28v4 The Swinging Pendulum (Mechanical/Aerospace Engineering) 797
Problems" 801
8 J
808
PT7.4 Trade-Offs 808
PT 7.5 Important Relationships and Formulas 809
PT 7.6 Advanced Methods and Additional References 809
PART EIGHT
PARTIAL PT8.1 Motivation 813
DIFFERENTIAL PT 8.2 Orientation 816
EQUATIONS 8 1 3
CHAPTER 2 9
Finite Difference: Elliptic Equations 820
29.1 The Laplace Equation 820
29.2 Solution Techniques 822
29.3 Boundary Conditions 828
29.4 The Control-Volume Approach 834
29.5 Software to Solve Elliptic Equations 837
Problems 838
xii CONTENTS
CHAPTER 3 0
Finite Difference: Parabolic Equations 840
30.1 The Heat Conduction Equation 840
30.2 Explicit Methods 841
30.3 A Simple Implicit Method 845
30.4 The Crank-Nicolson Method 849
30.5 Parabolic Equations in Two Spatial Dimensions 852
Problems 855
CHAPTER 31
Finite-Element Method 857
31.1 The General Approach 858
31.2 Finite-Element Application in One Dimension 862
31.3 Two-Dimensional Problems 871
31.4 Solving PDEs with Libraries and Packages 875
Problems 881
CHAPTER 3 2
Case Studies: Partial Differential Equations 884
32.1 One-Dimensional Mass Balance of a Reactor (Chemical/Bio
Engineering) 884
32.2 Deflections of a Plate (Civil/Environmental Engineering) 888
32.3 Two-Dimensional Electrostatic Field Problems (Electrical Engineering) 890
32.4 Finite-Element Solution of a Series of Springs (Mechanical/Aerospace
Engineering) 893
Problems 897
BIBLIOGRAPHY 911
INDEX 915