root_newton_raphson
Find a root of f(x)=0 using Newton-Raphson with numeric derivative, returning the root, convergence status, iteration table, and optional plot.
Instructions
Find a root of f(x) = 0 with the Newton-Raphson method (numeric derivative).
Args: func_str: Math expression in x. x0: Initial guess. tol: Convergence tolerance. max_iter: Maximum iterations. precision: Rounding digits. plot: When True, also return a PNG plot of f(x) and the root.
Returns:
Dict with the root, iteration table and convergence flag. With
plot=True a list [dict, Image] is returned instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x0 | Yes | ||
| tol | No | ||
| plot | No | ||
| func_str | Yes | ||
| max_iter | No | ||
| precision | No |