UNPKG

@holgerengels/compute-engine

Version:

Symbolic computing and numeric evaluations for JavaScript and Node.js

21 lines (20 loc) 1.16 kB
/* 0.26.0-alpha2 */ import type { BoxedExpression, IComputeEngine } from '../public'; export declare function expandProducts(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression | null; export declare function choose(n: number, k: number): number; /** Attempt to transform the expression (h, ops) into a sum */ export declare function expandFunction(ce: IComputeEngine, h: string, ops: ReadonlyArray<BoxedExpression>): BoxedExpression | null; /** Apply the distributive law if the expression is a product of sums. * For example, a(b + c) = ab + ac * Expand the expression if it is a power of a sum. * Expand the terms of the expression if it is a sum or negate. * If the expression is a fraction, expand the numerator. * If the exression is a relational operator, expand the operands. * Return null if the expression cannot be expanded. */ export declare function expand(expr: BoxedExpression | undefined): BoxedExpression | null; /** * Recursive expand of all terms in the expression. * * `expand()` only expands the top level of the expression. */ export declare function expandAll(expr: BoxedExpression): BoxedExpression | null;