npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ode-euler

v1.0.6

Published

Integrate a system of ODEs using the Euler method

Downloads

25

Readme

ode-euler Build Status npm version Dependency Status

Integrate a system of ODEs using the Euler method

Introduction

This module integrates a system of ordinary differential equations of the form where is a vector of length . Given time step , the Euler method integrates the ODE with update

Install

$ npm install ode-euler

Example

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 ]

API

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.

Credits

(c) 2015 Ricky Reusser. MIT License