Differential Equations Visualizer

Pick a first-order ODE of the form dy/dx = f(x, y). The slope field shows the local direction of solutions at every grid point. Click anywhere on the plot to drop an initial condition. The tool uses classical fourth-order Runge-Kutta integration to draw the solution curve forward and backward through that point.

Click anywhere in the field to draw a solution curve through that point.

Current ODE

Equation

Solutions grow or decay exponentially. The general solution is y = C·exp(x).

General solution

How to read this

  • Each tiny segment in the field shows the slope dy/dx at that point.
  • Click anywhere on the plot to drop an initial condition. RK4 integrates forward and backward.
  • Curves running parallel to nearby segments confirm the numerical solution agrees with the field.
Curves drawn so far 0

Controls

x-units
Show curve labels

Reference Guide

What a slope field shows

A first-order ODE dy/dx = f(x, y) assigns a slope to every point in the xy-plane. A slope field draws a short segment with that slope at each grid point. Solutions of the ODE are curves that stay tangent to the segments everywhere they pass.

Once you can read a slope field by eye, you can sketch how solutions behave without solving the equation. Look for horizontal segments (where f equals zero) to find equilibrium lines, and look for steep segments to spot regions of rapid growth.

Example

For dydx=y(1y)\frac{dy}{dx} = y(1-y) the field is flat along y = 0 and y = 1. Solutions starting between those two values rise toward y = 1.

RK4 vs Euler

Forward Euler advances by yn+1=yn+hf(xn,yn)y_{n+1} = y_n + h f(x_n, y_n) using a single slope evaluation. Its global error scales like h.

The classical fourth-order Runge-Kutta method (RK4) takes four slope samples per step and combines them as a weighted average. Its global error scales like h to the fourth power, which means a step size of 0.05 with RK4 is already much more accurate than Euler at the same h.

Method Slope evals Global error
Euler1O(h)
Midpoint2O(h²)
RK44O(h⁴)

Autonomous vs non-autonomous

An ODE is autonomous when f depends only on y, not on x. Examples include dydx=y\frac{dy}{dx} = -y and dydx=y(1y)\frac{dy}{dx} = y(1-y). The slope field of an autonomous ODE looks the same on every horizontal slice, so its segments form columns of identical arrows.

A non-autonomous ODE has explicit x dependence. Examples include dydx=x+y\frac{dy}{dx} = x + y and dydx=sin(x)\frac{dy}{dx} = \sin(x). The field changes left to right and curves can cross horizontal lines in non-trivial ways.

Equilibrium solutions of an autonomous ODE are horizontal lines where f(y) is zero. They are stable when f is negative just above and positive just below the line, and unstable when the signs flip.

How to use this tool

  1. Choose a preset f(x, y) from the dropdown, or type your own expression in the custom input.
  2. Click anywhere on the plot to drop an initial condition. The tool integrates from that point in both directions.
  3. Adjust step size h for finer accuracy. Smaller h takes longer but tracks the true solution more closely.
  4. Adjust curve length to extend or shorten how far each curve follows the field.
  5. Use the share button to copy a link that captures the equation, view, and every initial condition you placed.

Custom expression syntax

Variables x and y. Constants pi and e. Operators + - * / ^ . Functions sin, cos, tan, exp, log, sqrt, abs. Parentheses for grouping.