nerdamer-ts
Version:
javascript light-weight symbolic math expression evaluator
287 lines (286 loc) • 13.5 kB
TypeScript
export class FunctionProvider {
functions: {
cos: (number | ((symbol: any) => any))[];
sin: (number | ((symbol: any) => any))[];
tan: (number | ((symbol: any) => any))[];
sec: (number | ((symbol: any) => any))[];
csc: (number | ((symbol: any) => any))[];
cot: (number | ((symbol: any) => any))[];
acos: (number | ((symbol: any, ...args: any[]) => any))[];
asin: (number | ((symbol: any, ...args: any[]) => any))[];
atan: (number | ((symbol: any, ...args: any[]) => any))[];
arccos: (number | ((symbol: any, ...args: any[]) => any))[];
arcsin: (number | ((symbol: any, ...args: any[]) => any))[];
arctan: (number | ((symbol: any, ...args: any[]) => any))[];
asec: (number | ((symbol: any, ...args: any[]) => any))[];
acsc: (number | ((symbol: any, ...args: any[]) => any))[];
acot: (number | ((symbol: any, ...args: any[]) => any))[];
atan2: (number | ((a: any, b: any, ...args: any[]) => import("../Types/Symbol").Symbol))[];
acoth: (number | ((symbol: any, ...args: any[]) => any))[];
asech: (number | ((symbol: any, ...args: any[]) => any))[];
acsch: (number | ((symbol: any, ...args: any[]) => any))[];
sinh: (number | ((symbol: any, ...args: any[]) => any))[];
cosh: (number | ((symbol: any, ...args: any[]) => any))[];
tanh: (number | ((symbol: any, ...args: any[]) => any))[];
asinh: (number | ((symbol: any, ...args: any[]) => any))[];
sech: (number | ((symbol: any, ...args: any[]) => any))[];
csch: (number | ((symbol: any, ...args: any[]) => any))[];
coth: (number | ((symbol: any, ...args: any[]) => any))[];
acosh: (number | ((symbol: any, ...args: any[]) => any))[];
atanh: (number | ((symbol: any, ...args: any[]) => any))[];
log10: (number | null)[];
exp: (number | typeof exp)[];
radians: (number | typeof radians)[];
degrees: (number | typeof degrees)[];
min: (number | typeof min)[];
max: (number | typeof max)[];
erf: (number | null)[];
floor: (number | null)[];
ceil: (number | null)[];
trunc: (number | null)[];
Si: (number | null)[];
step: (number | null)[];
rect: (number | null)[];
sinc: (number | typeof sinc)[];
tri: (number | null)[];
sign: (number | typeof sign)[];
Ci: (number | null)[];
Ei: (number | null)[];
Shi: (number | null)[];
Chi: (number | null)[];
Li: (number | null)[];
fib: (number | null)[];
fact: (number | typeof factorial)[];
factorial: (number | typeof factorial)[];
continued_fraction: (number[] | typeof continued_fraction)[];
dfactorial: (number | null)[];
gamma_incomplete: (number[] | null)[];
round: (number[] | typeof round)[];
scientific: (number[] | typeof scientific)[];
mod: (number | typeof mod)[];
pfactor: (number | typeof pfactor)[];
vector: (number | typeof vector)[];
matrix: (number | typeof matrix)[];
Set: (number | typeof set)[];
imatrix: (number | typeof imatrix)[];
parens: (number | typeof parens)[];
sqrt: (number | typeof sqrt)[];
cbrt: (number | typeof cbrt)[];
nthroot: (number | typeof nthroot)[];
log: (number[] | typeof log)[];
expand: (number | typeof expandall)[];
abs: (number | typeof abs)[];
invert: (number | typeof invert)[];
determinant: (number | typeof determinant)[];
size: (number | typeof size)[];
transpose: (number | typeof transpose)[];
dot: (number | typeof dot)[];
cross: (number | typeof cross)[];
vecget: (number | typeof vecget)[];
vecset: (number | typeof vecget)[];
vectrim: (number[] | typeof vectrim)[];
matget: (number | typeof matget)[];
matset: (number | typeof matset)[];
matgetrow: (number | typeof matgetrow)[];
matsetrow: (number | typeof matsetrow)[];
matgetcol: (number | typeof matgetcol)[];
matsetcol: (number | typeof matsetcol)[];
rationalize: (number | typeof rationalize)[];
IF: (number | typeof IF)[];
is_in: (number | typeof is_in)[];
realpart: (number | typeof realpart)[];
imagpart: (number | typeof imagpart)[];
conjugate: (number | typeof conjugate)[];
arg: (number | typeof arg)[];
polarform: (number | typeof polarform)[];
rectform: (number | typeof rectform)[];
sort: (number[] | typeof sort)[];
integer_part: (number | null)[];
union: (number | typeof union)[];
contains: (number | typeof contains)[];
intersection: (number | typeof intersection)[];
difference: (number | typeof difference)[];
intersects: (number | typeof intersects)[];
is_subset: (number | typeof is_subset)[];
print: (number | typeof print)[];
};
getFunctionDescriptor(name: any): any;
/**
* Searches for function in FUNCTION_MODULES by name, throws error was not found
* @param name
* @return {(...args: any) => any}
* @throws
*/
findFunction(name: any): (...args: any) => any;
getFunctionDescriptors(): {
cos: (number | ((symbol: any) => any))[];
sin: (number | ((symbol: any) => any))[];
tan: (number | ((symbol: any) => any))[];
sec: (number | ((symbol: any) => any))[];
csc: (number | ((symbol: any) => any))[];
cot: (number | ((symbol: any) => any))[];
acos: (number | ((symbol: any, ...args: any[]) => any))[];
asin: (number | ((symbol: any, ...args: any[]) => any))[];
atan: (number | ((symbol: any, ...args: any[]) => any))[];
arccos: (number | ((symbol: any, ...args: any[]) => any))[];
arcsin: (number | ((symbol: any, ...args: any[]) => any))[];
arctan: (number | ((symbol: any, ...args: any[]) => any))[];
asec: (number | ((symbol: any, ...args: any[]) => any))[];
acsc: (number | ((symbol: any, ...args: any[]) => any))[];
acot: (number | ((symbol: any, ...args: any[]) => any))[];
atan2: (number | ((a: any, b: any, ...args: any[]) => import("../Types/Symbol").Symbol))[];
acoth: (number | ((symbol: any, ...args: any[]) => any))[];
asech: (number | ((symbol: any, ...args: any[]) => any))[];
acsch: (number | ((symbol: any, ...args: any[]) => any))[];
sinh: (number | ((symbol: any, ...args: any[]) => any))[];
cosh: (number | ((symbol: any, ...args: any[]) => any))[];
tanh: (number | ((symbol: any, ...args: any[]) => any))[];
asinh: (number | ((symbol: any, ...args: any[]) => any))[];
sech: (number | ((symbol: any, ...args: any[]) => any))[];
csch: (number | ((symbol: any, ...args: any[]) => any))[];
coth: (number | ((symbol: any, ...args: any[]) => any))[];
acosh: (number | ((symbol: any, ...args: any[]) => any))[];
atanh: (number | ((symbol: any, ...args: any[]) => any))[];
log10: (number | null)[];
exp: (number | typeof exp)[];
radians: (number | typeof radians)[];
degrees: (number | typeof degrees)[];
min: (number | typeof min)[];
max: (number | typeof max)[];
erf: (number | null)[];
floor: (number | null)[];
ceil: (number | null)[];
trunc: (number | null)[];
Si: (number | null)[];
step: (number | null)[];
rect: (number | null)[];
sinc: (number | typeof sinc)[];
tri: (number | null)[];
sign: (number | typeof sign)[];
Ci: (number | null)[];
Ei: (number | null)[];
Shi: (number | null)[];
Chi: (number | null)[];
Li: (number | null)[];
fib: (number | null)[];
fact: (number | typeof factorial)[];
factorial: (number | typeof factorial)[];
continued_fraction: (number[] | typeof continued_fraction)[];
dfactorial: (number | null)[];
gamma_incomplete: (number[] | null)[];
round: (number[] | typeof round)[];
scientific: (number[] | typeof scientific)[];
mod: (number | typeof mod)[];
pfactor: (number | typeof pfactor)[];
vector: (number | typeof vector)[];
matrix: (number | typeof matrix)[];
Set: (number | typeof set)[];
imatrix: (number | typeof imatrix)[];
parens: (number | typeof parens)[];
sqrt: (number | typeof sqrt)[];
cbrt: (number | typeof cbrt)[];
nthroot: (number | typeof nthroot)[];
log: (number[] | typeof log)[];
expand: (number | typeof expandall)[];
abs: (number | typeof abs)[];
invert: (number | typeof invert)[];
determinant: (number | typeof determinant)[];
size: (number | typeof size)[];
transpose: (number | typeof transpose)[];
dot: (number | typeof dot)[];
cross: (number | typeof cross)[];
vecget: (number | typeof vecget)[];
vecset: (number | typeof vecget)[];
vectrim: (number[] | typeof vectrim)[];
matget: (number | typeof matget)[];
matset: (number | typeof matset)[];
matgetrow: (number | typeof matgetrow)[];
matsetrow: (number | typeof matsetrow)[];
matgetcol: (number | typeof matgetcol)[];
matsetcol: (number | typeof matsetcol)[];
rationalize: (number | typeof rationalize)[];
IF: (number | typeof IF)[];
is_in: (number | typeof is_in)[];
realpart: (number | typeof realpart)[];
imagpart: (number | typeof imagpart)[];
conjugate: (number | typeof conjugate)[];
arg: (number | typeof arg)[];
polarform: (number | typeof polarform)[];
rectform: (number | typeof rectform)[];
sort: (number[] | typeof sort)[];
integer_part: (number | null)[];
union: (number | typeof union)[];
contains: (number | typeof contains)[];
intersection: (number | typeof intersection)[];
difference: (number | typeof difference)[];
intersects: (number | typeof intersects)[];
is_subset: (number | typeof is_subset)[];
print: (number | typeof print)[];
};
setFunctionDescriptor(name: any, descriptor: any): void;
removeFunctionDescriptor(name: any): void;
/**
* provide a mechanism for accessing functions directly. Not yet complete!!!
* Some functions will return undefined. This can maybe just remove the
* function object at some point when all functions are eventually
* housed in the global function object. Returns ALL parser available
* functions. Parser.functions may not contain all functions
* @return {Record<string, (...args: any[]) => any>}
*/
importFunctions(): Record<string, (...args: any[]) => any>;
}
import { exp } from "../Functions/Core";
import { radians } from "../Functions/Core";
import { degrees } from "../Functions/Core";
import { min } from "../Functions/Core";
import { max } from "../Functions/Core";
import { sinc } from "../Functions/Core";
import { sign } from "../Functions/Core";
import { factorial } from "../Functions/Core";
import { continued_fraction } from "../Functions/Core";
import { round } from "../Functions/Core";
import { scientific } from "../Functions/Core";
import { mod } from "../Functions/Core";
import { pfactor } from "../Functions/Core";
import { vector } from "../Functions/Core";
import { matrix } from "../Functions/Core";
import { set } from "../Functions/Core";
import { imatrix } from "../Functions/Core";
import { parens } from "../Functions/Core";
import { sqrt } from "../Functions/Core";
import { cbrt } from "../Functions/Core";
import { nthroot } from "../Functions/Core";
import { log } from "../Functions/Core";
import { expandall } from "../Functions/Core/math/expand";
import { abs } from "../Functions/Core";
import { invert } from "../Functions/Core";
import { determinant } from "../Functions/Core";
import { size } from "../Functions/Core";
import { transpose } from "../Functions/Core";
import { dot } from "../Functions/Core";
import { cross } from "../Functions/Core";
import { vecget } from "../Functions/Core";
import { vectrim } from "../Functions/Core";
import { matget } from "../Functions/Core";
import { matset } from "../Functions/Core";
import { matgetrow } from "../Functions/Core";
import { matsetrow } from "../Functions/Core";
import { matgetcol } from "../Functions/Core";
import { matsetcol } from "../Functions/Core";
import { rationalize } from "../Functions/Core";
import { IF } from "../Functions/Core";
import { is_in } from "../Functions/Core";
import { realpart } from "../Functions/Core";
import { imagpart } from "../Functions/Core";
import { conjugate } from "../Functions/Core";
import { arg } from "../Functions/Core";
import { polarform } from "../Functions/Core";
import { rectform } from "../Functions/Core";
import { sort } from "../Functions/Core";
import { union } from "../Functions/Core";
import { contains } from "../Functions/Core";
import { intersection } from "../Functions/Core";
import { difference } from "../Functions/Core";
import { intersects } from "../Functions/Core";
import { is_subset } from "../Functions/Core";
import { print } from "../Functions/Core";