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.math.ode.nonstiff;
019
020
021 /**
022 * This class implements the Gill 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/2 | 1/2 0 0 0
030 * 1/2 | (q-1)/2 (2-q)/2 0 0
031 * 1 | 0 -q/2 (2+q)/2 0
032 * |-------------------------------
033 * | 1/6 (2-q)/6 (2+q)/6 1/6
034 * </pre>
035 * where q = sqrt(2)</p>
036 *
037 * @see EulerIntegrator
038 * @see ClassicalRungeKuttaIntegrator
039 * @see MidpointIntegrator
040 * @see ThreeEighthesIntegrator
041 * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $
042 * @since 1.2
043 */
044
045 public class GillIntegrator extends RungeKuttaIntegrator {
046
047 /** Time steps Butcher array. */
048 private static final double[] STATIC_C = {
049 1.0 / 2.0, 1.0 / 2.0, 1.0
050 };
051
052 /** Internal weights Butcher array. */
053 private static final double[][] STATIC_A = {
054 { 1.0 / 2.0 },
055 { (Math.sqrt(2.0) - 1.0) / 2.0, (2.0 - Math.sqrt(2.0)) / 2.0 },
056 { 0.0, -Math.sqrt(2.0) / 2.0, (2.0 + Math.sqrt(2.0)) / 2.0 }
057 };
058
059 /** Propagation weights Butcher array. */
060 private static final double[] STATIC_B = {
061 1.0 / 6.0, (2.0 - Math.sqrt(2.0)) / 6.0, (2.0 + Math.sqrt(2.0)) / 6.0, 1.0 / 6.0
062 };
063
064 /** Simple constructor.
065 * Build a fourth-order Gill integrator with the given step.
066 * @param step integration step
067 */
068 public GillIntegrator(final double step) {
069 super("Gill", STATIC_C, STATIC_A, STATIC_B, new GillStepInterpolator(), step);
070 }
071
072 }