Direction Field / Slope Field Plotter
See an ODE’s local behavior before solving it analytically in MiniWebtool’s Direction Field / Slope Field Plotter. Enter y′ = f(x, y) to draw tangent segments, then add initial conditions for numerically integrated solution curves.
For Gemini, paste the copied question into the chat. You can also copy it below.Need help using this tool? Ask AI
View the question
Enter y′ = f(x, y), a window and up to 8 starting points below to plot the slope field with solution curves.
About Direction Field / Slope Field Plotter
The Direction Field / Slope Field Plotter visualizes the geometry of any first-order ordinary differential equation y' = f(x, y) without solving it analytically. At every point on a customizable grid it draws a small tangent segment whose slope equals f(x, y), revealing entire families of solution curves at a glance. An interactive SVG canvas lets you click to spawn RK4-integrated solution curves, animate particles flowing along the field, and export the result as a publication-ready image.
At a Glance
Direction Field / Slope Field Plotter draws the slope field of a first-order ODE y' = f(x, y) on a grid of tangent segments. It adds solution curves from initial conditions and lets you click to start more.
| Feature | What you get | Good for |
|---|---|---|
| Any first-order ODE | Type the right-hand side f(x, y) using x and y, such as y - x, x*y or sin(x) - y. The caret ^ is read as a power. | Seeing how a solution behaves before solving the ODE by hand |
| Domain and grid | Set the x and y ranges and choose a grid of 15x15, 21x21 or 29x29 segments, drawn as arrows or plain line segments. | Zooming in on the region where the interesting behavior is |
| Slope coloring | Color by |slope| on a logarithmic scale, with blue for small slopes and red for large ones, or switch to one uniform color. | Spotting nullclines and equilibrium bands where f(x, y) = 0 |
| Solution curves | Enter up to 8 initial conditions as x, y pairs, or click the plot to add more. Curves are integrated forward and backward with the RK4 method. | Checking a hand-derived solution against the field |
| Euler's method | Optionally enter a step h and an x value to get an approximate y at that x using Euler's method. | Comparing a numerical estimate with the plotted curve |
| Flow animation and SVG | Animate particles flowing along the field, hover to read x, y and slope, and save the plot as an SVG file. | Lecture notes and reports that need a scalable figure |
| Preset examples | Six preset ODEs, including logistic, saddle and Gaussian families, load with one click. | Teaching equilibrium, stability and saddle behavior |
What Is a Direction Field?
Given a first-order ODE y' = f(x, y), a direction field (also called a slope field) is a grid of short line segments placed at regularly spaced points (xi, yj). Each segment has slope f(xi, yj), which is the tangent slope of any solution curve passing through that point. Because solutions must stay tangent to the field everywhere they go, the overall picture shows you the qualitative behavior of the ODE — attractors, repellers, equilibrium lines, oscillations — before you ever write down an explicit formula.
The technique was popularized in the early 20th century as part of the qualitative theory of differential equations, and it is now a standard pedagogical tool in every introductory ODE course.
Why This Plotter Is Different
| Feature | This tool | Typical online plotter |
|---|---|---|
| Click-to-trace curves | Tap anywhere to drop a new RK4 solution starting there | Fixed set of curves; must re-submit a form |
| Flow animation | Particles flow along the field in real time | Static image only |
| Slope-magnitude coloring | Log-scaled gradient reveals nullclines and stiff regions | Single color throughout |
| Vector export | Save-as SVG for infinite-zoom graphics | Raster PNG only |
| Hover readout | Shows (x, y) and slope under the cursor | No live feedback |
How Solution Curves Are Computed
For each initial condition (x₀, y₀) you supply, the tool integrates the ODE using the classical fourth-order Runge-Kutta (RK4) method. RK4 samples the slope four times per step — once at the beginning, twice in the middle, and once at the end — and combines them in a weighted average:
RK4 has local truncation error O(h5) and global error O(h4), so it converges to the true solution four times faster than Euler's method as the step size shrinks. The plotter integrates both forward and backward from (x₀, y₀), so the curve extends to both sides of the initial point and fills the entire visible region.
Reading the Plot
Equilibrium lines and nullclines
Wherever the segments become horizontal, you are on a nullcline — the curve where f(x, y) = 0. In an autonomous ODE y' = g(y), constant nullclines are equilibrium solutions; the coloring makes them easy to spot as blue horizontal bands.
Stable vs unstable equilibria
At a stable equilibrium, neighbouring solutions curl back toward it: arrows above point down, arrows below point up. At an unstable equilibrium the opposite happens. For y' = y(1 − y), y = 1 is stable and y = 0 is unstable — you can see this instantly in the logistic preset.
Steep regions and stiffness
Red segments mark places where |f(x, y)| is large, so solutions change rapidly there. If your plot is dominated by red, the equation is stiff in that region and any numerical integrator will need a small step size to stay accurate.
Input Formats Accepted
1. Differential equation
Anything that parses as a valid math expression using x and y. Common examples: y - x, x*y, sin(x) - y, exp(-x^2) + y, y*(1-y). The caret ^ is converted to ** automatically.
2. Domain
Four numbers for the x and y ranges. Square domains give the most readable plots; if one axis is much longer, the tangent segments will look distorted even though the slope values are correct.
3. Initial conditions
A semicolon- or newline-separated list of x, y pairs. Each pair becomes one RK4 solution curve. Up to 8 initial conditions are accepted; additional curves can be added interactively by clicking on the plot.
How to Use This Plotter
- Enter the right-hand side of y' = f(x, y) in the expression field, or pick one of the six preset examples to see classic behavior.
- Set the x and y range. Start with a square region centered near the interesting behavior, then zoom in by resubmitting with a tighter range.
- List initial conditions as
x, ypairs separated by semicolons. You can also leave this blank and add curves after plotting. - Click Plot Direction Field. The SVG renders instantly with slope segments, color-coded magnitude, and any solution curves you specified.
- Interact: click or tap anywhere on the canvas to add more solution curves, hover to read off (x, y, slope), press Animate flow to see particles stream along the field, or Save SVG to export.
Worked Example
Take the classic equation y' = y − x. The nullcline is the line y = x, where the slope is zero. Above this line the slope is positive (arrows point up), and below it the slope is negative (arrows point down), so every solution curve is asymptotically pushed away from y = x in the vertical direction.
The plotter confirms this geometry visually: all trajectories except the particular solution y = x + 1 blow up exponentially, and the coloring turns the line y = x into a clear blue streak where slopes vanish.
Common Use Cases
- Teaching ODE concepts — equilibrium, stability, basin of attraction, saddle behavior.
- Checking analytical solutions — superimpose your hand-derived curve on the field and confirm tangency.
- Exploring population models — logistic, Allee effect, harvesting terms all have distinctive slope-field signatures.
- Visualizing control systems — first-order linear controllers reduce to y' = −k·y + u(x), whose slope field shows the response rate.
- Preparing figures for lecture notes, textbooks, and technical reports (use Save SVG for lossless output).
Limitations
The tool handles first-order explicit ODEs only — systems like dy/dx = f(x, y), dz/dx = g(x, y, z) require a phase-portrait tool. Implicit equations F(x, y, y') = 0 must be rewritten in the form y' = f(x, y) before plotting. Near singularities (points where f(x, y) is infinite or undefined), the grid is sparse and RK4 traces stop cleanly rather than extrapolating.
Frequently Asked Questions
What is a direction field (slope field)?
A direction field or slope field is a grid of short line segments placed at regularly spaced points in the x-y plane. At each point (x, y) the segment has slope equal to f(x, y), the right-hand side of a first-order ODE y' = f(x, y). Solution curves of the ODE must be tangent to the segments at every point, which lets you visualize entire families of solutions without solving the equation analytically.
How does the tool draw solution curves?
For every initial condition you provide, the tool integrates the ODE numerically using the classical fourth-order Runge-Kutta (RK4) method with a small step size. RK4 evaluates the slope four times per step and combines them with a weighted average to produce a trajectory that is accurate to O(h^4). The curve is traced both forward and backward from the starting point until it leaves the plot region or the slope becomes infinite.
What functions can I use in the expression?
You can use the arithmetic operators + - * / ^ together with the variables x and y, plus trigonometric functions (sin, cos, tan, asin, acos, atan), hyperbolic functions (sinh, cosh, tanh), exponential and logarithmic functions (exp, ln, log, log10), square root (sqrt), absolute value (abs), and the constants pi and e. Example valid expressions include y - x, x*y, sin(x)*cos(y), and exp(-x^2) + y.
What does the color mean?
When Color by |slope| is selected, each slope segment is colored by the magnitude of the slope at that point using a logarithmic scale. Blue indicates a small slope (nearly horizontal flow), and red indicates a large slope (nearly vertical flow). This reveals features such as equilibrium lines, stiff regions, and attractors at a glance.
What is a nullcline and why does it matter?
A nullcline is the set of points where f(x, y) = 0, so the slope field is horizontal along the nullcline. In an autonomous ODE, nullclines often contain equilibrium solutions; in non-autonomous equations they mark turning points of solutions. The tool highlights these regions with nearly horizontal blue segments when Color by slope is on.
Can it solve the equation, find equilibria or run Euler's method?
Yes. Below the plot the tool gives the exact solution when a closed form exists, with the method (separable, linear, Bernoulli, exact) and the particular solution through your first initial condition. For an autonomous equation y' = f(y) it lists every equilibrium in the window as stable, unstable or semi-stable and draws the phase line. Enter a step h and a target x to run Euler's method from the first initial condition: every step is shown in a table next to the accurate RK4 value. A table of slopes at the integer grid points helps with sketching the field by hand.
Can I use this tool on mobile?
Yes. The layout adapts to small screens and the SVG plot uses touch events, so you can tap anywhere on the canvas to add a new solution curve. All computations are performed server-side so the tool works identically on phones, tablets, and desktops.
What initial condition should I use to plot a solution of y' = y?
An initial condition is a starting point (x₀, y₀) on the solution you want to trace. For y' = y, choosing (0, 1) gives the solution y = eˣ; choosing (0, 2) gives y = 2eˣ. Enter the point in the initial-conditions field, then plot the field and curve. Different starting y-values produce different members of the same family of exponential curves.
Why do solution curves become very steep or stop near certain points?
A curve can become steep where the equation's slope grows large, or stop when integration reaches a point where the slope is undefined or cannot be evaluated. For example, y' = 1/x is undefined at x = 0, so a solution curve cannot pass through that point as an ordinary solution. Check whether the differential equation has a denominator that becomes zero, a square root of a negative value, or another domain restriction in the plotted window.
Why do all the slope marks look horizontal along a line?
Horizontal slope marks indicate locations where the derivative y' is zero, so a solution passing through such a point has a horizontal tangent there. For an equation such as y' = x, the marks are horizontal along x = 0 because the slope is zero whenever x is zero. The solution curves may still rise or fall elsewhere; the marks describe the local direction at each point, not the whole curve.
Further Reading
Reference this content, page, or tool as:
"Direction Field / Slope Field Plotter" at https://MiniWebtool.com/direction-field-slope-field-plotter/ from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: Apr 22, 2026
Chat with your favorite AI
For Gemini, paste the copied question into the chat. You can also copy it below.
View the question
Calculus:
- Average Rate of Change Calculator New
- Bernoulli ODE Solver New
- Convolution Calculator Popular
- Curl Calculator New
- Curvature Calculator
- Derivative Calculator
- Direction Field / Slope Field Plotter New
- Directional Derivative Calculator
- Divergence Calculator New
- Double Integral Calculator
- Euler's Method Calculator New
- Fast Fourier Transform (FFT) Calculator New
- First-Order ODE Solver New
- Fourier Series Coefficients Calculator
- Gradient Calculator (Multivariable) New
- Implicit Derivative Calculator
- Improper Integral Calculator New
- Infinite Series Sum Calculator New
- Instantaneous Rate of Change Calculator New
- Integral Calculator
- Inverse Laplace Transform Calculator
- L'Hôpital's Rule Calculator New
- Laplace Transform Calculator
- Limit Calculator
- Line Integral Calculator New
- Maclaurin Series Calculator New
- Newton's Method Calculator New
- Numerical Integration Calculator New
- Optimization Calculator (Calculus) New
- Partial Derivative Calculator
- Power Series Calculator New
- Radius of Convergence Calculator
- Related Rates Solver New
- Riemann Sum Calculator New
- Runge-Kutta (RK4) Method Calculator
- Second-Order ODE Solver New
- Series Convergence Test Calculator New
- Simpson's Rule Calculator New
- Single Variable Derivative Calculator
- Surface Integral Calculator New
- Surface of Revolution Calculator New
- System of ODEs Solver New
- Taylor Series Calculator
- Trapezoidal Rule Calculator New
- Triple Integral Calculator
- Volume of Revolution Calculator New
- Wronskian Calculator
- Z-Transform Calculator New