Package edu.jas.application
Class RealAlgebraicNumber<C extends GcdRingElem<C> & Rational>
- java.lang.Object
-
- edu.jas.application.RealAlgebraicNumber<C>
-
- All Implemented Interfaces:
Rational,AbelianGroupElem<RealAlgebraicNumber<C>>,Element<RealAlgebraicNumber<C>>,GcdRingElem<RealAlgebraicNumber<C>>,MonoidElem<RealAlgebraicNumber<C>>,RingElem<RealAlgebraicNumber<C>>,java.io.Serializable,java.lang.Comparable<RealAlgebraicNumber<C>>
public class RealAlgebraicNumber<C extends GcdRingElem<C> & Rational> extends java.lang.Object implements GcdRingElem<RealAlgebraicNumber<C>>, Rational
Complex algebraic number class based on bi-variate real algebraic numbers. Objects of this class are immutable. Bi-variate ideal implementation is in version 3614 2011-04-28 09:20:34Z.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description RealAlgebraicNumber<RealAlgebraicNumber<C>>numberRepresenting recursive RealAlgebraicNumber.RealAlgebraicRing<C>ringRing part of the data structure.
-
Constructor Summary
Constructors Constructor Description RealAlgebraicNumber(RealAlgebraicRing<C> r)The constructor creates a zero RealAlgebraicNumber.RealAlgebraicNumber(RealAlgebraicRing<C> r, C a)The constructor creates a RealAlgebraicNumber object from a GenPolynomial value.RealAlgebraicNumber(RealAlgebraicRing<C> r, GenPolynomial<C> a)The constructor creates a RealAlgebraicNumber object from a GenPolynomial value.RealAlgebraicNumber(RealAlgebraicRing<C> r, RealAlgebraicNumber<RealAlgebraicNumber<C>> a)The constructor creates a RealAlgebraicNumber object from a recursive real algebraic value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RealAlgebraicNumber<C>abs()RealAlgebraicNumber absolute value.intcompareTo(RealAlgebraicNumber<C> b)RealAlgebraicNumber comparison.intcompareTo(RealAlgebraicNumber<RealAlgebraicNumber<C>> b)RealAlgebraicNumber comparison.RealAlgebraicNumber<C>copy()Clone this.BigDecimaldecimalMagnitude()RealAlgebraicNumber decimal magnitude.RealAlgebraicNumber<C>divide(RealAlgebraicNumber<C> S)RealAlgebraicNumber division.RealAlgebraicNumber<C>[]egcd(RealAlgebraicNumber<C> S)RealAlgebraicNumber extended greatest common divisor.booleanequals(java.lang.Object b)Comparison with any other object.RealAlgebraicRing<C>factory()Get the corresponding element factory.RealAlgebraicNumber<C>gcd(RealAlgebraicNumber<C> S)RealAlgebraicNumber greatest common divisor.BigRationalgetRational()Return a BigRational approximation of this Element.inthashCode()Hash code for this RealAlgebraicNumber.RealAlgebraicNumber<C>inverse()RealAlgebraicNumber inverse.booleanisONE()Is RealAlgebraicNumber one.booleanisRootOfUnity()Is RealAlgebraicNumber a root of unity.booleanisUnit()Is RealAlgebraicNumber unit.booleanisZERO()Is RealAlgebraicNumber zero.BigRationalmagnitude()RealAlgebraicNumber magnitude.RealAlgebraicNumber<C>monic()RealAlgebraicNumber monic.RealAlgebraicNumber<C>multiply(RealAlgebraicNumber<C> S)RealAlgebraicNumber multiplication.RealAlgebraicNumber<C>multiply(RealAlgebraicNumber<RealAlgebraicNumber<C>> c)RealAlgebraicNumber multiplication.RealAlgebraicNumber<C>negate()RealAlgebraicNumber negate.RealAlgebraicNumber<C>remainder(RealAlgebraicNumber<C> S)RealAlgebraicNumber remainder.intsignum()RealAlgebraicNumber signum.RealAlgebraicNumber<C>subtract(RealAlgebraicNumber<C> S)RealAlgebraicNumber subtraction.RealAlgebraicNumber<C>sum(RealAlgebraicNumber<C> S)RealAlgebraicNumber summation.RealAlgebraicNumber<C>sum(RealAlgebraicNumber<RealAlgebraicNumber<C>> c)RealAlgebraicNumber summation.java.lang.StringtoScript()Get a scripting compatible string representation.java.lang.StringtoScriptFactory()Get a scripting compatible string representation of the factory.java.lang.StringtoString()Get the String representation as RingElem.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.jas.structure.MonoidElem
leftDivide, leftRemainder, power, quotientRemainder, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
-
-
-
Field Detail
-
number
public final RealAlgebraicNumber<RealAlgebraicNumber<C extends GcdRingElem<C> & Rational>> number
Representing recursive RealAlgebraicNumber.
-
ring
public final RealAlgebraicRing<C extends GcdRingElem<C> & Rational> ring
Ring part of the data structure.
-
-
Constructor Detail
-
RealAlgebraicNumber
public RealAlgebraicNumber(RealAlgebraicRing<C> r)
The constructor creates a zero RealAlgebraicNumber.- Parameters:
r- ring RealAlgebraicRing.
-
RealAlgebraicNumber
public RealAlgebraicNumber(RealAlgebraicRing<C> r, C a)
The constructor creates a RealAlgebraicNumber object from a GenPolynomial value.- Parameters:
r- ring RealAlgebraicRing. a- value element.
-
RealAlgebraicNumber
public RealAlgebraicNumber(RealAlgebraicRing<C> r, GenPolynomial<C> a)
The constructor creates a RealAlgebraicNumber object from a GenPolynomial value.- Parameters:
r- ring RealAlgebraicRing. a- value GenPolynomial.
-
RealAlgebraicNumber
public RealAlgebraicNumber(RealAlgebraicRing<C> r, RealAlgebraicNumber<RealAlgebraicNumber<C>> a)
The constructor creates a RealAlgebraicNumber object from a recursive real algebraic value.- Parameters:
r- ring RealAlgebraicRing. a- recursive real algebraic number.
-
-
Method Detail
-
factory
public RealAlgebraicRing<C> factory()
Get the corresponding element factory.- Specified by:
factoryin interfaceElement<C extends GcdRingElem<C> & Rational>- Returns:
- factory for this Element.
- See Also:
Element.factory()
-
copy
public RealAlgebraicNumber<C> copy()
Clone this.
-
getRational
public BigRational getRational()
Return a BigRational approximation of this Element.- Specified by:
getRationalin interfaceRational- Returns:
- a BigRational approximation of this.
- See Also:
Rational.getRational()
-
isZERO
public boolean isZERO()
Is RealAlgebraicNumber zero.- Specified by:
isZEROin interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Returns:
- If this is 0 then true is returned, else false.
- See Also:
AbelianGroupElem.isZERO()
-
isONE
public boolean isONE()
Is RealAlgebraicNumber one.- Specified by:
isONEin interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Returns:
- If this is 1 then true is returned, else false.
- See Also:
MonoidElem.isONE()
-
isUnit
public boolean isUnit()
Is RealAlgebraicNumber unit.- Specified by:
isUnitin interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Returns:
- If this is a unit then true is returned, else false.
- See Also:
MonoidElem.isUnit()
-
isRootOfUnity
public boolean isRootOfUnity()
Is RealAlgebraicNumber a root of unity.- Returns:
- true if |this**i| == 1, for some 0 < i ≤ deg(modul), else false.
-
toString
public java.lang.String toString()
Get the String representation as RingElem.- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScriptin interfaceElement<C extends GcdRingElem<C> & Rational>- Returns:
- script compatible representation for this Element.
- See Also:
Element.toScript()
-
toScriptFactory
public java.lang.String toScriptFactory()
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactoryin interfaceElement<C extends GcdRingElem<C> & Rational>- Returns:
- script compatible representation for this ElemFactory.
- See Also:
Element.toScriptFactory()
-
compareTo
public int compareTo(RealAlgebraicNumber<C> b)
RealAlgebraicNumber comparison.- Specified by:
compareToin interfacejava.lang.Comparable<C extends GcdRingElem<C> & Rational>- Specified by:
compareToin interfaceElement<C extends GcdRingElem<C> & Rational>- Parameters:
b- RealAlgebraicNumber.- Returns:
- sign(this-b).
-
compareTo
public int compareTo(RealAlgebraicNumber<RealAlgebraicNumber<C>> b)
RealAlgebraicNumber comparison.- Parameters:
b- AlgebraicNumber.- Returns:
- polynomial sign(this-b).
-
equals
public boolean equals(java.lang.Object b)
Comparison with any other object.
-
hashCode
public int hashCode()
Hash code for this RealAlgebraicNumber.
-
abs
public RealAlgebraicNumber<C> abs()
RealAlgebraicNumber absolute value.- Specified by:
absin interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Returns:
- the absolute value of this.
- See Also:
AbelianGroupElem.abs()
-
sum
public RealAlgebraicNumber<C> sum(RealAlgebraicNumber<C> S)
RealAlgebraicNumber summation.- Specified by:
sumin interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this+S.
-
sum
public RealAlgebraicNumber<C> sum(RealAlgebraicNumber<RealAlgebraicNumber<C>> c)
RealAlgebraicNumber summation.- Parameters:
c- recursive real algebraic number.- Returns:
- this+c.
-
negate
public RealAlgebraicNumber<C> negate()
RealAlgebraicNumber negate.- Specified by:
negatein interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Returns:
- -this.
- See Also:
AbelianGroupElem.negate()
-
subtract
public RealAlgebraicNumber<C> subtract(RealAlgebraicNumber<C> S)
RealAlgebraicNumber subtraction.- Specified by:
subtractin interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this-S.
-
divide
public RealAlgebraicNumber<C> divide(RealAlgebraicNumber<C> S)
RealAlgebraicNumber division.- Specified by:
dividein interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this/S.
-
inverse
public RealAlgebraicNumber<C> inverse()
RealAlgebraicNumber inverse.- Specified by:
inversein interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Returns:
- S with S = 1/this if defined.
- Throws:
NotInvertibleException- if the element is not invertible.- See Also:
MonoidElem.inverse()
-
remainder
public RealAlgebraicNumber<C> remainder(RealAlgebraicNumber<C> S)
RealAlgebraicNumber remainder.- Specified by:
remainderin interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this - (this/S)*S.
-
multiply
public RealAlgebraicNumber<C> multiply(RealAlgebraicNumber<C> S)
RealAlgebraicNumber multiplication.- Specified by:
multiplyin interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this*S.
-
multiply
public RealAlgebraicNumber<C> multiply(RealAlgebraicNumber<RealAlgebraicNumber<C>> c)
RealAlgebraicNumber multiplication.- Parameters:
c- recursive real algebraic number.- Returns:
- this*c.
-
monic
public RealAlgebraicNumber<C> monic()
RealAlgebraicNumber monic.- Returns:
- this with monic value part.
-
gcd
public RealAlgebraicNumber<C> gcd(RealAlgebraicNumber<C> S)
RealAlgebraicNumber greatest common divisor.
-
egcd
public RealAlgebraicNumber<C>[] egcd(RealAlgebraicNumber<C> S)
RealAlgebraicNumber extended greatest common divisor.
-
signum
public int signum()
RealAlgebraicNumber signum.- Specified by:
signumin interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Returns:
- signum(this).
- See Also:
AbelianGroupElem.signum()
-
magnitude
public BigRational magnitude()
RealAlgebraicNumber magnitude.- Returns:
- |this| as rational number.
-
decimalMagnitude
public BigDecimal decimalMagnitude()
RealAlgebraicNumber decimal magnitude.- Returns:
- |this| as big decimal.
-
-