• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 package org.apache.commons.math3.ode;
19 
20 import org.apache.commons.math3.exception.DimensionMismatchException;
21 import org.apache.commons.math3.exception.MaxCountExceededException;
22 
23 /**
24  * This interface allows users to add secondary differential equations to a primary set of
25  * differential equations.
26  *
27  * <p>In some cases users may need to integrate some problem-specific equations along with a primary
28  * set of differential equations. One example is optimal control where adjoined parameters linked to
29  * the minimized hamiltonian must be integrated.
30  *
31  * <p>This interface allows users to add such equations to a primary set of {@link
32  * FirstOrderDifferentialEquations first order differential equations} thanks to the {@link
33  * ExpandableStatefulODE#addSecondaryEquations(SecondaryEquations)} method.
34  *
35  * @see ExpandableStatefulODE
36  * @since 3.0
37  */
38 public interface SecondaryEquations {
39 
40     /**
41      * Get the dimension of the secondary state parameters.
42      *
43      * @return dimension of the secondary state parameters
44      */
getDimension()45     int getDimension();
46 
47     /**
48      * Compute the derivatives related to the secondary state parameters.
49      *
50      * @param t current value of the independent <I>time</I> variable
51      * @param primary array containing the current value of the primary state vector
52      * @param primaryDot array containing the derivative of the primary state vector
53      * @param secondary array containing the current value of the secondary state vector
54      * @param secondaryDot placeholder array where to put the derivative of the secondary state
55      *     vector
56      * @exception MaxCountExceededException if the number of functions evaluations is exceeded
57      * @exception DimensionMismatchException if arrays dimensions do not match equations settings
58      */
computeDerivatives( double t, double[] primary, double[] primaryDot, double[] secondary, double[] secondaryDot)59     void computeDerivatives(
60             double t,
61             double[] primary,
62             double[] primaryDot,
63             double[] secondary,
64             double[] secondaryDot)
65             throws MaxCountExceededException, DimensionMismatchException;
66 }
67