Chapter 9. Polynomials in GEL
Prev |  | Next

# Chapter 9. Polynomials in GEL

Currently Genius can handle polynomials of one variable written out as vectors, and do some basic operations with these. It is planned to expand this support further.

## Using Polynomials

Currently polynomials in one variable are just horizontal vectors with value only nodes. The power of the term is the position in the vector, with the first position being 0. So,

    [1,2,3]

translates to a polynomial of

    1 + 2*x + 3*x^2

You can add, subtract and multiply polynomials using the `AddPoly`, `SubtractPoly`, and `MultiplyPoly` functions respectively. You can print a polynomial using the `PolyToString` function. For example,

    PolyToString([1,2,3],"y")

gives

    3*y^2 + 2*y + 1

You can also get a function representation of the polynomial so that you can evaluate it. This is done by using `PolyToFunction`, which returns an anonymous function.

    f = PolyToFunction([0,1,1])
    f(2)

It is also possible to find roots of polynomials of degrees 1 through 4 by using the function `PolynomialRoots`, which calls the appropriate formula function. Higher degree polynomials must be converted to functions and solved numerically using a function such as `FindRootBisection`, `FindRootFalsePosition`, `FindRootMullersMethod`, or `FindRootSecant`.

See the section called “Polynomials” in the function list for the rest of functions acting on polynomials.

Prev |  | Next
Linear Algebra | Home | Chapter 10. Set Theory in GEL