Skip to content
This repository has been archived by the owner on Feb 24, 2019. It is now read-only.

rreusser/ode-explicit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[DEPRECATED] ode-explicit

Build Status

A simple module for integrating a system of first-order ODEs.

This package has been deprecated and replaced with scijs modules. For grealy improved integrators, see any of:

Usage

The integrators take a derivative function, initial conditions, and a hash of options. The integrator itself is just an object; you have to step it yourself. For example, the differential equations for a circle are:

\frac{d}{dt}\left[\begin{array}{c}y_0\y_1\end{array}\right] = \left[\begin{array}{c}-y_1\y_0\end{array}\right]

Then to set up the integration with initial conditions y0 = 1, y1 = 0 and timestep dt = 0.1,

var ode = require('ode-explicit');

var deriv = function(dydt, y, t) {
  dydt[0] = -y[1];
  dydt[1] =  y[0];
};

var y = [1,0];

var integrator = ode.rk4( deriv, y, {dt: 0.1, t: 0} );

The available integrators are euler, rk2, and rk4. Adaptive integration is on the way. To take a single timestep,

integrator.step();

and to take multiple timesteps,

integrator.steps(10);

The results are accessible in the original vector (or also in integrator.y).

Credits

(c) 2015 Ricky Reusser. MIT License

About

[DEPRECATED] Explicit RK-based ODE integrators

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published