Starlight Tools

Differential Equation Calculator and ODE Solver

Find exact solutions when supported and numerical solutions otherwise for first-order ordinary differential equations. Enter a complete equation, solve an initial-value problem, follow the working, and explore its slope field and solution graph. Compare Euler, Heun, RK4 and adaptive RK45. Calculations run in your browser.

Enter your equation

Try y′=x+y, dy/dx=x+y, y′+2y=6, or y′=x+y(x). Products such as 2y and xy are accepted.

Equation syntax reference

Choose the variables first. For time and temperature, choose t and T, then enter dT/dt=-0.2(T-20). You can also enter just the right-hand side. Use ^ for powers, parentheses to group terms, and sin, cos, tan, exp, ln, sqrt, abs. Trigonometric arguments are in radians. Write (2x+y)+(x+2y)*y'=0 for an exact differential form. Only one first derivative, occurring linearly, is supported. Enter the initial condition below, not after the equation.

The preview normalizes all multiplication. Exact mode supports linear, Bernoulli (integer powers 2–12), separable and autonomous forms, and detectable exact differential forms. Some results remain implicit or contain unevaluated integrals; this is not a general computer algebra system.

Initial condition (for a particular solution and graph)

Ctrl / ⌘ + Enter to solve. Load a worked example.

Solution

Choose a mode and solve.
—
Accepted / rejected—
Step size—
Estimated error—

Exact formulas and numerical approximations are labeled separately.

Slope field and solution curve

Graph window

Pointer coordinates appear here.

Focus the graph and use arrow keys to pan, +/− to zoom, or the buttons above. The square marks the initial condition; the endpoint is a circle. Comparison curves use different dash patterns.

Associated solution data and step calculations; use “Download graph data CSV” above for every plotted method.

Solution data and numerical steps

Every accepted step can be inspected below.

Calculated solution points
StepIndependent valueDependent valueCalculation

Choose an exact or numerical solution

  1. Choose your variable names and enter a complete first-order equation. Check the interpreted preview.
  2. Select Exact solution to classify the equation and derive a general solution. Apply an initial condition for a particular solution. Unsupported symbolic cases can be sent to Numerical solution.
  3. For a numerical result or graph, set the initial condition and target. Use adaptive RK45 for nonstiff problems, or Euler, Heun and RK4 with a fixed step count for coursework.
  4. Review the result and domain restrictions, expand the working, explore the slope field, or compare methods and export their points.

Euler

yₙ₊₁=yₙ+h f(xₙ,yₙ)

One starting slope; first-order global accuracy for smooth, stable problems.

Improved Euler (Heun)

yₙ₊₁=yₙ+h(k₁+k₂)/2

Average the initial slope and the predicted endpoint slope; second-order global accuracy.

RK4

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

Four stages, including two midpoint slopes; fourth-order global accuracy.

Adaptive RK45

Dormand–Prince uses seven stages and an embedded fourth/fifth-order pair. Accept a step when its estimated local error is at most atol + rtol × max(|yₙ|,|yₙ₊₁|); otherwise shrink and retry. Step selection is automatic.

Worked differential equation examples

Separable growth

y'=y; y(0)=1; target x=1.

Linear, autonomous and separable. Divide by y: dy/y=dx, so ln|y|=x+C. Apply y(0)=1 to get y=eˣ. Exact mode gives y(1)=e≈2.718281828; RK45 follows a rising convex curve.

First-order linear

y'+2y=6; y(0)=1; target x=1.

Linear. Multiply by e²ˣ: (e²ˣy)′=6e²ˣ. Integrate and apply y(0)=1: y=3−2e⁻²ˣ. Exact mode gives y(1)≈2.729329434. The graph rises toward the equilibrium y=3.

Logistic growth

dy/dt=y*(1-y/10); y(0)=1; target t=10.

Autonomous, separable and Bernoulli. With v=1/y, v′+v=0.1. The initial value v(0)=1 gives y=10/(1+9e⁻ᵗ). Exact mode gives y(10)≈9.995915676. The S-shaped curve approaches carrying capacity 10.

Newton cooling

dT/dt=-0.2(T-20); T(0)=90; target t=10.

Linear and autonomous. Integrate dT/(T−20)=−0.2dt, then apply T(0)=90: T=20+70e⁻⁰·²ᵗ. Exact mode gives T(10)≈29.47346983. The falling curve approaches ambient temperature 20.

Nonlinear separable

u'=s*u^2; u(0)=1; target s=1.

Separable: du/u²=s ds. Integrate −1/u=s²/2+C and apply u(0)=1: u=1/(1−s²/2). Exact mode gives u(1)=2. The branch through 0 exists for −√2

Backward integration

y'=y; y(1)=2.718281828459045; target x=0.

Linear and autonomous. Start from y(1)=2.718281828459045 (a rounded value of e). RK4 uses h=(0−1)/40=−0.025 and works backward. The endpoint is approximately 1; the graph falls as integration proceeds from right to left.

Near a singularity

y'=y^2; y(0)=1; target x=0.95.

Autonomous and separable. Integrate −1/y=x+C; y(0)=1 gives y=1/(1−x). The initial branch has x<1. Adaptive RK45 reaches y(0.95)≈20 with increasingly small steps. A target beyond 1 crosses a pole and cannot define a continuation of this IVP.

Exact differential form

(2x+y)+(x+2y)*y'=0; y(0)=1; target x=0.5.

Exact: M=2x+y and N=x+2y have Mᵧ=Nₓ=1. Integrate to F=x²+xy+y². Applying y(0)=1 gives F=1. At x=0.5 the branch through the initial point has y=(√13−1)/4≈0.651387819. The curve follows an implicit level set.

Accuracy and verification

Euler, Heun and classical RK4 have global orders 1, 2 and 4, respectively, under appropriate smoothness and stability assumptions. Their one-step local truncation errors have orders 2, 3 and 5. The Dormand–Prince RK45 implementation advances with the fifth-order formula and estimates local error from its embedded fourth-order formula.

For fixed steps, the displayed coarse-grid endpoint error estimate is 2ᵖ|y₂N−yN|/(2ᵖ−1). Step doubling assumes the leading truncation-error term dominates; it is an estimate, not a bound. RK45 tolerance controls estimated local error, not the total error at the endpoint. Tightening tolerance cannot overcome floating-point limits (about 15–16 significant decimal digits), unstable dynamics or model error.

Local existence and uniqueness ordinarily require continuity of f and local Lipschitz continuity in the dependent variable. Division during symbolic solving can exclude equilibria; these are noted separately. A stiff problem may force explicit methods to take tiny steps for stability. Rejections, domain failures and exhausted steps trigger warnings; these are heuristics, not proofs of stiffness or guaranteed detection of every singularity. Never extend a solution through a pole merely because sampled values are finite.

The graph plots numerical samples of the initial-value branch, including when Exact solution is selected. Implicit formulas and unevaluated integrals remain exact representations; approximate endpoint values are labeled. Finite sampling can miss extrema and domain gaps.

Verification process, reviewed 24 September 2026: automated regression checks compare the built-in examples with their known formulas and test equation normalization, method convergence, adaptive tolerances, backward integration and domain failures. Symbolic output includes an algebraic substitution argument. This is a software verification process; no independent credentialed mathematical review is claimed.

References: Shampine and Reichelt, The MATLAB ODE Suite (SIAM, 1997); Cleve Moler, Numerical Computing with MATLAB, chapter 7; Dormand–Prince method and tolerance documentation. These explain embedded methods, error control and nonstiff solver limitations.

Scope and privacy: one real, first-order scalar equation, up to 300 input characters; 1–12,500 fixed steps, with up to 50,000 for convergence checks. Initial values are limited to ±10¹² and solution magnitudes to 10¹⁰⁰. Equations and computed data remain in your browser. A copied permalink includes your inputs. Use consistent units; no unit conversion is performed.

Differential equation FAQs

What is an ODE?

An ordinary differential equation relates an unknown function to its derivatives with respect to one independent variable. This calculator handles one first-order equation.

What is an initial-value problem?

An initial-value problem combines a differential equation with a starting value, such as y′=y and y(0)=1. The condition selects a solution branch when a unique solution exists.

What is the difference between an exact and numerical solution?

An exact solution is a formula, implicit relation or integral representation that satisfies the equation. A numerical solution approximates values at selected points. Exact mode recognizes supported first-order forms; numerical mode uses Euler, Heun, RK4 or adaptive RK45.

Can this solve second-order equations or systems?

No. This interface accepts one scalar first-order equation whose first derivative occurs linearly. It does not solve systems, second-order equations or boundary-value problems.

What is a slope field?

A slope field draws short segments with slope f(x,y). A solution curve follows those directions through its initial point, helping you see growth, decay and equilibria.

What is a stiff equation?

A stiff equation has dynamics that force an explicit numerical method to take very small steps for stability, even when the visible solution varies slowly. This calculator warns about excessive work, but stiffness detection is heuristic; a specialized implicit solver may be needed.

Why do I need initial conditions?

You can turn off the initial condition in Exact mode to obtain a general solution containing C. A particular solution, numerical trajectory and graph require a starting point. Initial conditions do not guarantee uniqueness for every equation.

How do I enter dy/dx notation?

Enter dy/dx=x+y, y'=x+y, or y'+2y=6. The editor also accepts y(x) in place of y and normalizes 2y and xy. Choose t and T for dT/dt notation. Enter the initial condition in the separate fields.

Which numerical method should I choose?

Adaptive RK45 is the recommended practical choice for smooth nonstiff problems. Euler, improved Euler (Heun) and RK4 use fixed steps and are useful for coursework and convergence comparisons.

Can the calculator integrate backward?

Yes. Set the target below the initial independent value. The solver takes negative steps and reports points in integration order.

Why did the calculation stop?

The equation may be undefined, the solution may approach a singularity, numeric range may be exceeded, or the solver may fail to meet tolerance within its step budget. Interrupted output is labeled and only the completed interval is plotted.

Are my equation and initial values uploaded?

No. Parsing, symbolic transformations, integration, graphing and CSV creation run locally. A permalink contains the input values, so share it only when you intend to share those inputs.

Explore more mathematical tools

Explore more tools