public class BulirschStoerIntegrator extends AdaptiveNumericalIntegrator
An adaptive numerical integrator which uses successive subdivisions of the specified step size in order to measure the relative error in order to update the step size.
Note that the Tolerance
(get
/ set
) will affect
both how accurate the integrator will be as well as how small the step size will be
to achieve the desired accuracy. Having a really small tolerance in relation to large
dependent variables may not be best, since it may drive the step size to values near zero
over the course of the integration when a higher tolerance will still yield accurate results.
Modifier | Constructor and Description |
---|---|
|
BulirschStoerIntegrator()
Initializes a new instance.
|
protected |
BulirschStoerIntegrator(BulirschStoerIntegrator existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
|
BulirschStoerIntegrator(DependentVariableDerivatives system)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
adaptStep()
This method updates the
CurrentStepSize (get ) to account for error in the state and its derivatives. |
Object |
clone(CopyContext context)
Create a copy of this integrator.
|
int |
getLastNumberOfSubdivisionsUsed()
Gets the current maximum number of subdivisions used during the last iteration step.
|
double |
getSafetyFactorOne()
Gets a safety factor used when analyzing roundoff error and determining the new step size.
|
double |
getSafetyFactorTwo()
Gets a safety factor used when analyzing roundoff error and determining the new step size.
|
int[] |
getSubdivisions()
Gets or sets the set of successive subdivisions used to take steps.
|
double |
getTolerance()
Gets the value for the tolerance used to scale the error control,
which will control both how accurate the integrator is and the step size used
during integration.
|
void |
initialize(double x,
double[] y)
Initialize the integrator's initial independent and dependent variables and reset the integration parameters.
|
void |
reintegrate(double stepSize)
Repeats the last integration of the differential equations.
|
void |
setSafetyFactorOne(double value)
Sets a safety factor used when analyzing roundoff error and determining the new step size.
|
void |
setSafetyFactorTwo(double value)
Sets a safety factor used when analyzing roundoff error and determining the new step size.
|
void |
setSubdivisions(int[] value)
Gets or sets the set of successive subdivisions used to take steps.
|
void |
setTolerance(double value)
Sets the value for the tolerance used to scale the error control,
which will control both how accurate the integrator is and the step size used
during integration.
|
protected void |
startNextStep()
This performs the task of setting the Initial values to the previous Final values prior to taking the next step.
|
adjustStep, boundAndTruncateStepSize, getAdaptiveWeights, getCurrentStepSize, getIterations, getMaximumIterations, getMaximumStepSize, getMinimumStepSize, getStepDeflationExponent, getStepDeflationFactor, getStepInflationExponent, getStepInflationFactor, getStepSizeBehavior, getStepTruncationOrder, integrate, integrate, setAdaptiveWeights, setCurrentStepSize, setIterations, setMaximumIterations, setMaximumStepSize, setMinimumStepSize, setStepDeflationExponent, setStepDeflationFactor, setStepInflationExponent, setStepInflationFactor, setStepSizeBehavior, setStepTruncationOrder
getDimension, getDirection, getFinalDependentVariableValues, getFinalIndependentVariableValue, getInitialDependentVariableValues, getInitialIndependentVariableValue, getInitialStepSize, getIsThreadSafe, getPreviousStepSize, getStepSizeInformation, getSystemOfEquations, setDirection, setFinalDependentVariableValues, setFinalIndependentVariableValue, setInitialDependentVariableValues, setInitialIndependentVariableValue, setInitialStepSize, setStepSizeInformation, setSystemOfEquations
public BulirschStoerIntegrator()
public BulirschStoerIntegrator(DependentVariableDerivatives system)
system
- The system of equations to integrate.protected BulirschStoerIntegrator(@Nonnull BulirschStoerIntegrator existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public Object clone(CopyContext context)
clone
in interface ICloneWithContext
clone
in class NumericalIntegrator
context
- The context in which to create the copy.public final double getTolerance()
public final void setTolerance(double value)
public final double getSafetyFactorOne()
Subdivisions
(get
/ set
) array. The default value is 1/4.public final void setSafetyFactorOne(double value)
Subdivisions
(get
/ set
) array. The default value is 1/4.public final double getSafetyFactorTwo()
Subdivisions
(get
/ set
) array. The default value is 7/10.public final void setSafetyFactorTwo(double value)
Subdivisions
(get
/ set
) array. The default value is 7/10.public final int[] getSubdivisions()
Gets or sets the set of successive subdivisions used to take steps. For each step the Bulirsch-Stoer integrator takes, it will divide the step size according to the subdivisions and analyze the error. If the error doesn't converge, it will continue to subdivide until it either converges or decides that the step size itself is problematic and starts over with a new step size.
The default set is derived from the work of Deuflhard: { 2, 4, 6, 8, 10 }
When changing the set, make sure to check for stability as having too few or too many subdivisions can change the behavior of the algorithm.
public final void setSubdivisions(int[] value)
Gets or sets the set of successive subdivisions used to take steps. For each step the Bulirsch-Stoer integrator takes, it will divide the step size according to the subdivisions and analyze the error. If the error doesn't converge, it will continue to subdivide until it either converges or decides that the step size itself is problematic and starts over with a new step size.
The default set is derived from the work of Deuflhard: { 2, 4, 6, 8, 10 }
When changing the set, make sure to check for stability as having too few or too many subdivisions can change the behavior of the algorithm.
public final int getLastNumberOfSubdivisionsUsed()
public void initialize(double x, double[] y)
initialize
in class AdaptiveNumericalIntegrator
x
- The value of the initial independent variable.y
- The values for the initial dependent variables.public boolean adaptStep()
CurrentStepSize
(get
) to account for error in the state and its derivatives.
It returns true if the integrator should reintegrate with the updated step size or false if the integrator
should continue to the next integration step (potentially with a different step size).adaptStep
in class AdaptiveNumericalIntegrator
public void reintegrate(double stepSize)
Repeats the last integration of the differential equations.
When overriding this method, note that the CurrentStepSize
(get
)
property should be unaffected by the stepSize
parameter.
reintegrate
in class NumericalIntegrator
stepSize
- The increment made to the InitialIndependentVariableValue
(get
/ set
)
to transition to the new FinalIndependentVariableValue
(get
/ set
).protected void startNextStep()
startNextStep
in class NumericalIntegrator