import sympy as sp
x = sp.Symbol("x")
y_candidate = 2 * sp.exp(3 * x)
left_side = sp.diff(y_candidate, x)
right_side = 3 * y_candidate
sp.simplify(left_side - right_side)\(\displaystyle 0\)
A first-order differential equation describes a function by describing its first derivative. Instead of immediately telling you y, it tells you how y changes.
After this lesson you should be able to:
Compare these two statements:
y = 3x + 2
dy/dx = 3
The first statement gives y directly. The second statement says the rate of change of y with respect to x is always 3. Many functions differ by a constant but have derivative 3, so the differential equation describes a family of functions.
A common first-order form is
dy/dx = f(x, y)
The right-hand side tells you the slope that a solution should have at each point (x,y).
x or time t.y(x) or y(t).dy/dx or dy/dt is the rate of change.y(0)=5 gives a starting value.To check whether a function solves an ODE:
Show that y = 2e^{3x} solves dy/dx = 3y.
Step 1: Differentiate the candidate.
y = 2e^{3x}
y' = 6e^{3x}
Step 2: Compute the right-hand side 3y.
3y = 3(2e^{3x}) = 6e^{3x}
Step 3: Compare.
y' = 6e^{3x} and 3y = 6e^{3x}
They match, so the candidate is a solution.
Suppose the family of solutions is
y = Ce^{-2t}
and the initial condition is y(0)=7. Substitute t=0 and y=7:
7 = C e^0
7 = C
So the particular solution is
y = 7e^{-2t}
Newton’s law of cooling is often written as
dT/dt = -0.4(T - 20)
Here T is temperature and t is time. The expression T - 20 measures how far the object is from the surrounding temperature 20. The negative sign means that if the object is hotter than the room, the temperature decreases. If the object is colder than the room, the temperature increases.
| Pattern | Example | Meaning |
|---|---|---|
| Constant rate | dy/dt = 4 |
add the same amount each time unit |
| Proportional growth | dy/dt = 0.2y |
bigger y grows faster |
| Proportional decay | dy/dt = -0.2y |
bigger y decays faster |
| Autonomous | dy/dt = y(1-y) |
rate depends only on current y |
| Forced | dy/dt + 2y = sin(t) |
outside input affects the motion |
y is meters and t is seconds, dy/dt is meters per second.Is dy/dx = x + y first order? Explain.
Verify that y = 5e^x solves dy/dx = y.
The family y = C e^{4t} satisfies y(0)=3. Find C.
Interpret dP/dt = 0.03P if P is population and t is years.
dy/dx and no higher derivative.5e^x is 5e^x, which equals y.3 = C e^0, so C=3.Use these mini-labs to turn the vocabulary into a repeatable routine. In each lab, guess first, then follow the steps, then try the checkpoint without looking at the worked lines.
Guess first. In dP/dt = 0.04P, what is changing, and with respect to what input?
Guided exercise.
P; it is the quantity whose value changes.t; it is usually time.dP/dt means “rate of change of P per unit of t.”0.04P says the rate is proportional to the current amount.So a good sentence is: “The quantity P grows at a rate equal to 4% of its current size per unit time.”
Checkpoint. For dT/dt = -0.2(T - 70), identify the dependent variable, independent variable, derivative, and meaning of the negative sign.
Guess first. If y = 4e^{-2x}, should it solve y' = -2y?
Guided exercise.
y = 4e^(-2x)
y' = -8e^(-2x) differentiate
-2y = -2(4e^(-2x)) = -8e^(-2x)
Since y' and -2y are the same expression, the candidate solves the ODE.
Checkpoint. Verify that y = 3e^{5x} solves y' = 5y. Show the derivative and the substituted right-hand side.
Guess first. If the family is y = Ce^{3t} and y(0)=10, what should C be?
Guided exercise.
y = Ce^(3t)
10 = Ce^(3*0) substitute t=0 and y=10
10 = C e^0
10 = C
So the particular solution is y = 10e^{3t}.
Checkpoint. The family y = C e^{-4t} satisfies y(0)=8. Find the particular solution and explain what happens as t increases.
Guess first. If dA/dt = -0.15A and A is grams, what are the units of the right side?
Guided exercise.
The derivative dA/dt has units “grams per time.” Therefore 0.15 must have units “per time,” and the negative sign means A is decreasing. Bigger amounts lose more grams per time because the rate is proportional to A.
Checkpoint. Interpret dM/dt = 12 - 0.5M if M is milligrams of medicine in a body. Which term is input, and which term is removal?
Use SymPy to verify that a candidate solution satisfies an ODE.
\(\displaystyle 0\)
A result of 0 means the candidate satisfies the differential equation.