@thi.ng/math
Version:
Assorted common math functions & utilities
24 lines • 1.16 kB
TypeScript
/**
* Recursively evaluates function `fn` for `res` uniformly spaced values `t` in
* the closed parametric interval `[start,end]` and computes corresponding
* sample values `p`. For each `p` then calls `error` function to compute the
* error to query target value `q` and eventually returns the `t` producing the
* overall minimum error. At each level of recursion the search interval is
* increasingly narrowed / centered around the best `t` of the current
* iteration.
*
* The search is terminated early if the best error value is less than `eps`.
*
* The interval end points `start` and `end` MUST be normalized values in the
* closed `[0,1]` interval.
*
* @param fn - function to evaluate
* @param error - error function
* @param q - target value
* @param res - number of samples per interval
* @param iter - max number of iterations / recursion limit
* @param start - interval start
* @param end - interval end
*/
export declare const minError: <T>(fn: (x: number) => T, error: (p: T, q: T) => number, q: T, res?: number, iter?: number, start?: number, end?: number, eps?: number) => number;
//# sourceMappingURL=min-error.d.ts.map