Class DifferentialEquation

    • Field Detail

      • 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 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:
        initialize in interface DifferentialEquationInterface
        Parameters:
        x0 - double; the initial x-value
        y0 - double[]; the initial y-value array
      • y

        public double[] y​(double x)
        returns y as a function of x.
        Specified by:
        y in interface DifferentialEquationInterface
        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-value
        initialX - 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
      • setIntegrator

        public void setIntegrator​(NumericalIntegrator integrator)
        Parameters:
        integrator - NumericalIntegrator; The integrator to set.