Preface

Runge–Kutta 4th order is one of those algorithms that arrives in a textbook inside a box, with a name, four lines of formula, and an implicit instruction: use it, it works. In every numerical methods course the author has taken, in every scientific computing book that introduced it, and in every lecture that mentioned it, the derivation was skipped. The algorithm was presented as a gift. Not something to derive — something to apply.

The author used it that way for many years. It produced accurate results, the error was well-behaved, and the four stages were easy to code. That was enough. There is a name for this relationship to tools: “Homo habilis” — the handy human, the first of our ancestors known to make and use tools. A sharp edge cuts. A lever lifts. Runge–Kutta propagates a solution. One uses the tool, the tool works, and that is sufficient. For a few decades, the author was a perfectly content Homo habilis.

Then, one day, the question became unavoidable: where does this formula actually come from? Returning to the standard references, the author found that most textbooks state the four stages, verify the order conditions in passing, and move on. The derivation is treated as either too advanced to include or too tedious to bother with. After a few decades of being a content Homo habilis, the author decided to become a discontent Homo sapiens and actually derive RK4 from the calculus that had been sitting on the shelf all along.

The good news is that it can be done, starting from nothing more than differential and integral calculus, including multivariable calculus. No prior knowledge of differential equations is assumed. No prior knowledge of numerical analysis is assumed. No step is taken on faith. Every formula that appears in this book either follows directly from something you already know, or is introduced and explained in the pages just before it appears.

The journey begins with the historical problem that made numerical methods necessary in the first place. It traces the development of ideas from the simplest stepping rule — which turns out to be nothing more than Euler’s method and a one-term Taylor expansion — through second and third-order Runge–Kutta methods, arriving finally at the fourth-order method that struck the optimal balance between accuracy and computational cost and became the workhorse of scientific computing for more than a century. At each stage, the ideas are illustrated with Wolfram Language code that you can evaluate, modify, and explore interactively.

The author is sharing this journey in whatever form it takes to reach the reader. It is hoped that you enjoy this self-induced (d)evolution. When you arrive at the RK4 formula and see that it is not magic at all — but the natural and almost inevitable consequence of ideas you have known since calculus class — you may find, as the author did, that it was worth becoming discontent for a while.