ode_heun
Solves first-order ODE initial value problems with Heun's predictor-corrector method, returning numerical and exact solutions, error estimates, and an optional plot.
Instructions
Solve y'(x) = f(x, y), y(x0) = y0 with Heun's predictor-corrector method (2nd 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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"ecuacion_str": "<ecuacion_str>",
"x0": "<x0>",
"y0": "<y0>",
"xf": "<xf>",
"h": "<h>"
},
"name": "ode_heun"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| h | Yes | ||
| x0 | Yes | ||
| xf | Yes | ||
| y0 | Yes | ||
| tol | No | ||
| plot | No | ||
| precision | No | ||
| ecuacion_str | Yes |