Class BracketRoot1D

  • All Implemented Interfaces:
    java.lang.Comparable<BracketRoot1D>

    public class BracketRoot1D
    extends java.lang.Object
    implements java.lang.Comparable<BracketRoot1D>
    Represents the bracket around a root in a 1D function.

    Modified by: Joseph A. Huwaldt

    Version:
    September 16, 2012
    Author:
    Joseph A. Huwaldt Date: October 8, 1997
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double x1
      The lower bound of the bracket.
      double x2
      The upper bound of the bracket.
    • Constructor Summary

      Constructors 
      Constructor Description
      BracketRoot1D​(double x1, double x2)
      Construct a bracket around a root in a 1D function.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(BracketRoot1D o)
      Compares this object with the specified object for order.
      static java.util.List<BracketRoot1D> findBrackets​(Evaluatable1D func, double x1, double x2, int n)
      Given a function, func, defined on the interval x1 to x2, this routine subdivides the interval into n equally spaced segments, and searches for zero crossings of the function.
      java.lang.String toString()
      Return a String representation of this object.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • x1

        public double x1
        The lower bound of the bracket.
      • x2

        public double x2
        The upper bound of the bracket.
    • Constructor Detail

      • BracketRoot1D

        public BracketRoot1D​(double x1,
                             double x2)
        Construct a bracket around a root in a 1D function.
        Parameters:
        x1 - The lower bound of the bracket.
        x2 - The upper bound of the bracket.
    • Method Detail

      • findBrackets

        public static java.util.List<BracketRoot1DfindBrackets​(Evaluatable1D func,
                                                                 double x1,
                                                                 double x2,
                                                                 int n)
                                                          throws RootException
        Given a function, func, defined on the interval x1 to x2, this routine subdivides the interval into n equally spaced segments, and searches for zero crossings of the function. Brackets around any zero crossings found are returned.
        Parameters:
        func - The function that is being search for zero crossings.
        x1 - The start of the interval to be searched.
        x2 - The end of the interval to be searched.
        n - The number segments to divide the interval into.
        Returns:
        A list containing the brackets that were found. Could be an empty list if no brackets are found.
        Throws:
        RootException - if the Evaluatable1D throws a exception.
      • compareTo

        public int compareTo​(BracketRoot1D o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. This implementation compares the start of the bracket (x1) only.
        Specified by:
        compareTo in interface java.lang.Comparable<BracketRoot1D>
      • toString

        public java.lang.String toString()
        Return a String representation of this object.
        Overrides:
        toString in class java.lang.Object