
"Q[i][X]"
=======

Polynomial Library for the Q Programming Language.
Copyright (C) 2006-7  Rob Hubbard

"Q[i][X]" is a polynomial library for the Q programming language. It provides
functions such as polynomial arithmetic and polynomial factorisation.

This package contains polynomial.q, which contains the polynomial functions
and alg_matrix.q, which provides additional functions for matrix arithmetic,
including inverses. (The latter is currently experimental.) These modules are
designed to work with the rational.q module (now part of the standard Q
library).

The documentation of "Q[i][X]" can be found in the accompanying polynomial.pdf
file.

Here are a few examples, see polynomial.pdf for many more:

Create a polynomial:

==> def P = poly_with_coeffs [9%8,-21%2,177%16,9,-189%16,-15%8,3] ; P
poly_lambda '(\X . 3*X^6-15%8*X^5-189%16*X^4+9*X^3+177%16*X^2-21%2*X+9%8)

Try to factorise into monic rational factors:

==> monic_rat_factorise P
(3, //the remaining constant
[(poly_lambda '(\X . X+3%2),1),(poly_lambda '(\X . X-1%8),1),
(poly_lambda '(\X . X-1),2),(poly_lambda '(\X . X^2-2),1)])

Try to factorise into integral factors:

==> over_int_factorise P
(3%16, //the remaining constant
[(poly_lambda '(\X . X^2-2),1),(poly_lambda '(\X . X-1),2),
(poly_lambda '(\X . 8*X-1),1),(poly_lambda '(\X . 2*X+3),1)])

Find roots:

==> solve P
(true, //all roots found
[(-3%2,1),(1%8,1),(1,2)], //rational roots with multiplicities
[1.4142135623731,-1.4142135623731+1.73185491414387e-016*i],
  //approximate irrational roots
poly_lambda '(\X . 3))) //remaining factor
