What this calculator does
This tool numerically solves a first-order ordinary differential equation of the form \(y' = F(x, y)\) with the initial condition \(y(x_0) = y_0\), using the classic forward (explicit) Euler method. It marches from \(x_0\) to \(x_n\) in \(n\) equal steps and returns the step size \(h\), a full table of \((x, y)\) approximations, and the approximate endpoint value \(y(x_n)\).
How to use it
Enter the right-hand side \(F(x, y)\) as a math expression in the variables \(x\) and \(y\) (operators + - * / ^, parentheses, and functions such as sin, cos, exp, log/ln, sqrt, abs, plus the constants pi and e). Set the starting point \(x_0\), the initial value \(y_0\), the endpoint \(x_n\), and choose the number of subdivisions \(n\). Larger \(n\) gives a smaller step and generally a more accurate result.
The formula explained
The step size is $$h = \frac{x_n - x_0}{n},$$ and the grid points are \(x_k = x_0 + k \cdot h\). Starting from \(y_0\), each new value is computed as $$y_{k+1} = y_k + h \cdot F(x_k, y_k):$$ the slope \(F\) is sampled at the current point and used to take a straight-line step of width \(h\). The method is first-order accurate, so the global error scales like \(O(h)\).
Worked example
For \(y' = 1 - y^2\) with \(x_0 = 0\), \(y_0 = 0\), \(x_n = 1\) and \(n = 5\), the step size is \(h = 0.2\). The iteration gives \(y_1 = 0.2\), \(y_2 = 0.392\), \(y_3 = 0.5612672\), \(y_4 \approx 0.6982668\), \(y_5 \approx 0.8007513\). So the Euler estimate at \(x = 1\) is about \(0.8008\). The exact solution is \(\tanh(x)\), so \(\tanh(1) \approx 0.7616\); increasing \(n\) drives the Euler value toward this true value.
FAQ
Why is my answer different from the exact solution? Euler's method is only first-order accurate. The error shrinks roughly in proportion to \(h\), so picking a larger \(n\) (smaller step) improves accuracy.
Can \(x_n\) be smaller than \(x_0\)? Yes. The step size \(h\) becomes negative and the same recurrence integrates backwards.
What functions are supported? sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log/ln, log10, sqrt and abs, along with the constants pi and e.