fsolve-js
Version:
A numerical solver for non-linear systems of equations, utilizing the n-dimensional Newton-Raphson method.
81 lines (80 loc) • 2.34 kB
TypeScript
import { Matrix } from "mathjs";
/**
* Solver class
* Represents an intance of the numeric
* n-dimensional newton - raphson solver
*/
export declare class Solver {
/**
* Minimum error to stop solver
*/
private stopError;
/**
* Maximum number of iterations to stop solver
*/
private maxIterations;
/**
* Solver timeout (in ms)
*/
private timeOut;
/**
* Numerical differentiation delta
*/
private delta;
private diff;
/**
* Solver constructor
* @param stopError - Minimum error to stop solver.
* @param maxIterations - Maximum number of iterations to stop solver.
* @param timeOut - Solver timeout (in ms)
* @param delta Numerical differentiation delta.
*/
constructor(stopError?: number, maxIterations?: number, timeOut?: number, delta?: number);
/**
* Numerically finds the zeros of function f using Newton -
* Raphson method.
* @param f function to solve
* @param x0 initial guess
* @returns {Solution} use Solution.solved() to check
* if the solver found a solution, Solution.message() to
* get solver message and Solution.getX() to get solution's
* X vector.
*/
solve(f: (x: Matrix) => Matrix, x0: Matrix): Solution;
/**
* Numerically finds the zeros of function f using Newton -
* Raphson method generalization for underdetermined systems.
* @param f function to solve
* @param x0 initial guess
* @returns {Solution} use Solution.solved() to check
* if the solver found a solution, Solution.message() to
* get solver message and Solution.getX() to get solution's
* X vector.
*/
solveUnderdetermined(f: (x: Matrix) => Matrix, x0: Matrix): Solution;
}
/**
* Represents a solution
*/
declare class Solution {
private x;
private _solved;
private msg;
constructor(x: Matrix, solved: boolean, msg: string);
/**
* Get solution's X Vector.
*/
getX(): Matrix;
/**
* @returns boolean indicating if the solver found a solution
*/
solved(): boolean;
/**
* @returns solver's message.
*/
message(): string;
static success(x: Matrix): Solution;
static timeOut(x: Matrix): Solution;
static maxIterReached(x: Matrix): Solution;
}
export {};