Package odesolver

Class LSODA

java.lang.Object
odesolver.LSODA
All Implemented Interfaces:
org.apache.commons.math3.ode.FirstOrderIntegrator, org.apache.commons.math3.ode.ODEIntegrator
Direct Known Subclasses:
LSODAExt

public class LSODA extends Object implements org.apache.commons.math3.ode.FirstOrderIntegrator
  • Field Details

    • ode

      public org.apache.commons.math3.ode.FirstOrderDifferentialEquations ode
    • tn

      public double tn
    • istate

      public int istate
    • y

      public double[] y
    • write

      public boolean write
  • Constructor Details

    • LSODA

      public LSODA(double hmin, double hmax, double absoluteTol, double relativeTol, int maxOrderN, int maxOrderS)
  • Method Details

    • setForceStiff

      public void setForceStiff(boolean value)
      Whether to start on the BDF half and never switch back to Adams.
      Parameters:
      value - true to pin the stiff method
    • isForceStiff

      public boolean isForceStiff()
      Whether this integrator is pinned to the BDF half.
    • lsoda

      public void lsoda(int neq, double[] yp, double t, double tout, int itol, double[] rtol, double[] atol, int itask, int istate, int iopt, int msg, int maxstep, int maxhnil, int maxordn, int maxords, double tmax, double hinit, double hmax, double hmin)
      the ODE solving method that offers more customization parameters
      Parameters:
      neq - number of equations
      yp - initial values of y
      t - start time
      tout - end time
      itol - type of error tolerance
      rtol - relative error tolerance
      atol - absolute error tolerance
      itask - types of integration
      istate - indicate whether this is the first call or not
      iopt - indicate whether the params are default or not
      msg - indicate whether to print extra message
      maxstep - max steps
      maxhnil - number of consecutive times that h is too small to recognize
      maxordn - max order for non-stiff method
      maxords - max order for stiff method
      tmax - max t for integrating
      hinit - initial step size
      hmax - max step size
      hmin - min step size
    • setOutputTimes

      public void setOutputTimes(double[] ts)
      Instants to record besides the integrator's own steps, increasing.

      Resets the emission pointer, so it must be called before each integrate/lsoda call whose window it applies to. Pass null to go back to recording steps only.

      Parameters:
      ts - increasing output instants, or null
    • setStopCondition

      public void setStopCondition(StepStopCondition c)
      A test consulted after every accepted step, ending the integration when it returns true.

      WHY NOT addStepHandler. That method is an empty stub here -- it satisfies FirstOrderIntegrator and discards what it is given -- so a handler registered through it is silently never called. This is the hook that works.

      Like setOutputTimes(double[]) this must be set before EACH window, and set back to null when the window does not want it: stiffIntegratorFor may hand back a shared instance, and a condition left over from a previous window would apply to this one.

      Parameters:
      c - the test, or null to step every window in full
    • FirstOrderSystem

      public double[] FirstOrderSystem(double[] y, double t)
    • integrate

      public double integrate(org.apache.commons.math3.ode.FirstOrderDifferentialEquations ode, double t0, double[] y, double tout, double[] result) throws org.apache.commons.math3.exception.DimensionMismatchException, org.apache.commons.math3.exception.NumberIsTooSmallException, org.apache.commons.math3.exception.MaxCountExceededException, org.apache.commons.math3.exception.NoBracketingException
      the ODE integrating method
      Specified by:
      integrate in interface org.apache.commons.math3.ode.FirstOrderIntegrator
      Parameters:
      ode - the definition of the ordinary differential equations
      t0 - the initial value of t
      y - the initial values
      tout - the output station
      result - the array used to store the integrating result
      Throws:
      org.apache.commons.math3.exception.DimensionMismatchException
      org.apache.commons.math3.exception.NumberIsTooSmallException
      org.apache.commons.math3.exception.MaxCountExceededException
      org.apache.commons.math3.exception.NoBracketingException
    • getName

      public String getName()
      Specified by:
      getName in interface org.apache.commons.math3.ode.ODEIntegrator
    • addStepHandler

      public void addStepHandler(org.apache.commons.math3.ode.sampling.StepHandler stepHandler)
      Specified by:
      addStepHandler in interface org.apache.commons.math3.ode.ODEIntegrator
    • getStepHandlers

      public Collection<org.apache.commons.math3.ode.sampling.StepHandler> getStepHandlers()
      Specified by:
      getStepHandlers in interface org.apache.commons.math3.ode.ODEIntegrator
    • clearStepHandlers

      public void clearStepHandlers()
      Specified by:
      clearStepHandlers in interface org.apache.commons.math3.ode.ODEIntegrator
    • addEventHandler

      public void addEventHandler(org.apache.commons.math3.ode.events.EventHandler eventHandler, double v, double v1, int i)
      Specified by:
      addEventHandler in interface org.apache.commons.math3.ode.ODEIntegrator
    • addEventHandler

      public void addEventHandler(org.apache.commons.math3.ode.events.EventHandler eventHandler, double v, double v1, int i, org.apache.commons.math3.analysis.solvers.UnivariateSolver univariateSolver)
      Specified by:
      addEventHandler in interface org.apache.commons.math3.ode.ODEIntegrator
    • getEventHandlers

      public Collection<org.apache.commons.math3.ode.events.EventHandler> getEventHandlers()
      Specified by:
      getEventHandlers in interface org.apache.commons.math3.ode.ODEIntegrator
    • clearEventHandlers

      public void clearEventHandlers()
      Specified by:
      clearEventHandlers in interface org.apache.commons.math3.ode.ODEIntegrator
    • getCurrentStepStart

      public double getCurrentStepStart()
      Specified by:
      getCurrentStepStart in interface org.apache.commons.math3.ode.ODEIntegrator
    • getCurrentSignedStepsize

      public double getCurrentSignedStepsize()
      Specified by:
      getCurrentSignedStepsize in interface org.apache.commons.math3.ode.ODEIntegrator
    • setMaxEvaluations

      public void setMaxEvaluations(int i)
      Specified by:
      setMaxEvaluations in interface org.apache.commons.math3.ode.ODEIntegrator
    • getMaxEvaluations

      public int getMaxEvaluations()
      Specified by:
      getMaxEvaluations in interface org.apache.commons.math3.ode.ODEIntegrator
    • getEvaluations

      public int getEvaluations()
      Specified by:
      getEvaluations in interface org.apache.commons.math3.ode.ODEIntegrator
    • getJacobianEvaluations

      public int getJacobianEvaluations()
    • getStepsTaken

      public int getStepsTaken()
    • getMaxComponent

      public int getMaxComponent()
    • getTvec

      public ArrayList<Double> getTvec()
    • getYvec

      public ArrayList<Double[]> getYvec()