Ebook: Solving Ordinary Differential Equations in Python
Author: Joakim Sundnes
- Genre: Computers // Software: Systems: scientific computing
- Series: Simula SpringerBriefs on Computing
- Year: 2023
- Publisher: Springer
- Language: English
- pdf
This book explains the foundations of modern solvers for ordinary differential equations (ODEs). Formulating and solving ODEs is an essential part of mathematical modeling and computational science, and numerous solvers are available in commercial and open source software. However, no single ODE solver is the best choice for every single problem, and choosing the right solver requires fundamental insight into how the solvers work. This book will provide exactly that insight, to enable students and researchers to select the right solver for any ODE problem of interest, or implement their own solvers if needed. The presentation is compact and accessible, and focuses on the large and widely used class of solvers known as Runge-Kutta methods. Explicit and implicit methods are motivated and explained, as well as methods for error control and automatic time step selection, and all the solvers are implemented as a class hierarchy in Python.
The main purpose of the notes is to serve as a concise and gentle introduction to solving differential equations in Python, specifically for the course Introduction to programming for scientific applications (IN1900, 10 ETCS credits) at the University of Oslo. These notes will be most useful for readers with a basic knowledge of Python and NumPy, and it is also useful to have a fundamental understanding of ODEs.
One may question the usefulness of learning how to write your own ODE solvers in Python when there are already multiple solvers available, such as those in the SciPy library. However, no single ODE solver is universally optimal and efficient for all ODE problems, and the choice of solver should always be based on the specific characteristics of the problem at hand. To make the right choice, it is extremely beneficial to understand the strengths and weaknesses of different solvers, and the best way to gain this knowledge is by programming your own collection of ODE solvers. Different ODE solvers are conveniently grouped into families and hierarchies, offering an excellent example of how object-oriented programming (OOP) can maximize code reuse and minimize duplication.
The book’s presentation style is compact and pragmatic, incorporating numerous code examples to illustrate how various ODE solvers can be implemented and applied in practice. The complete source code for all examples, as well as Jupyter notebooks for each chapter, are provided in the accompanying online resources. The programs and code examples are written in a simple and compact Python style, avoiding the use of advanced tools and features. Experienced Python programmers may find more elegant and modern solutions to many of the examples, utilizing abstract base classes, type hints, data classes, and other advanced features. However, the book’s main goal is to introduce the fundamentals of ODE solvers and OOP as part of an introductory programming course, and we believe this purpose is best served by focusing on the basics.
Readers familiar with scientific computing or numerical software may also miss a discussion of computational performance. While performance is certainly relevant when solving ODEs, optimizing the performance of a Python-based solver easily becomes quite technical, and requires features like just-in-time compilers (e.g., Numba) or mixed-language programming. The solvers in this book use fairly basic features of Python and NumPy, sacrificing some performance in favor of enhancing understanding of solver properties and implementation.
The main purpose of the notes is to serve as a concise and gentle introduction to solving differential equations in Python, specifically for the course Introduction to programming for scientific applications (IN1900, 10 ETCS credits) at the University of Oslo. These notes will be most useful for readers with a basic knowledge of Python and NumPy, and it is also useful to have a fundamental understanding of ODEs.
One may question the usefulness of learning how to write your own ODE solvers in Python when there are already multiple solvers available, such as those in the SciPy library. However, no single ODE solver is universally optimal and efficient for all ODE problems, and the choice of solver should always be based on the specific characteristics of the problem at hand. To make the right choice, it is extremely beneficial to understand the strengths and weaknesses of different solvers, and the best way to gain this knowledge is by programming your own collection of ODE solvers. Different ODE solvers are conveniently grouped into families and hierarchies, offering an excellent example of how object-oriented programming (OOP) can maximize code reuse and minimize duplication.
The book’s presentation style is compact and pragmatic, incorporating numerous code examples to illustrate how various ODE solvers can be implemented and applied in practice. The complete source code for all examples, as well as Jupyter notebooks for each chapter, are provided in the accompanying online resources. The programs and code examples are written in a simple and compact Python style, avoiding the use of advanced tools and features. Experienced Python programmers may find more elegant and modern solutions to many of the examples, utilizing abstract base classes, type hints, data classes, and other advanced features. However, the book’s main goal is to introduce the fundamentals of ODE solvers and OOP as part of an introductory programming course, and we believe this purpose is best served by focusing on the basics.
Readers familiar with scientific computing or numerical software may also miss a discussion of computational performance. While performance is certainly relevant when solving ODEs, optimizing the performance of a Python-based solver easily becomes quite technical, and requires features like just-in-time compilers (e.g., Numba) or mixed-language programming. The solvers in this book use fairly basic features of Python and NumPy, sacrificing some performance in favor of enhancing understanding of solver properties and implementation.
Download the book Solving Ordinary Differential Equations in Python for free or read online
Continue reading on any device:
Last viewed books
Related books
{related-news}
Comments (0)