Function

nerdamer.connect

src/index.ts:688
nerdamer.connect(names: readonly string[], source: NumericalFunctionSource): typeof nerdamer

Imports numerical implementations from another library while preserving Nerdamer's symbolic representation of the selected functions. Imported functions are used by numerical evaluation and by buildFunction(). New function names remain symbolic during ordinary parsing; existing Nerdamer functions retain their symbolic simplification rules.

Parameters

NameTypeDescription
namesreadonly string[]Function names to import from source.
sourceNumericalFunctionSourceObject containing numerical functions, such as a mathjs instance.

Returns

typeof nerdamer — The root nerdamer function for chaining.

Examples

nerdamer.connect(['cos'], math);
nerdamer('cos(x)').text();                    // 'cos(x)'
nerdamer('cos(x)').evaluate({ x: 0 }).text(); // '1'