Euler Method (1st-Order ODE Solver)

Integrate an initial-value problem \(\frac{dy}{dx} = f(x, y),\ y(x_0) = y_0\) step by step using tangent-line extrapolation \(y_{i+1} = y_i + h\,f(x_i, y_i)\).

Euler Approximation vs Exact Solution

Exact y(x) Euler yᵢ

Step-by-Step Table

Global Truncation Error \(|y_{\text{exact}} - y_{\text{euler}}|\)

Scilab & Python Code (Minimal Exam-Ready)

Euler Update Formula

Truncating the Taylor series \(y(x+h) = y(x) + h y'(x) + \frac{h^2}{2}y''(\xi)\) after the linear term gives

$$ y_{i+1} = y_i + h\,f(x_i, y_i), \qquad x_{i+1} = x_i + h. $$

Error Scaling

  • Local truncation error: \(O(h^2)\) per step.
  • Global truncation error: Accumulates over \(N \propto 1/h\) steps to \(O(h)\) (first-order accurate). Halving \(h\) cuts the final error roughly in half.