Series Introduction: This is an 18-chapter deep dive
into ordinary differential equations spanning 7 months. We'll start from
scratch, understanding ODEs in the most intuitive way possible,
accompanied by extensive visualizations and real-world applications from
2020 (including COVID-19 epidemic modeling). Every concept originates
from practical problems and is implemented in Python, making mathematics
truly come alive!
Introduction: Change Is
Everywhere
If you observe the world around you, you'll notice everything is in
constant flux: - Coffee is cooling - Populations are growing - Pendulums
are swinging - Viruses are spreading - Hearts are beating
Differential equations are the mathematical language
for describing "change." They're not just mathematical tools — they're
keys to understanding the laws of nature.
Why Study Differential
Equations?
In 2020, COVID-19 swept across the globe. How did scientists predict
the pandemic's trajectory? How did they evaluate the effectiveness of
quarantine measures? The answer lies in differential
equations!
Today, we will: 1. Understand what a differential equation is (using
the simplest examples) 2. Explore its historical origins 3. Examine 3
real-world applications 4. Implement our first differential equation in
Python
What Is a
Differential Equation? Starting with Coffee
Newton's Law of
Cooling: A Story About Coffee
Imagine you've brewed a cup of coffee at 90° C and placed it in a
room at 20° C. A few minutes later, you return to find the coffee has
cooled.
Question: How does the coffee's temperature change
over time?
Newton's Observation (1701): The rate of cooling of
an object is proportional to the temperature difference between the
object and its environment.
Expressed mathematically: This is a differential
equation!
Interpretation: -: Temperature at time -: Rate of temperature change
(derivative) -:
Ambient temperature (20° C) -:
Cooling constant (depends on cup material and size)
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint
# Set up fonts for plotting plt.rcParams['font.sans-serif'] = ['Arial Unicode MS', 'SimHei'] plt.rcParams['axes.unicode_minus'] = False
# Define the differential equation defcoffee_cooling(T, t, k, T_env): """ Newton's Law of Cooling T: Current temperature t: Time k: Cooling constant T_env: Ambient temperature """ dTdt = -k * (T - T_env) return dTdt
# Parameter settings T0 = 90.0# Initial temperature (° C) T_env = 20.0# Ambient temperature (° C) k = 0.1# Cooling constant (1/minute) t = np.linspace(0, 60, 500) # 0-60 minutes
Key Insights: 1. Temperature approaches ambient
temperature via exponential decay 2. Cooling rate
decreases over time (smaller temperature difference
leads to slower cooling) 3. Theoretically, the coffee never quite
reaches ambient temperature (but gets very close)
The Exact Solution
For this simple equation, we can find the exact solution:Verification: - At:✓ - As:✓
Classification and Basic
Concepts
What Makes It
an "Ordinary" Differential Equation?
Definition: A differential equation containing only
one independent variable (usually time).
First-order ODE: Highest derivative is
first-orderExamples: Population growth, radioactive decay, RC
circuits
Second-order ODE: Highest derivative is
second-orderExamples: Spring oscillation, planetary motion,
RLC circuits
Linear vs. Nonlinear
Linear ODE:and
its derivatives appear to the first power only
Nonlinear ODE: Contains terms like,,
Why does this matter? - Linear equations:
Well-developed theory, easier to solve - Nonlinear equations: More
realistic, but often require numerical methods
A
Historical Journey: The Birth of Differential Equations
Newton and Leibniz (1600s)
1666: Newton invented calculus and immediately
applied it to describe motion.
Newton's Second Law is itself a differential
equation:This is the most important differential
equation in physics!
The Bernoulli Family (1700s)
Jakob Bernoulli and Johann
Bernoulli (brothers) studied many classical ODEs: - The
catenary problem (shape of a hanging chain) - The brachistochrone
problem (fastest descent path)
Daniel Bernoulli (their nephew/son): - Studied
elastic body vibrations - Proposed the superposition principle
Euler (1700s)
1739: Euler systematized ODE theory, introducing: -
General solutions for constant-coefficient linear equations - Euler's
method (the first numerical algorithm!)
Laplace (1800s)
1785: The Laplace Transform - Converts differential
equations to algebraic equations - An engineer's favorite tool!
Poincar é (1880s)
Revolutionary shift: Instead of seeking exact
solutions, study the properties of solutions -
Stability theory - Phase space - Laid the foundation for modern
dynamical systems
defdirection_field_example(): fig, ax = plt.subplots(1, 1, figsize=(10, 8)) # Define ODE deff(t, y): return y - t # Create grid t_vals = np.linspace(-2, 4, 20) y_vals = np.linspace(-2, 4, 20) T, Y = np.meshgrid(t_vals, y_vals) # Calculate slope at each point dY = f(T, Y) dT = np.ones_like(dY) # Normalize arrow length M = np.sqrt(dT**2 + dY**2) dT_norm = dT / M dY_norm = dY / M # Plot direction field ax.quiver(T, Y, dT_norm, dY_norm, M, cmap='viridis', alpha=0.6) # Plot several solution curves from scipy.integrate import odeint defode_func(y, t): return y - t t_span = np.linspace(-2, 4, 500) initial_conditions = [-1, 0, 1, 2, 3] for y0 in initial_conditions: sol = odeint(ode_func, y0, t_span) ax.plot(t_span, sol, 'r-', linewidth=2, alpha=0.8) ax.set_xlabel('t', fontsize=12) ax.set_ylabel('y', fontsize=12) ax.set_title('Direction Field: dy/dt = y - t', fontsize=14, fontweight='bold') ax.grid(True, alpha=0.3) ax.set_xlim(-2, 4) ax.set_ylim(-2, 4) plt.tight_layout() plt.savefig('direction_field.png', dpi=300, bbox_inches='tight') plt.close() print("✓ Figure generated: Direction Field")
direction_field_example()
Key Insights: - The red curves are integral
curves (solutions) - They flow along the
arrows - Different initial values lead to different solution
curves
Initial Value Problems (IVP)
Definition
Initial value problem: Given an ODE and initial
conditions, find the solution
Existence and Uniqueness Theorem (Picard-Lindel ö
f): Ifsatisfies certain
conditions (continuous and Lipschitz continuous), then the IVP has a
unique solution.
Why Are Initial Conditions
Important?
Without initial conditions, a differential equation has
infinitely many solutions (general solution). With
initial conditions, we determine a unique solution
(particular solution).
Physical interpretation: - Initial position and
velocity determine an object's entire trajectory - Initial population
determines future population changes
Numerical vs. Analytical
Solutions
Analytical Solutions
Express the solution exactly with a formula:
Advantages: Exact, elegant Disadvantages: Most ODEs don't have analytical
solutions!
Numerical Solutions
Approximate step by step using a computer:
Advantages: Applicable to any ODE Disadvantages: Only an approximation, requires
computational resources
Reality: 99% of ODEs in engineering and science are
solved numerically!
Linear vs nonlinear: Determines solution
difficulty
Direction fields: Visualize solution flow
Initial value problems: Determine unique
solutions
Numerical solutions: The main tool in practice
Why Does This Matter?
Differential equations are: - The language of
physics (Newton's laws) - Tools for biology
(population models) - Foundations of engineering
(control systems) - Models for economics (growth
theory) - Weapons for medicine (epidemic
prediction)
Preview of Next Chapter
"First-Order Differential Equations"
We will learn: - Separable equations: - Linear
equations: - Exact equations: - Mixing problems: Two liquids mixing -
RC circuits: Capacitor charging and discharging
Each type has specific techniques!
Exercises
Basic Problems
Verify thatis a
solution of(whereis an arbitrary
constant).
Coffee cools from 90° C to 60° C in 10 minutes with ambient
temperature 20° C. Find the cooling constant.
A radioactive element has a half-life of 10 years. How much of a
100-gram sample remains after 20 years?
Advanced Problems
Prove: All solutions ofapproach 0 (when).
For,
sketch the direction field and predict the solution behavior.
Why is the exponential population model unrealistic? Propose an
improvement.
Programming Problems
Implement Euler's method in Python to solve,, for.
Create an animated GIF showing solution curves with different
initial values evolving in the direction field.
Simulate undamped pendulum motion and plot the phase space
trajectory.
References
Boyce, W. E., & DiPrima, R. C. (2012). Elementary
Differential Equations. Wiley.
Strogatz, S. H. (2015). Nonlinear Dynamics and Chaos. CRC
Press.
MIT OpenCourseWare 18.03SC - Differential Equations
Tenenbaum, M., & Pollard, H. (1985). Ordinary Differential
Equations. Dover.
Imperial College COVID-19 Response Team (March 2020). Impact of
NPIs.
Code Resources
All code and figures for this chapter: - GitHub:
[ode-series]/chapter-1 - Jupyter Notebook: Interactive version -
Animated GIFs: Direction field evolution, simple harmonic motion