- new
Adaptive (diffEq, energySystem, diffEqSolver): AdaptiveStepSolverStep Solver #### Parameters

##### diffEq: ODESim

the ODESim that defines the differential equation to solve

##### energySystem: EnergySystem

gives information about energy in the ODESim

##### diffEqSolver: DiffEqSolver

the DiffEqSolver to use with various step sizes.

#### Returns AdaptiveStepSolver

`Private`

specialspecialTest_ : boolean = false

enables debug code for particular test

- get
Name (opt_localized?): string Name of this object, either the language-independent name for scripting purposes or the localized name for display to user.

The language-independent name should be the same as the English version but capitalized and with spaces and dashes replaced by underscore, see Util.toName and nameEquals.

#### Parameters

`Optional`

opt_localized: boolean`true`

means return the localized version of the name; default is`false`

which means return the language independent name.

#### Returns string

name of this object

- get
Second (): booleanDiff Returns whether to use second order differences for deciding when to reduce the step size. See setSecondDiff.

#### Returns boolean

whether to use change in change in energy as the criteria for accuracy

- name
Equals (name): boolean Whether this DiffEqSolver has the given name, adjusting for the transformation to a language-independent form of the name, as is done by Util.toName.

#### Parameters

##### name: string

the English or language-independent version of the name

#### Returns boolean

whether this DiffEqSolver has the given name (adjusted to language-independent form)

- set
Second (value): voidDiff Whether to use second order differences for deciding when to reduce the step size. The first difference is the change in energy of the system over a time step. We can only use first differences when the energy of the system is constant. If the energy of the system changes over time, then we need to reduce the step size until the change of energy over the step stabilizes. Put another way: we reduce the step size until the change in the change in energy becomes small.

#### Parameters

##### value: boolean

true means use

*change in change in energy*(second derivative) as the criteria for accuracy

#### Returns void

- step(stepSize): null | object
Advances the associated ODESim by the given small time increment, which results in modifiying the state variables of the ODESim. Modifies the variables array obtained from ODESim.getVarsList by using the change rates obtained from ODESim.evaluate.

#### Parameters

##### stepSize: number

the amount of time to advance the differential equation

#### Returns null | object

null if the step succeeds, otherwise an object relating to the error that occurred

- to
String (): stringShort Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.

For an object whose main purpose is to represent another Printable object, it is recommended to include the result of calling

`toStringShort`

on that other object. For example, calling`toStringShort()`

on a DisplayShape might return something like this:`DisplayShape{polygon:Polygon{'chain3'}}`

#### Returns string

a minimal string representation of this object.

Generated using TypeDoc

Experimental differential equation solver which reduces step size as needed to ensure that energy stays constant over every time step. Uses Decorator design pattern to wrap another DiffEqSolver.

For each step in solving the differential equation, we solve the step several times, taking multiple smaller time steps until some criteria tells us that we have achieved sufficient accuracy.

There are two criteria that can be used:

For a constant energy system, we reduce the step size until the change in energy for the overall step becomes small.

For a non-constant energy system, we look at the change in energy during the overall step; we reduce the step size until this change in energy stabilizes.

TO DOProbably a better approach is to use a method like Runge Kutta Fehlberg which modifies the step size based on error estimates for the diff eqns.TO DOTo make this a true Decorator pattern we need to modify the ODESim interface to support getting energy information and also add some other methods that are part of the Simulation and ODESim classes, like`modifyObjects, saveState, restoreState`

. Note that the current CollisionSim interface has several of these methods, so there is an argument to extend ODESim in this way.