Package nl.tudelft.simulation.jstats.ode
Class DifferentialEquation
- java.lang.Object
-
- org.djutils.event.LocalEventProducer
-
- nl.tudelft.simulation.jstats.ode.DifferentialEquation
-
- All Implemented Interfaces:
Serializable,Remote,DifferentialEquationInterface,EventProducer
- Direct Known Subclasses:
DifferentialEquation
public abstract class DifferentialEquation extends LocalEventProducer implements DifferentialEquationInterface
The DifferentialEquation is the abstract basis for the DESS formalism.Copyright (c) 2002-2023 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Author:
- Alexander Verbraeck, Peter Jacobs
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected doublelastXthe last x value, initialized with x0 to start integration.protected double[]lastYthe last calculated value array for lastX, initialized with the initial value array y0.protected doublestepSizethe stepSize; can be negative or positive.-
Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
-
Constructor Summary
Constructors Constructor Description DifferentialEquation(double stepSize, NumericalIntegratorType integratorType)constructs a new DifferentialEquation with a user-specified integrator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumericalIntegratorgetIntegrator()voidinitialize(double x0, double[] y0)initializes the differential equation.protected double[]integrateY(double x, double initialX, double[] initialY)integrates Y.voidsetIntegrator(NumericalIntegrator integrator)double[]y(double x)returns y as a function of x.-
Methods inherited from class org.djutils.event.LocalEventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface nl.tudelft.simulation.jstats.ode.DifferentialEquationInterface
dy
-
-
-
-
Constructor Detail
-
DifferentialEquation
public DifferentialEquation(double stepSize, NumericalIntegratorType integratorType)constructs a new DifferentialEquation with a user-specified integrator.- Parameters:
stepSize- double; the stepSize to use.integratorType- NumericalIntegratorType; the integrator to use.
-
-
Method Detail
-
initialize
public void initialize(double x0, double[] y0)initializes the differential equation.- Specified by:
initializein interfaceDifferentialEquationInterface- Parameters:
x0- double; the initial x-valuey0- double[]; the initial y-value array
-
y
public double[] y(double x)
returns y as a function of x.- Specified by:
yin interfaceDifferentialEquationInterface- Parameters:
x- double; the x-value- Returns:
- y
-
integrateY
protected double[] integrateY(double x, double initialX, double[] initialY)integrates Y.- Parameters:
x- double; the x-valueinitialX- double; the initial X value, non-final (will be updated)initialY- double[]; the initial Y value, non-final (will be updated)- Returns:
- the new Y value
-
getIntegrator
public NumericalIntegrator getIntegrator()
- Returns:
- Returns the integrator.
-
setIntegrator
public void setIntegrator(NumericalIntegrator integrator)
- Parameters:
integrator- NumericalIntegrator; The integrator to set.
-
-