Introduction to Python for Science and Engineering
Book Details :
Size5.21 MB

Introduction to Python for Science and Engineering

Introduction to Python for Science and Engineering by David J. Pine | PDF Free Download.

Author of Introduction to Python for Science and Engineering

David Pine has taught physics and chemical engineering for over 30 years at four different institutions: Cornell University (as a graduate student), Haverford College, UCSB, and, at 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 in experimental soft-matter physics, which is concerned with materials such as polymers, emulsions, and colloids. These materials constitute most of the material building blocks of biological organisms.

Python for Science and Engineering Contents

  • Introduction
  • Launching Python
  • Strings, Lists, Arrays, and Dictionaries
  • Input and Output
  • Conditionals and Loops
  • Plotting
  •  Functions
  • Curve Fitting
  • Numerical Routines: SciPy and NumPy
  •  Data Manipulation and Analysis: Pandas
  • Animation
  • Python Classes and GUIs

Preface to Python for Science and Engineering PDF

The aim of this book is to provide science and engineering students a practical introduction to technical programming in Python.

It grew out of notes I developed for various undergraduate physics courses I taught at NYU. While it has evolved considerably since I first put pen to paper, it retains its original purpose: to get students with no previous programming experience writing and running Python programs for scientific applications with a minimum of fuss.

The approach is pedagogical and “bottom-up,” which means starting with examples and extracting more general principles from that experience.

This is in contrast to presenting the general principles first and then examples of how those general principles work.

In my experience, the latter approach is satisfying only to the instructor. Much computer documentation takes a top-down approach, which is one of the reasons it’s frequently difficult to read and understand.

On the other hand, once examples have been seen, it’s useful to extract the general ideas in order to develop the conceptual framework needed for further applications.

In writing this text, I assume that the reader:

  •  has never programmed before; 
  • is not familiar with programming environments;
  • is familiar with how to get around a Mac or PC at a very basic level; and 
  • is competent in basic algebra, and for Chapters 8 and 9, calculus, linear algebra, ordinary differential equations, and Fourier analysis. The other chapters, including 10–12, require only basic algebra skills.

This book introduces, in some depth, four Python packages that are important for scientific applications: NumPy, short for Numerical Python, provides Python with a multidimensional array object (like a vector or matrix) that is at the center of virtually all fast numerical processing in scientific Python.

It is both versatile and powerful, enabling fast numerical computation that, in some cases, approaches speeds close to those of a compiled language like C, C++, or Fortran.

SciPy, short for Scientific Python, provides access through a Python interface to a very broad spectrum of scientific and numerical software written in C, C++, and Fortran.

These include routines to numerically differentiate and integrate functions, solve differential equations, diagonalize matrices, take discrete Fourier transforms, perform least-squares fitting, as well as many other numerical tasks. matplotlib is a powerful plotting package written for Python and capable of producing publication-quality plots.

While there are other Python plotting packages available, matplotlib is the most widely used and is the de-facto standard. Pandas is a powerful package for manipulating and analyzing data formatted and labeled in a manner similar to a spreadsheet (think Excel).

Pandas is very useful for handling data produced in experiments and is particularly adept at manipulating large data sets in different ways.

In addition, Chapter 12 provides a brief introduction to Python classes and to PyQt5, which provides Python routines for building graphical user interfaces (GUIs) that work on Macs, PCs, and Linux platforms. Chapters 1–7 provide the basic introduction to scientific Python and should be read in order.

Chapters 8–12 do not depend on each other and, with a few mild caveats, can be read in any order. As the book’s title implies, the text is focused on scientific uses of Python.

Many of the topics that are of primary importance to computer scientists, such as object-oriented design, are of secondary importance here. Our focus is on learning how to harness Python’s ability to perform scientific computations quickly and efficiently.

The text shows the reader how to interact with Python using IPython, which stands for Interactive Python, through one of three different interfaces, all freely available on the web: Spyder, an integrated development environment, Jupyter Notebooks, and a simple IPython terminal.

Chapter 2 provides an overview of Spyder and an introduction to IPython, which is a powerful interactive environment tailored to the scientific use of Python.

Appendix B provides an introduction to Jupyter notebooks. Python 3 is used exclusively throughout the text with little reference to any version of Python 2.

It’s been nearly 10 years since Python 3 was introduced and there is little reason to write a new code in Python 2; all the major Python packages have been updated to Python 3.

Moreover, once Python 3 has been learned, it’s a simple task to learn how Python 2 differs, which may be needed to deal with legacy code. There are many lucid web sites dedicated to this sometimes necessary but otherwise mind-numbing task.

The scripts, programs, and data files introduced in this book are available at

Finally, I would like to thank Étienne Ducrot, Wenhai Zheng, and Stefano Sacanna for providing some of the data and images used in Chapter 11, and Mingxin He and Wenhai Zheng for their critical reading of early versions of the text.

Download Introduction to Python for Science and Engineering in PDF Format For Free.