Horner

From WeBWorK_wiki
Revision as of 17:43, 18 November 2009 by Aubreyja (talk | contribs) (from ur manpages)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

horner

Description

Defines a polynomial passing through specified points (a Newton polynomial) and returns an efficient subroutine for evaluating that polynomial (using Horner's method).

Syntax

$fn = horner([$x0,$x1,$x2...],[$q0,$q1,$q2...]);

Params

A pair of references to arrays representing the x values and y values respectively of the interpolated points. The x values must be strictly increasing.

Returns

A non-parametric function subroutine representing the newton polynomial
&$fn($x) = $q0 + $q1*($x-$x0) +q2*($x-$x1)*($x-$x0);

Notes

This macro is defined in [PGnumericalmacros.pl].