Skip to content
Saha Hesap

First Order Differential Equation: Numerical Solution

Solves y′ = f(x,y) with an initial value using fourth order integration and compares two step counts.

Solving from an initial value

Supply an equation y′=f(x,y) and an initial condition y(x₀)=y₀. The tool integrates to the target point using a method of order four. Every step samples the slope at its start, twice at its midpoint and once at its end.

Example

For y′=2x with y(0)=1, direct integration gives y=x²+1. The result at x=2 is 5. Known analytical solutions are useful checks on a numerical calculation.

Choosing a step count

The calculation runs with the entered step count and again with twice that count. The main result uses the finer grid. Their difference is shown but is not a rigorous error bound. Stiff equations and singularities need other methods. Systems and boundary value problems are outside the scope of this tool.

Equation and step size

Enter only the right side of the equation. For y′=x, enter x. The initial condition is the value of y at the starting point, not its slope. A target before the initial point produces a negative step, indicating backward integration. Keep the units of the variables consistent in your model.

For example, solve y′=x with y(0)=2 up to x=2. Integration gives y=x²/2+2, so the target value is 4. Selecting 2 coarse steps gives step size 1. In the first step the slopes are 0, 0.5, 0.5 and 1. The weighted increment is (0+2×0.5+2×0.5+1)/6 = 0.5, giving y=2.5. The second step ends at 4. The main result uses 4 steps of size 0.5.

Agreement between the two grids in this example does not promise the same performance for every equation. Increase the step count and compare again. A smaller numerical step cannot remove uncertainty in initial conditions or coefficients. Inspect abrupt changes and undefined points in the interval separately. A finite output is not proof that a solution exists throughout the interval.

Related calculators

Found a mistake or something missing?

If a value looks wrong, a size is missing or you need a feature, write to us and we will fix it.

Send an email