Class DifferentialEquation

java.lang.Object
org.djutils.event.LocalEventProducer
nl.tudelft.simulation.jstats.ode.DifferentialEquation
All Implemented Interfaces:
DifferentialEquationInterface, org.djutils.event.EventProducer
Direct Known Subclasses:
DifferentialEquation

public abstract class DifferentialEquation extends org.djutils.event.LocalEventProducer implements DifferentialEquationInterface
The DifferentialEquation is the abstract basis for the DESS formalism.

Copyright (c) 2002-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information DSOL Manual. The DSOL project is distributed under a three-clause BSD-style license, which can be found at DSOL License.

Author:
Alexander Verbraeck, Peter Jacobs
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected double
    the last x value, initialized with x0 to start integration.
    protected double[]
    the last calculated value array for lastX, initialized with the initial value array y0.
    protected double
    the 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

    Modifier and Type
    Method
    Description
     
    void
    initialize(double x0, double[] y0)
    initializes the differential equation.
    protected double[]
    integrateY(double x, double initialX, double[] initialY)
    integrates Y.
    void
     
    double[]
    y(double x)
    returns y as a function of x.

    Methods inherited from class org.djutils.event.LocalEventProducer

    getEventListenerMap

    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

    Methods inherited from interface org.djutils.event.EventProducer

    addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
  • Field Details

    • lastY

      protected double[] lastY
      the last calculated value array for lastX, initialized with the initial value array y0.
    • stepSize

      protected double stepSize
      the stepSize; can be negative or positive.
    • lastX

      protected double lastX
      the last x value, initialized with x0 to start integration.
  • Constructor Details

    • DifferentialEquation

      public DifferentialEquation(double stepSize, NumericalIntegratorType integratorType)
      constructs a new DifferentialEquation with a user-specified integrator.
      Parameters:
      stepSize - the stepSize to use.
      integratorType - the integrator to use.
  • Method Details

    • initialize

      public void initialize(double x0, double[] y0)
      Description copied from interface: DifferentialEquationInterface
      initializes the differential equation.
      Specified by:
      initialize in interface DifferentialEquationInterface
      Parameters:
      x0 - the initial x-value
      y0 - the initial y-value array
    • y

      public double[] y(double x)
      Description copied from interface: DifferentialEquationInterface
      returns y as a function of x.
      Specified by:
      y in interface DifferentialEquationInterface
      Parameters:
      x - the x-value
      Returns:
      y
    • integrateY

      protected double[] integrateY(double x, double initialX, double[] initialY)
      integrates Y.
      Parameters:
      x - the x-value
      initialX - the initial X value, non-final (will be updated)
      initialY - 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 - The integrator to set.