Polynomials

Ruby/GSL represents a polynomial by the GSL::Poly class. The Poly class is a subclass of the GSL::Vector class. To solve an equation -1 + x^5 = 0, first create a GSL::Poly object with the coefficients [-1, 0, 0, 0, 0, 1], as

v = GSL::Poly.new([-1, 0, 0, 0, 0, 1])

and

p v.solve

Ruby/GSL also has a module function GSL::poly_solve function, and the usage is

p Poly.solve([-1, 0, 0, 0, 0, 1])

Methods

GSL::Poly#eval(x)
This evaluates the polynomial represented by the GSL::Poly object which contain the coefficients.
GSL::Poly.solve_quadratic(coefs)
GSL::Poly#.solve_quadratic
GSL::Poly.solve_cubic(coefs)
GSL::Poly#.solve_cubic
GSL::Poly.complex_solve
GSL::Poly#.solve
GSL::Poly.dd_init(xa, ya)
GSL::Poly::DividedDifferenceRepresentation#eval(x)
GSL::Poly::DividedDifferenceRepresentation#taylor(xp)

back