#### Overview of this book

Python, one of the world's most popular programming languages, has a number of powerful packages to help you tackle complex mathematical problems in a simple and efficient way. These core capabilities help programmers pave the way for building exciting applications in various domains, such as machine learning and data science, using knowledge in the computational mathematics domain. The book teaches you how to solve problems faced in a wide variety of mathematical fields, including calculus, probability, statistics and data science, graph theory, optimization, and geometry. You'll start by developing core skills and learning about packages covered in Python’s scientific stack, including NumPy, SciPy, and Matplotlib. As you advance, you'll get to grips with more advanced topics of calculus, probability, and networks (graph theory). After you gain a solid understanding of these topics, you'll discover Python's applications in data science and statistics, forecasting, geometry, and optimization. The final chapters will take you through a collection of miscellaneous problems, including working with specific data formats and accelerating code. By the end of this book, you'll have an arsenal of practical coding solutions that can be used and modified to solve a wide range of practical problems in computational mathematics and data science.
Preface
Basic Packages, Functions, and Concepts
Free Chapter
Mathematical Plotting with Matplotlib
Working with Randomness and Probability
Geometric Problems
Finding Optimal Solutions
Miscellaneous Topics
Other Books You May Enjoy

# Solving partial differential equations numerically

Partial differential equations are differential equations that involve partial derivatives of functions in two or more variables, as opposed to ordinary derivatives in only a single variable. Partial differential equations is a vast topic, and could easily fill a series of books. A typical example of a partial differential equation is the (one-dimensional) heat equation

where α is a positive constant and f(t, x) is a function. The solution to this partial differential equation is a function u(t, x), which represents the temperature of a rod, occupying the x range 0 ≤ x ≤ L, at a given time t > 0. To keep things simple, we will take f(t, x) = 0, which amounts to saying that no heating/cooling is applied to the system, α = 1, and L = 2. In practice, we can rescale the problem to fix the constant α, so this is not a restrictive problem. In this example, we will...