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.nonstiff;
019
020
021/**
022 * This class implements the 3/8 fourth order Runge-Kutta
023 * integrator for Ordinary Differential Equations.
024 *
025 * <p>This method is an explicit Runge-Kutta method, its Butcher-array
026 * is the following one :
027 * <pre>
028 *    0  |  0    0    0    0
029 *   1/3 | 1/3   0    0    0
030 *   2/3 |-1/3   1    0    0
031 *    1  |  1   -1    1    0
032 *       |--------------------
033 *       | 1/8  3/8  3/8  1/8
034 * </pre>
035 *
036 * @see EulerIntegrator
037 * @see ClassicalRungeKuttaIntegrator
038 * @see GillIntegrator
039 * @see MidpointIntegrator
040 * @see LutherIntegrator
041 * @since 1.2
042 */
043
044public class ThreeEighthesIntegrator extends RungeKuttaIntegrator {
045
046  /** Time steps Butcher array. */
047  private static final double[] STATIC_C = {
048    1.0 / 3.0, 2.0 / 3.0, 1.0
049  };
050
051  /** Internal weights Butcher array. */
052  private static final double[][] STATIC_A = {
053    {  1.0 / 3.0 },
054    { -1.0 / 3.0, 1.0 },
055    {  1.0, -1.0, 1.0 }
056  };
057
058  /** Propagation weights Butcher array. */
059  private static final double[] STATIC_B = {
060    1.0 / 8.0, 3.0 / 8.0, 3.0 / 8.0, 1.0 / 8.0
061  };
062
063  /** Simple constructor.
064   * Build a 3/8 integrator with the given step.
065   * @param step integration step
066   */
067  public ThreeEighthesIntegrator(final double step) {
068    super("3/8", STATIC_C, STATIC_A, STATIC_B, new ThreeEighthesStepInterpolator(), step);
069  }
070}