RootFinder

abstract class RootFinder(aFunction: FunctionIfc, anInterval: Interval, anInitialPoint: Double = (anInterval.lowerLimit + anInterval.upperLimit) / 2.0, maxIter: Int = 100, desiredPrec: Double = KSLMath.defaultNumericalPrecision) : FunctionalIterator(source)

Parameters

func

the function to search. The function must contain a root in the interval

anInterval

the interval to search

anInitialPoint

the initial point for the search, defaults to mid-point of the interval

maxIter

the maximum number of iterations allowed for the search, default = 100

desiredPrec

the desired precision of the search, default is KSLMath.defaultNumericalPrecision

Inheritors

Constructors

Link copied to clipboard
constructor(aFunction: FunctionIfc, anInterval: Interval, anInitialPoint: Double = (anInterval.lowerLimit + anInterval.upperLimit) / 2.0, maxIter: Int = 100, desiredPrec: Double = KSLMath.defaultNumericalPrecision)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
protected var fNeg: Double

The value of the function at xNeg

Link copied to clipboard
protected var fPos: Double

The value of the function at xPos

Link copied to clipboard

The initial point for the search

Link copied to clipboard
protected var interval: Interval

The interval to search for the root

Link copied to clipboard

The lower limit for the search interval

Link copied to clipboard

The upper limit for the search interval

Link copied to clipboard
protected var xNeg: Double

Value at which the function's value is negative.

Link copied to clipboard
protected var xPos: Double

Value at which the function's value is positive.

Functions

Link copied to clipboard
operator fun contains(x: Double): Boolean

Checks to see if the supplied point is within the search interval

Link copied to clipboard
fun hasRoot(interval: Interval): Boolean
fun hasRoot(xLower: Double, xUpper: Double): Boolean

Returns true if the supplied interval contains a root

Link copied to clipboard
fun setUpSearch(aFunction: FunctionIfc, anInterval: Interval, anInitialPoint: Double = (anInterval.lowerLimit + anInterval.upperLimit) / 2.0)

The interval must have a root for the function and the initial point must be within the interval

Link copied to clipboard
open override fun toString(): String