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 a simple Euler integrator for Ordinary
22 * Differential Equations.
23 *
24 * <p>The Euler algorithm is the simplest one that can be used to
25 * integrate ordinary differential equations. It is a simple inversion
26 * of the forward difference expression :
27 * <code>f'=(f(t+h)-f(t))/h</code> which leads to
28 * <code>f(t+h)=f(t)+hf'</code>. The interpolation scheme used for
29 * dense output is the linear scheme already used for integration.</p>
30 *
31 * <p>This algorithm looks cheap because it needs only one function
32 * evaluation per step. However, as it uses linear estimates, it needs
33 * very small steps to achieve high accuracy, and small steps lead to
34 * numerical errors and instabilities.</p>
35 *
36 * <p>This algorithm is almost never used and has been included in
37 * this package only as a comparison reference for more useful
38 * integrators.</p>
39 *
40 * @see MidpointIntegrator
41 * @see ClassicalRungeKuttaIntegrator
42 * @see GillIntegrator
43 * @see ThreeEighthesIntegrator
44 * @version $Revision: 620312 $ $Date: 2008-02-10 12:28:59 -0700 (Sun, 10 Feb 2008) $
45 * @since 1.2
46 */
47
48 public class EulerIntegrator
49 extends RungeKuttaIntegrator {
50
51 /** Integrator method name. */
52 private static final String methodName = "Euler";
53
54 /** Time steps Butcher array. */
55 private static final double[] c = {
56 };
57
58 /** Internal weights Butcher array. */
59 private static final double[][] a = {
60 };
61
62 /** Propagation weights Butcher array. */
63 private static final double[] b = {
64 1.0
65 };
66
67 /** Simple constructor.
68 * Build an Euler integrator with the given step.
69 * @param step integration step
70 */
71 public EulerIntegrator(double step) {
72 super(c, a, b, new EulerStepInterpolator(), 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 }