001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.commons.math3.ode; 019 020 import org.apache.commons.math3.exception.DimensionMismatchException; 021 import org.apache.commons.math3.exception.MaxCountExceededException; 022 023 /** 024 * This interface allows users to add secondary differential equations to a primary 025 * set of differential equations. 026 * <p> 027 * In some cases users may need to integrate some problem-specific equations along 028 * with a primary set of differential equations. One example is optimal control where 029 * adjoined parameters linked to the minimized hamiltonian must be integrated. 030 * </p> 031 * <p> 032 * This interface allows users to add such equations to a primary set of {@link 033 * FirstOrderDifferentialEquations first order differential equations} 034 * thanks to the {@link 035 * ExpandableStatefulODE#addSecondaryEquations(SecondaryEquations)} 036 * method. 037 * </p> 038 * @see ExpandableStatefulODE 039 * @version $Id: SecondaryEquations.java 1416643 2012-12-03 19:37:14Z tn $ 040 * @since 3.0 041 */ 042 public interface SecondaryEquations { 043 044 /** Get the dimension of the secondary state parameters. 045 * @return dimension of the secondary state parameters 046 */ 047 int getDimension(); 048 049 /** Compute the derivatives related to the secondary state parameters. 050 * @param t current value of the independent <I>time</I> variable 051 * @param primary array containing the current value of the primary state vector 052 * @param primaryDot array containing the derivative of the primary state vector 053 * @param secondary array containing the current value of the secondary state vector 054 * @param secondaryDot placeholder array where to put the derivative of the secondary state vector 055 * @exception MaxCountExceededException if the number of functions evaluations is exceeded 056 * @exception DimensionMismatchException if arrays dimensions do not match equations settings 057 */ 058 void computeDerivatives(double t, double[] primary, double[] primaryDot, 059 double[] secondary, double[] secondaryDot) 060 throws MaxCountExceededException, DimensionMismatchException; 061 062 }