UNPKG

@polkassembly/util

Version:

Set of utility functions for Polkassembly and more.

23 lines (22 loc) 775 B
import BN from 'bn.js'; interface Options { tolerance: BN; epsilon: BN; maxIterations: number; h: BN; verbose: boolean; } export interface NewtonRaphsonResult { foundRoot: boolean; result?: BN; } /** * @name newtonRaphson * @summary Returns the root of a polynomial function of degree 3 using the Newton Raphson algorithm. * @param f function that taxes x as parameter and returns the polynomial function of degree 3. * @param fp the derivative of f * @param x0 the starting point of the iteration. * @param options optional options to specify the `tolerance`, `epsilon`, macIterations` or `verbose`. **/ export declare function newtonRaphson(f: (x: BN) => BN, fp: (x: BN) => BN, x0: BN, options?: Options): NewtonRaphsonResult; export {};