Package org.apfloat

Class RootFinder

java.lang.Object
org.apfloat.RootFinder

class RootFinder extends Object
Helper class for finding roots of functions.
Since:
1.13.0
Version:
1.13.0
  • Constructor Details

    • RootFinder

      private RootFinder()
  • Method Details

    • findRoot

      public static Apfloat findRoot(Function<Apfloat,Apfloat> f, BiFunction<Apfloat,Apfloat,Apfloat> fp, Apfloat y, Apfloat initialGuess, long targetPrecision)
      Find the root of the given function with Newton's method, starting from the given initial guess.
      Parameters:
      f - The function.
      fp - The derivative of the function, first argument is x, second argument is f(x)
      y - The function value to match (e.g. zero to find zeros, some other value to find inverses of functions)
      initialGuess - The initial guess
      targetPrecision - Target precision of the result
      Returns:
      The root