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
018package org.apache.commons.math4.legacy.ode;
019
020import org.apache.commons.math4.legacy.core.RealFieldElement;
021
022/** This interface represents a first order differential equations set.
023 *
024 * <p>This interface should be implemented by all real first order
025 * differential equation problems before they can be handled by the
026 * integrators {@link FirstOrderIntegrator#integrate} method.</p>
027 *
028 * <p>A first order differential equations problem, as seen by an
029 * integrator is the time derivative <code>dY/dt</code> of a state
030 * vector <code>Y</code>, both being one dimensional arrays. From the
031 * integrator point of view, this derivative depends only on the
032 * current time <code>t</code> and on the state vector
033 * <code>Y</code>.</p>
034 *
035 * <p>For real problems, the derivative depends also on parameters
036 * that do not belong to the state vector (dynamical model constants
037 * for example). These constants are completely outside of the scope
038 * of this interface, the classes that implement it are allowed to
039 * handle them as they want.</p>
040 *
041 * @see FirstOrderFieldIntegrator
042 *
043 * @param <T> the type of the field elements
044 * @since 3.6
045 */
046
047public interface FirstOrderFieldDifferentialEquations<T extends RealFieldElement<T>> {
048
049    /** Get the dimension of the problem.
050     * @return dimension of the problem
051     */
052    int getDimension();
053
054    /** Initialize equations at the start of an ODE integration.
055     * <p>
056     * This method is called once at the start of the integration. It
057     * may be used by the equations to initialize some internal data
058     * if needed.
059     * </p>
060     * @param t0 value of the independent <I>time</I> variable at integration start
061     * @param y0 array containing the value of the state vector at integration start
062     * @param finalTime target time for the integration
063     */
064    void init(T t0, T[] y0, T finalTime);
065
066    /** Get the current time derivative of the state vector.
067     * @param t current value of the independent <I>time</I> variable
068     * @param y array containing the current value of the state vector
069     * @return time derivative of the state vector
070     */
071    T[] computeDerivatives(T t, T[] y);
072}