b2KIT

Differential Equation Solver

Solve and visualize first and second-order ODEs numerically. Supports Euler, RK4 methods with phase portraits.

Tested tool guide Tested browser tools Checked August 16, 2026

What Differential Equation Solver does, with a checked example

Explore an initial-value problem by entering an ordinary differential equation, its starting conditions, an interval, and a numerical step size. The solver advances the solution with either Euler's method or fourth-order Runge-Kutta (RK4), then visualizes the resulting trajectory and, where applicable, its phase portrait. The main surprise is that the result is not a symbolic formula. It is a sequence of approximated values whose accuracy depends strongly on the chosen method and step size.

Worked example

A concrete input and expected output from the current implementation.

Input

Equation: y' = y
Initial condition: y(0) = 1
Interval: 0 to 0.2
Step size: 0.1
Method: Euler

Expected output

x = 0, y = 1
x = 0.1, y = 1.1
x = 0.2, y = 1.21

Euler's update is y_next = y + h f(x,y). The first step gives 1 + 0.1(1) = 1.1, and the second gives 1.1 + 0.1(1.1) = 1.21.

How the result is produced

1

Euler stepping

Euler's method evaluates the derivative at the current solution point and follows that slope for one full step. For y' = f(x,y), each update is y_next = y + h f(x,y). It is easy to inspect, but its accumulated error can be conspicuous when the interval is long, the step is large, or the solution changes rapidly.

2

RK4 and phase space

RK4 samples four slopes during each step and combines them into one update, usually giving a closer approximation than Euler at the same step size. A second-order equation can be viewed as two linked first-order equations by setting v = y'. This state representation supports a phase portrait showing y against its derivative rather than against the independent variable.

Good uses

  • Compare Euler and RK4 trajectories for the same initial-value problem and step size.
  • Estimate a first-order model, such as exponential growth or cooling, when a symbolic solution is unnecessary.
  • Inspect oscillation or stability in a second-order equation through its solution curve and phase portrait.

Limits and checks

  • A smooth plotted curve does not make the numerical values exact; it connects approximations produced at discrete steps.
  • Changing the step size can change the result substantially, especially for Euler's method or a rapidly varying solution.
  • A phase portrait shows relationships between state variables, so its horizontal axis need not represent time or the equation's independent variable.

Common questions

Does this solver find the exact closed-form solution?

No. Euler and RK4 generate numerical approximations from an initial condition. They can show how a solution develops over the requested interval, but they do not prove an identity or return a general formula containing arbitrary constants. Use a symbolic differential-equation system when an exact form is required.

Why do Euler and RK4 give different curves?

They approximate each step differently. Euler uses one slope from the start of the step, while RK4 combines four slope evaluations. Their results should generally move closer as the step size is reduced for a well-behaved problem. Persistent divergence can indicate an inadequate step size, instability, a singularity, or an incorrectly entered equation or initial condition.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools