FOR NUMERICAL
METHODS FOR
ENGINEERS 8TH
EDTION BY STEVEN C.
CHAPRA
,TABLE OF CONTENTS
PART 1 - MODELING, COMPUTERS, AND ERROR ANALYSIS
1) Mathematical Modeling and Engineering Problem Solving
2) Programming and Software
3) Approximations and Round-Off Errors
4) Truncation Errors and the Taylor Series
PART 2 - ROOTS OF EQUATIONS
5) Bracketing Methods
6) Open Methods
7) Roots of Polynomials
8) Case Studies: Roots of Equations
PART 3 - LINEAR ALGEBRAIC EQUATIONS
9) Gauss Elimination
10) LU Decomposition and Matrix Inversion
11) Special Matrices and Gauss-Seidel
12) Case Studies: Linear Algebraic Equations
PART 4 - OPTIMIZATION
13) One-Dimensional Unconstrained Optimization
14) Multidimensional Unconstrained Optimization
15) Constrained Optimization
16) Case Studies: Optimization
PART 5 - CURVE FITTING
17) Least-Squares Regression
18) Interpolation
19) Fourier Approximation
20) Case Studies: Curve Fitting
PART 6 - NUMERICAL DIFFERENTIATION AND INTEGRATION
21) Newton-Cotes Integration Formulas
22) Integration of Equations
23) Numerical Differentiation
24) Case Studies: Numerical Integration and Differentiation
PART 7 - ORDINARY DIFFERENTIAL EQUATIONS
25) Runge-Kutta Methods
26) Stiffness and Multistep Methods
27) Boundary-Value and Eigenvalue Problems
28) Case Studies: Ordinary Differential Equations
PART 8 - PARTIAL DIFFERENTIAL EQUATIONS
29) Finite Difference: Elliptic Equations
30) Finite Difference: Parabolic Equations
31) Finite-Element Method
32) Case Studies: Partial Differential Equations
,Chapter 2
2.1
If X < 1 0 Then If X
< 5 Then
X=5
El s e
Pri nt X
End If
El s e
Do
If X < 5 0 Exit
X=X-5
End Do
End If
2.2
Step 1: Start
Step 2: Initialize Sum And Count To
Zero Step 3: Examine Top Card.
Step 4: If It Says “End Of Data” Proceed To Step 9; Otherwise, Proceed
To Next Step. Step 5: Add Value From Top Card To Sum.
Step 6: Increase Count
By 1. Step 7: Discard
Top Card Step 8:
Return To Step 3.
Step 9: Is The Count Greater Than Zero?
If Yes, Proceed To
Step 10. If No, Proceed
To Step 11.
Step 10: Calculate Average = Sum/Count
Step 11: End
2.3
start
sum = 0
count = 0
T
count > 0
INPUT
value
F
average = sum/count
value = T
“end of data”
F end
sum = sum + value
count = count + 1
, 2.4
Students Could Implement The Subprogram In Any Number Of Languages. The
Following Fortran 90 Program Is One Example. It Should Be Noted That The
Availability Of Complex Variables In Fortran 90, Would Allow This Subroutine
To Be Made Even More Concise. However, We Did Not Exploit This Feature, In
Order To Make The Code More Compatible With Visual Basic, Matlab, Etc.
Program Rootfind
Implicit None
Integer::Ier
Real::A, B, C, R1, I1, R2, I2
Data A,B,C/1.,5.,2./
Call Roots(A, B, C, Ier, R1, I1, R2, I2) If (Ier .Eq. 0)
Then
Print *, R1,I1," I"
Print *, R2,I2," I" Else
Print *, "No Roots"End
If
End
Subroutine Roots(A, B, C, Ier, R1, I1, R2, I2) Implicit None
Integer::Ier
Real::A, B, C, D, R1, I1, R2, I2R1=0.
R2=0.
I1=0.
I2=0.
If (A .Eq. 0.) Then If (B
<> 0) Then
R1 = -C/B
Else
Ier = 1
End If
Else
D = B**2 - 4.*A*CIf
(D >= 0) Then
R1 = (-B + Sqrt(D))/(2*A)
R2 = (-B - Sqrt(D))/(2*A)Else
R1 = -B/(2*A) R2
= R1
I1 = Sqrt(Abs(D))/(2*A)
I2 = -I1
End If
End If
End
The Answers For The 3 Test Cases Are: (A) -4.56; (B) 0.5; (C) +
2.33i;
2.33i.
Several Features Of This Subroutine Bear Mention:
The Subroutine Does Not Involve Input Or Output. Rather, Information Is
Passed In And Out Via The Arguments. This Is Often The Preferred Style,
Because The I/O Is Left To The Discretion Of The Programmer Within The
Calling Program.
Note That An Error Code Is Passed (Ier = 1) For The Case Where No Roots Are
Possible.