Top Description Fields Constructors Methods
org.apache.commons.math3.ode.nonstiff

public abstract Class RungeKuttaFieldIntegrator<T extends RealFieldElement<T>>

extends AbstractFieldIntegrator<T extends RealFieldElement<T>>
implements FieldButcherArrayProvider<T extends RealFieldElement<T>>
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.ode.nonstiff.FieldButcherArrayProvider
Known Direct Subclasses
org.apache.commons.math3.ode.nonstiff.ThreeEighthesFieldIntegrator, org.apache.commons.math3.ode.nonstiff.EulerFieldIntegrator, org.apache.commons.math3.ode.nonstiff.GillFieldIntegrator, org.apache.commons.math3.ode.nonstiff.ClassicalRungeKuttaFieldIntegrator, org.apache.commons.math3.ode.nonstiff.LutherFieldIntegrator, org.apache.commons.math3.ode.nonstiff.MidpointFieldIntegrator
Type Parameters
<T>
the type of the field elements
Imports
org.apache.commons.math3.Field, .RealFieldElement, org.apache.commons.math3.exception.DimensionMismatchException, .MaxCountExceededException, .NoBracketingException, .NumberIsTooSmallException, org.apache.commons.math3.ode.AbstractFieldIntegrator, .FieldEquationsMapper, .FieldExpandableODE, .FirstOrderFieldDifferentialEquations, .FieldODEState, .FieldODEStateAndDerivative, org.apache.commons.math3.util.MathArrays

This class implements the common part of all fixed step Runge-Kutta integrators for Ordinary Differential Equations.

These methods are explicit Runge-Kutta methods, their Butcher arrays are as follows :

   0  |
  c2  | a21
  c3  | a31  a32
  ... |        ...
  cs  | as1  as2  ...  ass-1
      |--------------------------
      |  b1   b2  ...   bs-1  bs

Since
3.6
See Also
EulerFieldIntegrator, ClassicalRungeKuttaFieldIntegrator, GillFieldIntegrator, MidpointFieldIntegrator

Field Summary

Modifier and TypeField and Description
private final T[][]
a

Internal weights from Butcher array (without the first empty row).

private final T[]
b

External weights for the high order method from Butcher array.

private final T[]
c

Time steps from Butcher array (without the first zero).

private final T
step

Integration step.

Constructor Summary

AccessConstructor and Description
protected
RungeKuttaFieldIntegrator(final Field<T>
field to which the time and state vector elements belong
field
,
final String
name of the method
name
,
final T
integration step
step
)

Simple constructor.

Method Summary

Modifier and TypeMethod and Description
protected abstract RungeKuttaFieldStepInterpolator<T>

Returns:

external weights for the high order method from Butcher array
createInterpolator
(boolean
integration direction indicator
forward
,
T[][]
slopes at the intermediate points
yDotK
,
final FieldODEStateAndDerivative<T>
start of the global step
globalPreviousState
,
final FieldODEStateAndDerivative<T>
end of the global step
globalCurrentState
,
FieldEquationsMapper<T>
equations mapper for the all equations
mapper
)

Create an interpolator.

protected T

Returns:

p/q computed in the instance field
fraction
(final int
numerator
p
,
final int
denominator
q
)

Create a fraction.

public FieldODEStateAndDerivative<T>
integrate(final FieldExpandableODE<T>
differential equations to integrate
equations
,
final FieldODEState<T>
initial state (time, primary and secondary state vectors)
initialState
,
final T
target time for the integration (can be set to a value smaller than t0 for backward integration)
finalTime
)

Implements org.apache.commons.math3.ode.FirstOrderFieldIntegrator.integrate.

Integrate the differential equations up to the given time.

public T[]

Returns:

state vector at t
singleStep
(final FirstOrderFieldDifferentialEquations<T>
differential equations to integrate
equations
,
final T
initial time
t0
,
final T[]
initial value of the state vector at t0
y0
,
final T
target time for the integration (can be set to a value smaller than t0 for backward integration)
t
)

Fast computation of a single step of ODE integration.

Inherited from org.apache.commons.math3.ode.AbstractFieldIntegrator:
acceptStepaddEventHandleraddEventHandleraddStepHandlerclearEventHandlersclearStepHandlerscomputeDerivativesgetCurrentSignedStepsizegetCurrentStepStartgetEquationsgetEvaluationsgetEvaluationsCountergetEventHandlersgetFieldgetMaxEvaluationsgetNamegetStepHandlersgetStepSizegetStepStartinitIntegrationisLastStepresetOccurredsanityCheckssetIsLastStepsetMaxEvaluationssetStateInitializedsetStepSizesetStepStart

Field Detail

aback to summary
private final T[][] a

Internal weights from Butcher array (without the first empty row).

bback to summary
private final T[] b

External weights for the high order method from Butcher array.

cback to summary
private final T[] c

Time steps from Butcher array (without the first zero).

stepback to summary
private final T step

Integration step.

Constructor Detail

RungeKuttaFieldIntegratorback to summary
protected RungeKuttaFieldIntegrator(final Field<T> field, final String name, final T step)

Simple constructor. Build a Runge-Kutta integrator with the given step. The default step handler does nothing.

Parameters
field:Field<T>

field to which the time and state vector elements belong

name:String

name of the method

step:T

integration step

Method Detail

createInterpolatorback to summary
protected abstract RungeKuttaFieldStepInterpolator<T> createInterpolator(boolean forward, T[][] yDotK, final FieldODEStateAndDerivative<T> globalPreviousState, final FieldODEStateAndDerivative<T> globalCurrentState, FieldEquationsMapper<T> mapper)

Create an interpolator.

Parameters
forward:boolean

integration direction indicator

yDotK:T[][]

slopes at the intermediate points

globalPreviousState:FieldODEStateAndDerivative<T>

start of the global step

globalCurrentState:FieldODEStateAndDerivative<T>

end of the global step

mapper:FieldEquationsMapper<T>

equations mapper for the all equations

Returns:RungeKuttaFieldStepInterpolator<T>

external weights for the high order method from Butcher array

fractionback to summary
protected T fraction(final int p, final int q)

Create a fraction.

Parameters
p:int

numerator

q:int

denominator

Returns:T

p/q computed in the instance field

integrateback to summary
public FieldODEStateAndDerivative<T> integrate(final FieldExpandableODE<T> equations, final FieldODEState<T> initialState, final T finalTime) throws NumberIsTooSmallException, DimensionMismatchException, MaxCountExceededException, NoBracketingException

Implements org.apache.commons.math3.ode.FirstOrderFieldIntegrator.integrate.

Doc from org.apache.commons.math3.ode.FirstOrderFieldIntegrator.integrate.

Integrate the differential equations up to the given time.

This method solves an Initial Value Problem (IVP).

Since this method stores some internal state variables made available in its public interface during integration (getCurrentSignedStepsize()), it is not thread-safe.

Parameters
equations:FieldExpandableODE<T>

differential equations to integrate

initialState:FieldODEState<T>

initial state (time, primary and secondary state vectors)

finalTime:T

target time for the integration (can be set to a value smaller than t0 for backward integration)

Returns:FieldODEStateAndDerivative<T>

final state, its time will be the same as finalTime if integration reached its target, but may be different if some org.apache.commons.math3.ode.events.FieldEventHandler stops it at some point.

Exceptions
NumberIsTooSmallException:
if integration step is too small
MaxCountExceededException:
if the number of functions evaluations is exceeded
NoBracketingException:
if the location of an event cannot be bracketed
singleStepback to summary
public T[] singleStep(final FirstOrderFieldDifferentialEquations<T> equations, final T t0, final T[] y0, final T t)

Fast computation of a single step of ODE integration.

This method is intended for the limited use case of very fast computation of only one step without using any of the rich features of general integrators that may take some time to set up (i.e. no step handlers, no events handlers, no additional states, no interpolators, no error control, no evaluations count, no sanity checks ...). It handles the strict minimum of computation, so it can be embedded in outer loops.

This method is not used at all by the integrate(FieldExpandableODE, FieldODEState, RealFieldElement) method. It also completely ignores the step set at construction time, and uses only a single step to go from t0 to t.

As this method does not use any of the state-dependent features of the integrator, it should be reasonably thread-safe if and only if the provided differential equations are themselves thread-safe.

Parameters
equations:FirstOrderFieldDifferentialEquations<T>

differential equations to integrate

t0:T

initial time

y0:T[]

initial value of the state vector at t0

t:T

target time for the integration (can be set to a value smaller than t0 for backward integration)

Returns:T[]

state vector at t