Package com.singularsys.extensions.polynomials
PolynomialCreator pc = new PolynomialCreator(jep); Node simp = pc.simplify(node); Node expand = pc.expand(node); boolean flag = pc.equals(node1,node2); int res = pc.compare(node1,node2); PNodeI poly = pc.createPoly(node);
How it works
The basic idea is to reduce each equation to a canonical form based on a total ordering of the terms.
For example a polynomial in x
will always be in the form
a+b x+c x^2+d x^3.
This makes comparison of two polynomials easy as it is just necessary to compare term by term, whereas it is dificult
to compare x^2-1
with (x+1)*(x-1)
without any simplification or reordering is tricky.
As an illustration some of the rules for the ordering are
0<1<2
, 5<x
, x<x^2<x^3
, x<y
.
A polynomial is constructed from a set of monomials by arranging the monomials in order. Likewise a monomial is constructed from a set of variables by arranging the variables in name order.
The algorithm can also work with non-polynomial equations. Functions are order by the name of the function and the ordering of their arguments.
Hence cos(x)<sin(x)<sin(y)
.
- Since:
- Jep 3.5 / Extensions 2.0
- See Also:
- Polynomials documentation
-
Interface Summary Interface Description PNodeI An element in a polynomial representation of an expression. -
Class Summary Class Description AbstractPNode Default methods, when more specific methods do not work.Coeffs Jep function to extract array of coefficients from a polynomial.Compare Thecompare(x,y)
command.Expand The expand(x) command.Monomial Represents an immutable monomial a x^i * y^j * ... * z^k, a constant.MutableMonomial A mutable monomial representing a * x^i * y^j * ... * z^k.MutablePolynomial A mutable polynomial representing a + b + c.PConstant Represents a constant.PFunction Represents a function.Polynomial Represents a polynomial.PolynomialCreator A system for symbolic simplification, expansion and comparision based on conversion to a canonical polynomial representation.POperator Represents an operator.PVariable Represents a variable.Simplify The simplify(x) command.SymbolicEquals Thesymequals(x,y)
command.