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.math3.ode.nonstiff; 019 020import org.apache.commons.math3.util.FastMath; 021 022 023/** 024 * This class implements the Luther sixth order Runge-Kutta 025 * integrator for Ordinary Differential Equations. 026 027 * <p> 028 * This method is described in H. A. Luther 1968 paper <a 029 * href="http://www.ams.org/journals/mcom/1968-22-102/S0025-5718-68-99876-1/S0025-5718-68-99876-1.pdf"> 030 * An explicit Sixth-Order Runge-Kutta Formula</a>. 031 * </p> 032 033 * <p>This method is an explicit Runge-Kutta method, its Butcher-array 034 * is the following one : 035 * <pre> 036 * 0 | 0 0 0 0 0 0 037 * 1 | 1 0 0 0 0 0 038 * 1/2 | 3/8 1/8 0 0 0 0 039 * 2/3 | 8/27 2/27 8/27 0 0 0 040 * (7-q)/14 | ( -21 + 9q)/392 ( -56 + 8q)/392 ( 336 - 48q)/392 ( -63 + 3q)/392 0 0 041 * (7+q)/14 | (-1155 - 255q)/1960 ( -280 - 40q)/1960 ( 0 - 320q)/1960 ( 63 + 363q)/1960 ( 2352 + 392q)/1960 0 042 * 1 | ( 330 + 105q)/180 ( 120 + 0q)/180 ( -200 + 280q)/180 ( 126 - 189q)/180 ( -686 - 126q)/180 ( 490 - 70q)/180 043 * |-------------------------------------------------------------------------------------------------------------------------------------------------- 044 * | 1/20 0 16/45 0 49/180 49/180 1/20 045 * </pre> 046 * where q = √21</p> 047 * 048 * @see EulerIntegrator 049 * @see ClassicalRungeKuttaIntegrator 050 * @see GillIntegrator 051 * @see MidpointIntegrator 052 * @see ThreeEighthesIntegrator 053 * @since 3.3 054 */ 055 056public class LutherIntegrator extends RungeKuttaIntegrator { 057 058 /** Square root. */ 059 private static final double Q = FastMath.sqrt(21); 060 061 /** Time steps Butcher array. */ 062 private static final double[] STATIC_C = { 063 1.0, 1.0 / 2.0, 2.0 / 3.0, (7.0 - Q) / 14.0, (7.0 + Q) / 14.0, 1.0 064 }; 065 066 /** Internal weights Butcher array. */ 067 private static final double[][] STATIC_A = { 068 { 1.0 }, 069 { 3.0 / 8.0, 1.0 / 8.0 }, 070 { 8.0 / 27.0, 2.0 / 27.0, 8.0 / 27.0 }, 071 { ( -21.0 + 9.0 * Q) / 392.0, ( -56.0 + 8.0 * Q) / 392.0, ( 336.0 - 48.0 * Q) / 392.0, (-63.0 + 3.0 * Q) / 392.0 }, 072 { (-1155.0 - 255.0 * Q) / 1960.0, (-280.0 - 40.0 * Q) / 1960.0, ( 0.0 - 320.0 * Q) / 1960.0, ( 63.0 + 363.0 * Q) / 1960.0, (2352.0 + 392.0 * Q) / 1960.0 }, 073 { ( 330.0 + 105.0 * Q) / 180.0, ( 120.0 + 0.0 * Q) / 180.0, (-200.0 + 280.0 * Q) / 180.0, (126.0 - 189.0 * Q) / 180.0, (-686.0 - 126.0 * Q) / 180.0, (490.0 - 70.0 * Q) / 180.0 } 074 }; 075 076 /** Propagation weights Butcher array. */ 077 private static final double[] STATIC_B = { 078 1.0 / 20.0, 0, 16.0 / 45.0, 0, 49.0 / 180.0, 49.0 / 180.0, 1.0 / 20.0 079 }; 080 081 /** Simple constructor. 082 * Build a fourth-order Luther integrator with the given step. 083 * @param step integration step 084 */ 085 public LutherIntegrator(final double step) { 086 super("Luther", STATIC_C, STATIC_A, STATIC_B, new LutherStepInterpolator(), step); 087 } 088 089}