Newly Potted Mandrakes
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

## bessel

1.0.2 • Public • Published

# 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:

In the browser:

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:

## 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:

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.

## Keywords

### install

`npm i bessel`

4,253

1.0.2

Apache-2.0

### homepage

oss.sheetjs.com

github