Calcist

Style

Buttons

Spacing

How much to show

Decimal places

Text size

Differential equation calculator

Enter y′ as a formula in x and y, a starting point and how far to go. You get the solution by the classical Runge–Kutta method (RK4), a table, a graph with the slope field, and, for linear equations, the exact solution by the integrating factor.

Use x and y with + − * / ^ and functions like sin, e^x, ln and sqrt.

Private: calculated on your device. Nothing you type is sent anywhere.

Next: Need an antiderivative on the way? Use the integral calculator. For growth at a fixed rate, the compound interest calculator has the money version.

What it solves

A first-order differential equation y′ = f(x, y) tells you the slope of the solution at every point. With a starting value y(x₀) = y₀, there's usually exactly one solution curve. This differential solver follows that curve step by step. It handles growth and decay (y′ = ky), logistic growth (y′ = y(1 − y)), cooling, mixing problems and anything else you can write as y′ = f(x, y).

How it's calculated: Runge–Kutta (RK4)

k₁ = f(xₙ, yₙ)
k₂ = f(xₙ + h/2, yₙ + (h/2)k₁)
k₃ = f(xₙ + h/2, yₙ + (h/2)k₂)
k₄ = f(xₙ + h, yₙ + h·k₃)
yₙ₊₁ = yₙ + (h/6)(k₁ + 2k₂ + 2k₃ + k₄)

RK4 samples the slope four times per step and averages them. It's a fourth-order method: halving h cuts the error about 16-fold. The calculator reruns with h/2 and shows how much the answer moved, so you can see how many digits to trust. For comparison it also shows Euler's method, yₙ₊₁ = yₙ + h·f(xₙ, yₙ), which is only first-order.

For y′ = y with y(0) = 1 and h = 0.1, RK4 gives y(1) ≈ 2.718279744, against the exact value e ≈ 2.718281828. Euler's method with the same step gives only 2.593742.

The integrating factor method

If the equation is linear in y, it can be written y′ + P(x)y = Q(x). Then:

  1. Find the integrating factor μ(x) = e^(∫P(x) dx).
  2. Multiply through. The left side becomes (μy)′, so (μy)′ = μQ.
  3. Integrate both sides: μy = ∫μQ dx + C, then divide by μ.
  4. Use the initial value to find C.

The calculator does these steps whenever P and Q are simple enough to integrate, and checks the formula against the RK4 numbers.

Worked example

Solve y′ = 4 − 2y with y(0) = 0. In standard form, y′ + 2y = 4, so P = 2 and Q = 4.

  1. μ = e^(∫2 dx) = e^(2x).
  2. (e^(2x)y)′ = 4e^(2x), so e^(2x)y = 2e^(2x) + C.
  3. y = 2 + Ce^(−2x). With y(0) = 0, C = −2.
  4. y = 2 − 2e^(−2x), and y(1) = 2 − 2e⁻² ≈ 1.72932943.

Limitations

  • One first-order equation at a time. Second-order equations and systems need to be rewritten as systems, which this calculator doesn't take.
  • If the solution blows up (y′ = y² from y(0) = 1 reaches infinity at x = 1) or leaves the domain of f, the calculator stops and says where.
  • Stiff equations, with very fast decay like y′ = −1000y, need a small step to stay stable. If halving h changes the answer a lot, make h smaller.
  • The slope field is drawn on the graph's window only.

Sources

How we checked this

Before every update, this calculator is run in a real browser with these known answers, and it must match all of them:

  • y′ = y, y(0) = 1, h = 0.1: y(1) ≈ 2.71828 (e) ✓
  • y′ = y solved exactly: y = eˣ ✓
  • Integrating factor: y′ = 4 − 2y, y(0) = 0 gives y = 2 − 2e^(−2x) ✓
  • A step size of 0 is rejected ✓

Last checked October 26, 2026. Spotted something wrong? The math is done in your browser with the formula shown on this page, so you can check any result by hand.

Add this calculator to your website (free)

Paste this code into any web page. The calculator works on your page, resizes itself, has no ads and no tracking, and nothing your visitors type is sent anywhere. More about embedding.

Questions people ask

What is an integrating factor?

A function μ(x) = e^(∫P dx) that you multiply a linear equation y′ + P(x)y = Q(x) by, so that the left side becomes the derivative of μy and can be integrated directly.

What is a slope field?

A grid of short line segments, each with the slope y′ = f(x, y) at that point. Solution curves follow the segments, so you can sketch solutions without solving.

How accurate is RK4?

Its error shrinks like h⁴, so halving the step makes it about 16 times smaller. The calculator reruns with h/2 and shows how much the answer moved, which tells you how many digits to trust.

What's the difference between Euler's method and RK4?

Euler uses one slope per step and its error shrinks like h. RK4 averages four slopes per step and its error shrinks like h⁴, so it's far more accurate for the same step.

Related calculators