Differential Equations Tool

Slope Field Generator

Enter dy/dx = f(x, y) to plot its slope field and click to draw solution curves — or switch to phase portrait mode for two-dimensional systems with equilibrium points classified.

Click to draw solution curvesSlope fields & phase portraitsRuns in your browser
Slope field
Click anywhere to draw the solution curve through that point.
Equation
Use x, y, + − * / ^, sin, cos, exp, ln, sqrt, abs, pi, e. Implicit multiplication (2xy) works.

Examples

Window & density

2 curves drawn · RK4 in arc length, both directions from each click

What the plotter does

A direction field plotter built for calculus and differential equations courses

Any first-order equation

Type dy/dx in plain notation — x − y, y(1 − y), sin(x) cos(y), −x/y — with the standard functions and implicit multiplication.

Solution curves on click

Each click is an initial condition. The curve is integrated forward and backward with RK4 in arc length, so vertical tangents stay smooth.

Phase portraits

Enter dx/dt and dy/dt for an autonomous system to see the vector field, trajectories with direction arrows, and speed-coloured arrows.

Equilibria classified

Fixed points are found with Newton iteration and labelled node, saddle, spiral, or center from the Jacobian trace and determinant, with eigenvalues shown.

Adjustable window

Set the x and y ranges and the grid density to zoom into a region or to get the coarse field a textbook figure uses.

Export

Download the current plot as a PNG for homework, slides, or notes. Nothing leaves your browser.

How slope fields and phase portraits work

A first-order differential equation dy/dx = f(x, y) tells you the slope of a solution at every point of the plane, even when you cannot write the solution down. A slope field draws that information directly: on a grid of points, each short segment is tilted to slope f(x, y). Because every solution curve must be tangent to the field wherever it passes, the picture shows the whole family of solutions at once, and a particular solution is the curve you get by following the segments from an initial condition.

This tool turns your expression into a compiled function and evaluates it at every grid point to draw the field. When you click, it integrates the equation numerically from that point. Rather than stepping in x, which fails where the slope is vertical, it steps along the curve’s arc length using the direction (1, f)/√(1 + f²) and a fourth-order Runge–Kutta scheme, marching both forward and backward until the curve leaves the window or the equation becomes undefined. For smooth equations the result matches the exact solution to several decimal places inside the window.

A phase portrait is the two-dimensional analogue for autonomous systems dx/dt = f(x, y), dy/dt = g(x, y), such as a damped pendulum, a predator–prey model, or a linear system written in matrix form. Here the arrows show the velocity vector at each point and trajectories are curves parameterised by time. Their qualitative shape is organised by the equilibrium points, where f and g are both zero. The tool seeds Newton’s method from a coarse grid to locate them and then linearises: with the Jacobian’s trace τ and determinant Δ, a negative Δ is a saddle, positive Δ with τ² ≥ 4Δ is a node, and positive Δ with complex eigenvalues is a spiral, stable when τ < 0 and unstable when τ > 0. A zero trace with complex eigenvalues is a center of the linearisation, which nonlinear terms may turn into a very slow spiral.

Reading the pictures is most of the skill. In a slope field, horizontal segments mark where y′ = 0, the isocline along which solutions have maxima, minima, or plateaus; the logistic equation y′ = y(1 − y) shows solutions flattening toward the equilibrium y = 1 and away from y = 0. In a phase portrait, closed orbits mean periodic behaviour, trajectories converging on a point mean a stable equilibrium, and the stable and unstable curves through a saddle divide the plane into regions with different long-term fates.

Numerical curves are approximations. Near a singularity, for example y = 0 in y′ = −x/y, the integration stops rather than inventing values, and very stiff systems can drift over long trajectories. Narrowing the window or comparing against a known solution is the usual check. The plots are meant to accompany the analytic work in a course, not replace it.

Built and maintained by the runcell.dev team. Last reviewed September 2026.

Frequently Asked Questions

Related tools

More interactive math and logic tools that run in the browser

Truth Table Generator
Truth tables, Karnaugh maps, and minimal SOP / POS for Boolean expressions.
AI Geometry Solver
Step-by-step solutions for geometry problems from text or a diagram.
WebGL Fluid Simulation
Real-time Navier–Stokes fluid you can paint with the mouse.