GithubHelp home page GithubHelp logo

isabella232 / bessel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sheetjs/bessel

0.0 0.0 0.0 63 KB

Bessel Functions in JS

Home Page: http://oss.sheetjs.com/bessel/

License: Apache License 2.0

Shell 0.81% JavaScript 93.37% CSS 2.57% Makefile 1.05% HTML 2.21%

bessel's Introduction

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

bessel's People

Contributors

sheetjsdev avatar hmalphettes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.