# Class Dopri

Basic Dormandâ€“Prince integrator class for solving ordinary differential equations. For delay differential equations, see DDE.

### Example

``````function lorenz(t: number, y: number[], dydt: number[]) {    const y1 = y[0];    const y2 = y[1];    const y3 = y[2];    dydt[0] = 10 * (y2 - y1);    dydt[1] = 28 * y1 - y2 - y1 * y3;    dydt[2] = -8 / 3 * y3 + y1 * y2;};const solver = new Dopri(lorenz, 3);solver.initialise(0, [10, 1, 1]);const solution = solver.run(10);const t = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10];const y = solution(t);
``````

• Dopri

## Constructors

• #### Parameters

• ##### rhs: RhsFn

The right hand side function to be integrated

• ##### n: number

The number of variables in the system to be integrated

• ##### control: Partial<DopriControlParam> = {}

Optional control parameters to tune the integration

• ##### output: OutputFn = null

Optional output function, to compute additional quantities related to the integration alongside the solution

## Methods

• initialise(t: number, y: number[]): Dopri
• Initialise the solver

#### Parameters

• ##### t: number

The time to start integrating from

• ##### y: number[]

The initial conditions

#### Returns Dopri

• run(tEnd: number): ((t: number[]) => number[][])
• Integrate the solution through to some time

#### Parameters

• ##### tEnd: number

End time of the integration

#### Returns ((t: number[]) => number[][])

• (t: number[]): number[][]
• This is essentially a vectorised version of InterpolatedSolution, accepting a vector of times.

### Returns

A vector of vectors; element `[i][j]` is the `j`th variable at the `i`th time in `t`

#### Parameters

• ##### t: number[]

Vector of times to request the solution at

#### Returns number[][]

• statistics(): { lastError: number; nEval: number; nSteps: number; nStepsAccepted: number; nStepsRejected: number; stiffNNonstiff: number; stiffNStiff: number }
• Return statistics about the integration so far

#### Returns { lastError: number; nEval: number; nSteps: number; nStepsAccepted: number; nStepsRejected: number; stiffNNonstiff: number; stiffNStiff: number }

• ##### lastError: number

The last estimated error in the solution

• ##### nEval: number

The number of evaluations of the rhs function

• ##### nSteps: number

The number of steps attempted

• ##### nStepsAccepted: number

The number of steps accepted

• ##### nStepsRejected: number

The number of steps rejected

• ##### stiffNNonstiff: number

The number of stiff checks that were non-stiff

• ##### stiffNStiff: number

The number of stiff checks that were stiff

• steps(): number[]
• #### Returns number[]

Generated using TypeDoc