Functions Index :: P :: Polynomial

[<< up one level]


numeric :: powseries


Polynomial(float x, string coef_func, int start_index, int end_index, int "increment", string "coef_args")


Returns an arbitrary polynomial of x.

The polynomial is generated by summing the terms coef_func(index, coef_args) * Pow(x, index)) for all indexes in the range [start_index .. end_index), ie end_index is not included.

The function is a special case of the more general PowSeries function, where the power_func argument is the Self function.

See PowSeries for an explanation of the arguments.


# Calculate the polynomial (2 + bn)*x2n starting from n=0 and taking 10 terms for value of x = 5.4 and b = 2.3

function mycoef(int i, float b) { return 2 + b * Int(i / 2) }

# Since i increases at step of 2, i/2 will increase at steps of 1

p1 = Polynomial(5.4, "mycoef", 0, 20, 2, String(2.3))


[<< top]