Equana

Back to Polynomials

polyval

Evaluate a polynomial at given point(s).

Syntax

polyval(coeffs, x) → r

Backends

TypeScriptnumwa

Description

Evaluate a polynomial at given point(s).

Parameters

NameDescription
coeffsPolynomial coefficients (descending order)
xEvaluation point (scalar or array)

Returns

Polynomial value(s) at x

Examples

Try It
>> polyval([1, 0, -1], 2)
3  (evaluates x² - 1 at x=2)
Try It
>> polyval([1, 0], [1, 2, 3])
[1, 2, 3]