Forum archive 2000-2006

Michael Gage - horner

Michael Gage - horner

by Arnold Pizer -
Number of replies: 0
inactiveTopichorner topic started 8/28/2001; 8:27:47 PM
last post 8/28/2001; 8:27:47 PM
userMichael Gage - horner  blueArrow
8/28/2001; 8:27:47 PM (reads: 1949, responses: 0)

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.

 

<| Post or View Comments |>