Clamps Dictionary
L
lagrange
Function
(lagrange &rest coords)
Return the function of a lagrange interpolating polynomial for the given coords. This is a generalization of fit-quadratic, fitting a polynomial function to the given points. The order of the polynomial will be 1- the number of given coordinate pairs.
Arguments
coords |
A list of alternating x and y values to fit. |
Example
(let ((fn (lagrange 1 3 7 6.8 10 1.2 14 14))) (loop for x in '(1 7 10 14) collect (funcall fn x)))) ; => (3.0 6.8 1.2 14.0) (plot (lagrange 1 3 7 6.8 10 1.2 14 14))