Table of Contents

Class BinarySolverUtil

Namespace
Hi.Geom.Solvers
Assembly
HiGeom.dll

Utility class providing binary solving methods for one-dimensional functions.

public static class BinarySolverUtil
Inheritance
BinarySolverUtil
Inherited Members

Methods

CenterSplitionSolve(Func<double, double>, Range<double>, Vec2d, double, double, Func<double, bool>, int)

Efficient center splitting solve that uses an initial point (x0, y0) within the boundary to save one function evaluation. The algorithm intelligently chooses the optimal boundary points based on the initial point position.

public static IEnumerable<BinarySolvingStatus> CenterSplitionSolve(Func<double, double> func, Range<double> xBoundary, Vec2d x0y0, double yTarget, double convergenceLimit, Func<double, bool> isYAcceptableFunc, int maxIteration = 12)

Parameters

func Func<double, double>

The function to solve

xBoundary Range<double>

Boundary of the search interval. The order of Min and Max is not mattered, i.e. they can be reversed.

x0y0 Vec2d

Initial x,y value (x0,func(x0))

yTarget double

Target y value to solve for

convergenceLimit double

Convergence limit (acceptable error)

isYAcceptableFunc Func<double, bool>

Function to determine if a y value is acceptable

maxIteration int

Maximum number of iterations

Returns

IEnumerable<BinarySolvingStatus>

A sequence of solving status objects showing the progress of the solution

CenterSplitionSolve(Func<double, double>, Range<double>, double, double, double, Func<double, bool>, int)

Solves for a target y-value using the center splitting method with a boundary range and initial x value.

public static IEnumerable<BinarySolvingStatus> CenterSplitionSolve(Func<double, double> func, Range<double> xBoundary, double x0, double yTarget, double convergenceLimit, Func<double, bool> isYAcceptableFunc, int maxIteration = 12)

Parameters

func Func<double, double>

The function to solve

xBoundary Range<double>

Boundary of the search interval

x0 double

Initial x value (must be within the boundary)

yTarget double

Target y value to solve for

convergenceLimit double

Convergence limit (acceptable error)

isYAcceptableFunc Func<double, bool>

Function to determine if a y value is acceptable

maxIteration int

Maximum number of iterations

Returns

IEnumerable<BinarySolvingStatus>

A sequence of solving status objects showing the progress of the solution

CenterSplitionSolve(Func<double, double>, Range<double>, double, double, Func<double, bool>, int)

Solves for a target y-value using the center splitting method with a boundary range.

public static IEnumerable<BinarySolvingStatus> CenterSplitionSolve(Func<double, double> func, Range<double> xBoundary, double yTarget, double convergenceLimit, Func<double, bool> isYAcceptableFunc, int maxIteration = 12)

Parameters

func Func<double, double>

The function to solve

xBoundary Range<double>

Boundary of the search interval

yTarget double

Target y value to solve for

convergenceLimit double

Convergence limit (acceptable error)

isYAcceptableFunc Func<double, bool>

Function to determine if a y value is acceptable

maxIteration int

Maximum number of iterations

Returns

IEnumerable<BinarySolvingStatus>

A sequence of solving status objects showing the progress of the solution

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 xBoundary, double yTarget, double convergenceLimit, Func<double, bool> isYAcceptableFunc, int maxIteration = 12)

Parameters

func Func<double, double>

The function to solve

x0 double

Initial x value

y0 double

Initial y value (func(x0))

xBoundary double

extended side boundary

yTarget double

Target y value to solve for

convergenceLimit double

Convergence limit (acceptable error)

isYAcceptableFunc Func<double, bool>

Function to determine if a y value is acceptable

maxIteration int

Maximum 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 double

Initial x value

y0 double

Initial y value (func(x0))

x1 double

Second x value

y1 double

Second y value (func(x1))

yTarget double

Target y value to solve for

convergenceLimit double

Convergence limit (acceptable error)

isYAcceptableFunc Func<double, bool>

Function to determine if a y value is acceptable

maxIteration int

Maximum 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 double

Initial x value

y0 double

Initial y value (func(x0))

x1 double

Second x value

yTarget double

Target y value to solve for

convergenceLimit double

Convergence limit (acceptable error)

maxIteration int

Maximum 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 double

Initial x value

y0 double

Initial y value (func(x0))

x1 double

Second x value

y1 double

Second y value (func(x1))

yTarget double

Target y value to solve for

convergenceLimit double

Convergence limit (acceptable error)

maxIteration int

Maximum number of iterations

Returns

IEnumerable<BinarySolvingStatus>

A sequence of solving status objects showing the progress of the solution