Class BinarySolverUtil
Utility class providing binary solving methods for one-dimensional functions.
public static class BinarySolverUtil
- Inheritance
-
BinarySolverUtil
- Inherited Members
Methods
CenterSplitionSolve(Func<double, double>, double, double, double, double, double, Func<double, bool>, int)
Solves for a target y-value using the center splitting method.
public static IEnumerable<BinarySolvingStatus> CenterSplitionSolve(Func<double, double> func, double x0, double y0, double x1, double yTarget, double convergenceLimit, Func<double, bool> isYAcceptableFunc, int maxIteration = 12)
Parameters
func
Func<double, double>The function to solve
x0
doubleInitial x value
y0
doubleInitial y value (func(x0))
x1
doubleSecond x value
yTarget
doubleTarget y value to solve for
convergenceLimit
doubleConvergence limit (acceptable error)
isYAcceptableFunc
Func<double, bool>Function to determine if a y value is acceptable
maxIteration
intMaximum number of iterations
Returns
- IEnumerable<BinarySolvingStatus>
A sequence of solving status objects showing the progress of the solution
CenterSplitionSolveWithY1(Func<double, double>, double, double, double, double, double, double, Func<double, bool>, int)
Solves for a target y-value using the center splitting method with a pre-calculated y1 value.
public static IEnumerable<BinarySolvingStatus> CenterSplitionSolveWithY1(Func<double, double> func, double x0, double y0, double x1, double y1, double yTarget, double convergenceLimit, Func<double, bool> isYAcceptableFunc, int maxIteration = 12)
Parameters
func
Func<double, double>The function to solve
x0
doubleInitial x value
y0
doubleInitial y value (func(x0))
x1
doubleSecond x value
y1
doubleSecond y value (func(x1))
yTarget
doubleTarget y value to solve for
convergenceLimit
doubleConvergence limit (acceptable error)
isYAcceptableFunc
Func<double, bool>Function to determine if a y value is acceptable
maxIteration
intMaximum number of iterations
Returns
- IEnumerable<BinarySolvingStatus>
A sequence of solving status objects showing the progress of the solution
SlopeSolve(Func<double, double>, double, double, double, double, double, int)
Solves for a target y-value using the slope method.
public static IEnumerable<BinarySolvingStatus> SlopeSolve(Func<double, double> func, double x0, double y0, double x1, double yTarget, double convergenceLimit, int maxIteration = 12)
Parameters
func
Func<double, double>The function to solve
x0
doubleInitial x value
y0
doubleInitial y value (func(x0))
x1
doubleSecond x value
yTarget
doubleTarget y value to solve for
convergenceLimit
doubleConvergence limit (acceptable error)
maxIteration
intMaximum number of iterations
Returns
- IEnumerable<BinarySolvingStatus>
A sequence of solving status objects showing the progress of the solution
SlopeSolveWithY1(Func<double, double>, double, double, double, double, double, double, int)
Solves for a target y-value using the slope method with a pre-calculated y1 value.
public static IEnumerable<BinarySolvingStatus> SlopeSolveWithY1(Func<double, double> func, double x0, double y0, double x1, double y1, double yTarget, double convergenceLimit, int maxIteration = 12)
Parameters
func
Func<double, double>The function to solve
x0
doubleInitial x value
y0
doubleInitial y value (func(x0))
x1
doubleSecond x value
y1
doubleSecond y value (func(x1))
yTarget
doubleTarget y value to solve for
convergenceLimit
doubleConvergence limit (acceptable error)
maxIteration
intMaximum number of iterations
Returns
- IEnumerable<BinarySolvingStatus>
A sequence of solving status objects showing the progress of the solution