Package edu.jas.root
Class Interval<C extends RingElem<C> & Rational>
- java.lang.Object
-
- edu.jas.root.Interval<C>
-
- Type Parameters:
C
- coefficient type.
- All Implemented Interfaces:
java.io.Serializable
public class Interval<C extends RingElem<C> & Rational> extends java.lang.Object implements java.io.Serializable
Interval. For example isolating interval for real roots.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(C c)
Test if an element is contained in this interval.boolean
contains(Interval<C> vc)
Test if an interval is contained in this interval.Interval<C>
copy()
Copy this.boolean
equals(java.lang.Object b)
Comparison with any other object.int
hashCode()
Hash code for this Interval.C
length()
Length.C
middle()
Middle point.Interval<C>
multiply(Interval<C> o)
Multiply intervals.C
randomPoint()
Random point of interval.BigRational
rationalLength()
BigRational Length.BigRational
rationalMiddle()
Rational middle point.Interval<C>
subtract(Interval<C> o)
Subtract intervals.Interval<C>
sum(Interval<C> o)
Sum of intervals.BigDecimal
toDecimal()
BigDecimal representation of Interval.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toString()
String representation of Interval.
-
-
-
Method Detail
-
toString
public java.lang.String toString()
String representation of Interval.- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Returns:
- script compatible representation for this Interval.
-
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 Interval.- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
contains
public boolean contains(C c)
Test if an element is contained in this interval.- Parameters:
c
- element to test.- Returns:
- true, if left ≤ b ≤ right;
-
contains
public boolean contains(Interval<C> vc)
Test if an interval is contained in this interval.- Parameters:
vc
- interval to test.- Returns:
- true, if left ≤ vc.left and vc.right ≤ right;
-
rationalLength
public BigRational rationalLength()
BigRational Length.- Returns:
- |left-right|;
-
toDecimal
public BigDecimal toDecimal()
BigDecimal representation of Interval.
-
rationalMiddle
public BigRational rationalMiddle()
Rational middle point.- Returns:
- (left+right)/2;
-
randomPoint
public C randomPoint()
Random point of interval.- Returns:
- a random point contained in this interval.
-
sum
public Interval<C> sum(Interval<C> o)
Sum of intervals.- Parameters:
o
- other interval.- Returns:
- this+other
-
subtract
public Interval<C> subtract(Interval<C> o)
Subtract intervals.- Parameters:
o
- other interval.- Returns:
- this-other
-
-