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.int
RealAlgebraicNumber comparison.int
RealAlgebraicNumber comparison.copy()
Copy this.RealAlgebraicNumber magnitude.RealAlgebraicNumber division.egcd
(RealAlgebraicNumber<C> S) RealAlgebraicNumber extended greatest common divisor.boolean
Comparison 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.void
RealAlgebraicNumber half interval.int
hashCode()
Hash code for this RealAlgebraicNumber.inverse()
RealAlgebraicNumber inverse.boolean
isONE()
Is RealAlgebraicNumber one.boolean
Is RealAlgebraicNumber a root of unity.boolean
isUnit()
Is RealAlgebraicNumber unit.boolean
isZERO()
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.int
signum()
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, wait
Methods 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:
getRational
in interfaceRational
- Returns:
- a BigRational approximation of this.
- See Also:
-
isZERO
public boolean isZERO()Is RealAlgebraicNumber zero.- Specified by:
isZERO
in 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:
isONE
in 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:
isUnit
in 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:
toScriptFactory
in interfaceElement<C extends GcdRingElem<C> & Rational>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
-
compareTo
RealAlgebraicNumber comparison.- Specified by:
compareTo
in interfaceComparable<C extends GcdRingElem<C> & Rational>
- Specified by:
compareTo
in 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:
abs
in interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>
- Returns:
- the absolute value of this.
- See Also:
-
sum
RealAlgebraicNumber summation.- Specified by:
sum
in 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:
negate
in interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>
- Returns:
- -this.
- See Also:
-
signum
public int signum()RealAlgebraicNumber signum. Note: Modifies ring.root eventually.- Specified by:
signum
in 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:
subtract
in interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>
- Parameters:
S
- RealAlgebraicNumber.- Returns:
- this-S.
-
divide
RealAlgebraicNumber division.- Specified by:
divide
in interfaceMonoidElem<C extends GcdRingElem<C> & Rational>
- Parameters:
S
- RealAlgebraicNumber.- Returns:
- this/S.
-
inverse
RealAlgebraicNumber inverse.- Specified by:
inverse
in 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:
remainder
in 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:
quotientRemainder
in interfaceMonoidElem<C extends GcdRingElem<C> & Rational>
- Parameters:
S
- a RealAlgebraicNumber- Returns:
- [this/S, this - (this/S)*S].
-
multiply
RealAlgebraicNumber multiplication.- Specified by:
multiply
in 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.
-