Skip to content

About

Akima cubic spline, natural cubic spline, linear and nearest neighbor interpolation, and LOESS/LOWESS local regression. A partial TypeScript port of the Apache Commons Math interpolation classes.

Topics

Resources

Stars

29 stars

Watchers

4 watching

Forks

Repository files navigation

Commons Math Interpolation – Akima, Cubic Spline and LOESS for TypeScript

This package is a partial TypeScript port of the interpolation classes of the Apache Commons Math library, with some extensions.

The following forms of interpolation are implemented:

The interpolators work on a dataset of x/y points (knots) and return a function f(x).

Additionally, a local regression algorithm is implemented that can be used in conjunction with the above interpolators.

Interpolation demo: www.source-code.biz/snippets/typescript/akima
LOESS demo: www.source-code.biz/snippets/typescript/loess
NPM package: commons-math-interpolation

Usage

An example program is in the examples directory.

Example for Akima interpolation:

import {createAkimaSplineInterpolator} from "commons-math-interpolation";

const f = createAkimaSplineInterpolator([0, 1, 3, 4], [2, 5, 4, 1]);
console.log(f(2.5));

The LOESS functions and types are imported from the Loess module:

import {createLoessInterpolator} from "commons-math-interpolation/Loess";

const f = createLoessInterpolator({xVals, yVals, bandwidthFraction: 0.3});

Modules

Module Description
Akima Akima cubic spline interpolation.
BasicInterpolators Dispatcher for the basic interpolation methods (without LOESS).
Cubic Natural cubic spline interpolation.
Index Main entry point of the package.
Linear Linear interpolation.
Loess LOESS/LOWESS local regression.
NearestNeighbor Nearest neighbor interpolation.
Utils Utility functions and types used by the other modules of this package.

About

Akima cubic spline, natural cubic spline, linear and nearest neighbor interpolation, and LOESS/LOWESS local regression. A partial TypeScript port of the Apache Commons Math interpolation classes.

Topics

Resources

Stars

29 stars

Watchers

4 watching

Forks

Used by

Contributors

Languages