public class Polynomial extends AbstractPNode
Monomial
s, but can be any AbstractPNode
. The order of the terms is specified by the total ordering.pc
Modifier and Type | Method and Description |
---|---|
PNodeI |
add(PNodeI node)
Adds a node to this one.
|
PNodeI |
add(Polynomial p) |
int |
compareTo(PNodeI node)
Compares this expression to argument.
|
int |
compareTo(Polynomial p) |
void |
convertToPolyArray(java.lang.String var,
java.util.Map<java.lang.Integer,PNodeI> polyArray)
Internal method for extracting coefficients
|
PNodeI |
div(PNodeI node)
Divides this by the argument.
|
boolean |
equalsPNode(PNodeI node)
True is nodes represent the same parse trees
|
PNodeI |
expand()
complete expansion. (1+x)^2 --> 1+2*x+x^2
|
int |
getNTerms()
The number of terms which make up the polynomial.
|
PNodeI |
getTerm(int i)
Get the n-th term
|
PNodeI |
mul(PNodeI node)
Multiplies this by the argument.
|
PNodeI |
negate()
negates node i.e.
|
PNodeI |
sub(PNodeI node)
Subtracts the argument from this.
|
PNodeI |
sub(Polynomial p) |
Node |
toCompactNode()
A more efficient representation.
|
Node |
toNode()
Converts the node to standard Jep format.
|
java.lang.String |
toString()
Produces a string representation of the argument.
|
static PNodeI |
valueOf(PolynomialCreator pc,
PNodeI[] terms) |
invert, isOne, isZero, pow
public static PNodeI valueOf(PolynomialCreator pc, PNodeI[] terms) throws ParseException
ParseException
public PNodeI add(PNodeI node) throws ParseException
PNodeI
add
in interface PNodeI
add
in class AbstractPNode
ParseException
public PNodeI sub(PNodeI node) throws ParseException
PNodeI
sub
in interface PNodeI
sub
in class AbstractPNode
ParseException
public PNodeI add(Polynomial p) throws ParseException
ParseException
public PNodeI sub(Polynomial p) throws ParseException
ParseException
public PNodeI negate() throws ParseException
PNodeI
ParseException
public PNodeI mul(PNodeI node) throws ParseException
PNodeI
mul
in interface PNodeI
mul
in class AbstractPNode
ParseException
public PNodeI div(PNodeI node) throws ParseException
PNodeI
div
in interface PNodeI
div
in class AbstractPNode
ParseException
public boolean equalsPNode(PNodeI node)
PNodeI
equalsPNode
in interface PNodeI
equalsPNode
in class AbstractPNode
public int compareTo(PNodeI node)
PNodeI
compareTo
in interface PNodeI
compareTo
in interface java.lang.Comparable<PNodeI>
compareTo
in class AbstractPNode
public int compareTo(Polynomial p)
public java.lang.String toString()
PNodeI
public Node toNode() throws ParseException
PNodeI
ParseException
public Node toCompactNode() throws ParseException
ParseException
public PNodeI expand() throws ParseException
PNodeI
ParseException
public int getNTerms()
public PNodeI getTerm(int i)
i
- index of termspublic void convertToPolyArray(java.lang.String var, java.util.Map<java.lang.Integer,PNodeI> polyArray) throws ParseException
PNodeI
var
- variable namepolyArray
- results added to this mapParseException
Copyright © 2018 Singular Systems http://www.singularsys.com/jep