Python for Science and
Engineering
Introduction to Python for Science and Engineering offers a quick and incisive
introduction to the Python programming language for use in any science or
engineering discipline. The approach is pedagogical and “bottom up,” which
means starting with examples and extracting more general principles from that
experience. No prior programming experience is assumed.
Readers will learn the basics of Python syntax, data structures, input and output,
conditionals and loops, user-defined functions, plotting, animation, and visual-
ization. They will also learn how to use Python for numerical analysis, including
curve fitting, random numbers, linear algebra, solutions to nonlinear equa-
tions, numerical integration, solutions to differential equations, and fast Fourier
transforms.
Readers learn how to interact and program with Python using JupyterLab and
Spyder, two simple and widely used integrated development environments.
All the major Python libraries for science and engineering are covered, includ-
ing NumPy, SciPy, Matplotlib, and Pandas. Other packages are also introduced,
including Numba, which can render Python numerical calculations as fast as
compiled computer languages such as C but without their complex overhead.
David J. Pine has taught physics and chemical engineering for over 40 years
at four different institutions: Cornell University (as a graduate student), Haver-
ford College, UCSB, and NYU, where he is a Professor of Physics, Mathematics,
and Chemical & Biomolecular Engineering. He has taught a broad spectrum of
courses, including numerical methods. He does research on optical materials
and in experimental soft-matter physics, which is concerned with materials such
as polymers, emulsions, and colloids.
,Intelligent Data-Driven Systems and Artificial Intelligence
Series Editor: Harish Garg
Cognitive Machine Intelligence
Applications, Challenges, and Related Technologies
Inam Ullah Khan, Salma El Hajjami, Mariya Ouaissa, Salwa Belqziz and
Tarandeep Kaur Bhatia
Artificial Intelligence and Internet of Things based Augmented Trends for
Data Driven Systems
Anshu Singla, Sarvesh Tanwar, Pao-Ann Hsiung
Modelling of Virtual Worlds Using the Internet of Things
Edited by Simar Preet Singh and Arun Solanki
Data-Driven Technologies and Artificial Intelligence in Supply Chain
Tools and Techniques
Mahesh Chand, Vineet Jain and Puneeta Ajmera
For more information about this series, please visit: www.routledge.com/Intelli-
gent-Data-Driven-Systems-and-Artificial-Intelligence/book-series/CRCIDDSAAI
, Designed cover image: David J. Pine
MATLAB• and Simulink• are trademarks of The MathWorks, Inc. and are used with per-
mission. The MathWorks does not warrant the accuracy of the text or exercises in this
book. This book’s use or discussion of MATLAB• or Simulink• software or related prod-
ucts does not constitute endorsement or sponsorship by The MathWorks of a particular
pedagogical approach or particular use of the MATLAB• and Simulink•software.
Second edition published 2025
by CRC Press
2385 NW Executive Center Drive, Suite 320, Boca Raton FL 33431
and by CRC Press
4 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN
CRC Press is an imprint of Taylor & Francis Group, LLC
© 2025 David J. Pine
First edition published by CRC Press 2018
Reasonable efforts have been made to publish reliable data and information, but the author
and publisher cannot assume responsibility for the validity of all materials or the conse-
quences of their use. The authors and publishers have attempted to trace the copyright
holders of all material reproduced in this publication and apologize to copyright holders if
permission to publish in this form has not been obtained. If any copyright material has not
been acknowledged please write and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted,
reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other
means, now known or hereafter invented, including photocopying, microfilming, and re-
cording, or in any information storage or retrieval system, without written permission
from the publishers.
For permission to photocopy or use material electronically from this work, access www.
copyright.com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood
Drive, Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please
contact
Trademark notice: Product or corporate names may be trademarks or registered trade-
marks and are used only for identification and explanation without intent to infringe.
ISBN: 978-1-032-65033-3 (hbk)
ISBN: 978-1-032-67390-5 (pbk)
ISBN: 978-1-032-67395-0 (ebk)
DOI: 10.1201/9781032673950
Typeset in Nimbus font
by KnowledgeWorks Global Ltd.