POLY Function

Standard Library function that evaluates a polynomial function of a variable.

Usage

result = POLY(x, coefficients)

Input Parameters

x — The variable that is evaluated. May be a scalar or array.

coefficients — A vector containing one more element than the degree of the polynomial function. These elements are the coefficients of the polynomial equation that is used by POLY.

Returned Value

result — The values calculated from the polynomial function of x.

Keywords

None.

Discussion

POLY evaluates a polynomial function of a variable according to the formula:

result = c0 + c1x + c2x2 + ... + cn–1xn–1

where n is the dimension of the polynomial c, and c0 through cn–1 are the coefficients.

POLY returns a variable with the same dimensions as x. Each element of the result is equal to the computed value of c0 + c1x + c2x2 + cixi for each element of x.

The POLY function can be used in conjunction with POLY_FIT and POLYFITW, which both return the coefficients of a polynomial function fitted through data.

Example

x = 2
c = [1, 2, 3]
func = POLY(x, c)
PRINT, func
; PV-WAVE prints: 17

See Also

POLY_2D, POLY_FIT, POLYFITW, LAGRANGE