
Product
Introducing Custom Tabs for Org Alerts
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.
Integrate a system of ODEs using the Euler method
This module integrates a system of ordinary differential equations of the form


is a vector of length
. Given time step
, the Euler method integrates the ODE with update 
$ npm install ode-euler
var euler = require('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 ]
require('ode-euler')( y0, deriv, t0, dt )Arguments:
y0: an array or typed array containing initial conditions. This vector is updated in-place with each integrator step.deriv: a function that calculates the derivative. Format is function( dydt, y, t ). Inputs are current state y and current time t, output is calcualted derivative dydt.t0: initial time
.dt: time step
.Returns: Initialized integrator object.
Properties:
n: dimension of y0.y: current state. Initialized as a shallow copy of input y0.deriv: function that calcualtes derivative. Initialized from input. May be changed.t: current time, incremented by dt with each time step.dt: time step
. Initialized from input dt. May be changed.Methods:
.step(): takes a single step of the Euler integrator and stores the result in-place in the y property..steps( n ): takes n steps of the Euler integrator, storing the result in-place in the y property.(c) 2015 Ricky Reusser. MIT License
FAQs
Integrate a system of ODEs using the Euler method
The npm package ode-euler receives a total of 1 weekly downloads. As such, ode-euler popularity was classified as not popular.
We found that ode-euler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.