comp • gb.gsl • polynomial • tostring

Polynomial.ToString (gb.gsl)

Function ToString ( [ Local As Boolean ] ) As String

Return the string representation of a polynomial.

  • If Local is TRUE, then localized numbers are printed.

  • If Local is FALSE (the default), then the returned string can be evaluated by Eval.

Examples

Dim P As Polynomial = [1, 2, 1, 2i]
Dim A As Matrix = [[1, 0], [0, -1]]

' Localized string representation
Print P.ToString(True)
' String representation that can be evaluated
Print P.ToString(False)
' Compute P(A)
Print Eval(P.ToString(False), ["x": A])
2ix^3+x^2+2x+1
2i*x^3+x^2+2*x+1
[[4+2i 0][0 -2i]]