This book teaches the basic components in the scientific computing pipeline: modeling, differential equations, numerical algorithms, programming, plotting, and software testing. The pedagogical idea is to treat these topics in the context of a very simple mathematical model, the differential equation for exponential decay, \( u^{\prime}(t)=-au(t) \), where \( u \) is unknown and \( a \) is a given parameter. By keeping the mathematical problem simple, the text can go deep into all details about how one must combine mathematics and computer science to create well-tested, reliable, and flexible software for such a mathematical model.
The writing style is gentle and aims at a broad audience. I am much inspired by Nick Trefethen's praise of easy learning:
Some people think that stiff challenges are the best device to induce learning, but I am not one of them. The natural way to learn something is by spending vast amounts of easy, enjoyable time at it. This goes whether you want to speak German, sight-read at the piano, type, or do mathematics. Give me the German storybook for fifth graders that I feel like reading in bed, not Goethe and a dictionary. The latter will bring rapid progress at first, then exhaustion and failure to resolve.The main thing to be said for stiff challenges is that inevitably we will encounter them, so we had better learn to face them boldly. Putting them in the curriculum can help teach us to do so. But for teaching the skill or subject matter itself, they are overrated. [1] (p. 86)
Prerequisite knowledge for this book is basic one-dimensional calculus and preferably some experience with computer programming in Python or MATLAB. The material was initially written for self study and therefore features comprehensive and easy-to-understand explanations. For some readers it may act as an overview and refresher of traditional mathematical topics and likely a first introduction to many of the software topics. The text can also be used as a case-based and mathematically simple introduction to modern multi-disciplinary problem solving with computers, using the range of applications in the chapter Models as motivation and then treating the details of the mathematical and computer science subjects from the other chapters. In particular, I have also had in mind the new groups of readers from bio- and geo-sciences who need to enter the world of computer-based differential equation modeling, but lack experience with (and perhaps also interest in) mathematics and programming.
The choice of topics in this book is motivated from what is needed in more advanced courses on finite difference methods for partial differential equations (PDEs). It turns out that a range of concepts and tools needed for PDEs can be introduced and illustrated by very simple ordinary differential equation (ODE) examples. The goal of the text is therefore to lay a foundation for understanding numerical methods for PDEs by first meeting the fundamental ideas in a simpler ODE setting. Compared to other books, the present one has a much stronger focus on how to turn mathematics into working code. It also explains the mathematics and programming in more detail than what is common in the literature.
There is a more advanced companion book in the works, "Finite Difference Computing with Partial Differential Equations", which treats finite difference methods for PDEs using the same writing style and having the same focus on turning mathematical algorithms into reliable software.
Although the main example in the present book is \( u^{\prime}=-au \), we also address the more general model problem \( u'=-a(t)u + b(t) \), and the completely general, nonlinear problem \( u'=f(u,t) \), both for scalar and vector \( u(t) \). The author believes in the principle simplify, understand, and then generalize. That is why we start out with the simple model \( u^{\prime}=-au \) and try to understand how methods are constructed, how they work, how they are implemented, and how they may fail for this problem, before we generalize what we have learned from \( u^{\prime}=-au \) to more complicated models.
The following list of topics will be elaborated on.
sympy
software
for symbolic computations.The book contains a set of exercises in most of the chapters. The exercises are divided into three categories: exercises refer to the text (usually variations or extensions of examples in the text), problems are stand-alone exercises without references to the text, and projects are larger problems. Exercises, problems, and projects share a common numbering to avoid confusion between, e.g., Exercise 4.3 and Problem 4.3 (it will be Exercise 4.3 and Problem 4.4 if they follow after each other).
Acknowledgments. Professor Svein Linge has provided very detailed and constructive feedback on this text, and all his efforts are highly appreciated. Many students have also pointed out weaknesses and found errors. A special thank goes to Yapi Donatien Achou's proof reading. Many thanks also to Linda Falch-Koslung, Dr. Olav Dajani, and the rest of the OUS team for feeding me with FOLFIRINOX and thereby keeping me alive and in good enough shape to finish this book.