Registry / ai-ml / fmin
library0.0.4jsnpmunverified

fmin is a JavaScript library designed for unconstrained numerical function minimization, offering implementations of several common optimization algorithms. These include the Nelder-Mead method, Gradient Descent, Wolf Line Search, and the Non-Linear Conjugate Gradient method. Currently at version 0.0.4, the package appears to be largely unmaintained; its last known commit was over eight years ago, indicating an abandoned status. While it originally differentiated itself by providing interactive visualizations and an accompanying blog post to explain the algorithms, these are external to the core npm package. Due to its very early development stage (sub-1.0 version) and prolonged inactivity, users should be aware of potential limitations regarding modern JavaScript compatibility, lack of TypeScript type definitions, and unoptimized performance compared to contemporary alternatives. The project has no clear release cadence, and development seems to have ceased.

npm install fmin
INSTALL
IMPORT
SIG · FMIN
F
fmin
ai-mljavascriptv0.0.4
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.

fmin (module object)
const fmin = require('fmin');
import fmin from 'fmin';
Primarily a CommonJS module from early development. While ESM `import` might work with bundlers, direct Node.js ESM usage without transpilation could be problematic due to its age and module format.
nelderMead
const fmin = require('fmin'); const solution = fmin.nelderMead(lossFunction, initialPoint);
import { nelderMead } from 'fmin';
The `nelderMead` function is a property of the main `fmin` module object, not a named export. It must be accessed via the imported `fmin` object.
conjugateGradient
const fmin = require('fmin'); const solution = fmin.conjugateGradient(lossAndGradientFunction, initialPoint);
import { conjugateGradient } from 'fmin';
Similar to `nelderMead`, `conjugateGradient` is a property of the main `fmin` module object. It's not available as a direct named import.

Demonstrates how to use the Nelder-Mead algorithm to find the minimum of a simple 2D function, logging the solution and iterations.

function loss(X) { var x = X[0], y = X[1]; return Math.sin(y) * x + Math.sin(x) * y + x * x + y * y; } // Assuming a CommonJS environment or bundled application const fmin = require('fmin'); const initialGuess = [-3.5, 3.5]; const solution = fmin.nelderMead(loss, initialGuess); console.log("Minimum found at:", solution.x); console.log("Value at minimum:", solution.fx); console.log("Iterations:", solution.iterations);
Debug
Known issues
gotchaThe `fmin` package is largely unmaintained, with its last commit over eight years ago (as of 2026) and remaining at version 0.0.4. This indicates a lack of ongoing support and potential for unaddressed bugs or security vulnerabilities.
fix
Consider more actively maintained numerical optimization libraries for production systems. If used, thoroughly review the code and be prepared to fork or fix issues yourself.
affects: >=0.0.1
gotchaThe package lacks official TypeScript type definitions, which can lead to poorer developer experience and potential type-related errors when integrating into TypeScript projects.
fix
Manual type declarations (`.d.ts` files) would need to be created, or explicit `any` types used, compromising type safety.
affects: >=0.0.1
gotchaPerformance of algorithms may not be optimized for modern JavaScript engines or large-scale optimization problems compared to newer, actively developed libraries. Benchmarking against current alternatives is advisable.
fix
For performance-critical applications, evaluate contemporary optimization libraries that leverage modern JS features and optimization techniques.
affects: >=0.0.1
gotchaThe library primarily uses CommonJS module syntax, and direct ESM `import` statements might not work as expected in all environments without a bundler or specific Node.js configuration due to its age and early development stage.
fix
Ensure proper module bundling (e.g., Webpack, Rollup) or use Node.js's CommonJS `require` syntax. For browser environments, ensure your code is bundled to resolve `require` calls.
affects: >=0.0.1
Errors
Common errors & fixes
ReferenceError: fmin is not defined
Attempting to use `fmin` without properly importing or requiring it, or if the module failed to load.
fix
Ensure you have `const fmin = require('fmin');` at the top of your CommonJS file, or that your bundler correctly handles the import in an ESM context.
TypeError: fmin.nelderMead is not a function
The `fmin` object was imported incorrectly, or `nelderMead` property does not exist on the imported object (e.g., due to a failed or partial import).
fix
Verify that `const fmin = require('fmin');` correctly assigns the module's export to the `fmin` variable, and that the `nelderMead` function is indeed available as a property on it. Avoid named imports like `import { nelderMead } from 'fmin';` as it's not a named export.
ReferenceError: require is not defined
Trying to use CommonJS `require` syntax in an environment that is pure ESM (e.g., a Node.js ESM module without `createRequire` or a browser environment without a bundler).
fix
If in a pure ESM environment, you may need a bundler to process `require` statements or investigate dynamic `import()` if feasible. For browser usage, ensure your code is bundled to resolve `require` calls.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
fmin — npm install fmin · libregistry