📊 Section 1 -- Interactive Simulation
Controls
ODE y = f(t,y)
Display
💡 Section 2 -- The Idea, Step by Step
Imagine someone hands you a single rule: "Tell me where you are right now, and I'll tell you how fast you're changing." That rule is a first-order differential equation. It never gives your position directly -- only your speed at this very instant. Your job is to start somewhere and let the rule carry you forward, moment by moment, like driving a car where the speedometer reading depends on where you happen to be.
Here the changing thing is $y$, time is $t$, and the rate of change is $y'=dy/dt$. The rule is written $y'=f(t,y)$. Think of a hot cup of coffee: the further its temperature sits above the room, the faster it cools, so $y'=-y$. Start at $y_0=1$ and take one small step of size $h=0.1$. The new value is roughly the old value plus (step)(rate): $y_0+h\cdot(-y_0)=1-0.1=0.9$. Keep stepping and you trace the whole cooling curve without ever needing a tidy formula.
The precise statement pairs the rule with a starting point: $y'=f(t,y)$ with $y(t_0)=y_0$ -- an initial-value problem. The direction field draws a tiny segment of slope $f(t,y)$ at every point of the plane, and any solution is simply a curve that stays tangent to those segments everywhere it goes. When the rule factors as $y'=g(t)h(y)$ you can separate and integrate each side on its own; when it is linear, $y'+p(t)y=q(t)$, multiplying by the integrating factor $e^{\int p\,dt}$ collapses the left side into the single derivative $(\mu y)'$. The Euler method turns the coffee-cup trick into a recipe, $y_{n+1}=y_n+h\,f(t_n,y_n)$, whose error shrinks in direct proportion to the step $h$. In the panel, the Initial y0 slider chooses where your curve starts and the Step h slider sets how big each Euler step is.
1) Choose y'=y(1-y) (logistic) and slide $y_0$ both above and below 1 -- every curve bends toward the stable line $y=1$. 2) Choose y'=-y and push $h$ up to 0.5: the Euler staircase visibly peels away from the gold exact curve, then tightens back onto it as you shrink $h$. 3) Switch the lower graph to Error vs h and watch the error fall along a straight log-log line of slope $\approx 1$ -- the fingerprint of a first-order method.
📐 Section 3 -- First-Order ODEs
If $f(t,y)$ is continuous and Lipschitz in $y$ near $(t_0,y_0)$, then $y'=f(t,y)$, $y(t_0)=y_0$ has a unique solution on some interval.
| Type | Form | Solution Method |
|---|---|---|
| Separable | $y'=g(t)h(y)$ | $\int dy/h(y)=\int g\,dt$ |
| Linear | $y'+p(t)y=q(t)$ | Integrating factor $e^{\int p}$ |
| Logistic | $y'=ry(1-y/K)$ | Partial fractions |
| Exact | $M\,dt+N\,dy=0,\;M_y=N_t$ | Find potential $F$ |
Separate: $dy/y=-dt$. Integrate: $\ln|y|=-t+C$. Exponentiate: $y=y_0 e^{-t}$. With $y_0=1$: $y(t)=e^{-t}$. Check: $y'=-e^{-t}=-y$ ✓.
$y_{n+1}=y_n+h\cdot f(t_n,y_n)$. Global error $O(h)$ -- halving $h$ halves the error. For $y'=-y$, $h=0.1$, $n=10$: $y_{10}=(0.9)^{10}=0.3487$ vs exact $e^{-1}=0.3679$. Error $=0.019$.
$y'=y(1-y)$. Solution: $y(t)=1/(1+(1/y_0-1)e^{-t})$. Equilibria: $y=0$ (unstable), $y=1$ (stable). All solutions with $y_0>0$ converge to $y=1$ as $t o\infty$.
For $y'+p(t)y=q(t)$: multiply by $\mu=e^{\int p\,dt}$. LHS becomes $(\mu y)'$. Integrate: $\mu y=\int \mu q\,dt+C$. Example: $y'+y=e^t$, $\mu=e^t$: $(e^t y)'=e^{2t}$, so $y=e^t/2+Ce^{-t}$.
At each $(t,y)$, draw a slope segment of slope $f(t,y)$. Solution curves are tangent to all segments. Stable equilibria attract nearby curves; unstable repel. The simulation shows all solutions simultaneously.
Convert IVP to integral equation: $y=y_0+\int_{t_0}^t f(s,y(s))\,ds$. Define iterates $y_{n+1}=y_0+\int f(s,y_n)\,ds$. For Lipschitz $f$, this converges uniformly. Provides existence proof and theoretical basis for numerical methods.
❓ Section 4 -- FAQ
At each $(t,y)$ the slope $f(t,y)$ is drawn as a short line segment. Solution curves are everywhere tangent to these segments -- they "flow" along the field. Equilibria (where $f=0$) appear as horizontal segments. The field shows all solutions globally without solving the ODE explicitly.
Key takeaway: direction field = visual map of all solution slopes. Stable equilibria attract nearby curves.The blue staircase path shows Euler steps vs the gold exact solution. The step size $h$ controls accuracy. The error graph shows $|y_{ m Euler}(T)-y_{ m exact}(T)|$ vs $h$ on log-log scale with slope $pprox 1$ -- confirming first-order convergence.
Key takeaway: Euler error ~ h (first-order). Log-log error graph has slope 1.Radioactive decay ($dN/dt=-\lambda N$), drug pharmacokinetics, population logistic growth, Newton cooling ($dT/dt=-k(T-T_{ m env})$), RC circuits ($dV/dt=-V/(RC)$), compound interest ($dA/dt=rA$), epidemic SIR model (coupled ODEs).
Key takeaway: decay, drug clearance, logistic growth, RC circuits, compound interest -- all first-order ODEs.For Lipschitz $f$, Euler converges with error $O(h)$. But for stiff ODEs (e.g., $y'=-1000y$), explicit Euler requires $h<0.002$ for stability -- impractically small. Implicit methods (Backward Euler, Crank-Nicolson) handle stiffness with large steps. RK4 needs only $h<0.002$ for accuracy but also suffers stability issues with stiffness.
Key takeaway: Euler converges for Lipschitz f but fails for stiff ODEs. Implicit methods handle stiffness.$k_0=f(0,1)=0$, $y_1=1$. $k_1=f(0.1,1)=0.2$, $y_2=1.02$. $k_2=f(0.2,1.02)=0.408$, $y_3=1.0609$. Exact: $y=e^{t^2}$, $y(0.3)=e^{0.09}=1.0942$. Error $=0.033$. With $h=0.01$: error $pprox0.0033$ -- confirms first-order convergence.
Key takeaway: halving h halves the Euler error -- first-order convergence confirmed.Convert IVP to $y=y_0+\int f(s,y(s))\,ds$ (integral equation). Picard iterates $y_{n+1}=y_0+\int f(s,y_n)\,ds$ converge since $T[y]=y_0+\int f(\cdot,y)$ is a contraction in $C[t_0,t_0+\delta]$ (sup norm) when $f$ is Lipschitz. Banach fixed-point theorem guarantees a unique fixed point = the solution. The same argument proves uniqueness.
Key takeaway: Picard iteration is a contraction mapping; Banach fixed-point theorem gives unique existence.