public class Bisection extends Object implements RootFinder
Constructor and Description |
---|
Bisection() |
Modifier and Type | Method and Description |
---|---|
int |
guessesNeeded()
Different root finding methods require different numbers of initial guesses.
|
static double |
root(double eps,
double a,
double b,
Function f,
double... args) |
static double |
root(double eps,
double a,
double b,
int pos,
Function f,
double... args) |
static double |
root(double a,
double b,
Function f,
double... args)
Uses the bisection method to find the argument of some function f for which
f(args) = 0.
|
double |
root(double eps,
int maxIterations,
double[] initialGuesses,
Function f,
int pos,
double... args)
Attempts to numerical compute the root of a given function, such that f(args) = 0.
|
double |
root(double eps,
int maxIterations,
double[] initialGuesses,
Function f,
int pos,
Vec args)
Attempts to numerical compute the root of a given function, such that f(args) = 0.
|
static double |
root(double eps,
int maxIterations,
double a,
double b,
int pos,
Function f,
double... args)
Uses the bisection method to find the argument of some function f for which
f(args) = 0.
|
public static double root(double a, double b, Function f, double... args)
a
- the lower end of the search interval. f(a) must be ≤ 0b
- the uper end of the search interval. f(b) must be ≥ 0f
- the function to find a root ofargs
- the list of initial values for the function. The value at 0
can be anything, since it will be over written by the search.public static double root(double eps, double a, double b, Function f, double... args)
public static double root(double eps, double a, double b, int pos, Function f, double... args)
public static double root(double eps, int maxIterations, double a, double b, int pos, Function f, double... args)
eps
- the accuracy desiredmaxIterations
- the maximum number of iterationsa
- the lower end of the search interval. f(a) must be ≤ 0b
- the uper end of the search interval. f(b) must be ≥ 0f
- the function to find a root ofpos
- which variable in the arguments is going to be the search variableargs
- the list of initial values for the function. The value at pos
can be anything, since it will be over written by the search.public double root(double eps, int maxIterations, double[] initialGuesses, Function f, int pos, double... args)
RootFinder
root
in interface RootFinder
eps
- the accuracy desired for the solutionmaxIterations
- the maximum number of steps allowed before forcing a return of the current solution.initialGuesses
- an array containing the initial guess valuesf
- the function to find the root ofpos
- the index of the argument that will be allowed to alter in order to find the root. Starts from 0args
- the values to be passed to the function as argumentspublic double root(double eps, int maxIterations, double[] initialGuesses, Function f, int pos, Vec args)
RootFinder
root
in interface RootFinder
eps
- the accuracy desired for the solutionmaxIterations
- the maximum number of steps allowed before forcing a return of the current solution.initialGuesses
- an array containing the initial guess valuesf
- the function to find the root ofpos
- the index of the argument that will be allowed to alter in order to find the root. Starts from 0args
- the values to be passed to the function as argumentspublic int guessesNeeded()
RootFinder
guessesNeeded
in interface RootFinder
Copyright © 2017. All rights reserved.