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:
Serializable
Interval. For example isolating interval for real roots.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Test if an element is contained in this interval.boolean
Test if an interval is contained in this interval.copy()
Copy this.boolean
Comparison with any other object.int
hashCode()
Hash code for this Interval.length()
Length.middle()
Middle point.Multiply intervals.Random point of interval.BigRational Length.Rational middle point.Subtract intervals.Sum of intervals.BigDecimal representation of Interval.toScript()
Get a scripting compatible string representation.toString()
String representation of Interval.
-
Field Details
-
left
left interval border. -
right
right interval border.
-
-
Constructor Details
-
Interval
Constructor.- Parameters:
left
- interval border.right
- interval border.
-
Interval
Constructor.- Parameters:
mid
- left and right interval border.
-
-
Method Details
-
toString
String representation of Interval. -
toScript
Get a scripting compatible string representation.- Returns:
- script compatible representation for this Interval.
-
copy
Copy this.- Returns:
- a copy of this.
-
equals
Comparison with any other object. -
hashCode
public int hashCode()Hash code for this Interval. -
contains
Test if an element is contained in this interval.- Parameters:
c
- element to test.- Returns:
- true, if left ≤ b ≤ right;
-
contains
Test if an interval is contained in this interval.- Parameters:
vc
- interval to test.- Returns:
- true, if left ≤ vc.left and vc.right ≤ right;
-
length
Length.- Returns:
- |left-right|;
-
rationalLength
BigRational Length.- Returns:
- |left-right|;
-
toDecimal
BigDecimal representation of Interval. -
rationalMiddle
Rational middle point.- Returns:
- (left+right)/2;
-
middle
Middle point.- Returns:
- (left+right)/2;
-
randomPoint
Random point of interval.- Returns:
- a random point contained in this interval.
-
sum
Sum of intervals.- Parameters:
o
- other interval.- Returns:
- this+other
-
subtract
Subtract intervals.- Parameters:
o
- other interval.- Returns:
- this-other
-
multiply
Multiply intervals.- Parameters:
o
- other interval.- Returns:
- this*other
-