@cortex-js/compute-engine 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compute-engine.esm.js +679 -220
- package/dist/compute-engine.js +679 -220
- package/dist/compute-engine.min.esm.js +10 -10
- package/dist/compute-engine.min.js +10 -10
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +8 -2
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compile.d.ts +1 -1
- package/dist/types/compute-engine/compute-engine.d.ts +265 -29
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +2 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/public.d.ts +5 -2
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/domains.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +3 -3
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/public.d.ts +8 -260
- package/dist/types/compute-engine/rules.d.ts +1 -1
- package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/solve.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +2 -2
- package/dist/types/math-json/math-json-format.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +2 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const COMPLEX_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const CONTROL_STRUCTURES_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const CORE_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
import { FunctionDefinition, IComputeEngine, IdentifierDefinitions, SymbolDefinition } from '../public';
|
|
3
3
|
export declare function getStandardLibrary(categories: LibraryCategory[] | LibraryCategory | 'all'): readonly IdentifierDefinitions[];
|
|
4
4
|
export declare const LIBRARIES: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const LINEAR_ALGEBRA_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const LOGIC_LIBRARY: IdentifierDefinitions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const POLYNOMIALS_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare function randomExpression(level?: number): Expression;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const RELOP_LIBRARY: IdentifierDefinitions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const SETS_LIBRARY: IdentifierDefinitions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const STATISTICS_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const TRIGONOMETRY_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { BoxedExpression } from '../public';
|
|
4
4
|
export declare const MACHINE_PRECISION_BITS = 53;
|
|
@@ -107,5 +107,5 @@ export declare function monteCarloEstimate(f: (x: number) => number, a: number,
|
|
|
107
107
|
* @returns
|
|
108
108
|
*/
|
|
109
109
|
export declare function limit(f: (x: number) => number, x: number, dir?: number): number;
|
|
110
|
-
export declare function fromRoman(roman: string): [number, rest: string];
|
|
111
|
-
export declare function fromDigits(s: string, baseInput?: string | number): [number, rest: string];
|
|
110
|
+
export declare function fromRoman(roman: string): [result: number, rest: string];
|
|
111
|
+
export declare function fromDigits(s: string, baseInput?: string | number): [result: number, rest: string];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare function isPrime(n: number): boolean | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
* The most important classes are {@link ComputeEngine} and
|
|
3
3
|
* {@link BoxedExpression}.
|
|
4
4
|
*
|
|
@@ -207,6 +207,8 @@ export interface BoxedExpression {
|
|
|
207
207
|
/** The Compute Engine associated with this expression provides
|
|
208
208
|
* a context in which to interpret it, such as definition of symbols
|
|
209
209
|
* and functions.
|
|
210
|
+
*
|
|
211
|
+
* {@link ComputeEngine} is the class that implements IComputeEngine.
|
|
210
212
|
*/
|
|
211
213
|
readonly engine: IComputeEngine;
|
|
212
214
|
/** From `Object.valueOf()`, return a primitive value for the expression.
|
|
@@ -1560,6 +1562,7 @@ export interface ComputeEngineStats {
|
|
|
1560
1562
|
highwaterMark: number;
|
|
1561
1563
|
}
|
|
1562
1564
|
export type AssignValue = boolean | number | string | Decimal | Complex | LatexString | SemiBoxedExpression | ((ce: any, args: any) => BoxedExpression) | undefined;
|
|
1565
|
+
export type ArrayValue = boolean | number | string | Decimal | Complex | BoxedExpression | undefined;
|
|
1563
1566
|
/** @internal */
|
|
1564
1567
|
export interface IComputeEngine {
|
|
1565
1568
|
latexDictionary: readonly LatexDictionaryEntry[];
|
|
@@ -1615,175 +1618,32 @@ export interface IComputeEngine {
|
|
|
1615
1618
|
chop(n: Decimal): Decimal | 0;
|
|
1616
1619
|
chop(n: Complex): Complex | 0;
|
|
1617
1620
|
chop(n: number | Decimal | Complex): number | Decimal | Complex;
|
|
1618
|
-
/** Create an arbitrary precision number.
|
|
1619
|
-
*
|
|
1620
|
-
* The return value is an object with methods to perform arithmetic
|
|
1621
|
-
* operations:
|
|
1622
|
-
* - `toNumber()`: convert to a JavaScript `number` with potential loss of precision
|
|
1623
|
-
* - `add()`
|
|
1624
|
-
* - `sub()`
|
|
1625
|
-
* - `neg()` (unary minus)
|
|
1626
|
-
* - `mul()`
|
|
1627
|
-
* - `div()`
|
|
1628
|
-
* - `pow()`
|
|
1629
|
-
* - `sqrt()` (square root)
|
|
1630
|
-
* - `cbrt()` (cube root)
|
|
1631
|
-
* - `exp()` (e^x)
|
|
1632
|
-
* - `log()`
|
|
1633
|
-
* - `ln()` (natural logarithm)
|
|
1634
|
-
* - `mod()`
|
|
1635
|
-
|
|
1636
|
-
* - `abs()`
|
|
1637
|
-
* - `ceil()`
|
|
1638
|
-
* - `floor()`
|
|
1639
|
-
* - `round()`
|
|
1640
|
-
|
|
1641
|
-
* - `equals()`
|
|
1642
|
-
* - `gt()`
|
|
1643
|
-
* - `gte()`
|
|
1644
|
-
* - `lt()`
|
|
1645
|
-
* - `lte()`
|
|
1646
|
-
*
|
|
1647
|
-
* - `cos()`
|
|
1648
|
-
* - `sin()`
|
|
1649
|
-
* - `tanh()`
|
|
1650
|
-
* - `acos()`
|
|
1651
|
-
* - `asin()`
|
|
1652
|
-
* - `atan()`
|
|
1653
|
-
* - `cosh()`
|
|
1654
|
-
* - `sinh()`
|
|
1655
|
-
* - `acosh()`
|
|
1656
|
-
* - `asinh()`
|
|
1657
|
-
* - `atanh()`
|
|
1658
|
-
*
|
|
1659
|
-
* - `isFinite()`
|
|
1660
|
-
* - `isInteger()`
|
|
1661
|
-
* - `isNaN()`
|
|
1662
|
-
* - `isNegative()`
|
|
1663
|
-
* - `isPositive()`
|
|
1664
|
-
* - `isZero()`
|
|
1665
|
-
* - `sign()` (1, 0 or -1)
|
|
1666
|
-
*
|
|
1667
|
-
*/
|
|
1668
1621
|
bignum: (a: Decimal.Value | bigint) => Decimal;
|
|
1669
|
-
/** Create a complex number.
|
|
1670
|
-
* The return value is an object with methods to perform arithmetic
|
|
1671
|
-
* operations:
|
|
1672
|
-
* - `re` (real part, as a JavaScript `number`)
|
|
1673
|
-
* - `im` (imaginary part, as a JavaScript `number`)
|
|
1674
|
-
* - `add()`
|
|
1675
|
-
* - `sub()`
|
|
1676
|
-
* - `neg()` (unary minus)
|
|
1677
|
-
* - `mul()`
|
|
1678
|
-
* - `div()`
|
|
1679
|
-
* - `pow()`
|
|
1680
|
-
* - `sqrt()` (square root)
|
|
1681
|
-
* - `exp()` (e^x)
|
|
1682
|
-
* - `log()`
|
|
1683
|
-
* - `ln()` (natural logarithm)
|
|
1684
|
-
* - `mod()`
|
|
1685
|
-
|
|
1686
|
-
* - `abs()`
|
|
1687
|
-
* - `ceil()`
|
|
1688
|
-
* - `floor()`
|
|
1689
|
-
* - `round()`
|
|
1690
|
-
|
|
1691
|
-
* - `arg()` the angle of the complex number
|
|
1692
|
-
* - `inverse()` the inverse of the complex number 1/z
|
|
1693
|
-
* - `conjugate()` the conjugate of the complex number
|
|
1694
|
-
|
|
1695
|
-
* - `equals()`
|
|
1696
|
-
*
|
|
1697
|
-
* - `cos()`
|
|
1698
|
-
* - `sin()`
|
|
1699
|
-
* - `tanh()`
|
|
1700
|
-
* - `acos()`
|
|
1701
|
-
* - `asin()`
|
|
1702
|
-
* - `atan()`
|
|
1703
|
-
* - `cosh()`
|
|
1704
|
-
* - `sinh()`
|
|
1705
|
-
* - `acosh()`
|
|
1706
|
-
* - `asinh()`
|
|
1707
|
-
* - `atanh()`
|
|
1708
|
-
*
|
|
1709
|
-
* - `isFinite()`
|
|
1710
|
-
* - `isNaN()`
|
|
1711
|
-
* - `isZero()`
|
|
1712
|
-
* - `sign()` (1, 0 or -1)
|
|
1713
|
-
*/
|
|
1714
1622
|
complex: (a: number | Complex, b?: number) => Complex;
|
|
1715
1623
|
isBignum(a: unknown): a is Decimal;
|
|
1716
1624
|
isComplex(a: unknown): a is Complex;
|
|
1717
1625
|
set precision(p: number | 'machine');
|
|
1718
1626
|
get precision(): number;
|
|
1719
1627
|
costFunction: (expr: BoxedExpression) => number;
|
|
1720
|
-
/** In strict mode (the default) the Compute Engine performs
|
|
1721
|
-
* validation of domains and signature and may report errors.
|
|
1722
|
-
*
|
|
1723
|
-
* When strict mode is off, results may be incorrect or generate JavaScript
|
|
1724
|
-
* errors if the input is not valid.
|
|
1725
|
-
*
|
|
1726
|
-
*/
|
|
1727
1628
|
strict: boolean;
|
|
1728
|
-
/**
|
|
1729
|
-
* Associate a new definition to a symbol in the current context.
|
|
1730
|
-
*
|
|
1731
|
-
* If a definition existed previously, it is replaced.
|
|
1732
|
-
*
|
|
1733
|
-
*
|
|
1734
|
-
* For internal use. Use `ce.declare()` instead.
|
|
1735
|
-
*
|
|
1736
|
-
* @internal
|
|
1737
|
-
*/
|
|
1738
1629
|
defineSymbol(name: string, def: SymbolDefinition): BoxedSymbolDefinition;
|
|
1739
|
-
/**
|
|
1740
|
-
* Associate a new definition to a function in the current context.
|
|
1741
|
-
*
|
|
1742
|
-
* If a definition existed previously, it is replaced.
|
|
1743
|
-
*
|
|
1744
|
-
* For internal use. Use `ce.declare()` instead.
|
|
1745
|
-
*
|
|
1746
|
-
* @internal
|
|
1747
|
-
*/
|
|
1748
1630
|
defineFunction(name: string, def: FunctionDefinition): BoxedFunctionDefinition;
|
|
1749
1631
|
lookupSymbol(name: string, wikidata?: string, scope?: RuntimeScope): undefined | BoxedSymbolDefinition;
|
|
1750
|
-
/** Return `undefined` if no definition exist for this `head` */
|
|
1751
1632
|
lookupFunction(head: string | BoxedExpression, scope?: RuntimeScope | null): undefined | BoxedFunctionDefinition;
|
|
1752
|
-
/**
|
|
1753
|
-
* Return a boxed expression from the input.
|
|
1754
|
-
*/
|
|
1755
1633
|
box(expr: Decimal | Complex | [num: number, denom: number] | SemiBoxedExpression, options?: {
|
|
1756
1634
|
canonical?: boolean;
|
|
1757
1635
|
}): BoxedExpression;
|
|
1758
1636
|
canonical(xs: SemiBoxedExpression[]): BoxedExpression[];
|
|
1759
|
-
/** Return a boxed number */
|
|
1760
1637
|
number(value: number | bigint | string | MathJsonNumber | Decimal | Complex | Rational, options?: {
|
|
1761
1638
|
metadata?: Metadata;
|
|
1762
1639
|
canonical?: boolean;
|
|
1763
1640
|
}): BoxedExpression;
|
|
1764
|
-
/** Return a canonical boxed symbol */
|
|
1765
1641
|
symbol(sym: string, options?: {
|
|
1766
1642
|
metadata?: Metadata;
|
|
1767
1643
|
canonical?: boolean;
|
|
1768
1644
|
}): BoxedExpression;
|
|
1769
|
-
/** Return a canonical boxed string */
|
|
1770
1645
|
string(s: string, metadata?: Metadata): BoxedExpression;
|
|
1771
|
-
/** Return a canonical boxed domain.
|
|
1772
|
-
*
|
|
1773
|
-
* If the domain is invalid, may return an `["Error"]` expression
|
|
1774
|
-
*
|
|
1775
|
-
*/
|
|
1776
1646
|
domain(domain: BoxedDomain | DomainExpression, metadata?: Metadata): BoxedDomain;
|
|
1777
|
-
/**
|
|
1778
|
-
* Return a canonical expression.
|
|
1779
|
-
*
|
|
1780
|
-
* Note that the result may not be a function, or may have a different
|
|
1781
|
-
* `head` than the one specified.
|
|
1782
|
-
*
|
|
1783
|
-
* For example:
|
|
1784
|
-
* `ce.fn("Rational", [ce.number(1), ce.number(2)]))` \( \to \) `ce.number([1,2])`
|
|
1785
|
-
*
|
|
1786
|
-
*/
|
|
1787
1647
|
fn(head: string | SemiBoxedExpression, ops: SemiBoxedExpression[], options?: {
|
|
1788
1648
|
canonical: boolean;
|
|
1789
1649
|
}): BoxedExpression;
|
|
@@ -1796,71 +1656,25 @@ export interface IComputeEngine {
|
|
|
1796
1656
|
* The result is canonical, but the caller has to ensure that all the
|
|
1797
1657
|
* conditions are met (i.e. `ops` properly normalized and sorted, all
|
|
1798
1658
|
* `ops` canonical, etc..) so that the result is actually canonical.
|
|
1799
|
-
*/
|
|
1800
|
-
_fn(head: string | BoxedExpression, ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
1801
|
-
/** Shortcut for `this.fn("Error"...)`.
|
|
1802
1659
|
*
|
|
1803
|
-
*
|
|
1660
|
+
* @internal
|
|
1804
1661
|
*/
|
|
1662
|
+
_fn(head: string | BoxedExpression, ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
1805
1663
|
error(message: string | [string, ...SemiBoxedExpression[]], where?: SemiBoxedExpression): BoxedExpression;
|
|
1806
1664
|
domainError(expectedDomain: BoxedDomain | DomainLiteral, actualDomain: undefined | BoxedDomain, where?: SemiBoxedExpression): BoxedExpression;
|
|
1807
|
-
/**
|
|
1808
|
-
* Add a`["Hold"]` wrapper to `expr.
|
|
1809
|
-
*/
|
|
1810
1665
|
hold(expr: SemiBoxedExpression): BoxedExpression;
|
|
1811
|
-
/** Shortcut for `this.fn("Add"...)`.
|
|
1812
|
-
*
|
|
1813
|
-
* The result is canonical.
|
|
1814
|
-
*/
|
|
1815
1666
|
add(ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
1816
|
-
/** Shortcut for `this.fn("Multiply"...)`
|
|
1817
|
-
*
|
|
1818
|
-
* The result is canonical.
|
|
1819
|
-
*/
|
|
1820
1667
|
mul(ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
1821
|
-
/** Shortcut for `this.fn("Power"...)`
|
|
1822
|
-
*
|
|
1823
|
-
* The result is canonical.
|
|
1824
|
-
*/
|
|
1825
1668
|
pow(base: BoxedExpression, exponent: number | Rational | BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
1826
|
-
|
|
1827
|
-
*
|
|
1828
|
-
* The result is canonical.
|
|
1829
|
-
*/
|
|
1830
|
-
sqrt(base: BoxedExpression, metadata?: Metadata): any;
|
|
1831
|
-
/** Shortcut for `this.fn("Divide", [1, expr])`
|
|
1832
|
-
*
|
|
1833
|
-
* The result is canonical.
|
|
1834
|
-
*/
|
|
1669
|
+
sqrt(base: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
1835
1670
|
inv(expr: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
1836
|
-
/** Shortcut for `this.fn("Negate", [expr])`
|
|
1837
|
-
*
|
|
1838
|
-
* The result is canonical.
|
|
1839
|
-
*/
|
|
1840
1671
|
neg(expr: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
1841
|
-
/** Shortcut for `this.fn("Divide", [num, denom])`
|
|
1842
|
-
*
|
|
1843
|
-
* The result is canonical.
|
|
1844
|
-
*/
|
|
1845
1672
|
div(num: BoxedExpression, denom: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
1846
|
-
/** Shortcut for `this.fn("Pair"...)`
|
|
1847
|
-
*
|
|
1848
|
-
* The result is canonical.
|
|
1849
|
-
*/
|
|
1850
1673
|
pair(first: BoxedExpression, second: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
1851
|
-
/** Shortcut for `this.fn("Tuple"...)`
|
|
1852
|
-
*
|
|
1853
|
-
* The result is canonical.
|
|
1854
|
-
*/
|
|
1855
1674
|
tuple(elements: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
1675
|
+
array(elements: ArrayValue[] | ArrayValue[][], metadata?: Metadata): BoxedExpression;
|
|
1856
1676
|
rules(rules: Rule[]): BoxedRuleSet;
|
|
1857
1677
|
pattern(expr: LatexString | SemiBoxedExpression): Pattern;
|
|
1858
|
-
/**
|
|
1859
|
-
* Parse a string of LaTeX and return a corresponding `BoxedExpression`.
|
|
1860
|
-
*
|
|
1861
|
-
* The result may not be canonical.
|
|
1862
|
-
*
|
|
1863
|
-
*/
|
|
1864
1678
|
parse(s: LatexString | string, options?: {
|
|
1865
1679
|
canonical?: boolean;
|
|
1866
1680
|
}): BoxedExpression;
|
|
@@ -1870,54 +1684,17 @@ export interface IComputeEngine {
|
|
|
1870
1684
|
parse(s: LatexString | string | null, options?: {
|
|
1871
1685
|
canonical?: boolean;
|
|
1872
1686
|
}): null | BoxedExpression;
|
|
1873
|
-
/** Serialize a `BoxedExpression` or a `MathJSON` expression to
|
|
1874
|
-
* a LaTeX string
|
|
1875
|
-
*/
|
|
1876
1687
|
serialize(expr: SemiBoxedExpression, options?: {
|
|
1877
1688
|
canonical?: boolean;
|
|
1878
1689
|
}): LatexString;
|
|
1879
|
-
/**
|
|
1880
|
-
* Options to control the serialization of MathJSON expression to LaTeX
|
|
1881
|
-
* when using `this.latex` or `this.engine.serialize()`.
|
|
1882
|
-
*
|
|
1883
|
-
*
|
|
1884
|
-
* {@inheritDoc NumberFormattingOptions}
|
|
1885
|
-
* {@inheritDoc ParseLatexOptions}
|
|
1886
|
-
* {@inheritDoc SerializeLatexOptions}
|
|
1887
|
-
*
|
|
1888
|
-
*/
|
|
1889
1690
|
get latexOptions(): NumberFormattingOptions & ParseLatexOptions & SerializeLatexOptions;
|
|
1890
1691
|
set latexOptions(opts: Partial<NumberFormattingOptions> & Partial<ParseLatexOptions> & Partial<SerializeLatexOptions>);
|
|
1891
|
-
/** {@inheritDoc JsonSerializationOptions} */
|
|
1892
1692
|
get jsonSerializationOptions(): Readonly<JsonSerializationOptions>;
|
|
1893
1693
|
set jsonSerializationOptions(val: Partial<JsonSerializationOptions>);
|
|
1894
|
-
/** Create a new scope on top of the scope stack, and set it as current */
|
|
1895
1694
|
pushScope(scope?: Partial<Scope>): IComputeEngine;
|
|
1896
|
-
/** Remove the most recent scope from the scope stack, and set its
|
|
1897
|
-
* parent scope as current. */
|
|
1898
1695
|
popScope(): IComputeEngine;
|
|
1899
|
-
/** Set the current scope, return the previous scope. */
|
|
1900
1696
|
swapScope(scope: RuntimeScope | null): RuntimeScope | null;
|
|
1901
|
-
/**
|
|
1902
|
-
* Reset the value of any identifiers that have been assigned a value
|
|
1903
|
-
* in the current scope.
|
|
1904
|
-
* @internal */
|
|
1905
1697
|
resetContext(): void;
|
|
1906
|
-
/** Assign a value to an identifier in the current scope.
|
|
1907
|
-
* Use `undefined` to reset the identifier to no value.
|
|
1908
|
-
*
|
|
1909
|
-
* The identifier should be a valid MathJSON identifier
|
|
1910
|
-
* not a LaTeX string.
|
|
1911
|
-
*
|
|
1912
|
-
* The identifier can take the form "f(x, y") to create a function
|
|
1913
|
-
* with two parameters, "x" and "y".
|
|
1914
|
-
*
|
|
1915
|
-
* If the id was not previously declared, an automatic declaration
|
|
1916
|
-
* is done. The domain of the identifier is inferred from the value.
|
|
1917
|
-
* To more precisely define the domain of the identifier, use `ce.declare()`
|
|
1918
|
-
* instead, which allows you to specify the domain, value and other
|
|
1919
|
-
* attributes of the identifier.
|
|
1920
|
-
*/
|
|
1921
1698
|
assign(ids: {
|
|
1922
1699
|
[id: string]: AssignValue;
|
|
1923
1700
|
}): IComputeEngine;
|
|
@@ -1925,18 +1702,6 @@ export interface IComputeEngine {
|
|
|
1925
1702
|
assign(arg1: string | {
|
|
1926
1703
|
[id: string]: AssignValue;
|
|
1927
1704
|
}, arg2?: AssignValue): IComputeEngine;
|
|
1928
|
-
/**
|
|
1929
|
-
* Declare an identifier: specify their domain, and other attributes,
|
|
1930
|
-
* including optionally a value.
|
|
1931
|
-
*
|
|
1932
|
-
* Once the domain of an identifier has been declared, it cannot be changed.
|
|
1933
|
-
* The domain information is used to calculate the canonical form of
|
|
1934
|
-
* expressions and ensure they are valid. If the domain could be changed
|
|
1935
|
-
* after the fact, previously valid expressions could become invalid.
|
|
1936
|
-
*
|
|
1937
|
-
* Use the `Anyting` domain for a very generic domain.
|
|
1938
|
-
*
|
|
1939
|
-
*/
|
|
1940
1705
|
declare(identifiers: {
|
|
1941
1706
|
[id: string]: BoxedDomain | DomainExpression | SymbolDefinition | FunctionDefinition;
|
|
1942
1707
|
}): IComputeEngine;
|
|
@@ -1944,27 +1709,10 @@ export interface IComputeEngine {
|
|
|
1944
1709
|
declare(arg1: string | {
|
|
1945
1710
|
[id: string]: BoxedDomain | DomainExpression | SymbolDefinition | FunctionDefinition;
|
|
1946
1711
|
}, arg2?: BoxedDomain | DomainExpression | SymbolDefinition | FunctionDefinition): IComputeEngine;
|
|
1947
|
-
/**
|
|
1948
|
-
* Add an assumption.
|
|
1949
|
-
*
|
|
1950
|
-
* Note that the assumption is put into canonical form before being added.
|
|
1951
|
-
*
|
|
1952
|
-
* @param symbol - The symbol to make an assumption about
|
|
1953
|
-
*
|
|
1954
|
-
* Returns:
|
|
1955
|
-
* - `contradiction` if the new assumption is incompatible with previous
|
|
1956
|
-
* ones.
|
|
1957
|
-
* - `tautology` if the new assumption is redundant with previous ones.
|
|
1958
|
-
* - `ok` if the assumption was successfully added to the assumption set.
|
|
1959
|
-
*
|
|
1960
|
-
*
|
|
1961
|
-
*/
|
|
1962
1712
|
assume(predicate: SemiBoxedExpression): AssumeResult;
|
|
1963
|
-
/** Remove all assumptions about one or more symbols */
|
|
1964
1713
|
forget(symbol?: string | string[]): void;
|
|
1965
1714
|
get assumptions(): ExpressionMapInterface<boolean>;
|
|
1966
1715
|
ask(pattern: SemiBoxedExpression): BoxedSubstitution[];
|
|
1967
|
-
/** Using the current assumptions, answer a query. */
|
|
1968
1716
|
verify(query: SemiBoxedExpression): boolean;
|
|
1969
1717
|
/** @internal */
|
|
1970
1718
|
shouldContinueExecution(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare function distribute(expr: BoxedExpression[]): BoxedExpression;
|
|
3
3
|
/** Use the multinomial theorem (https://en.wikipedia.org/wiki/Multinomial_theorem) to expand the expression.
|
|
4
4
|
* The expression must be a power of a sum of terms.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
export declare const version = "0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
|
+
export declare const version = "0.21.0";
|
|
3
3
|
export { ComputeEngine } from './compute-engine/compute-engine';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export declare const MISSING: Expression;
|
|
3
3
|
export declare function isNumberExpression(expr: Expression | null): expr is number | string | MathJsonNumber;
|
|
4
4
|
export declare function isNumberObject(expr: Expression | null): expr is MathJsonNumber;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.21.0 */
|
|
2
2
|
export { isSymbolObject, isStringObject, isFunctionObject, isDictionaryObject, stringValue as getStringValue, head, headName, symbol, applyRecursively, mapArgs, op, nops, dictionary as getDictionary, } from './math-json/utils';
|
|
3
|
-
export declare const version = "0.
|
|
3
|
+
export declare const version = "0.21.0";
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.21.0",
|
|
3
3
|
"scripts": {
|
|
4
4
|
"build": "bash ./scripts/build.sh",
|
|
5
5
|
"clean": "bash ./scripts/clean.sh",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"files": [
|
|
39
39
|
"/dist"
|
|
40
40
|
],
|
|
41
|
+
"type": "module",
|
|
41
42
|
"exports": {
|
|
42
43
|
".": {
|
|
43
44
|
"types": "./dist/types/compute-engine.d.ts",
|