🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

ndarray-function-basis

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ndarray-function-basis

Construct an ndarray basis given a sequence of points and functions

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

ndarray-function-basis

Construct an ndarray basis given a sequence of points and functions

Introduction

This module extends the idea of a Vandermonde matrix to a sequence of arbitrary functions. It constructs a set of basis vectors that can be used in a least squares curve fit.

Usage

basis( x, functions [, dtype])

  • x: a vector of numbers for the independent variable at which the functions are evaluated
  • functions: an Array of functions that take a Number as input and return a Number as output
  • dtype (optional): the datatype of the output array, as listed in the ndarray documentation.

Example

For example, to construct a sinusoidal basis with period 2*pi and a constant offset,

var basis = require('ndarray-function-basis'),
    ndarray = require('ndarray');

var x = ndarray([1,2,3,4]);

var f1 = function(x) { return 1; }
var f3 = Math.sin;
var f4 = Math.cos;

var y = basis(x, [f1, f2, f3]);

See also:

ndarray-householder-qr: Householder QR for least squares curve-fitting ndarray-vandermonde: Construct a Vandermonde (polynomial) basis

Credits

(c) 2015 Ricky Reusser. MIT License

Keywords

linearalgebra

FAQs

Package last updated on 09 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts