Package edu.jas.root
Class RealAlgebraicNumber<C extends GcdRingElem<C> & Rational>
java.lang.Object
edu.jas.root.RealAlgebraicNumber<C>
- All Implemented Interfaces:
Rational,AbelianGroupElem<RealAlgebraicNumber<C>>,Element<RealAlgebraicNumber<C>>,GcdRingElem<RealAlgebraicNumber<C>>,MonoidElem<RealAlgebraicNumber<C>>,RingElem<RealAlgebraicNumber<C>>,Serializable,Comparable<RealAlgebraicNumber<C>>
public class RealAlgebraicNumber<C extends GcdRingElem<C> & Rational>
extends Object
implements GcdRingElem<RealAlgebraicNumber<C>>, Rational
Real algebraic number class based on AlgebraicNumber. Objects of this class
are immutable.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal AlgebraicNumber<C> Representing AlgebraicNumber.final RealAlgebraicRing<C> Ring part of the data structure. -
Constructor Summary
ConstructorsConstructorDescriptionThe constructor creates a RealAlgebraicNumber object from a GenPolynomial object module.The constructor creates a RealAlgebraicNumber object from RealAlgebraicRing modul and a AlgebraicNumber value.The constructor creates a RealAlgebraicNumber object from RealAlgebraicRing modul and a GenPolynomial value. -
Method Summary
Modifier and TypeMethodDescriptionabs()RealAlgebraicNumber absolute value.intRealAlgebraicNumber comparison.intRealAlgebraicNumber comparison.copy()Copy this.RealAlgebraicNumber magnitude.RealAlgebraicNumber division.egcd(RealAlgebraicNumber<C> S) RealAlgebraicNumber extended greatest common divisor.booleanComparison with any other object.factory()Get the corresponding element factory.floor()RealAlgebraicNumber floor.gcd(RealAlgebraicNumber<C> S) RealAlgebraicNumber greatest common divisor.Return a BigRational approximation of this Element.voidRealAlgebraicNumber half interval.inthashCode()Hash code for this RealAlgebraicNumber.inverse()RealAlgebraicNumber inverse.booleanisONE()Is RealAlgebraicNumber one.booleanIs RealAlgebraicNumber a root of unity.booleanisUnit()Is RealAlgebraicNumber unit.booleanisZERO()Is RealAlgebraicNumber zero.RealAlgebraicNumber magnitude.monic()RealAlgebraicNumber monic.RealAlgebraicNumber multiplication.multiply(GenPolynomial<C> c) RealAlgebraicNumber multiplication.RealAlgebraicNumber multiplication.negate()RealAlgebraicNumber negate.Quotient and remainder by division of this by S.RealAlgebraicNumber remainder.intsignum()RealAlgebraicNumber signum.RealAlgebraicNumber subtraction.RealAlgebraicNumber summation.sum(GenPolynomial<C> c) RealAlgebraicNumber summation.sum(RealAlgebraicNumber<C> S) RealAlgebraicNumber summation.toScript()Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()Get the String representation as RingElem.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface edu.jas.structure.MonoidElem
leftDivide, leftRemainder, power, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
Field Details
-
number
Representing AlgebraicNumber. -
ring
Ring part of the data structure.
-
-
Constructor Details
-
RealAlgebraicNumber
The constructor creates a RealAlgebraicNumber object from RealAlgebraicRing modul and a GenPolynomial value.- Parameters:
r- ring RealAlgebraicRing. a- value GenPolynomial.
-
RealAlgebraicNumber
The constructor creates a RealAlgebraicNumber object from RealAlgebraicRing modul and a AlgebraicNumber value.- Parameters:
r- ring RealAlgebraicRing. a- value AlgebraicNumber.
-
RealAlgebraicNumber
The constructor creates a RealAlgebraicNumber object from a GenPolynomial object module.- Parameters:
r- ring RealAlgebraicRing.
-
-
Method Details
-
factory
Get the corresponding element factory. -
copy
Copy this. -
getRational
Return a BigRational approximation of this Element.- Specified by:
getRationalin interfaceRational- Returns:
- a BigRational approximation of this.
- See Also:
-
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:
-
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:
-
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:
-
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
Get the String representation as RingElem. -
toScript
Get a scripting compatible string representation. -
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:
-
compareTo
RealAlgebraicNumber comparison.- Specified by:
compareToin interfaceComparable<C extends GcdRingElem<C> & Rational>- Specified by:
compareToin interfaceElement<C extends GcdRingElem<C> & Rational>- Parameters:
b- RealAlgebraicNumber.- Returns:
- real sign(this-b).
-
compareTo
RealAlgebraicNumber comparison.- Parameters:
b- AlgebraicNumber.- Returns:
- polynomial sign(this-b).
-
equals
Comparison with any other object. -
hashCode
public int hashCode()Hash code for this RealAlgebraicNumber. -
abs
RealAlgebraicNumber absolute value.- Specified by:
absin interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Returns:
- the absolute value of this.
- See Also:
-
sum
RealAlgebraicNumber summation.- Specified by:
sumin interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this+S.
-
sum
RealAlgebraicNumber summation.- Parameters:
c- coefficient.- Returns:
- this+c.
-
sum
RealAlgebraicNumber summation.- Parameters:
c- polynomial.- Returns:
- this+c.
-
negate
RealAlgebraicNumber negate.- Specified by:
negatein interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Returns:
- -this.
- See Also:
-
signum
public int signum()RealAlgebraicNumber signum. Note: Modifies ring.root eventually.- Specified by:
signumin interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Returns:
- real signum(this).
- See Also:
-
halfInterval
public void halfInterval()RealAlgebraicNumber half interval. -
floor
RealAlgebraicNumber floor.- Returns:
- floor of this.
-
magnitude
RealAlgebraicNumber magnitude.- Returns:
- |this|.
-
decimalMagnitude
RealAlgebraicNumber magnitude.- Returns:
- |this| as big decimal.
-
subtract
RealAlgebraicNumber subtraction.- Specified by:
subtractin interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this-S.
-
divide
RealAlgebraicNumber division.- Specified by:
dividein interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this/S.
-
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:
-
remainder
RealAlgebraicNumber remainder.- Specified by:
remainderin interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this - (this/S)*S.
-
quotientRemainder
Quotient and remainder by division of this by S.- Specified by:
quotientRemainderin interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- a RealAlgebraicNumber- Returns:
- [this/S, this - (this/S)*S].
-
multiply
RealAlgebraicNumber multiplication.- Specified by:
multiplyin interfaceMonoidElem<C extends GcdRingElem<C> & Rational>- Parameters:
S- RealAlgebraicNumber.- Returns:
- this*S.
-
multiply
RealAlgebraicNumber multiplication.- Parameters:
c- coefficient.- Returns:
- this*c.
-
multiply
RealAlgebraicNumber multiplication.- Parameters:
c- polynomial.- Returns:
- this*c.
-
monic
RealAlgebraicNumber monic.- Returns:
- this with monic value part.
-
gcd
RealAlgebraicNumber greatest common divisor. -
egcd
RealAlgebraicNumber extended greatest common divisor.
-