|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.perisic.ring.Ring
com.perisic.ring.PolynomialRing
public class PolynomialRing
Multivariate Polynomials over a Ring. Example of use (Polynomials of Z[a][b]):
import com.perisic.ring.*;
import java.math.*;
public class PolynomialRingExample1 {
public static void main(String [] args) {
PolynomialRing P = new PolynomialRing(Ring.Z,"a,b");
RingElt a = P.map("a^2 - b^2");
RingElt b = P.map("(a - b)^2");
RingElt d = P.gcd(a,b);
System.out.println("gcd("+a+","+b+") = "+d+" (in "+P+")");
}
}
writes "gcd(a^2 + -1*b^2,a^2 + -2*a*b + b^2) = -1*a + b (in Z[a][b])" to the output.
Ring.Z| Field Summary |
|---|
| Fields inherited from class com.perisic.ring.Ring |
|---|
C, F2, Q, R, Z |
| Constructor Summary | |
|---|---|
PolynomialRing(Ring R,
java.lang.String variables)
Constructs a new polynomial ring over one or more variables. |
|
PolynomialRing(Ring R,
java.lang.String[] variables)
Constructs a new polynomial ring over variables.length variables. |
|
| Method Summary | |
|---|---|
RingElt |
add(RingElt p,
RingElt q)
Returns the sum of the parameters. |
RingElt |
construct(int[] exponents,
java.lang.Object[] coefficients)
Returns a Polynomial by matching exponents to coefficients. |
RingElt |
construct(int exponent,
java.lang.Object coefficient)
Returns the Polynomial coefficient * X^exponent, where X is the variable of this PolynomialRing. |
RingElt |
contents(RingElt b)
Returns the contents of b. |
int |
degree(RingElt b)
The degree of b, where b is considered as an univariate polynomial. |
RingElt[] |
divmod(RingElt p,
RingElt q)
Returns an array { p/q, p%q }. |
RingElt |
ediv(RingElt p,
RingElt q)
Returns p/q (Euclidian division). |
boolean |
equals(java.lang.Object ob)
true if coefficient ring and variable are the same. |
boolean |
equalZero(RingElt b)
Returns true if b is equals to zero, false otherwise. |
RingElt[] |
extendedGcd(RingElt a,
RingElt b)
Extended greatest common divisor of the parameters. |
RingElt |
gcd(RingElt p,
RingElt q)
Greatest common divisor of the parameters. |
RingElt |
getCoefficientAt(int i,
RingElt b)
Returns the coefficient for x^i of b (or null), where b is considered as an univariate polynomial over x. |
Ring |
getCoefficientRing()
Returns the Ring R sucht that the PolynomialRing is the Ring R[x] where x is the variable of the PolynomialRing. |
RingElt |
getTrueCoefficientAt(int i,
RingElt b)
Returns the coefficient for x^i of b, where b is considered as an univariate polynomial over x. |
java.lang.String |
getVariable()
Returns the variable x sucht that the PolynomialRing is the Ring R[x] where R is a Ring. |
RingElt |
globalLeadingCoefficient(RingElt b)
Determins recursively the global leading Coefficient of the polynomial over all variables. |
RingElt |
inv(RingElt b)
Returns 1/b as an element of this Ring. |
boolean |
isEuclidian()
true if the coefficient ring is a field. |
boolean |
isUFD()
true if the coefficient ring and therefore also the polynomial ring is an uniqe factorization domain. |
RingElt |
leadingCoefficient(RingElt b)
The leading coefficient of b, where b is considered as an univariate polynomial. |
RingElt |
map(RingElt a)
Maps a RingElt of various other rings to this ring. |
RingElt |
map(java.lang.String a)
Maps a String to an element of this PolynomialRing. |
RingElt |
mod(RingElt p,
RingElt q)
Returns p%q (remainder of Euclidian division). |
RingElt |
mult(RingElt p,
RingElt q)
Returns the product of the parameters. |
RingElt |
neg(RingElt b)
Returns -b as an element of this Ring. |
RingElt |
normalize(RingElt b)
Returns a normal form for the polynomial b. |
RingElt |
one()
Returns 1 as an element of this Ring. |
RingElt |
primitivePart(RingElt a)
Returns b/contents(b). |
RingElt |
tdiv(RingElt p,
RingElt q)
Returns p/q (true division). |
java.lang.String |
toString()
Returns a the polynomial ring in the format R[x1][x2]...[xn]. |
RingElt |
zero()
Returns 0 as an element of this Ring. |
| Methods inherited from class com.perisic.ring.Ring |
|---|
div, eltToString, equal, evaluatePolynomial, isField, map, map, map, pow, pow, sub |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PolynomialRing(Ring R,
java.lang.String variables)
P = new PolynomialRing(Ring.Z, "a,x1,x2,x3,y"); generates
P = Z[a][x1][x2][x3][y].
S = new PolynomialRing(new QuotientField(P),"W");
with P as before, generates
S = Z(a,x1,x2,x3,y)[W].
S = new PolynomialRing(R,"a,b"); is the same as
T = new PolynomialRing(R,"a"); S = new PolynomialRing(T,"b");
variables - is a comma separated list of alphanumeric characters.R - is the (global) Coefficient Ring
public PolynomialRing(Ring R,
java.lang.String[] variables)
variables - an String array of alphanumeric characters.R - is the (global) Coefficient RingPolynomialRing(Ring,java.lang.String).| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isEuclidian()
isEuclidian in class Ringpublic boolean isUFD()
isUFD in class Ringpublic Ring getCoefficientRing()
public java.lang.String getVariable()
public RingElt add(RingElt p,
RingElt q)
add in class Ringp - a RingElt which can be mapped via map(RingElt) to an element of this ring.q - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt mult(RingElt p,
RingElt q)
mult in class Ringp - a RingElt which can be mapped via map(RingElt) to an element of this ring.q - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt[] divmod(RingElt p,
RingElt q)
Note: For non Euclidian rings this method still works if the leading coefficient of q is a unit in the Coefficient Ring.
p - a RingElt which can be mapped via map(RingElt) to an element of this ring.q - a RingElt which can be mapped to via map(RingElt) an element of this ring.
public RingElt ediv(RingElt p,
RingElt q)
ediv in class Ringp - a RingElt which can be mapped via map(RingElt) to an element of this ring.q - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt tdiv(RingElt p,
RingElt q)
tdiv in class Ringp - a RingElt which can be mapped via map(RingElt) to an element of this ring.q - a RingElt which can be mapped via map(RingElt) to an element of this ring.
RingException - for p%q != 0.
public RingElt mod(RingElt p,
RingElt q)
mod in class Ringp - a RingElt which can be mapped via map(RingElt) to an element of this ring.q - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt gcd(RingElt p,
RingElt q)
gcd in class Ringp - a RingElt which can be mapped via map(RingElt) to an element of this ring.q - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt[] extendedGcd(RingElt a,
RingElt b)
a - a RingElt which can be mapped via map(RingElt) to an element of this ring.b - a RingElt which can be mapped via map(RingElt) to an element of this ring.
RingException - if the coefficient ring is not a field.public RingElt leadingCoefficient(RingElt b)
b - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public int degree(RingElt b)
b - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt getCoefficientAt(int i,
RingElt b)
null
is returned. If i > n or i < 0 a java.lang.IndexOutOfBoundException
is thrown.
Note: If the coefficient is 0 then null is returned!
b - a RingElt which can be mapped via map(RingElt) to an element of this ring.
IndexOutOfBoundException - for i < 0 or i > degree(b).
public RingElt getTrueCoefficientAt(int i,
RingElt b)
b - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt normalize(RingElt b)
b - A RingElt which can be mapped via map(RingElt) to an element of this ring.
RingException - if the polynomial is not (consindered as multivariate)
a polynomoial over a field or
Z.public RingElt globalLeadingCoefficient(RingElt b)
b - A RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt one()
one in class Ringpublic RingElt zero()
zero in class Ringpublic RingElt inv(RingElt b)
inv in class Ringb - A RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt neg(RingElt b)
neg in class Ringb - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public boolean equalZero(RingElt b)
equalZero in class Ringb - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public RingElt contents(RingElt b)
b - a RingElt which can be mapped via map(RingElt)to an element of this ring.
public RingElt primitivePart(RingElt a)
a - a RingElt which can be mapped via map(RingElt) to an element of this ring.
public boolean equals(java.lang.Object ob)
equals in class java.lang.Objectob - an object that may or may not be a PolynomialRing.
public RingElt map(RingElt a)
Elements of the following rings are mapped into F2[a][b][c][d]:
Q[a][b][c][d], F2[a], Z[d][b], Q[b][a], F2[d][b][c][a], Quot(Z[b][d]), ...
map in class Ringa - a RingElt which can be mapped to an element of this ring.
RingException - if the element cannot be mapped.public RingElt map(java.lang.String a)
a - b, (a + b)^2 * 1.2/7, 1 + ((a + b + a * 5.0 + (3 - b)^13)^17)/10.
Known Bugs/Problems:
Expressions containing arithmetic operators with an alternative meaning lead to problems. For example 2E-3 for the DoubleField Number 0.002 leads to a RingException. Use 2/(10^3) instead.
map in class Ringa - a RingElt of this PolynomialRing which is described by the String.
RingException - if the String cannot be interpreted.
public RingElt construct(int[] exponents,
java.lang.Object[] coefficients)
exponents - An array of positive integers.coefficients - An array of objects which can be mapped
to elements of the Coefficient Ring.
public RingElt construct(int exponent,
java.lang.Object coefficient)
coefficient - An object which can be mapped to an element of the
coefficient ring.exponent - A positive integer.
map(java.lang.String),
map(RingElt),
Ring.map(java.math.BigInteger)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||