Wiley.com
Print this page Share

Chemical and Biomedical Engineering Calculations Using Python

ISBN: 978-1-119-26706-5
288 pages
January 2017
Chemical and Biomedical Engineering Calculations Using Python (1119267064) cover image

Description

Presents standard numerical approaches for solving common mathematical problems in engineering using Python.

  • Covers the most common numerical calculations used by engineering students
  • Covers Numerical Differentiation and Integration, Initial Value Problems, Boundary Value Problems, and Partial Differential Equations
  • Focuses on open ended, real world problems that require students to write a short report/memo as part of the solution process
  • Includes an electronic download of the Python codes presented in the book
See More

Table of Contents

Preface xi

About the Companion Website xv

1 Problem Solving in Engineering 1

1.1 Equation Identification and Categorization 4

1.1.1 Algebraic versus Differential Equations 4

1.1.2 Linear versus Nonlinear Equations 5

1.1.3 Ordinary versus Partial Differential Equations 6

1.1.4 Interpolation versus Regression 8

Problems 10

Additional Resources 11

References 11

2 Programming with Python 12

2.1 Why Python? 12

2.1.1 Compiled versus Interpreted Computer Languages 13

2.1.2 A Note on Python Versions 14

2.2 Getting Python 15

2.2.1 Installation of Python 17

2.2.2 Alternative to Installation: SageMathCloud 18

2.3 Python Variables and Operators 19

2.3.1 Updating Variables 21

2.3.2 Containers 23

2.4 External Libraries 25

2.4.1 Finding Documentation 27

Problems 28

Additional Resources 29

References 30

3 Programming Basics 31

3.1 Comparators and Conditionals 31

3.2 Iterators and Loops 34

3.2.1 Indentation Style 39

3.3 Functions 39

3.3.1 Pizza Example 43

3.3.2 Print Function 44

3.4 Debugging or Fixing Errors 45

3.5 Top 10

+ Python Error Messages 45

Problems 47

Additional Resources 49

References 49

4 External Libraries for Engineering 51

4.1 Numpy Library 51

4.1.1 Array and Vector Creation 51

4.1.2 Array Operations 55

4.1.3 Getting Helping with Numpy 55

4.1.4 Numpy Mathematical Functions 56

4.1.5 Random Vectors with Numpy 57

4.1.6 Sorting and Searching 57

4.1.7 Polynomials 58

4.1.8 Loading and Saving Arrays 59

4.2 Matplotlib Library 60

4.3 Application: Gillespie Algorithm 63

Problems 66

Additional Resources 68

References 68

5 Symbolic Mathematics 70

5.1 Introduction 70

5.2 Symbolic Mathematics Packages 71

5.3 An Introduction to SymPy 72

5.3.1 Multiple Equations 75

5.4 Factoring and Expanding Functions 76

5.4.1 Equilibrium Kinetics Example 77

5.4.2 Partial Fraction Decomposition 78

5.5 Derivatives and Integrals 78

5.5.1 Reaction Example 79

5.5.2 Symbolic Integration 80

5.5.3 Reactor Sizing Example 80

5.6 Cryptography 81

Problems 83

References 86

6 Linear Systems 87

6.1 Example Problem 88

6.2 A Direct Solution Method 91

6.2.1 Distillation Example 95

6.2.2 Blood Flow Network Example 95

6.2.3 Computational Cost 98

6.3 Iterative Solution Methods 100

6.3.1 Vector Norms 100

6.3.2 Jacobi Iteration 100

6.3.3 Gauss–Seidel Iteration 103

6.3.4 Relaxation Methods 105

6.3.5 Convergence of Iterative Methods 105

Problems 107

References 112

7 Regression 113

7.1 Motivation 113

7.2 Fitting Vapor Pressure Data 114

7.3 Linear Regression 115

7.3.1 Alternative Derivation of the Normal Equations 118

7.4 Nonlinear Regression 119

7.4.1 Lunar Disintegration 122

7.5 Multivariable Regression 126

7.5.1 Machine Learning 127

Problems 129

References 134

8 Nonlinear Equations 135

8.1 Introduction 135

8.2 Bisection Method 137

8.3 Newton’s Method 140

8.4 Broyden’s Method 143

8.5 Multiple Nonlinear Equations 146

8.5.1 The Point Inside a Square 149

Problems 151

9 Statistics 156

9.1 Introduction 156

9.2 Reading Data from a File 156

9.2.1 Numpy Library 157

9.2.2 CVS Library 159

9.2.3 Pandas 159

9.2.4 Parsing an Array 162

9.3 Statistical Analysis 162

9.4 Advanced Linear Regression 164

9.5 U.S. Electrical Rates Example 168

Problems 172

References 175

10 Numerical Differentiation and Integration 176

10.1 Introduction 176

10.2 Numerical Differentiation 176

10.2.1 First Derivative Approximation 177

10.2.2 Second Derivative Approximation 180

10.2.3 Scipy Derivative Approximation 181

10.3 Numerical Integration 183

10.3.1 Trapezoid Rule 185

10.3.2 Numerical Integration Using Scipy 186

10.3.3 Error Function 187

Problems 190

Reference 192

11 Initial Value Problems 193

11.1 Introduction 193

11.2 Biochemical Reactors 193

11.3 Forward Euler 195

11.4 Modified Euler Method 198

11.5 Systems of Equations 199

11.5.1 The Lorenz System and Chaotic Solutions 200

11.5.2 Second-Order Initial Value Problems 203

11.6 Stiff Differential Equations 203

Problems 206

References 210

12 Boundary Value Problems 211

12.1 Introduction 211

12.2 Shooting Method 212

12.3 Finite Difference Method 216

12.3.1 Reactions in Spherical Catalysts 220

Problems 224

Reference 226

13 Partial Differential Equations 227

13.1 Finite Difference Method for Steady-State PDEs 227

13.1.1 Setup 228

13.1.2 Matrix Assembly 230

13.1.3 Solving and Plotting 232

13.2 Convection 233

13.3 Finite Difference Method for Transient PDEs 236

Problems 241

Reference 244

14 Finite Element Method 245

14.1 A Warning 245

14.2 Why FEM? 246

14.3 Laplace’s Equation 246

14.3.1 The Mesh 246

14.3.2 Discretization 247

14.3.3 Wait! Why Are We Doing This? 248

14.3.4 FEniCS Implementation 248

14.4 Pattern Formation 249

Additional Resources 253

References 254

Index 255

See More

Downloads

Download TitleSizeDownload
Chapter 2 3.69 KB Click to Download
Chapter 3 5.14 KB Click to Download
Chapter 4 137.43 KB Click to Download
Chapter 5 30.85 KB Click to Download
Chapter 6 8.41 KB Click to Download
Chapter 7 241.04 KB Click to Download
Chapter 8 87.21 KB Click to Download
Chapter 9 370.97 KB Click to Download
Chapter 10 2.41 KB Click to Download
Chapter 11 283.42 KB Click to Download
Chapter 12 178.67 KB Click to Download
Chapter 13 213.20 KB Click to Download
Chapter 14 637.26 KB Click to Download
See More

Related Titles

Back to Top