npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

numfit

v1.0.7

Published

Javascript library for numerical interpolation and extrapolation.

Downloads

4

Readme

Numfit is a versatile JavaScript library that excels at numerical interpolation and extrapolation, extending its prowess to solving the coefficients of polynomial equations. It currently boasts nine distinct classes tailored for interpolation and extrapolation tasks:

  • Linear
  • Bilinear
  • Trilinear
  • Quadratic
  • Biquadratic
  • Triquadratic
  • Cubic
  • Bicubic
  • Tricubic

Installation

NodeJS Enviroment

Using NPM

Browser Enviroment

There's a couple ways to use Numfit in you browser based projects:

Using CDN (Recommended)

To harness the library without the complexities of local deployment, consider employing a Content Delivery Network (CDN). Simply incorporate the following script tag into your HTML document's <head> section:

<script src="https://cdn.jsdelivr.net/gh/buca/numfit/build/Numfit.min.js"></script>

Using a Local Copy

Alternatively, you can opt for a local deployment of the library. Locate the /build/ directory within this repository and download either the standard Numfit.js file or the minified version Numfit.min.js. Then, incorporate the downloaded file into your HTML document's <head> section using a <script> tag:

<script src="my-directory/Numfit.min.js"></script>

Replace my-directory with the actual path to the downloaded file.

Basic Usage

const positions = [ 0, 1 ];
const values = [ 0, 0, 0, 255, 255, 255 ];
const dimension = 3;
const linear = new Linear( positions, values, dimension );

linear.evaluate(  0 );
linear.evaluate( .5 ); 
linear.evaluate(  1 );
const positions = [ 0,0, 1,1, 2,2, 3,3 ];
const values = [ 
	0,0,0, 255,0,0, 0,255,0, 0,0,255,
	255,0,0, 0,255,0, 0,0,255, 0,0,0, 
	0,255,0, 0,0,255, 0,0,0, 255,0,0,
	0,0,255, 0,0,0, 255,0,0, 0,255,0
];
const dimension = 3;
const bicubic = new Bicubic( positions, values, dimension );

bicubic.step( [0,0], [1,1], [.1,.1] ( position, value ) => {
	// Do something with positions and the values.
});

Building and Testing

Setup

Running the build and testing procedures is easy. First make sure you have npm installed. Secondly navigate to the root directory / in your CLI and run npm install --save-dev which will install two dependencies required in the build and testing phases, esbuild and vitest respectively.

Building

To run the build procedure, you simply navigate to the root directory / in your CLI and run npm run build which will produce two files in the /build/ directory: Numfit.js and Numfit.min.js.

Testing

To run the tests, you again navigate to the root directory / in your CLI and run npm run test which will produce the test results.

Roadmap

Features that we are planning to support down the road are:

  • [ ] More types of samplers. Currently supports step, segment and map.
  • [ ] Polynomial
  • [ ] Multilinear
  • [ ] Multiquadratic
  • [ ] Multicubic
  • [ ] Multipolynomial
  • [ ] Linear Regression
  • [ ] Support for hermite interpolation (defining derivatives)
  • [ ] Support for Inverse Distance Weighing