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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLSODA(double hmin, double hmax, double absoluteTol, double relativeTol, int maxOrderN, int maxOrderS) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventHandler(org.apache.commons.math3.ode.events.EventHandler eventHandler, double v, double v1, int i) voidaddEventHandler(org.apache.commons.math3.ode.events.EventHandler eventHandler, double v, double v1, int i, org.apache.commons.math3.analysis.solvers.UnivariateSolver univariateSolver) voidaddStepHandler(org.apache.commons.math3.ode.sampling.StepHandler stepHandler) voidvoiddouble[]FirstOrderSystem(double[] y, double t) doubledoubleintCollection<org.apache.commons.math3.ode.events.EventHandler>intintintgetName()Collection<org.apache.commons.math3.ode.sampling.StepHandler>intgetTvec()getYvec()doubleintegrate(org.apache.commons.math3.ode.FirstOrderDifferentialEquations ode, double t0, double[] y, double tout, double[] result) the ODE integrating methodbooleanWhether this integrator is pinned to the BDF half.voidlsoda(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 parametersvoidsetForceStiff(boolean value) Whether to start on the BDF half and never switch back to Adams.voidsetMaxEvaluations(int i) voidsetOutputTimes(double[] ts) Instants to record besides the integrator's own steps, increasing.voidA test consulted after every accepted step, ending the integration when it returns true.
-
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 equationsyp- initial values of yt- start timetout- end timeitol- type of error tolerancertol- relative error toleranceatol- absolute error toleranceitask- types of integrationistate- indicate whether this is the first call or notiopt- indicate whether the params are default or notmsg- indicate whether to print extra messagemaxstep- max stepsmaxhnil- number of consecutive times that h is too small to recognizemaxordn- max order for non-stiff methodmaxords- max order for stiff methodtmax- max t for integratinghinit- initial step sizehmax- max step sizehmin- 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/lsodacall whose window it applies to. Pass null to go back to recording steps only.- Parameters:
ts- increasing output instants, or null
-
setStopCondition
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
FirstOrderIntegratorand 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:stiffIntegratorFormay 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:
integratein interfaceorg.apache.commons.math3.ode.FirstOrderIntegrator- Parameters:
ode- the definition of the ordinary differential equationst0- the initial value of ty- the initial valuestout- the output stationresult- the array used to store the integrating result- Throws:
org.apache.commons.math3.exception.DimensionMismatchExceptionorg.apache.commons.math3.exception.NumberIsTooSmallExceptionorg.apache.commons.math3.exception.MaxCountExceededExceptionorg.apache.commons.math3.exception.NoBracketingException
-
getName
- Specified by:
getNamein interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
addStepHandler
public void addStepHandler(org.apache.commons.math3.ode.sampling.StepHandler stepHandler) - Specified by:
addStepHandlerin interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
getStepHandlers
- Specified by:
getStepHandlersin interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
clearStepHandlers
public void clearStepHandlers()- Specified by:
clearStepHandlersin interfaceorg.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:
addEventHandlerin interfaceorg.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:
addEventHandlerin interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
getEventHandlers
- Specified by:
getEventHandlersin interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
clearEventHandlers
public void clearEventHandlers()- Specified by:
clearEventHandlersin interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
getCurrentStepStart
public double getCurrentStepStart()- Specified by:
getCurrentStepStartin interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
getCurrentSignedStepsize
public double getCurrentSignedStepsize()- Specified by:
getCurrentSignedStepsizein interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
setMaxEvaluations
public void setMaxEvaluations(int i) - Specified by:
setMaxEvaluationsin interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
getMaxEvaluations
public int getMaxEvaluations()- Specified by:
getMaxEvaluationsin interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
getEvaluations
public int getEvaluations()- Specified by:
getEvaluationsin interfaceorg.apache.commons.math3.ode.ODEIntegrator
-
getJacobianEvaluations
public int getJacobianEvaluations() -
getStepsTaken
public int getStepsTaken() -
getMaxComponent
public int getMaxComponent() -
getTvec
-
getYvec
-