Direction Field Visualizer
Plot slope fields and trace solution curves for \(y' = f(t,y)\) using an adaptive Tsitouras 5(4) (Tsit5) solver — click anywhere on the field to draw a solution curve through that point.
What Is a Direction Field?
A direction field (or slope field) for \(y' = f(t,y)\) places a short arrow at each grid point \((t,y)\) whose slope equals \(f(t,y)\). Any solution curve must be tangent to the arrows everywhere it passes.
Adaptive Solver — Two Trajectory Modes
Clicking a point \((t_0,y_0)\) solves the IVP with an adaptive Tsitouras 5(4) (Tsit5) explicit Runge–Kutta method with FSAL (the final stage of an accepted step is reused as the first stage of the next, giving an effective cost of six derivative evaluations). Step size is automatically shrunk near steep slopes and enlarged in smooth regions.
The Trajectory Mode selector chooses how the curve is parameterised:
- t-step (default) — integrates \(y(t)\) directly from \(y' = f(t,y)\). Fastest and most familiar; one \(y\) value per \(t\). Stops short of vertical tangents and pole-style singularities (e.g. \(y' = -t/y\) at \(y = 0\)).
- Arc-length — integrates the equivalent autonomous 2D system \(\dot{t} = \cos\theta,\ \dot{y} = \sin\theta\) where \(\theta = \arctan f(t,y)\). The unit-speed RHS stays bounded as \(f \to \pm\infty\), so vertical tangents are crossed smoothly and full implicit curves close up — \(y' = -t/y\) traces complete circles in one click. This is exactly the trick used by phase portraits to draw trajectories of \(\dot{x} = Q(x,y),\ \dot{y} = P(x,y)\).
How to Use
- Type \(f(t,y)\) in the equation box. Use
torxfor the independent variable. - Press Enter or click Update Field to redraw the arrows.
- Click anywhere on the canvas to trace a solution curve through that point.
- Multiple curves use distinct colors automatically.
- Clear Solutions removes all curves. Download PNG saves the view.
Keyboard Navigation
- Tab through all controls; Enter in the equation field updates the plot.
- Click function names in the table to insert them directly into the equation box.
Direction field visualization. Click on the canvas to draw a solution curve through the chosen point.
Each example loads in arc-length mode so vertical tangents are crossed and full implicit curves close up. Bounds use a 5:3 aspect ratio matching the canvas, so circles look round. Click anywhere on the field after loading.
Click a function name to insert it into the equation box.
| Code | Notation |
|---|---|
| sqrt(x) | \(\sqrt{x}\) |
| cbrt(x) | \(\sqrt[3]{x}\) |
| abs(x) | \(|x|\) |
| sin(x) | \(\sin x\) |
| cos(x) | \(\cos x\) |
| tan(x) | \(\tan x\) |
| cot(x) | \(\cot x\) |
| sec(x) | \(\sec x\) |
| csc(x) | \(\csc x\) |
| asin(x) | \(\arcsin x\) |
| acos(x) | \(\arccos x\) |
| atan(x) | \(\arctan x\) |
| sinh(x) | \(\sinh x\) |
| cosh(x) | \(\cosh x\) |
| tanh(x) | \(\tanh x\) |
| exp(x) | \(e^{x}\) |
| log(x) | \(\ln x\) |
| log10(x) | \(\log_{10} x\) |
| pi | \(\pi\) |
| e | \(e\) |
| ceil(x) | \(\lceil x\rceil\) |
| floor(x) | \(\lfloor x\rfloor\) |
| round(x) | \(\operatorname{round}(x)\) |
| max(a,b) | \(\max(a,b)\) |
| min(a,b) | \(\min(a,b)\) |