interpolation_lagrange
Build the Lagrange interpolating polynomial from points or a generating function, evaluate it at a specific x, and optionally plot the result.
Instructions
Build the Lagrange interpolating polynomial through a set of points.
Provide either the point values puntos_y or the generating function
func_str evaluated at puntos_x.
Args:
puntos_x: Distinct abscissas of the interpolation points.
x_eval: Optional x where the polynomial is evaluated.
func_str: Optional generating function f(x) for the y values.
puntos_y: Optional y values matching puntos_x one-to-one.
precision: Rounding digits.
plot: When True, also return a PNG plot of the polynomial and points.
Returns:
Dict with the polynomial, its degree, the points table and error
bounds when func_str is provided. With plot=True a list
[dict, Image] is returned instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plot | No | ||
| x_eval | No | ||
| func_str | No | ||
| puntos_x | Yes | ||
| puntos_y | No | ||
| precision | No |