Class Solver

Object
Solver

public class Solver
extends Object
The Solver class solves for zeros of GeneralFunctions using Newton's method or Halley's method of root finding.
  • Method Details

    • getSolutionPointNewton

      public static double getSolutionPointNewton​(GeneralFunction expression, double initialPoint, int runs)
      Gives an approximate root of a GeneralFunction using newtonsMethod(functions.GeneralFunction, double) on the initialPoint for a specified amount of runs
      Parameters:
      expression - the function whose root is being found
      initialPoint - initial approximation of the root
      runs - the amount of times that newtonsMethod(functions.GeneralFunction, double) is iterated
      Returns:
      the approximate solution for a root of the function
    • getSolutionPointNewton

      public static double getSolutionPointNewton​(GeneralFunction expression, double initialPoint)
      Gives an approximate root of a GeneralFunction using newtonsMethod(functions.GeneralFunction, double) on the initialPoint for the amount of runs specified in Settings.defaultSolverIterations
      Parameters:
      expression - the function whose root is being found
      initialPoint - initial approximation of the root
      Returns:
      the approximate solution for a root of the function
    • getSolutionsRange

      public static List<Double> getSolutionsRange​(GeneralFunction expression, double lower, double upper)
      Gives approximate roots of a GeneralFunction in a range of values using the solver specified in Settings.defaultSolverType
      Parameters:
      expression - the function whose roots are being found
      lower - the lower bound of the values that will be searched
      upper - the upper bound of the values that will be searched
      Returns:
      a List of all the approximate roots found
    • getSolutionsRangeNewton

      public static List<Double> getSolutionsRangeNewton​(GeneralFunction expression, double lower, double upper, int runs)
      Gives approximate roots of a GeneralFunction using newtonsMethod(functions.GeneralFunction, double) in a range of values for a specified amount of runs
      Parameters:
      expression - the function whose roots are being found
      lower - the lower bound of the values that will be searched
      upper - the upper bound of the values that will be searched
      runs - the amount of times that newtonsMethod(functions.GeneralFunction, double) is iterated
      Returns:
      a List of all the approximate roots found
    • getSolutionsRangeHalley

      public static List<Double> getSolutionsRangeHalley​(GeneralFunction expression, double lower, double upper)
      Gives approximate roots of a GeneralFunction using Halley's method in a range of values for the amount of runs specified in Settings
      Parameters:
      expression - the function whose roots are being found
      lower - the lower bound of the values that will be searched
      upper - the upper bound of the values that will be searched
      Returns:
      a List of all the approximate roots found
    • getSolutionsRangeNewton

      public static List<Double> getSolutionsRangeNewton​(GeneralFunction expression, double lower, double upper)
      Gives approximate roots of a GeneralFunction using newtonsMethod(functions.GeneralFunction, double) in a range of values for the amount of runs specified in Settings
      Parameters:
      expression - the function whose roots are being found
      lower - the lower bound of the values that will be searched
      upper - the upper bound of the values that will be searched
      Returns:
      a List of all the approximate roots found