Integrate a system of ordinary differential equations using the explicit Euler method.
$ npm install compute-ode-euler
For use in the browser, use browserify.
var euler = require( 'compute-ode-euler' );
What does this function do?
var euler = require( 'compute-ode-euler' );
var deriv = function(dydt, y, t) {
dydt[ 0 ] = -y[ 1 ];
dydt[ 1 ] = y[ 0 ];
}
var y0 = [1,0];
var n = 1000;
var t0 = 0;
var dt = 2.0 * Math.PI / n;
var integrator = euler( y0, deriv, t0, dt );
// Integrate 1000 steps:
integrator.steps( n );
// Integrate all the way around a circle:
// => integrator.y = [ 1.0199349143076457, -0.00008432969374211775 ]
To run the example code from the top-level application directory,
$ node ./examples/index.js
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
Copyright © 2015. The Compute.io Authors.