Registry / data / numeric

numeric

JSON →
library24.2jsnpmunverified

Numeric JavaScript is a legacy library for performing numerical analysis within JavaScript environments, including matrix operations, solving linear systems, finding eigenvalues, and optimization problems. Despite its capabilities, the package's last stable version (1.2.6) was published in December 2012, indicating it is no longer actively maintained. Its core differentiators were performing complex calculations directly in the browser, reducing server load. Due to its age, it lacks modern JavaScript features, performance optimizations, and official TypeScript support, making it generally unsuitable for new projects. Developers seeking numerical analysis in contemporary JavaScript should consider actively maintained alternatives like `math.js` or `ndarray`.

npm install numeric
INSTALL
IMPORT
SIG · NUMERIC
N
numeric
datajavascriptv24.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

numeric
const numeric = require('numeric');
import numeric from 'numeric';
This package is CommonJS-only. Direct 'import' statements will fail in ESM environments without specific build tool configuration.
numeric (browser global)
<script src="path/to/numeric.js"></script> // 'numeric' object is now globally available
In a browser, load the script tag. The library exposes a global 'numeric' object.
Type definitions
// No official types are shipped. Consider community-maintained @types/numeric or manual declaration.
This package predates widespread TypeScript adoption and does not ship with its own type definitions. Using it in a TypeScript project requires manual type declarations or a community-maintained `@types` package (if available and up-to-date).

This quickstart demonstrates fundamental numerical operations: matrix multiplication, generating an identity matrix, solving a linear system of equations, and computing eigenvalues and eigenvectors.

const numeric = require('numeric'); // 1. Matrix Multiplication (dot product) const A = [[1, 2], [3, 4]]; const B = [[5, 6], [7, 8]]; const C = numeric.dot(A, B); console.log('Matrix C (A * B):', C); // Expected: [[19, 22], [43, 50]] // 2. Identity Matrix const I = numeric.identity(3); console.log('3x3 Identity Matrix:', I); // 3. Solving a Linear System (Ax = b) // A = [[2, 1], [1, 3]], b = [4, 7] const solve_A = [[2, 1], [1, 3]]; const solve_b = [4, 7]; const x = numeric.solve(solve_A, solve_b); console.log('Solution x for Ax=b:', x); // Expected: [1, 2] // 4. Eigenvalues (for a symmetric matrix) const eigen_matrix = [[2, 0], [0, 3]]; const eigenvalues = numeric.eig(eigen_matrix); // The real parts of the eigenvalues (lambda.x) and eigenvectors (E.x) console.log('Eigenvalues (real parts):', eigenvalues.lambda.x); // Expected: [2, 3] console.log('Eigenvectors (real parts):', eigenvalues.E.x);
Debug
Known issues
breakingThe 'numeric' package is effectively abandoned, with its last update over a decade ago. It lacks active maintenance, bug fixes, security patches, or support for modern JavaScript features and environments.
fix
Avoid using 'numeric' for new projects. Consider actively maintained alternatives such as 'math.js', 'ndarray', or specialized scientific computing libraries.
affects: >=1.0.0
gotchaAs an older package, 'numeric' is built using CommonJS modules. Attempting to import it directly using ES module syntax (`import ... from 'numeric'`) in modern ESM-only environments will result in runtime errors.
fix
Use CommonJS `require()` syntax (`const numeric = require('numeric');`) in Node.js. For browser environments, load `numeric.js` via a `<script>` tag. If used in an ESM project, a bundler (e.g., Webpack, Rollup) configured to handle CJS modules is required.
affects: >=1.0.0
gotchaJavaScript's `Number` type uses 64-bit floating-point representation (IEEE 754), which inherently leads to precision issues for certain decimal arithmetic (e.g., `0.1 + 0.2 !== 0.3`). This is critical in numerical analysis where exactness is often required.
fix
Be aware of floating-point inaccuracies. For sensitive calculations requiring arbitrary precision, use dedicated decimal arithmetic libraries (e.g., `decimal.js`, `big.js`) instead of standard JavaScript numbers, or explore libraries built on `BigInt` (not supported by 'numeric').
affects: >=1.0.0
gotchaThe JavaScript `Number` type has limitations for representing large integers reliably (up to `Number.MAX_SAFE_INTEGER`). Calculations exceeding this range can lead to silent data corruption or incorrect results.
fix
For operations with very large integers, JavaScript's native `BigInt` type should be used. However, 'numeric' does not support `BigInt`, requiring developers to manage large integer arithmetic outside the library or use a different numerical package.
affects: >=1.0.0
gotchaThe library does not provide official TypeScript type definitions. Integrating 'numeric' into a TypeScript project will either require manually writing declaration files (`.d.ts`) or relying on potentially outdated community-maintained `@types/numeric` packages.
fix
Install `@types/numeric` if available, or create custom `.d.ts` files to provide type information for the library's functions and objects. This adds maintenance overhead and potential type mismatches.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: numeric.dot is not a function
The 'numeric' object was not correctly imported or is not available in the current scope, or the `numeric.js` script failed to load in the browser.
fix
Ensure `const numeric = require('numeric');` is at the top of your Node.js file, or that `<script src="numeric.js"></script>` is loaded before your code in a browser. Verify the file path is correct.
ReferenceError: numeric is not defined
The 'numeric' library was not successfully loaded or imported before being used.
fix
For Node.js, ensure `require('numeric')` is used to import the module. For browser usage, confirm the `<script>` tag pointing to `numeric.js` is correctly placed and loaded, and the `numeric` global object is available. Check for typos in variable names.
SyntaxError: Cannot use import statement outside a module
Attempting to use ES Module `import` syntax with the CommonJS-only `numeric` package in an environment not configured for ESM or without a bundler to transpile.
fix
Replace `import numeric from 'numeric';` with `const numeric = require('numeric');`. If you must use ESM syntax, ensure your project is configured for ES Modules (e.g., `"type": "module"` in `package.json`) and your bundler can handle CJS interoperability.
Upgrade
Version history
24.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
numeric — npm install numeric · libregistry