public class VariationalEquation extends Object
secondary equations to
 compute the global Jacobian matrices with respect to the initial state
 vector and, if any, to some parameters of the primary ODE set.
 The primary set of ODE for which Jaobian matrices are requested may be:
ODEJacobiansProvider that computes by itself
 both the ODE and its local partial derivatives,OrdinaryDifferentialEquation which must therefore
 be completed with a finite differences configuration to compute local
 partial derivatives (so-called internal differentiation).
 As the variational equation automatically inserts secondary differential
 equations, in the expandable ODE, data for
 initial state must also be inserted before integration and matrices
 result must be extracted after integration. This implies a precise
 scheduling of the calls to the various methods of this class. The
 proper scheduling is the following one:
 
// set up equations ODEJacobiansProvider jode = new MyODE(...); ExpandableODE expandable = new Expandable(jode); VariationalEquation ve = new VariationalEquation(expandable, jode); // set up initial state ODEState initWithoutDerivatives = new ODEState(t0, y0); ve.setInitialMainStateJacobian(dYdY0); // only needed if the default identity matrix is not suitable ve.setInitialParameterJacobian(name, dYdP); // only needed if the default zero matrix is not suitable ODEState initWithDerivatives = ve.setUpInitialState(initWithoutDerivatives); // perform integration on the expanded equations with the expanded initial state ODEStateAndDerivative finalState = integrator.integrate(expandable, initWithDerivatives, finalT); // extract Jacobian matrices dYdY0 = ve.extractMainSetJacobian(finalState); dYdP = ve.extractParameterJacobian(finalState, name);
 The most important part is to not forget to call setUpInitialState(ODEState) to add
 the secondary state with the initial matrices to the ODEState used in the
 integrate method.
 Forgetting to do this and passing only a ODEState without the secondary state
 set up will trigger an error as the state vector will not have the correct dimension.
 
| Modifier and Type | Class and Description | 
|---|---|
| static class  | VariationalEquation.MismatchedEquationsSpecial exception for equations mismatch. | 
| Constructor and Description | 
|---|
| VariationalEquation(ExpandableODE expandable,
                   ODEJacobiansProvider jode)Build variational equation using analytical local partial derivatives. | 
| VariationalEquation(ExpandableODE expandable,
                   OrdinaryDifferentialEquation ode,
                   double[] hY,
                   ParametersController controller,
                   ParameterConfiguration... paramsAndSteps)Build variational equation using finite differences for local
 partial derivatives. | 
| Modifier and Type | Method and Description | 
|---|---|
| double[][] | extractMainSetJacobian(ODEState state)Extract the Jacobian matrix with respect to state. | 
| double[] | extractParameterJacobian(ODEState state,
                        String pName)Extract the Jacobian matrix with respect to one parameter. | 
| void | setInitialMainStateJacobian(double[][] dYdY0)Set the initial value of the Jacobian matrix with respect to state. | 
| void | setInitialParameterJacobian(String pName,
                           double[] dYdP)Set the initial value of a column of the Jacobian matrix with respect to one parameter. | 
| ODEState | setUpInitialState(ODEState initialState)Set up initial state. | 
public VariationalEquation(ExpandableODE expandable, OrdinaryDifferentialEquation ode, double[] hY, ParametersController controller, ParameterConfiguration... paramsAndSteps) throws VariationalEquation.MismatchedEquations
expandable - expandable set into which variational equations should be registeredode - base ordinary differential equation for which Jacobians
 matrices are requestedhY - step used for finite difference computation with respect to state vectorcontroller - controller to change parametersparamsAndSteps - parameters and steps to compute the Jacobians df/dpVariationalEquation.MismatchedEquations - if the primary set of the expandable set does
 not match the odepublic VariationalEquation(ExpandableODE expandable, ODEJacobiansProvider jode) throws VariationalEquation.MismatchedEquations
 Parameters must belong to the supported ones given by Parameterizable.getParametersNames(), so the primary set of differential
 equations must be Parameterizable.
 
Note that each selection clears the previous selected parameters.
expandable - expandable set into which variational equations should be registeredjode - the primary first order differential equations set to extendVariationalEquation.MismatchedEquations - if the primary set of the expandable set does
 not match the odepublic void setInitialMainStateJacobian(double[][] dYdY0)
                                 throws MathIllegalArgumentException
If this method is not called, the initial value of the Jacobian matrix with respect to state is set to identity.
 This method must be called before setUpInitialState(ODEState)
 
dYdY0 - initial Jacobian matrix w.r.t. stateMathIllegalArgumentException - if matrix dimensions are incorrectpublic void setInitialParameterJacobian(String pName, double[] dYdP) throws MathIllegalArgumentException
If this method is not called for some parameter, the initial value of the column of the Jacobian matrix with respect to this parameter is set to zero.
 This method must be called before setUpInitialState(ODEState)
 
pName - parameter namedYdP - initial Jacobian column vector with respect to the parameterMathIllegalArgumentException - if a parameter is not supportedMathIllegalArgumentException - if the column vector does not match state dimensionpublic ODEState setUpInitialState(ODEState initialState)
 This method inserts the initial Jacobian matrices data into
 an ODE state by overriding the additional
 state components corresponding to the instance. It must be
 called prior to integrate the equations.
 
 This method must be called after
 setInitialMainStateJacobian(double[][]) and
 setInitialParameterJacobian(String, double[]).
 
initialState - initial state, without the initial Jacobians
 matricespublic double[][] extractMainSetJacobian(ODEState state)
state - state from which to extract Jacobian matrixpublic double[] extractParameterJacobian(ODEState state, String pName)
state - state from which to extract Jacobian matrixpName - name of the parameter for the computed Jacobian matrixCopyright © 2016–2020 Hipparchus.org. All rights reserved.