Page i
Applied Numerical Methods
with Python for Engineers and Scientists
Steven C. Chapra
Tufts University, Professor Emeritus
David E. Clough
University of Colorado, Boulder, Professor Emeritus
Page ii
APPLIED NUMERICAL METHODS WITH PYTHON FOR ENGINEERS AND SCIENTISTS
Published by McGraw Hill LLC, 1325 Avenue of the Americas, New York, NY 10121. Copyright 2022 by McGraw Hill LLC. All rights reserved. Printed in the United States of America. 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 McGraw Hill LLC, 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 LWI 26 25 24 23 22 21
ISBN 978-1-265-01796-5
MHID 1-265-01796-4
Cover Image: VisualCommunications/E+/Getty Images
All credits appearing on page or at the end of the book are considered to be an extension of the copyright page.
The Internet addresses listed in the text were accurate at the time of publication. The inclusion of a website does not indicate an endorsement by the authors or McGraw Hill LLC, and McGraw Hill LLC does not guarantee the accuracy of the information presented at these sites.
mheducation.com/highered
Page iii
Dedication:
Steven C. Chapra
To Cynthia K. Chapra
in gratitude for her love, support,
and for allowing this nerd the time and space to play with his computer.
David E. Clough
To my parents, John and Eunice Clough, for providing a loving, supportive home and a launching pad for my career as an educator.
Page iv
About the Authors
Steve Chapra is the Emeritus Professor and Louis Berger Chair in the Civil and Environmental Engineering Department at Tufts University. His other books include Surface Water-Quality Modeling, Numerical Methods for Engineers, and Applied Numerical Methods with MATLAB.
Dr. Chapra received engineering degrees from Manhattan College and the University of Michigan. Before joining Tufts, he worked for the U.S. Environmental Protection Agency and the National Oceanic and Atmospheric Administration and taught at Texas A&M University, the University of Colorado, and Imperial College London. His general research interests focus on surface water-quality modeling and advanced computer applications in environmental engineering.
He is a Fellow and Life Member of the American Society of Civil Engineering (ASCE) and has received several awards for his scholarly and academic contributions, including the Rudolph Hering Medal (ASCE) for his research, and the Meriam-Wiley Distinguished Author Award (American Society for Engineering Education). He has also been recognized as an outstanding teacher and advisor among the engineering faculties at Texas A&M University, the University of Colorado, and Tufts University. As a strong proponent of continuing education, he has taught over 90 workshops for professionals on numerical methods, computer programming, and environmental modeling.
David Clough joined the faculty of the Department of Chemical and Biological Engineering at the University of Colorado in 1975 after a brief career with DuPont in Wilmington, Delaware. He retired from Colorado in 2017 and holds the position of Professor Emeritus. He remains active at Colorado by assisting faculty and students in teaching and research. Notably, he teaches a series of workshops on process modeling and computer simulation as part of the senior design course sequence.
Dr. Clough received degrees in chemical engineering from Case Western Reserve University and the University of Colorado. He has extensive experience in applied computing, process automation, and the modeling of various processes with emphasis on dynamic behavior, including polymerization, high-temperature catalytic reactors, fluidized beds, open-channel flow, biomedical instrumentation, and solar-thermal reactors.
Clough first learned to program in the original Fortran language while in high school in the early 1960s. Since then, he has experience in a wide array of programming languages and computing tools and has applied his expertise through his teaching, research, and industrial applications.
Over his career, Clough has taught hundreds of short courses to practicing professionals on applied computing and problem-solving. Spanning three decades, his courses on spreadsheet problem-solving, offered through the American Institute of Chemical Engineers, have been among the most popular offered by AIChE. During Steve Chapras years at Colorado, they collaborated to develop the introduction to engineering computing course that has now been taught to thousands of first-year engineering students.
Page v
Contents
About the Authors
Preface
P art O ne Modeling, Computers, and Error Analysis
1.1Motivation
1.2Part Organization
CHAPTER 1
Mathematical Modeling, Numerical Methods, and Problem Solving
1.1 A Simple Mathematical Model
1.2 Conservation Laws in Engineering and Science
1.3 Numerical Methods Covered in This Book
1.4 Case Study: Its a Real Drag
Problems
CHAPTER 2
Python Fundamentals
2.1 The Spyder/IPython Environment
2.2 Assignment
2.3 Mathematical Operations
2.4 Use of Built-In Functions
2.5 Graphics
2.6 Other Resources
2.7 Case Study: Exploratory Data Analysis
Problems
CHAPTER 3
Programming in Python
3.1 Python Script Files
3.2 InputOutput
3.3 Structured Programming
3.4 Nesting and Indentation
3.5 Python Functions with Function Name Arguments
3.6 Case Study: Bungee Jumper Velocity
Problems
CHAPTER 4
Roundoff and Truncation Errors
4.1 Errors
4.2 Roundoff Errors
4.3 Truncation Errors
4.4 Total Numerical Error
4.5 Blunders, Model Errors, and Data Uncertainty
Problems
Page vi
P art T wo Roots and Optimization
2.1Overview
2.2Part Organization
Next page