controls type of output
order of derivatives (default = 0)
Value of the polynomial, evaluated at x
import mir.math.common: approxEqual; double[] x = [3.0, 4.5, 1.9, 2]; alias f = (x) => 3.0 + 4.5 * x^^1 + 1.9 * x^^2 + 2 * x^^3; alias df = (x) => 4.5 + 2 * 1.9 * x^^1 + 3 * 2 * x^^2; alias d2f = (x) => 2 * 1.9 + 6 * 2 * x^^1; assert(poly(3.3, x).approxEqual(f(3.3))); assert(poly(7.2, x).approxEqual(f(7.2))); assert(poly!1(3.3, x).approxEqual(df(3.3))); assert(poly!1(7.2, x).approxEqual(df(7.2))); assert(poly!2(3.3, x).approxEqual(d2f(3.3))); assert(poly!2(7.2, x).approxEqual(d2f(7.2)));
Evaluate polynomial.
Coefficients assumed to be in the order a0 + a1 * x ^^ 1 + ... + aN * x ^^ N