Differential equations – slope fields, particular solutions and Euler's method
MathematicsCalculusAges 17–18
How do you mainly use this simulation?
Use it with your class: students open it from a link or a QR code, with no account needed.
Choose dy/dx = f(x, y) (exponential growth or decay, y′ = ay + b, logistic growth, Newton's law of cooling, x + y, xy, −x/y, x) and see its slope field; click to draw the particular solution through that point, with the working by separation of variables. The Euler's method screen takes steps of size h and compares each value with the exact solution in an error table, also for h/2. The Coupled system screen applies Euler's method to dx/dt, dy/dt (predator–prey, centre, spiral, saddle). The Linear systems screen sets the matrix A of dx/dt = Ax and shows the phase portrait with trajectories from clicked points, the eigenvalues and the type (saddle, node, spiral, centre or a degenerate case) on the trace–determinant plane; it also writes x″ + bx′ + cx = 0 as a coupled system and solves it with Euler's method. The Methods screen finds the order and degree of an equation and works homogeneous equations (y = vx) and linear equations dy/dx + P(x)y = Q(x) (integrating factor) step by step; the particular solution through a clicked point is checked by substitution, on the slope field and with Euler's method.
Lesson: First-order differential equations: slope fields, separation of variables and Euler's method
What it shows
A first-order differential equation dy/dx = f(x, y) gives a gradient at every point, and its solution curves follow those gradients. Separable equations are solved by separating the variables; a homogeneous equation dy/dx = F(y/x) becomes separable with y = vx, and a linear equation dy/dx + P(x)y = Q(x) is solved with the integrating factor e^(∫P dx). Euler's method follows the tangent for a step h, so its error is roughly proportional to h. For a linear system dx/dt = Ax, the trace and determinant of A decide whether the origin is a saddle, node, spiral or centre.
How to use
On Slope field, choose an Equation and click the graph. On Euler's method, set h and n and press ▶ Run. On Coupled system and Linear systems, choose a system or set a₁₁ to a₂₂ and click starting points. On Methods, find the order and degree under Order and degree; under Homogeneous or Linear, choose the equation, click a point, press Step ▶ to see the working and then Record.
Parameters you can change
- Screen Slope field, Euler's method, Coupled system, Linear systems, Methods
- Differential equation dy/dx = ky (exponential growth or decay), dy/dx = ay + b, dy/dx = ky(1 − y/L) (logistic growth), dT/dt = −k(T − Tₐ) (Newton's law of cooling), dy/dx = x + y, dy/dx = xy, dy/dx = −x/y, dy/dx = x
- Coefficient k (a for y′ = ay + b) of the chosen equation -2–2
- Second constant: b, carrying capacity L or surrounding temperature Tₐ (°C) -5–40
- Initial condition: x₀ (t₀ for cooling) -5–40
- Initial condition: y₀ = y(x₀) (T₀ for cooling) -5–100
- Step size h (Euler's method screen) 0.05–10
- Number of steps n (Euler's method screen) 1–40
- Show the exact solution (Euler and system screens)
- Show the isocline dy/dx = 0 (Slope field screen)
- System (Coupled system screen) Predator–prey (Lotka–Volterra), x′ = y, y′ = −x (centre), x′ = y, y′ = −x − 0.5y (spiral), x′ = x + y, y′ = 4x + y (saddle)
- Step size h for the system 0.01–0.5
- Number of steps for the system 1–200
- Part of the Linear systems screen Matrix A, Second-order equation x″ + bx′ + cx = 0
- Matrix entry a₁₁ (Linear systems screen) -5–5
- Matrix entry a₁₂ (Linear systems screen) -5–5
- Matrix entry a₂₁ (Linear systems screen) -5–5
- Matrix entry a₂₂ (Linear systems screen) -5–5
- Coefficient b in x″ + bx′ + cx = 0 -4–4
- Coefficient c in x″ + bx′ + cx = 0 -5–10
- Starting value x(0) of the second-order equation -4–4
- Starting value x′(0) of the second-order equation -4–4
- Part of the Methods screen Order and degree, Homogeneous equations, Linear equations
- Equation for order and degree (Methods screen) dy/dx = x + y, d²y/dx² + 4y = 0, (dy/dx)³ + 2y = x, (d²y/dx²)³ + (dy/dx)⁴ − y = 0, d³y/dx³ + 2(d²y/dx²)² + dy/dx = 0, (dy/dx)² + dy/dx − cos²y = 0, d²y/dx² + sin(dy/dx) = 0, dy/dx + ln(dy/dx) = x
- Homogeneous equation (Methods screen) dy/dx = (x + y)/x, dy/dx = (x² + y²)/(xy), dy/dx = (x² + xy + y²)/x², dy/dx = (x + y)/(x − y), dy/dx = −x/y
- P(x) in dy/dx + P(x)y = Q(x) (Methods screen) 1, −1, 2, 1/x, 2/x
- Q(x) in dy/dx + P(x)y = Q(x) (Methods screen) 0, 1, x, x², eˣ, sin x, cos x
- Point x₀ of the particular solution (Methods screen) -4–4
- Point y₀ of the particular solution (Methods screen) -4–4
- Step size h of the Euler check (Methods screen) 0.05–2
- Number of Euler steps n (Methods screen) 1–40
Questions to explore
- For dy/dx = x + y with y(0) = 1, why does Euler's method always underestimate the exact solution?
- How does the error of Euler's method at a fixed x change when the step size h is halved?
- For the system x′ = y, y′ = −x, why does the Euler path spiral outwards instead of closing?
- Why does every matrix with a negative determinant give a saddle point?
- Why does the substitution y = vx turn a homogeneous equation into one whose variables separate?