14. Differential Equations#
Differential equations arise in the mathematical modeling of a wide range of problems, ranging from science and engineering to economics and finance. Here we will consider Ordinary Differential Equations (ODEs), where the unknown function \(y(t)\) depends on a single independent variable \(t\). While you may have learned to find exact, or closed-form, solutions for certain simple equations in your calculus classes, the vast majority of real-world problems are far too complex to be solved analytically. This is where computation becomes indispensable. In this chapter, we will learn how to use a computer to find highly accurate approximate solutions to these equations.
We will begin our study with Initial Value Problems (IVPs), where all conditions are known at a single starting point. We’ll build our own numerical solvers from scratch, starting with the intuitive Euler’s method and advancing to the powerful 4th-order Runge-Kutta (RK4) method. We’ll see how to apply these methods to solve higher-order equations (like the pendulum) by cleverly rewriting them as first-order systems. We will then explore a different class of problems, Boundary Value Problems (BVPs), and solve them using the finite difference method, which transforms the ODE into a large system of linear equations. Finally, we’ll see how to leverage professional Julia packages like DifferentialEquations.jl to solve complex problems efficiently and accurately.