Package edu.jas.root
Class ComplexAlgebraicNumber<C extends GcdRingElem<C> & Rational>
- java.lang.Object
-
- edu.jas.root.ComplexAlgebraicNumber<C>
-
- All Implemented Interfaces:
AbelianGroupElem<ComplexAlgebraicNumber<C>>
,Element<ComplexAlgebraicNumber<C>>
,GcdRingElem<ComplexAlgebraicNumber<C>>
,MonoidElem<ComplexAlgebraicNumber<C>>
,RingElem<ComplexAlgebraicNumber<C>>
,java.io.Serializable
,java.lang.Comparable<ComplexAlgebraicNumber<C>>
public class ComplexAlgebraicNumber<C extends GcdRingElem<C> & Rational> extends java.lang.Object implements GcdRingElem<ComplexAlgebraicNumber<C>>
Complex algebraic number class based on AlgebraicNumber. Objects of this class are immutable.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description AlgebraicNumber<Complex<C>>
number
Representing AlgebraicNumber.ComplexAlgebraicRing<C>
ring
Ring part of the data structure.
-
Constructor Summary
Constructors Constructor Description ComplexAlgebraicNumber(ComplexAlgebraicRing<C> r)
The constructor creates a ComplexAlgebraicNumber object from a GenPolynomial object module.ComplexAlgebraicNumber(ComplexAlgebraicRing<C> r, AlgebraicNumber<Complex<C>> a)
The constructor creates a ComplexAlgebraicNumber object from ComplexAlgebraicRing modul and a AlgebraicNumber value.ComplexAlgebraicNumber(ComplexAlgebraicRing<C> r, GenPolynomial<Complex<C>> a)
The constructor creates a ComplexAlgebraicNumber object from ComplexAlgebraicRing modul and a GenPolynomial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ComplexAlgebraicNumber<C>
abs()
ComplexAlgebraicNumber absolute value.int
compareTo(AlgebraicNumber<Complex<C>> b)
ComplexAlgebraicNumber comparison.int
compareTo(ComplexAlgebraicNumber<C> b)
ComplexAlgebraicNumber comparison.ComplexAlgebraicNumber<C>
copy()
Copy this.Complex<BigDecimal>
decimalMagnitude()
ComplexAlgebraicNumber magnitude.ComplexAlgebraicNumber<C>
divide(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber division.ComplexAlgebraicNumber<C>[]
egcd(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber extended greatest common divisor.boolean
equals(java.lang.Object b)
Comparison with any other object.ComplexAlgebraicRing<C>
factory()
Get the corresponding element factory.ComplexAlgebraicNumber<C>
gcd(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber greatest common divisor.int
hashCode()
Hash code for this ComplexAlgebraicNumber.ComplexAlgebraicNumber<C>
inverse()
ComplexAlgebraicNumber inverse.boolean
isONE()
Is ComplexAlgebraicNumber one.boolean
isRootOfUnity()
Is ComplexAlgebraicNumber a root of unity.boolean
isUnit()
Is ComplexAlgebraicNumber unit.boolean
isZERO()
Is ComplexAlgebraicNumber zero.Complex<BigRational>
magnitude()
ComplexAlgebraicNumber magnitude.ComplexAlgebraicNumber<C>
monic()
ComplexAlgebraicNumber monic.ComplexAlgebraicNumber<C>
multiply(Complex<C> c)
ComplexAlgebraicNumber multiplication.ComplexAlgebraicNumber<C>
multiply(GenPolynomial<Complex<C>> c)
ComplexAlgebraicNumber multiplication.ComplexAlgebraicNumber<C>
multiply(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber multiplication.ComplexAlgebraicNumber<C>
negate()
ComplexAlgebraicNumber negate.ComplexAlgebraicNumber<C>[]
quotientRemainder(ComplexAlgebraicNumber<C> S)
Quotient and remainder by division of this by S.ComplexAlgebraicNumber<C>
remainder(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber remainder.int
signum()
ComplexAlgebraicNumber signum.ComplexAlgebraicNumber<C>
subtract(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber subtraction.ComplexAlgebraicNumber<C>
sum(AlgebraicNumber<Complex<C>> c)
ComplexAlgebraicNumber summation.ComplexAlgebraicNumber<C>
sum(Complex<C> c)
ComplexAlgebraicNumber summation.ComplexAlgebraicNumber<C>
sum(GenPolynomial<Complex<C>> c)
ComplexAlgebraicNumber summation.ComplexAlgebraicNumber<C>
sum(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber summation.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toScriptFactory()
Get a scripting compatible string representation of the factory.java.lang.String
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 Detail
-
number
public final AlgebraicNumber<Complex<C extends GcdRingElem<C> & Rational>> number
Representing AlgebraicNumber.
-
ring
public final ComplexAlgebraicRing<C extends GcdRingElem<C> & Rational> ring
Ring part of the data structure.
-
-
Constructor Detail
-
ComplexAlgebraicNumber
public ComplexAlgebraicNumber(ComplexAlgebraicRing<C> r, GenPolynomial<Complex<C>> a)
The constructor creates a ComplexAlgebraicNumber object from ComplexAlgebraicRing modul and a GenPolynomial value.- Parameters:
r
- ring ComplexAlgebraicRing. a
- value GenPolynomial.
-
ComplexAlgebraicNumber
public ComplexAlgebraicNumber(ComplexAlgebraicRing<C> r, AlgebraicNumber<Complex<C>> a)
The constructor creates a ComplexAlgebraicNumber object from ComplexAlgebraicRing modul and a AlgebraicNumber value.- Parameters:
r
- ring ComplexAlgebraicRing. a
- value AlgebraicNumber.
-
ComplexAlgebraicNumber
public ComplexAlgebraicNumber(ComplexAlgebraicRing<C> r)
The constructor creates a ComplexAlgebraicNumber object from a GenPolynomial object module.- Parameters:
r
- ring ComplexAlgebraicRing.
-
-
Method Detail
-
factory
public ComplexAlgebraicRing<C> factory()
Get the corresponding element factory.- Specified by:
factory
in interfaceElement<C extends GcdRingElem<C> & Rational>
- Returns:
- factory for this Element.
- See Also:
Element.factory()
-
copy
public ComplexAlgebraicNumber<C> copy()
Copy this.- Specified by:
copy
in interfaceElement<C extends GcdRingElem<C> & Rational>
- Returns:
- Creates and returns a copy of this Element.
- See Also:
Element.copy()
-
isZERO
public boolean isZERO()
Is ComplexAlgebraicNumber zero.- Specified by:
isZERO
in 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 ComplexAlgebraicNumber one.- Specified by:
isONE
in 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 ComplexAlgebraicNumber 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:
MonoidElem.isUnit()
-
isRootOfUnity
public boolean isRootOfUnity()
Is ComplexAlgebraicNumber 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:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScript
in 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:
toScriptFactory
in interfaceElement<C extends GcdRingElem<C> & Rational>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
Element.toScriptFactory()
-
compareTo
public int compareTo(ComplexAlgebraicNumber<C> b)
ComplexAlgebraicNumber comparison.- Specified by:
compareTo
in interfacejava.lang.Comparable<C extends GcdRingElem<C> & Rational>
- Specified by:
compareTo
in interfaceElement<C extends GcdRingElem<C> & Rational>
- Parameters:
b
- ComplexAlgebraicNumber.- Returns:
- sign(this-b).
-
compareTo
public int compareTo(AlgebraicNumber<Complex<C>> b)
ComplexAlgebraicNumber 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 ComplexAlgebraicNumber.
-
abs
public ComplexAlgebraicNumber<C> abs()
ComplexAlgebraicNumber absolute value.- Specified by:
abs
in interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>
- Returns:
- the absolute value of this.
- See Also:
AbelianGroupElem.abs()
-
sum
public ComplexAlgebraicNumber<C> sum(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber summation.- Specified by:
sum
in interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>
- Parameters:
S
- ComplexAlgebraicNumber.- Returns:
- this+S.
-
sum
public ComplexAlgebraicNumber<C> sum(GenPolynomial<Complex<C>> c)
ComplexAlgebraicNumber summation.- Parameters:
c
- complex polynomial.- Returns:
- this+c.
-
sum
public ComplexAlgebraicNumber<C> sum(AlgebraicNumber<Complex<C>> c)
ComplexAlgebraicNumber summation.- Parameters:
c
- algebraic number.- Returns:
- this+c.
-
sum
public ComplexAlgebraicNumber<C> sum(Complex<C> c)
ComplexAlgebraicNumber summation.- Parameters:
c
- coefficient.- Returns:
- this+c.
-
negate
public ComplexAlgebraicNumber<C> negate()
ComplexAlgebraicNumber negate.- Specified by:
negate
in interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>
- Returns:
- -this.
- See Also:
AbelianGroupElem.negate()
-
subtract
public ComplexAlgebraicNumber<C> subtract(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber subtraction.- Specified by:
subtract
in interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>
- Parameters:
S
- ComplexAlgebraicNumber.- Returns:
- this-S.
-
divide
public ComplexAlgebraicNumber<C> divide(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber division.- Specified by:
divide
in interfaceMonoidElem<C extends GcdRingElem<C> & Rational>
- Parameters:
S
- ComplexAlgebraicNumber.- Returns:
- this/S.
-
inverse
public ComplexAlgebraicNumber<C> inverse()
ComplexAlgebraicNumber 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:
MonoidElem.inverse()
-
remainder
public ComplexAlgebraicNumber<C> remainder(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber remainder.- Specified by:
remainder
in interfaceMonoidElem<C extends GcdRingElem<C> & Rational>
- Parameters:
S
- ComplexAlgebraicNumber.- Returns:
- this - (this/S)*S.
-
quotientRemainder
public ComplexAlgebraicNumber<C>[] quotientRemainder(ComplexAlgebraicNumber<C> S)
Quotient and remainder by division of this by S.- Specified by:
quotientRemainder
in interfaceMonoidElem<C extends GcdRingElem<C> & Rational>
- Parameters:
S
- a ComplexAlgebraicNumber- Returns:
- [this/S, this - (this/S)*S].
-
multiply
public ComplexAlgebraicNumber<C> multiply(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber multiplication.- Specified by:
multiply
in interfaceMonoidElem<C extends GcdRingElem<C> & Rational>
- Parameters:
S
- ComplexAlgebraicNumber.- Returns:
- this*S.
-
multiply
public ComplexAlgebraicNumber<C> multiply(Complex<C> c)
ComplexAlgebraicNumber multiplication.- Parameters:
c
- coefficient.- Returns:
- this*c.
-
multiply
public ComplexAlgebraicNumber<C> multiply(GenPolynomial<Complex<C>> c)
ComplexAlgebraicNumber multiplication.- Parameters:
c
- polynomial.- Returns:
- this*c.
-
monic
public ComplexAlgebraicNumber<C> monic()
ComplexAlgebraicNumber monic.- Returns:
- this with monic value part.
-
gcd
public ComplexAlgebraicNumber<C> gcd(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber greatest common divisor.
-
egcd
public ComplexAlgebraicNumber<C>[] egcd(ComplexAlgebraicNumber<C> S)
ComplexAlgebraicNumber extended greatest common divisor.
-
signum
public int signum()
ComplexAlgebraicNumber signum.- Specified by:
signum
in interfaceAbelianGroupElem<C extends GcdRingElem<C> & Rational>
- Returns:
- signum(this).
- See Also:
AbelianGroupElem.signum()
-
magnitude
public Complex<BigRational> magnitude()
ComplexAlgebraicNumber magnitude.- Returns:
- |this| as complex rational number.
-
decimalMagnitude
public Complex<BigDecimal> decimalMagnitude()
ComplexAlgebraicNumber magnitude.- Returns:
- |this| as complex big decimal.
-
-