Package edu.jas.root
Class RealAlgebraicRing<C extends GcdRingElem<C> & Rational>
- java.lang.Object
-
- edu.jas.root.RealAlgebraicRing<C>
-
- All Implemented Interfaces:
AbelianGroupFactory<RealAlgebraicNumber<C>>
,ElemFactory<RealAlgebraicNumber<C>>
,MonoidFactory<RealAlgebraicNumber<C>>
,RingFactory<RealAlgebraicNumber<C>>
,java.io.Serializable
public class RealAlgebraicRing<C extends GcdRingElem<C> & Rational> extends java.lang.Object implements RingFactory<RealAlgebraicNumber<C>>
Real algebraic number factory class based on AlgebraicNumberRing with RingFactory interface. Objects of this class are immutable with the exception of the isolating intervals.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description AlgebraicNumberRing<C>
algebraic
Representing AlgebraicNumberRing.RealRootsSturm<C>
engine
Real root computation engine.protected BigRational
eps
Precision of the isolating interval for a real root.static int
PRECISION
Precision of the isolating rectangle for a complex root.
-
Constructor Summary
Constructors Constructor Description RealAlgebraicRing(GenPolynomial<C> m, Interval<C> root)
The constructor creates a RealAlgebraicNumber factory object from a GenPolynomial objects module.RealAlgebraicRing(GenPolynomial<C> m, Interval<C> root, boolean isField)
The constructor creates a RealAlgebraicNumber factory object from a GenPolynomial objects module.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigInteger
characteristic()
Characteristic of this ring.RealAlgebraicRing<C>
copy()
Copy this RealAlgebraicRing.RealAlgebraicNumber<C>
copy(RealAlgebraicNumber<C> c)
Copy RealAlgebraicNumber element c.boolean
equals(java.lang.Object b)
Comparison with any other object.RealAlgebraicNumber<C>
fromInteger(long a)
Get a RealAlgebraicNumber element from a long value.RealAlgebraicNumber<C>
fromInteger(java.math.BigInteger a)
Get a RealAlgebraicNumber element from a BigInteger value.RealAlgebraicNumber<C>
fromRational(BigRational a)
Get a RealAlgebraicNumber element from a BigRational value.java.util.List<RealAlgebraicNumber<C>>
generators()
Get a list of the generating elements.BigRational
getEps()
Get the epsilon.RealAlgebraicNumber<C>
getGenerator()
Get the generating element.RealAlgebraicNumber<C>
getONE()
Get the one element.Interval<C>
getRoot()
Get the interval for the real root.RealAlgebraicNumber<C>
getZERO()
Get the zero element.void
halfInterval()
RealAlgebraicRing half interval.int
hashCode()
Hash code for this RealAlgebraicNumber.boolean
isAssociative()
Query if this ring is associative.boolean
isCommutative()
Query if this ring is commutative.boolean
isField()
Query if this ring is a field.boolean
isFinite()
Is this structure finite or infinite.RealAlgebraicNumber<C>
parse(java.io.Reader r)
Parse RealAlgebraicNumber from Reader.RealAlgebraicNumber<C>
parse(java.lang.String s)
Parse RealAlgebraicNumber from String.RealAlgebraicNumber<C>
random(int n)
RealAlgebraicNumber random.RealAlgebraicNumber<C>
random(int n, java.util.Random rnd)
RealAlgebraicNumber random.void
refineRoot()
Refine root.void
refineRoot(BigRational e)
Refine root.void
setEps(C e)
Set a new epsilon.void
setEps(BigRational e)
Set a new epsilon.void
setField(boolean isField)
Assert that this ring is a field.void
setRoot(Interval<C> v)
Set a refined interval for the real root.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toString()
Get the String representation as RingFactory.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.jas.structure.ElemFactory
valueOf
-
-
-
-
Field Detail
-
algebraic
public final AlgebraicNumberRing<C extends GcdRingElem<C> & Rational> algebraic
Representing AlgebraicNumberRing.
-
PRECISION
public static final int PRECISION
Precision of the isolating rectangle for a complex root.
-
eps
protected BigRational eps
Precision of the isolating interval for a real root.
-
engine
public final RealRootsSturm<C extends GcdRingElem<C> & Rational> engine
Real root computation engine.
-
-
Constructor Detail
-
RealAlgebraicRing
public RealAlgebraicRing(GenPolynomial<C> m, Interval<C> root)
The constructor creates a RealAlgebraicNumber factory object from a GenPolynomial objects module.- Parameters:
m
- module GenPolynomial. root
- isolating interval for a real root.
-
RealAlgebraicRing
public RealAlgebraicRing(GenPolynomial<C> m, Interval<C> root, boolean isField)
The constructor creates a RealAlgebraicNumber factory object from a GenPolynomial objects module.- Parameters:
m
- module GenPolynomial.root
- isolating interval for a real root.isField
- indicator if m is prime.
-
-
Method Detail
-
getRoot
public Interval<C> getRoot()
Get the interval for the real root. Note: interval may shrink later.- Returns:
- real root isolating interval
-
setRoot
public void setRoot(Interval<C> v)
Set a refined interval for the real root. Note: interval may shrink eventually.- Parameters:
v
- interval.
-
getEps
public BigRational getEps()
Get the epsilon.- Returns:
- eps.
-
setEps
public void setEps(BigRational e)
Set a new epsilon.- Parameters:
e
- epsilon.
-
refineRoot
public void refineRoot()
Refine root.
-
refineRoot
public void refineRoot(BigRational e)
Refine root.- Parameters:
e
- epsilon.
-
halfInterval
public void halfInterval()
RealAlgebraicRing half interval.
-
isFinite
public boolean isFinite()
Is this structure finite or infinite.- Specified by:
isFinite
in interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Returns:
- true if this structure is finite, else false.
- See Also:
ElemFactory.isFinite()
-
copy
public RealAlgebraicNumber<C> copy(RealAlgebraicNumber<C> c)
Copy RealAlgebraicNumber element c.- Specified by:
copy
in interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Parameters:
c
-- Returns:
- a copy of c.
-
copy
public RealAlgebraicRing<C> copy()
Copy this RealAlgebraicRing.- Returns:
- a copy of this.
-
getZERO
public RealAlgebraicNumber<C> getZERO()
Get the zero element.- Specified by:
getZERO
in interfaceAbelianGroupFactory<C extends GcdRingElem<C> & Rational>
- Returns:
- 0 as RealAlgebraicNumber.
-
getONE
public RealAlgebraicNumber<C> getONE()
Get the one element.- Specified by:
getONE
in interfaceMonoidFactory<C extends GcdRingElem<C> & Rational>
- Returns:
- 1 as RealAlgebraicNumber.
-
getGenerator
public RealAlgebraicNumber<C> getGenerator()
Get the generating element.- Returns:
- alpha as RealAlgebraicNumber.
-
generators
public java.util.List<RealAlgebraicNumber<C>> generators()
Get a list of the generating elements.- Specified by:
generators
in interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Returns:
- list of generators for the algebraic structure.
- See Also:
ElemFactory.generators()
-
isCommutative
public boolean isCommutative()
Query if this ring is commutative.- Specified by:
isCommutative
in interfaceMonoidFactory<C extends GcdRingElem<C> & Rational>
- Returns:
- true if this ring is commutative, else false.
-
isAssociative
public boolean isAssociative()
Query if this ring is associative.- Specified by:
isAssociative
in interfaceMonoidFactory<C extends GcdRingElem<C> & Rational>
- Returns:
- true if this ring is associative, else false.
-
isField
public boolean isField()
Query if this ring is a field.- Specified by:
isField
in interfaceRingFactory<C extends GcdRingElem<C> & Rational>
- Returns:
- true if algebraic is prime, else false.
-
setField
public void setField(boolean isField)
Assert that this ring is a field.- Parameters:
isField
- true if this ring is a field, else false.
-
characteristic
public java.math.BigInteger characteristic()
Characteristic of this ring.- Specified by:
characteristic
in interfaceRingFactory<C extends GcdRingElem<C> & Rational>
- Returns:
- characteristic of this ring.
-
fromInteger
public RealAlgebraicNumber<C> fromInteger(java.math.BigInteger a)
Get a RealAlgebraicNumber element from a BigInteger value.- Specified by:
fromInteger
in interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Parameters:
a
- BigInteger.- Returns:
- a RealAlgebraicNumber.
-
fromRational
public RealAlgebraicNumber<C> fromRational(BigRational a)
Get a RealAlgebraicNumber element from a BigRational value.- Parameters:
a
- BigRational.- Returns:
- a RealAlgebraicNumber.
-
fromInteger
public RealAlgebraicNumber<C> fromInteger(long a)
Get a RealAlgebraicNumber element from a long value.- Specified by:
fromInteger
in interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Parameters:
a
- long.- Returns:
- a RealAlgebraicNumber.
-
toString
public java.lang.String toString()
Get the String representation as RingFactory.- 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 interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
ElemFactory.toScript()
-
equals
public boolean equals(java.lang.Object b)
Comparison with any other object.- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this RealAlgebraicNumber.- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
random
public RealAlgebraicNumber<C> random(int n)
RealAlgebraicNumber random.- Specified by:
random
in interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Parameters:
n
- such that 0 ≤ v ≤ (2n-1).- Returns:
- a random integer mod modul.
-
random
public RealAlgebraicNumber<C> random(int n, java.util.Random rnd)
RealAlgebraicNumber random.- Specified by:
random
in interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Parameters:
n
- such that 0 ≤ v ≤ (2n-1).rnd
- is a source for random bits.- Returns:
- a random integer mod modul.
-
parse
public RealAlgebraicNumber<C> parse(java.lang.String s)
Parse RealAlgebraicNumber from String.- Specified by:
parse
in interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Parameters:
s
- String.- Returns:
- RealAlgebraicNumber from s.
-
parse
public RealAlgebraicNumber<C> parse(java.io.Reader r)
Parse RealAlgebraicNumber from Reader.- Specified by:
parse
in interfaceElemFactory<C extends GcdRingElem<C> & Rational>
- Parameters:
r
- Reader.- Returns:
- next RealAlgebraicNumber from r.
-
-