|
|
xiii | |
Preface |
|
xv | |
Acknowledgments |
|
xxi | |
Authors |
|
xxiii | |
|
Chapter 1 Engineering and Scientific Calculations |
|
|
1 | (40) |
|
|
1 | (2) |
|
|
3 | (6) |
|
1.1.1 Positional and Scientific Notation |
|
|
3 | (1) |
|
1.1.2 Accuracy and Precision |
|
|
4 | (1) |
|
1.1.3 Significant Figures |
|
|
5 | (1) |
|
|
6 | (3) |
|
1.2 Mathematical Functions |
|
|
9 | (13) |
|
1.2.1 Absolute Value and Sign Functions |
|
|
10 | (1) |
|
1.2.2 Exponents and Logarithms |
|
|
10 | (4) |
|
1.2.3 Trigonometric Functions |
|
|
14 | (6) |
|
1.2.4 Hyperbolic Functions |
|
|
20 | (2) |
|
|
22 | (2) |
|
|
24 | (4) |
|
1.5 Organizing and Planning Solutions to Problems |
|
|
28 | (13) |
|
|
36 | (5) |
|
Chapter 2 Computer-Based Calculations |
|
|
41 | (14) |
|
|
41 | (2) |
|
2.1 Numerical Quantities as Stored in the Computer |
|
|
43 | (6) |
|
|
43 | (3) |
|
|
46 | (3) |
|
2.2 How the Computer Stores Text |
|
|
49 | (1) |
|
2.3 Boolean True/False Information |
|
|
49 | (2) |
|
2.4 Computer Storage Evolution and Terminology |
|
|
51 | (4) |
|
|
51 | (4) |
|
|
55 | (46) |
|
|
55 | (1) |
|
3.1 The Spyder/IPython Environment |
|
|
56 | (5) |
|
3.2 Mathematical Functions |
|
|
61 | (3) |
|
3.3 Variables and Assignment |
|
|
64 | (3) |
|
3.4 Objects, Attributes, Methods, and Data Types |
|
|
67 | (5) |
|
|
69 | (2) |
|
|
71 | (1) |
|
|
72 | (4) |
|
|
76 | (6) |
|
|
82 | (5) |
|
|
87 | (6) |
|
3.8.1 Console Input and Output |
|
|
88 | (1) |
|
3.8.2 File Input and Output |
|
|
89 | (2) |
|
|
91 | (2) |
|
|
93 | (8) |
|
|
97 | (4) |
|
Chapter 4 Structured Programming with Python |
|
|
101 | (36) |
|
|
101 | (1) |
|
4.1 An Overview of Program Structure |
|
|
102 | (2) |
|
4.2 Implementing Decision Structures with Python |
|
|
104 | (6) |
|
4.3 Implementing Repetition Structures with Python |
|
|
110 | (8) |
|
4.3.1 The General Loop Structure |
|
|
110 | (2) |
|
4.3.2 The List-Driven and Count-Controlled Loop Structures |
|
|
112 | (4) |
|
4.3.3 The break and Continue Statements with the for Loop |
|
|
116 | (2) |
|
4.4 User-Defined Functions in Python |
|
|
118 | (19) |
|
|
120 | (1) |
|
|
121 | (6) |
|
|
127 | (2) |
|
|
129 | (8) |
|
Chapter 5 Graphics--Matplotlib |
|
|
137 | (38) |
|
|
137 | (1) |
|
5.1 Introduction to Matplotlib |
|
|
137 | (3) |
|
5.2 Customizing Line and Scatter Plots |
|
|
140 | (11) |
|
5.3 Using Figure Window Objects |
|
|
151 | (3) |
|
5.4 Creating Bar Plots Including Histograms |
|
|
154 | (4) |
|
5.5 Creating Other Plots of Interest |
|
|
158 | (6) |
|
5.6 Contour and Surface Plots |
|
|
164 | (11) |
|
|
170 | (5) |
|
Chapter 6 Array and Matrix Operations |
|
|
175 | (24) |
|
|
175 | (1) |
|
6.1 Creating Arrays in Python |
|
|
176 | (5) |
|
6.1.1 Creating Special Arrays |
|
|
178 | (1) |
|
6.1.2 Combining, Stacking, and Splitting Arrays |
|
|
179 | (1) |
|
|
180 | (1) |
|
6.2 Indexing: Array Subscripts |
|
|
181 | (3) |
|
|
184 | (5) |
|
6.4 Vector/Matrix Operations |
|
|
189 | (10) |
|
6.4.1 Matrix/Vector Multiplication |
|
|
190 | (3) |
|
|
193 | (1) |
|
|
193 | (3) |
|
|
196 | (3) |
|
Chapter 7 Solving Single Algebraic Equations |
|
|
199 | (50) |
|
|
199 | (1) |
|
7.1 The Nature of Single, Nonlinear Equations in One Unknown |
|
|
200 | (2) |
|
7.2 Bracketing Methods--Bisection |
|
|
202 | (5) |
|
7.3 Bracketing Methods--False Position |
|
|
207 | (5) |
|
7.4 Open Methods--Newton-Raphson |
|
|
212 | (7) |
|
7.5 Open Methods--Modified Secant |
|
|
219 | (2) |
|
7.6 Circular Methods--Fixed-Point Iteration |
|
|
221 | (6) |
|
7.7 Circular Methods--The Wegstein Method |
|
|
227 | (3) |
|
7.8 A Hybrid Approach--Brent's Method |
|
|
230 | (3) |
|
7.9 Solving for the Roots of Polynomials |
|
|
233 | (4) |
|
7.10 Case Study: Trajectories of Projectiles in Air |
|
|
237 | (12) |
|
|
242 | (7) |
|
Chapter 8 Solving Sets of Algebraic Equations |
|
|
249 | (44) |
|
|
249 | (1) |
|
8.1 Systems of Linear Algebraic Equations |
|
|
250 | (2) |
|
8.2 Solving Small Numbers of Linear Algebraic Equations |
|
|
252 | (8) |
|
|
252 | (2) |
|
8.2.2 Determinants and Cramer's Rule |
|
|
254 | (1) |
|
|
254 | (2) |
|
|
256 | (2) |
|
8.2.3 Elimination of Unknowns |
|
|
258 | (2) |
|
|
260 | (13) |
|
8.3.1 Naive Gaussian Elimination |
|
|
261 | (4) |
|
8.3.2 Gaussian Elimination Computer Algorithm |
|
|
265 | (1) |
|
8.3.2.1 Naive Gaussian Elimination Algorithm |
|
|
265 | (2) |
|
8.3.2.2 Adding Determinant Evaluation |
|
|
267 | (1) |
|
|
268 | (2) |
|
8.3.2.4 Detecting Singular and Ill-Conditioned Systems |
|
|
270 | (3) |
|
8.4 Solving Sets of Linear Equations with the NumPy linalg Module |
|
|
273 | (1) |
|
8.5 Solving Sets of Nonlinear Algebraic Equations |
|
|
274 | (11) |
|
8.5.1 Solution of Nonlinear Algebraic Equations by Successive Substitution |
|
|
275 | (3) |
|
8.5.2 The Newton-Raphson Method for Nonlinear Systems of Equations |
|
|
278 | (7) |
|
8.6 Use of the root Function from the SciPy optimize Module to Solve Nonlinear Equations |
|
|
285 | (8) |
|
|
286 | (7) |
|
Chapter 9 Solving Differential Equations |
|
|
293 | (36) |
|
|
293 | (1) |
|
9.1 Describing Differential Equations |
|
|
294 | (4) |
|
9.2 Quadrature - Finding the Area under the Curve |
|
|
298 | (9) |
|
9.2.1 Pre-computer Methods |
|
|
298 | (2) |
|
9.2.2 Quadrature for Continuous Functions |
|
|
300 | (4) |
|
9.2.3 The quad Function from SciPy's integrate Module |
|
|
304 | (1) |
|
9.2.4 Quadrature for Discrete Data |
|
|
305 | (2) |
|
9.3 Solving Differential Equations with Initial Conditions |
|
|
307 | (12) |
|
|
307 | (4) |
|
|
311 | (2) |
|
9.3.3 Systems of Differential Equations |
|
|
313 | (6) |
|
9.4 Solving Differential Equations with the solve_ivp Function from SciPy's integrate Module |
|
|
319 | (10) |
|
|
323 | (6) |
|
Chapter 10 Working with Data |
|
|
329 | (58) |
|
|
329 | (1) |
|
10.1 Characterizing Data Sets: Initial Observations and Sample Statistics |
|
|
330 | (12) |
|
10.1.1 General Data Concepts |
|
|
330 | (3) |
|
10.1.2 Sample Statistics: Central Tendency and Dispersion |
|
|
333 | (1) |
|
10.1.2.1 Central Tendency |
|
|
334 | (2) |
|
10.1.2.2 Spread or Dispersion |
|
|
336 | (3) |
|
10.1.3 Using Boxplots to Diagnose Outliers |
|
|
339 | (3) |
|
|
342 | (10) |
|
10.2.1 Several Important Distributions |
|
|
345 | (1) |
|
10.2.1.1 Uniform Distribution |
|
|
345 | (1) |
|
10.2.1.2 Normal Distribution |
|
|
346 | (1) |
|
10.2.1.3 Weibull Distribution |
|
|
347 | (1) |
|
10.2.2 Python and Distributions |
|
|
347 | (1) |
|
|
348 | (4) |
|
10.3 Making Claims Based on Data |
|
|
352 | (11) |
|
10.3.1 Comparison of Data with a Standard |
|
|
353 | (3) |
|
10.3.2 Comparison between Two Samples |
|
|
356 | (2) |
|
10.3.3 Determining Whether Data Are Normally Distributed |
|
|
358 | (5) |
|
10.4 Fitting Mathematical Models to Data |
|
|
363 | (24) |
|
10.4.1 Straight-line Linear Regression |
|
|
364 | (4) |
|
10.4.2 Fitting Polynomials |
|
|
368 | (2) |
|
10.4.3 General Issues and Precautions |
|
|
370 | (9) |
|
|
379 | (6) |
|
|
385 | (2) |
Index |
|
387 | (6) |
Index of Python Terminology |
|
393 | |