Enter ODE Inputs
Accepted functions and notation
Use variables x and y in the derivative. Use x only in the exact solution.
Supported functions: sin, cos, tan, exp, log, sqrt, abs, pow, min, max, round, floor, and ceil. Use ^ for powers.
Example Data Table
Sample problem: y' = y - x^2 + 1, y(0)=0.5, step h=0.2, method RK4.
| Step | x | Approximate y | Exact y | Absolute Error |
|---|---|---|---|---|
| 0 | 0.0 | 0.500000 | 0.500000 | 0.000000 |
| 1 | 0.2 | 0.829293 | 0.829299 | 0.000006 |
| 2 | 0.4 | 1.214076 | 1.214088 | 0.000012 |
| 3 | 0.6 | 1.648922 | 1.648941 | 0.000019 |
| 4 | 0.8 | 2.127203 | 2.127230 | 0.000027 |
| 5 | 1.0 | 2.640823 | 2.640859 | 0.000036 |
Formula Used
General initial value problem
Given: y' = f(x, y), with y(x₀) = y₀. The solver advances numerically from x₀ to the target x using an explicit update rule.
Forward Euler
yₙ₊₁ = yₙ + h f(xₙ, yₙ)
Heun Method
k₁ = f(xₙ, yₙ), k₂ = f(xₙ + h, yₙ + h k₁), then yₙ₊₁ = yₙ + h(k₁ + k₂)/2
Explicit Midpoint
k₁ = f(xₙ, yₙ), k₂ = f(xₙ + h/2, yₙ + h k₁/2), then yₙ₊₁ = yₙ + h k₂
Ralston Method
k₁ = f(xₙ, yₙ), k₂ = f(xₙ + 2h/3, yₙ + 2h k₁/3), then yₙ₊₁ = yₙ + h(k₁/4 + 3k₂/4)
Runge–Kutta 4
yₙ₊₁ = yₙ + h(k₁ + 2k₂ + 2k₃ + k₄)/6, where k₁, k₂, k₃, and k₄ sample the slope across the step.
Error calculation
If an exact solution is provided, the solver computes |y_exact(xₙ) - y_approx(xₙ)| at every row, plus final, mean, and maximum absolute errors.
How to Use This Calculator
- Enter the derivative function
f(x,y). - Optionally enter the exact solution
y(x)for error tracking. - Provide the initial point
x₀and initial valuey₀. - Set the target x-value and the step size
h. - Choose an explicit method such as Euler or RK4.
- Select decimal precision and click Solve ODE.
- Review the summary cards, graph, and full solution table.
- Use the CSV or PDF buttons to export the computed results.
Frequently Asked Questions
1) What is an explicit ODE solver?
It estimates solution values step by step from an initial condition. Each new point is computed directly from already known values, so no simultaneous algebraic system must be solved at every step.
2) When should I use Euler instead of RK4?
Use Euler for quick checks, teaching, or rough trend inspection. Use RK4 when you want much better accuracy with the same basic setup, especially over larger intervals or moderate nonlinear behavior.
3) Why does step size matter so much?
The step size controls how often the slope is sampled. Smaller steps usually improve accuracy, but they increase runtime and table length. Large steps may hide important curvature or create numerical instability.
4) Can I solve nonlinear equations here?
Yes. The derivative may be nonlinear in x, y, or both, such as y - x^2 + 1 or sin(x) - y^2. The method still advances numerically from the initial condition.
5) What does the exact solution field do?
It lets the calculator compare the numerical approximation with a known closed-form answer. That enables row-by-row absolute error, final error, mean error, and a second line on the graph.
6) Can I integrate backward in x?
Yes. Enter a target x-value smaller than the initial x-value. The solver automatically reverses the marching direction while still using the positive step size you provide in the form.
7) What functions can I type in the expression box?
You can use x, y, numbers, parentheses, powers, and functions such as sin, cos, tan, exp, log, sqrt, abs, pow, min, max, round, floor, and ceil.
8) Why might my result look unstable?
Some ODEs are stiff or highly sensitive. Explicit methods can become unstable if the step is too large. Try a smaller step, compare methods, and inspect the plotted curve for oscillations or divergence.