Numerical ODE Solver

Differential Equation Solver

Solve first-order and second-order ordinary differential equations numerically using the fourth-order Runge-Kutta method. Enter your equation, initial conditions, interval and number of steps.

Calculate a Differential Equation

Enter the right side of y' = f(x,y). Example: x + y.
Required for second-order equations.

Examples

Example 1
y' = x + y
x₀ = 0, y₀ = 1
Example 2
y' = 2x - y
x₀ = 0, y₀ = 1
Example 3
y' = sin(x) - y
x₀ = 0, y₀ = 0
Example 4
y'' = -y
x₀ = 0, y₀ = 1, y′₀ = 0

Supported Functions

sin(x), cos(x), tan(x), sqrt(x), abs(x), exp(x), ln(x), log(x), log10(x), asin(x), acos(x), atan(x), floor(x), ceil(x)

Variables

First order: x, y
Second order: x, y, yp

What Is a Differential Equation?

A differential equation contains an unknown function and one or more derivatives of that function. Differential equations are used throughout mathematics, physics, engineering, biology and economics.

First-Order Differential Equation

A first-order initial-value problem can be written as:

y' = f(x,y)

y(x₀) = y₀

Second-Order Differential Equation

A second-order initial-value problem can be written as:

y'' = f(x,y,y')

y(x₀) = y₀
y′(x₀) = y′₀

How RK4 Works

The fourth-order Runge-Kutta method calculates several estimates of the derivative during every numerical step and combines them to obtain a more accurate approximation of the next solution value.

y(next) = y + h/6 × (k₁ + 2k₂ + 2k₃ + k₄)

Example

For the equation y' = x + y with y(0) = 1, enter:

Equation: x + y
Initial x₀: 0
Initial y₀: 1
End x: 5
Steps: 100

Frequently Asked Questions

An ordinary differential equation, or ODE, contains derivatives with respect to one independent variable.

RK4 means fourth-order Runge-Kutta. It uses four derivative estimates during each numerical step.

First-order equations can use x and y. Second-order equations can use x, y and yp. The variable yp represents y′.

Yes. Select Second Order, enter -y, set y₀ and y′₀, and select the desired interval and number of steps.