Package jsl.utilities.rootfinding
Class IPBisectionRootFinder
- java.lang.Object
-
- jsl.simulation.IterativeProcess<RootFinderStep>
-
- jsl.utilities.rootfinding.IPRootFinder
-
- jsl.utilities.rootfinding.IPBisectionRootFinder
-
- All Implemented Interfaces:
ObservableIfc,IterativeProcessIfc,GetNameIfc
public class IPBisectionRootFinder extends IPRootFinder
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jsl.simulation.IterativeProcess
IterativeProcess.Created, IterativeProcess.Ended, IterativeProcess.Initialized, IterativeProcess.IterativeState, IterativeProcess.ShowElapsedTimeTask, IterativeProcess.StepCompleted
-
-
Field Summary
Fields Modifier and Type Field Description protected doublefNegThe value of the function at xNegprotected doublefPosThe value of the function at xPosprotected doublemyDesiredPrecisionDesired precision.protected doublexNegValue at which the function's value is negative.protected doublexPosValue at which the function's value is positive.-
Fields inherited from class jsl.utilities.rootfinding.IPRootFinder
f, myInitialPt, myInterval, myMaxIterations, numIterations, searchFactor
-
Fields inherited from class jsl.simulation.IterativeProcess
COMPLETED_ALL_STEPS, COMPLETED_ALL_STEPS_MSG, EXCEEDED_EXECUTION_TIME, EXCEEDED_EXECUTION_TIME_MSG, MET_STOPPING_CONDITION, MET_STOPPING_CONDITION_MSG, myBeginExecutionTime, myCreatedState, myCurrentStep, myDoneFlag, myEndedState, myEndExecutionTime, myEndingStateIndicator, myId, myInitFlag, myInitializedState, myIPLogReport, myMaxAllowedExecutionTime, myName, myObservableComponent, myRunningFlag, myRunningStepFlag, mySaveStepOption, myState, myStepCompletedState, myStepCounter, mySteps, myTBConsoleUpdates, myTimer, myTimerTask, NO_STEPS_EXECUTED, NO_STEPS_EXECUTED_MSG, UNFINISHED, UNFINISHED_MSG
-
-
Constructor Summary
Constructors Constructor Description IPBisectionRootFinder(FunctionIfc func, double lower, double upper)IPBisectionRootFinder(FunctionIfc func, double initialPt, double lower, double upper)IPBisectionRootFinder(FunctionIfc func, Interval interval)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetDesiredPrecision()Returns the desired precision.doublegetFNeg()doublegetFPos()doublegetPrecision()doublegetXNeg()doublegetXPos()booleanhasConverged()Check to see if the result has been attained.protected booleanhasNext()This method should check to see if another step is necessary for the iterative process.protected voidinitializeIterations()static voidmain(java.lang.String[] args)protected RootFinderStepnext()This method should return the next step to be executed in the iterative process or null if no more steps can be executed.protected voidrunStep()This method tells the iterative process to execute the current step.voidsetDesiredPrecision(double prec)Defines the desired precision.java.lang.StringtoString()Returns a String representation of the finder-
Methods inherited from class jsl.utilities.rootfinding.IPRootFinder
contains, findInterval, findInterval, getFunctionAtRoot, getInitialPoint, getLowerLimit, getMaxIterations, getRoot, getUpperLimit, hasIterations, hasRoot, hasRoot, hasRoot, recommendInitialPoint, recommendInitialPoint, relativePrecision, relativePrecision, setFunction, setInitialPoint, setInterval, setInterval, setInterval, setInterval, setMaxIterations, setRoot
-
Methods inherited from class jsl.simulation.IterativeProcess
addObserver, allStepsCompleted, checkStoppingCondition, checkStoppingCondition_, consoleOutput, contains, countObservers, deleteObserver, deleteObservers, end, end, endIterations, executionTimeExceeded, getBeginExecutionTime, getCurrentStateAsString, getCurrentStep, getElapsedExecutionTime, getEndExecutionTime, getEndingStateIndicator, getEndingStateIndicatorAsString, getId, getLogReport, getMaximumAllowedExecutionTime, getName, getNumberStepsCompleted, getSaveStepOption, getStepIterator, getStepList, getStoppingFlag, getStoppingMessage, initialize, isCreated, isDone, isEnded, isExecutionTimeExceeded, isInitialized, isRunning, isRunningStep, isStepCompleted, isUnfinished, noStepsExecuted, run, runAll_, runNext, runNext_, setId, setMaximumExecutionTime, setName, setSaveStepOption, setState, stop, stop, stoppedByCondition, turnOffLogReport, turnOnLogReport, turnOnTimer
-
-
-
-
Field Detail
-
xNeg
protected double xNeg
Value at which the function's value is negative.
-
xPos
protected double xPos
Value at which the function's value is positive.
-
fNeg
protected double fNeg
The value of the function at xNeg
-
fPos
protected double fPos
The value of the function at xPos
-
myDesiredPrecision
protected double myDesiredPrecision
Desired precision.
-
-
Constructor Detail
-
IPBisectionRootFinder
public IPBisectionRootFinder(FunctionIfc func, Interval interval)
- Parameters:
func-interval-
-
IPBisectionRootFinder
public IPBisectionRootFinder(FunctionIfc func, double lower, double upper)
- Parameters:
func-lower-upper-
-
IPBisectionRootFinder
public IPBisectionRootFinder(FunctionIfc func, double initialPt, double lower, double upper)
- Parameters:
func-lower-upper-
-
-
Method Detail
-
getXNeg
public double getXNeg()
- Returns:
- the xNeg
-
getXPos
public double getXPos()
- Returns:
- the xPos
-
getFNeg
public double getFNeg()
- Returns:
- the fNeg
-
getFPos
public double getFPos()
- Returns:
- the fPos
-
getPrecision
public double getPrecision()
-
getDesiredPrecision
public double getDesiredPrecision()
Returns the desired precision.
-
setDesiredPrecision
public void setDesiredPrecision(double prec)
Defines the desired precision.
-
hasNext
protected boolean hasNext()
Description copied from class:IterativeProcessThis method should check to see if another step is necessary for the iterative process. True means that the process has another step to be executed. False, means that no more steps are available for execution.- Specified by:
hasNextin classIterativeProcess<RootFinderStep>- Returns:
- true if another step is present
-
hasConverged
public boolean hasConverged()
Check to see if the result has been attained.- Specified by:
hasConvergedin classIPRootFinder- Returns:
- boolean
-
toString
public java.lang.String toString()
Description copied from class:IPRootFinderReturns a String representation of the finder- Overrides:
toStringin classIPRootFinder- Returns:
- A String with basic results
-
initializeIterations
protected void initializeIterations()
- Overrides:
initializeIterationsin classIterativeProcess<RootFinderStep>
-
next
protected RootFinderStep next()
Description copied from class:IterativeProcessThis method should return the next step to be executed in the iterative process or null if no more steps can be executed. It should advance the current step to the next step if it is available- Specified by:
nextin classIterativeProcess<RootFinderStep>- Returns:
- the type of the step
-
runStep
protected void runStep()
Description copied from class:IterativeProcessThis method tells the iterative process to execute the current step. Typical usage is to call this after calling next() to advance to the next step. This method should throw a NoSuchStepException if there are no more steps to run and it is told to run the step.- Specified by:
runStepin classIterativeProcess<RootFinderStep>
-
main
public static void main(java.lang.String[] args)
- Parameters:
args-
-
-