Class Pegasus

java.lang.Object
org.shredzone.commons.suncalc.util.Pegasus

public class Pegasus extends Object
Finds the root of a function by using the Pegasus method.
See Also:
  • Constructor Details

  • Method Details

    • calculate

      public static Double calculate(double lower, double upper, double accuracy, Function<Double,Double> f)
      Find the root of the given function within the boundaries.
      Parameters:
      lower - Lower boundary
      upper - Upper boundary
      accuracy - Desired accuracy
      f - Function to be used for calculation
      Returns:
      root that was found
      Throws:
      ArithmeticException - if the root could not be found in the given accuracy within 30 iterations.