comp • gb.gsl • polynomial • solve

Polynomial.Solve (gb.gsl)

Function Solve ( [ Complex As Boolean ] ) As Array

Return the polynomial roots, i.e. solve the following equation: P(x) = 0, provided that the polynomial coefficient are reals.

  • If Complex is TRUE, then all complex roots are returned.

  • If Complex is FALSE, then only the real roots are returned.

If no root is found, then a void array is returned.

If the polynomial has one of the following forms:

  • x^3 + a*x^2 + b*x + c = 0

  • a*x^2 + b*x + c = 0

Then the algorithm will be as exact as possible.

Otherwise, a approximative algorithm will be used, that may not converge. In that case, an error is raised.

The case of coincident roots is not considered special. For example, the equation (x-1)^3 = 0 will have three roots with exactly equal values.