In basic calculus, we learn how to find the derivative of a function. In the real world, we often encounter the reverse problem: we know how a system changes, and we want to find the function that describes the system’s state. These are Differential Equations (DEs).
A DE is an equation that relates a function to its derivatives. For example:
This says that the rate of change of is proportional to its current value. This is the model for population growth, radioactive decay, and continuously compounded interest.
Separation of Variables
The simplest way to solve a first-order DE is to “separate” the variables so that all ‘s are on one side and all ‘s are on the other.
Example: Solve .
(where )
Modeling: Newton’s Law of Cooling
Newton’s Law of Cooling states that the rate of change of the temperature of an object is proportional to the difference between its temperature and the ambient temperature :
This equation tells us that a hot cup of coffee cools down quickly at first (when the difference is large) and then slows down as it approaches room temperature.
Interactive Lab
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
# Define the model: dT/dt = -k(T - Ta)
def model(T, t, k, Ta):
dTdt = -k * (T - Ta)
return dTdt
# Initial conditions
T0 = 90 # Coffee temperature at t=0
Ta = 20 # Room temperature
k = 0.1 # Cooling constant
t = np.linspace(0, 60, 100) # 60 minutes
# Solve ODE
T = odeint(model, T0, t, args=(k, Ta))
plt.plot(t, T)
plt.axhline(Ta, color='r', linestyle='--', label='Room Temp')
plt.xlabel('Time (min)')
plt.ylabel('Temperature (C)')
plt.title('Newton\'s Law of Cooling')
plt.legend()
plt.grid(True)
plt.show()
print(f"Temperature at 10 mins: {T[16][0]:.2f} C")
print(f"Temperature at 60 mins: {T[-1][0]:.2f} C")
28print(f"Temperature at 10 mins: {T[16][0]:.2f} C")
29print(f"Temperature at 60 mins: {T[-1][0]:.2f} C")
30
Linear Systems and Matrices
When we have multiple interdependent variables (like a predator and its prey, or a set of connected water tanks), we use Systems of Differential Equations.
The solution to this system is deeply connected to the Eigenvalues and Eigenvectors of the matrix . In fact, the general solution is based on the matrix exponential .
Exercises
Knowledge Check
What is the general solution to the DE dy/dx = 3y?
Answer: y = Ce^(3x)
This is the standard growth equation. Separating variables gives dy/y = 3dx, which integrates to ln(y) = 3x + C, or y = e^(3x+C) = Ce^(3x).
What is the general solution to the DE dy/dx = 3y?
Knowledge Check
In Newton's Law of Cooling, what happens as time approaches infinity?
Answer: The object's temperature reaches the ambient temperature.
As T approaches Ta, the derivative dT/dt approaches zero. The system reaches equilibrium with its environment.
In Newton's Law of Cooling, what happens as time approaches infinity?
Knowledge Check
Which linear algebra concept is most important for solving systems of DEs?
Answer: Eigenvalues and Eigenvectors
Eigenvectors represent the 'modes' or 'independent directions' of the system's evolution, allowing us to decouple the equations and solve them separately.
Which linear algebra concept is most important for solving systems of DEs?