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

bessel

v1.0.2

Published

Pure-JS Bessel Functions

Downloads

526,853

Readme

bessel

Pure-JS implementation of Bessel functions J,Y,I,K (for the browser and nodejs). Emphasis on correctness and performance for integer order.

The standard notation is used here:

  • J is the Bessel function of the first kind
  • Y is the Bessel function of the second kind
  • I is the modified Bessel function of the first kind
  • K is the modified Bessel function of the second kind

Installation

With npm:

$ npm install bessel

In the browser:

<script src="bessel.js"></script>

The browser exposes a variable BESSEL

The script will manipulate module.exports if available (e.g. in a CommonJS require context). This is not always desirable. To prevent the behavior, define DO_NOT_EXPORT_BESSEL

Usage

In all cases, the relevant function takes two arguments (value, order).

The return value is a JS number. NaN signals an error in calculation.

  • BESSEL.besselj(x, n) computes J_{n}(x)

  • BESSEL.bessely(x, n) computes Y_{n}(x)

  • BESSEL.besseli(x, n) computes I_{n}(x)

  • BESSEL.besselk(x, n) computes K_{n}(x)

For example:

// var BESSEL = require('bessel'); // uncomment this line if in node
BESSEL.besselj(1.5,0)              // 0.5118276712499389
BESSEL.bessely(1.5,0)              // 0.38244892476502895
BESSEL.besseli(1.5,0)              // 1.6467232021476754
BESSEL.besselk(1.5,0)              // 0.2138055693236539

var Y = BESSEL.bessely
Y(Math.PI, 5) + Y(Math.PI, 3) - (2 * 4 / Math.PI) * Y(Math.PI, 4) // 0

Testing

make test will run the nodejs-based test.

To generate the excel.tsv test cases, make a 6-column Excel Sheet:

| x | n | BESSELI | BESSELJ | BESSELK | BESSELY | |---|---|:--------------:|:--------------:|:--------------:|:--------------:| | x | n |BESSELI(A1,B1)|BESSELJ(A1,B1)|BESSELK(A1,B1)|BESSELY(A1,B1)|

To generate the mma.tsv test cases, use the Mathematica Bessel Functions:

(* Bessel_[value, order] *)
F[x_,n_]:={x/2,n,BesselI[n,x/2], BesselJ[n,x/2], BesselK[n,x/2], BesselY[n,x/2]}
Do[Print[ExportString[N[F[x,n],10],"csv"]], {n,1,3}, {x,1,20} ]

Note: Each function follows Excel semantics (value, order). Other platforms like Mathematica reverse the argument order.

License

Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 License are reserved by the Original Author.

Badges

Build Status

Build Status

Coverage Status

NPM Downloads

Dependencies Status

ghit.me

Analytics