~ubuntu-branches/ubuntu/quantal/commons-math/quantal

« back to all changes in this revision

Viewing changes to src/java/org/apache/commons/math/ode/ThreeEighthesIntegrator.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2009-03-15 20:20:21 UTC
  • Revision ID: james.westby@ubuntu.com-20090315202021-zto3nmvqgcf3ami4
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
 
3
 * contributor license agreements.  See the NOTICE file distributed with
 
4
 * this work for additional information regarding copyright ownership.
 
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
6
 * (the "License"); you may not use this file except in compliance with
 
7
 * the License.  You may obtain a copy of the License at
 
8
 *
 
9
 *      http://www.apache.org/licenses/LICENSE-2.0
 
10
 *
 
11
 * Unless required by applicable law or agreed to in writing, software
 
12
 * distributed under the License is distributed on an "AS IS" BASIS,
 
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
14
 * See the License for the specific language governing permissions and
 
15
 * limitations under the License.
 
16
 */
 
17
 
 
18
package org.apache.commons.math.ode;
 
19
 
 
20
/**
 
21
 * This class implements the 3/8 fourth order Runge-Kutta
 
22
 * integrator for Ordinary Differential Equations.
 
23
 *
 
24
 * <p>This method is an explicit Runge-Kutta method, its Butcher-array
 
25
 * is the following one :
 
26
 * <pre>
 
27
 *    0  |  0    0    0    0
 
28
 *   1/3 | 1/3   0    0    0
 
29
 *   2/3 |-1/3   1    0    0
 
30
 *    1  |  1   -1    1    0
 
31
 *       |--------------------
 
32
 *       | 1/8  3/8  3/8  1/8
 
33
 * </pre>
 
34
 * </p>
 
35
 *
 
36
 * @see EulerIntegrator
 
37
 * @see ClassicalRungeKuttaIntegrator
 
38
 * @see GillIntegrator
 
39
 * @see MidpointIntegrator
 
40
 * @version $Revision: 620312 $ $Date: 2008-02-10 12:28:59 -0700 (Sun, 10 Feb 2008) $
 
41
 * @since 1.2
 
42
 */
 
43
 
 
44
public class ThreeEighthesIntegrator
 
45
  extends RungeKuttaIntegrator {
 
46
 
 
47
  /** Integrator method name. */
 
48
  private static final String methodName = "3/8";
 
49
 
 
50
  /** Time steps Butcher array. */
 
51
  private static final double[] c = {
 
52
    1.0 / 3.0, 2.0 / 3.0, 1.0
 
53
  };
 
54
 
 
55
  /** Internal weights Butcher array. */
 
56
  private static final double[][] a = {
 
57
    {  1.0 / 3.0 },
 
58
    { -1.0 / 3.0, 1.0 },
 
59
    {  1.0, -1.0, 1.0 }
 
60
  };
 
61
 
 
62
  /** Propagation weights Butcher array. */
 
63
  private static final double[] b = {
 
64
    1.0 / 8.0, 3.0 / 8.0, 3.0 / 8.0, 1.0 / 8.0
 
65
  };
 
66
 
 
67
  /** Simple constructor.
 
68
   * Build a 3/8 integrator with the given step.
 
69
   * @param step integration step
 
70
   */
 
71
  public ThreeEighthesIntegrator(double step) {
 
72
    super(c, a, b, new ThreeEighthesStepInterpolator(), step);
 
73
  }
 
74
 
 
75
  /** Get the name of the method.
 
76
   * @return name of the method
 
77
   */
 
78
  public String getName() {
 
79
    return methodName;
 
80
  }
 
81
 
 
82
}