ode_euler
Solves the initial value problem y'(x)=f(x,y), y(x0)=y0 using the explicit Euler method and returns the numerical solution, exact solution when available, and errors.
Instructions
Solve y'(x) = f(x, y), y(x0) = y0 with the explicit Euler method (1st order).
Args: ecuacion_str: Right-hand side f(x, y). x0, y0: Initial condition. xf: Final x (must be > x0). h: Step size (must be positive). tol: Optional tolerance flag for the final error. precision: Rounding digits. plot: When True, also return a PNG plot of the solution.
Returns:
Dict with the numerical solution, exact solution (when available) and
errors. With plot=True a list [dict, Image] is returned instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| h | Yes | ||
| x0 | Yes | ||
| xf | Yes | ||
| y0 | Yes | ||
| tol | No | ||
| plot | No | ||
| precision | No | ||
| ecuacion_str | Yes |