4.0.0 • Published 4 months ago

@adaskothebeast/splines v4.0.0

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
4 months ago

Splines

Splines implementation in TypeScript.

Description from Wikipedia

In mathematics, a spline is a special function defined piecewise by polynomials. In interpolating problems, spline interpolation is often preferred to polynomial interpolation because it yields similar results, even when using low degree polynomials, while avoiding Runge's phenomenon for higher degrees.

Types of algorithms

  1. Monotone cubic Hermit interpolation Reference

In the mathematical field of numerical analysis, monotone cubic interpolation is a variant of cubic interpolation that preserves monotonicity of the data set being interpolated.

Monotonicity is preserved by linear interpolation but not guaranteed by cubic interpolation.

  1. Natural Cubic Spline - Reference

It is a piece-wise cubic polynomial that is twice continuously differentiable. It is considerably ‘stiffer’ than a polynomial in the sense that it has less tendency to oscillate between data points.

Installation

npm install @adaskothebeast/splines --save
yarn add @adaskothebeast/splines

Usage

Initialize first with pairs of x and y numbers array.

const values: NumberPair[] = [new NumberPair(1, 5), new NumberPair(2, 6.5), ...];

//or
const values: NumberTuple[] = [[1, 5], [2, 6.5], ...];

const spline = new MonotoneCubicHermitInterpolation(values);

const result = spline.interpolate(1.3);
4.0.0

4 months ago

3.0.0

6 months ago

2.1.2

7 months ago

2.1.1

7 months ago

2.1.4

7 months ago

2.1.3

7 months ago

2.1.0

7 months ago

2.0.2

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago