📊 Section 1 — Interactive Simulation
Pick an ODE $y'=f(x,y)$. The slope field shows the direction $y$ must move at every point. Click anywhere to drop an initial condition; an integral curve traces forward and backward via RK4.
Animation
ODE Preset
Initial Condition
Integration
Display Options
Tips
• Click anywhere on the field to drop a new initial condition.
• Try Logistic: every solution converges to $y=1$ (carrying capacity).
• Halve $h$ — RK4 error drops by $16\times$ (order 4); Euler error drops by $2\times$ (order 1).
💡 Section 2 — The Idea, Step by Step
From a one-line "slope rule" to curves you can actually draw — starting with no symbols at all.
Imagine standing on a hillside where, at every single spot, a tiny arrow tells you which way to lean for your next step. You are never handed the whole trail — only a rule for the direction to face wherever you happen to be. A first-order differential equation is exactly that kind of rule: at every point of the page it tells you how steeply your curve must rise or fall right there. Follow the arrows and a path draws itself.
We write the rule as $y' = f(x,y)$. Here $y'$ is the steepness (the slope) of your path, and $f(x,y)$ is a recipe that hands you that slope once you say where you are, $(x,y)$. Take the simplest example, $y' = y$: "your slope always equals your height." Start at height $y=1$ when $x=0$; the rule says the slope is $1$, so you climb. Step a little to the right, $\Delta x = 0.1$, and you rise to about $y \approx 1 + 0.1\times 1 = 1.1$. Now the same rule demands a steeper slope of $1.1$. Higher means steeper means even higher — that runaway loop is exactly exponential growth, $y = e^{x}$ (true value at $x=0.1$ is $1.105\ldots$). Populations, savings, and bacteria all obey this one "rate equals amount" rule.
Draw the slope $f(x,y)$ as a short segment at a whole grid of points and you get the slope field shown above. A solution, or integral curve, is any curve that stays tangent to those segments everywhere — its derivative matches the prescribed slope at every step. One rule has infinitely many solutions, a whole family; an initial condition $y(x_0)=y_0$ pins down the single curve you ride, and (when $f$ is nice) the curves never cross. When the rule is tidy you integrate by hand: separable $y'=g(x)h(y)$ splits into $\int \frac{dy}{h(y)} = \int g(x)\,dx$; linear $y'+p(x)y=q(x)$ folds up under the integrating factor $\mu=e^{\int p\,dx}$. When it isn't tidy, the simulation's RK4 marches the curve numerically, averaging four sampled slopes per step. In the panel, the preset is your choice of rule $f$, the $x_0,y_0$ sliders plant the starting point, $x_{\text{end}}$ says how far to march, and $h$ is the step length — smaller $h$, smaller error, more steps.
Try this in the sim above
• Keep $y' = y$ and drag $y_0$ up and down: every curve is just a stretched copy of $e^x$, and none of them ever touch.
• Switch to Logistic $y'=y(1-y)$ and drop initial points both above and below $1$: every curve bends toward the line $y=1$, the carrying capacity.
• On Euler vs RK4, crank the step $h$ large and watch Euler drift off the true curve while RK4 still hugs it — halving $h$ shrinks RK4's error about $16\times$ but Euler's only $2\times$.
📐 Section 3 — Three Solvable Forms & Picard's Theorem
Existence/uniqueness, then how to actually solve in three classical cases.
Consider the IVP $y' = f(x,y)$, $y(x_0) = y_0$. If $f$ is continuous on a rectangle containing $(x_0, y_0)$ and is Lipschitz in $y$ there (i.e., $\abs{f(x, y_1) - f(x, y_2)} \le L\abs{y_1 - y_2}$), then a unique solution exists on some open interval around $x_0$.
In particular, if $f$ and $\partial f/\partial y$ are continuous, the IVP has a unique local solution. Lipschitz fails $\Rightarrow$ uniqueness can fail (e.g.\ $y' = \sqrt{y}$, $y(0)=0$ has two solutions).
Symbol Table
| Symbol | Meaning | Type |
|---|---|---|
| $x$ | Independent variable | Real, often time |
| $y(x)$ | Unknown function — the "solution" | Real-valued, differentiable |
| $y'$ | $dy/dx$ — rate of change of $y$ | Real, depends on $x$ |
| $f(x,y)$ | Right-hand side: prescribes the slope at $(x,y)$ | $\R^2 \to \R$ |
| $(x_0, y_0)$ | Initial condition | Point in $\R^2$ |
| $\mu(x)$ | Integrating factor (linear ODE) | $\mu(x) = \exp(\int p(x)\,dx)$ |
| $F(x,y)$ | Potential function (exact ODE) | Level curves are solutions |
| $h$ | Numerical step size | Real, $> 0$ |
Three Solution Recipes
Simulation ↔ Symbol Mapping
dropdown preset | defines $f(x,y)$ — the right-hand side of $y' = f(x,y)$ |
slider x₀, y₀ | initial condition $(x_0, y_0)$ — solution starts here |
slider x_end | upper limit of integration — final $x$ value |
slider h (log) | numerical step size — smaller $h$, smaller error, more steps |
slider k, T_a | parameters of Newton's-cooling preset |
| slope-field arrows | at each grid point $(x, y)$, an arrow with slope $f(x,y)$ — solutions follow these tangents |
readout order p | empirical $p$ from $\log_2(\text{err}_h / \text{err}_{h/2})$ — RK4 should give 4, Euler 1 |
graph error vs h | log-log error vs step size — slope is the order of the method |
Worked Example — $y' + y = \sin(x),\ y(0) = 0$
Recognize: Linear, $p(x)=1$, $q(x)=\sin x$.
Integrating factor: $\mu(x) = e^{\int 1\,dx} = e^x$.
Multiply through: $(e^x y)' = e^x \sin x$.
Integrate: $\int e^x \sin x\,dx = \tfrac12 e^x(\sin x - \cos x) + C$. So $e^x y = \tfrac12 e^x(\sin x - \cos x) + C$.
Apply IC $y(0)=0$: $0 = \tfrac12(0 - 1) + C$, so $C = \tfrac12$.
Solution: $\boxed{y(x) = \tfrac12(\sin x - \cos x) + \tfrac12 e^{-x}.}$ The transient $e^{-x}/2$ dies, leaving the steady oscillation $\tfrac12(\sin x - \cos x)$.
❓ Section 4 — Frequently Asked Questions
It means finding a function $y(x)$ such that plugging $y$ and $y'$ into the equation makes it an identity for all $x$ in some interval. The equation tells you the slope at every point; the solution is a curve whose tangent at each point matches that prescribed slope. There are typically infinitely many solutions — a one-parameter family — and an initial condition $y(x_0)=y_0$ picks out one specific solution. Geometrically, the slope field shows the prescribed slopes; integral curves "thread through" the field tangentially.
Key takeaway: an ODE is a slope rule; solving = finding a curve tangent to that rule everywhere.The slope field draws short tangent segments at a regular grid of points. At each $(x,y)$, the segment's slope is exactly $f(x,y)$ — what $y'$ must be there if a solution passes through. The integral curve is computed by RK4 starting at your chosen $(x_0, y_0)$: at each step it samples the slope at four nearby points and takes a weighted average to produce the next point. The result is a curve that's tangent to the slope field at every step — i.e., a solution of the ODE — accurate to $O(h^4)$ per step.
Key takeaway: slope field = direction recipe; integral curve = RK4 follows it tangentially.Whenever a quantity changes at a rate that depends on its current value or on time. Population growth: $dP/dt = rP$ → exponential, then logistic when resources cap. Newton's cooling: a hot object cools at rate proportional to temperature gap with surroundings — first-order linear. Radioactive decay: $dN/dt = -\lambda N$. Drug pharmacokinetics: drug concentration in bloodstream obeys first-order elimination + dosing input. RC circuits: voltage across capacitor satisfies $RC\,V' + V = V_s(t)$ — exactly the linear ODE we solved. Compound interest with continuous deposits: linear ODE for account balance.
Key takeaway: any "rate-depends-on-amount" model is a first-order ODE — populations, temperatures, drugs, circuits, money.If two solutions $y_1$ and $y_2$ crossed at a point $(x^*, y^*)$, both would satisfy $y(x^*) = y^*$ and $y'(x^*) = f(x^*, y^*)$ — same initial value, same slope. By Picard's uniqueness theorem (assuming Lipschitz $f$), there's only one solution through any point — so $y_1 = y_2$ in a neighbourhood, contradicting the assumption they were different curves. The slope field is a "non-crossing flow". When uniqueness fails (e.g., $y' = 3y^{2/3}$ at $y=0$ — not Lipschitz there), curves can branch: $y \equiv 0$ and $y = (x-c)^3$ both satisfy $y(c)=0$.
Key takeaway: Lipschitz ⇒ no crossings, by uniqueness. Non-Lipschitz ⇒ branching is possible.RK4 takes the step $y_{n+1} = y_n + \tfrac{h}{6}(k_1 + 2k_2 + 2k_3 + k_4)$ where $k_1 = f(x_n, y_n)$, $k_2 = f(x_n + h/2,\ y_n + h k_1/2)$, $k_3 = f(x_n + h/2,\ y_n + h k_2/2)$, $k_4 = f(x_n + h,\ y_n + h k_3)$. The four-point Simpson-like weighted average matches the Taylor series of the true solution up to and including $h^4$ terms — the leading error is $O(h^5)$ per step, accumulating to $O(h^4)$ globally over a fixed interval. Cost per step: 4 function evaluations vs 1 for Euler. To gain a factor of 10 in accuracy: Euler needs $10\times$ more steps, RK4 needs only $10^{1/4}\approx 1.78\times$ more — RK4 wins enormously for tight tolerances.
Key takeaway: RK4 = 4-stage weighted slope average that matches Taylor through $h^4$. 4× cost, but $1/h^3$× accuracy.An autonomous ODE $y' = f(y)$ (no $x$ dependence) defines a vector field on the line/phase space — at each $y$, a velocity vector $f(y)$. Its solution is the flow generated by integrating that field. Equilibria $f(y^*)=0$ are fixed points; their stability is determined by $f'(y^*)$: stable if $f'(y^*) < 0$, unstable if $> 0$. Generalize to $\R^n$: $\mathbf{y}' = \mathbf{F}(\mathbf{y})$ — autonomous system. Equilibria of nonlinear systems are classified by eigenvalues of the Jacobian (linearization theorem of Hartman-Grobman). This is the start of dynamical systems theory: bifurcations, attractors, chaos, structural stability — all built on the geometric view of ODEs as flows of vector fields.
Key takeaway: ODEs are vector fields; solutions are flows; equilibria + linearization launch dynamical systems theory.They're three orthogonal "structures" that allow closed-form integration. Separable: $y'$ factors as $g(x)h(y)$ — variables disentangle, two independent integrals do the job. Linear: $y$ and $y'$ appear only to the first power, no products of $y$ with itself — integrating factor turns the LHS into a perfect derivative. Exact: the ODE rewritten as $M\,dx + N\,dy = 0$ is the differential of some $F$ — the gradient/conservation viewpoint. Most random ODEs aren't any of these (e.g.\ $y' = \cos(xy)$). Recognizing the form is the first triage step before reaching for numerics. There are also tricks (substitutions: homogeneous, Bernoulli, Riccati) that convert a non-classical equation to one of these three.
Key takeaway: separable, linear, exact — three solvable forms with three different integration strategies. Try each; if none, go numerical.