1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.jstats.ode.integrators;
11
12 import nl.tudelft.simulation.jstats.ode.DifferentialEquationInterface;
13
14 /***
15 * The Euler numerical estimator as described in <a
16 * href="http://mathworld.wolfram.com/EulerForwardMethod.html">
17 * http://mathworld.wolfram.com/EulerForwardMethod.html </a>
18 * <p>
19 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
20 * University of Technology </a>, the Netherlands. <br>
21 * See for project information <a
22 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
23 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
24 * License (GPL) </a>, no warranty <br>
25 *
26 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
27 * Jacobs </a>
28 * @version 1.2 Apr 20, 2004
29 * @since 1.4
30 */
31 public class Euler extends NumericalIntegrator
32 {
33 /***
34 * constructs a new Euler
35 *
36 * @param timeStep the timeStep
37 * @param equation the differentialEquation
38 */
39 public Euler(final double timeStep,
40 final DifferentialEquationInterface equation)
41 {
42 super(timeStep, equation);
43 }
44
45 /***
46 * @see nl.tudelft.simulation.jstats.ode.integrators.NumericalIntegrator#next(double,
47 * double[])
48 */
49 public double[] next(final double x, final double[] y)
50 {
51 return super.add(y, super.multiply(this.timeStep, this.equation
52 .dy(x, y)));
53 }
54 }