polynomial

Syntax

polynomial(X, coeffs)

Arguments

X is a scalar/vector.

coeffs is a vector indicating the coefficients of a polynomial.

Details

Apply the polynomial coefficient vector coeffs on each element of X. Return a vector of the same length as X.

Examples

The following example calculates \(1+2*x + 3*x^2\) for each number from 1 to 10.

$ polynomial(1..10, 1 2 3);
[6,17,34,57,86,121,162,209,262,321]