@cortex-js/compute-engine 0.10.0 → 0.12.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 +4720 -4832
- package/dist/compute-engine.min.esm.js +2 -2
- package/dist/compute-engine.min.js +2 -2
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.d.ts +9 -9
- 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 +3 -2
- package/dist/types/compute-engine/boxed-expression/box.d.ts +2 -2
- 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 +2 -2
- 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 +32 -38
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +3 -2
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +8 -3
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +4 -3
- package/dist/types/compute-engine/compute-engine.d.ts +26 -46
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.d.ts +4 -4
- 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-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.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-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 +11 -11
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/public.d.ts +31 -31
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -2
- 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 +2 -2
- 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 +2 -4
- package/dist/types/compute-engine/library/arithmetic.d.ts +2 -2
- package/dist/types/compute-engine/library/calculus.d.ts +2 -2
- package/dist/types/compute-engine/library/collections.d.ts +2 -2
- package/dist/types/compute-engine/library/core.d.ts +2 -2
- package/dist/types/compute-engine/library/domains.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +5 -5
- package/dist/types/compute-engine/library/logic.d.ts +2 -2
- package/dist/types/compute-engine/library/polynomials.d.ts +2 -2
- package/dist/types/compute-engine/library/random-expression.d.ts +2 -0
- package/dist/types/compute-engine/library/relational-operator.d.ts +2 -2
- package/dist/types/compute-engine/library/sets.d.ts +2 -2
- package/dist/types/compute-engine/library/trigonometry.d.ts +2 -2
- package/dist/types/compute-engine/library/utils.d.ts +3 -0
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +12 -0
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -9
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +10 -12
- package/dist/types/compute-engine/public.d.ts +111 -116
- 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/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +3 -2
- package/dist/types/compute-engine/symbolic/negate.d.ts +4 -6
- package/dist/types/compute-engine/symbolic/polynomials.d.ts +3 -3
- package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/sum.d.ts +3 -2
- package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +2 -3
- package/dist/types/math-json/math-json-format.d.ts +7 -7
- package/dist/types/math-json/utils.d.ts +2 -1
- package/dist/types/math-json.d.ts +2 -3
- package/package.json +1 -1
package/dist/math-json.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** MathJSON 0.
|
|
1
|
+
/** MathJSON 0.12.0 */
|
|
2
2
|
function isSymbolObject(expr) {
|
|
3
3
|
return expr !== null && typeof expr === 'object' && 'sym' in expr;
|
|
4
4
|
}
|
|
@@ -182,6 +182,6 @@ function mapArgs(expr, fn) {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
// This is the root of the `math-json` package (i.e. `math-json.js` and
|
|
185
|
-
const version = '0.
|
|
185
|
+
const version = '0.12.0';
|
|
186
186
|
|
|
187
187
|
export { applyRecursively, dictionary as getDictionary, stringValue as getStringValue, head, headName, isDictionaryObject, isFunctionObject, isStringObject, isSymbolObject, mapArgs, nops, op, symbol, version };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** MathJSON 0.
|
|
2
|
-
function n(n){return null!==n&&"object"==typeof n&&"sym"in n}function t(n){return null!==n&&"object"==typeof n&&"str"in n}function r(n){return null!==n&&"object"==typeof n&&"fn"in n}function u(n){return null!==n&&"object"==typeof n&&"dict"in n}function l(n){return null==n?null:"object"==typeof n&&"str"in n?n.str:"string"!=typeof n||n.length<2||"'"!==n[0]||"'"!==n[n.length-1]?null:n.substring(1,n.length-1)}function e(n){return null==n?null:Array.isArray(n)?n[0]:r(n)?n.fn[0]:null}function i(n){const t=e(n);return"string"==typeof t?t:""}function o(n){return null==n?null:Array.isArray(n)?n.slice(1):r(n)?n.fn.slice(1):null}function f(n,t){return null==n?null:Array.isArray(n)?n[t]??null:r(n)?n.fn[t]??null:null}function c(n){return f(n,2)}function s(n){return null==n?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function y(t){if(null==t)return null;if("string"==typeof t){if(/^[+\-\.0-9]/.test(t))return null;if(t.length>=2&&"'"===t[0]&&"'"===t[t.length-1])return null}const r=n(t)?t.sym:t;return"string"!=typeof r?null:r}function a(n){const t=e(n);if("KeyValuePair"===t||"Tuple"===t||"Pair"===t){const t=l(function(n){return f(n,1)}(n));return t?[t,c(n)??"Nothing"]:null}return null}function g(n){if(null===n)return null;if("object"==typeof n&&"dict"in n)return n.dict;const t=a(n);if(t)return{[t[0]]:t[1]};if("Dictionary"===e(n)){const t={};for(let r=1;r<s(n);r++){const u=a(f(n,r));u&&(t[u[0]]=u[1])}return t}return null}function p(n,t){const r=e(n);if(null!==r)return[t(r),...(o(n)??[]).map(t)];const u=g(n);if(null!==u){const n=Object.keys(u),r={};for(const l of n)r[l]=t(u[l]);return{dict:r}}return t(n)}function h(n,t){let u=null;if(Array.isArray(n)&&(u=n),r(n)&&(u=n.fn),null===u)return[];let l=1;const e=[];for(;l<u.length;)e.push(t(u[l])),l+=1;return e}const A="0.
|
|
1
|
+
/** MathJSON 0.12.0 */
|
|
2
|
+
function n(n){return null!==n&&"object"==typeof n&&"sym"in n}function t(n){return null!==n&&"object"==typeof n&&"str"in n}function r(n){return null!==n&&"object"==typeof n&&"fn"in n}function u(n){return null!==n&&"object"==typeof n&&"dict"in n}function l(n){return null==n?null:"object"==typeof n&&"str"in n?n.str:"string"!=typeof n||n.length<2||"'"!==n[0]||"'"!==n[n.length-1]?null:n.substring(1,n.length-1)}function e(n){return null==n?null:Array.isArray(n)?n[0]:r(n)?n.fn[0]:null}function i(n){const t=e(n);return"string"==typeof t?t:""}function o(n){return null==n?null:Array.isArray(n)?n.slice(1):r(n)?n.fn.slice(1):null}function f(n,t){return null==n?null:Array.isArray(n)?n[t]??null:r(n)?n.fn[t]??null:null}function c(n){return f(n,2)}function s(n){return null==n?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function y(t){if(null==t)return null;if("string"==typeof t){if(/^[+\-\.0-9]/.test(t))return null;if(t.length>=2&&"'"===t[0]&&"'"===t[t.length-1])return null}const r=n(t)?t.sym:t;return"string"!=typeof r?null:r}function a(n){const t=e(n);if("KeyValuePair"===t||"Tuple"===t||"Pair"===t){const t=l(function(n){return f(n,1)}(n));return t?[t,c(n)??"Nothing"]:null}return null}function g(n){if(null===n)return null;if("object"==typeof n&&"dict"in n)return n.dict;const t=a(n);if(t)return{[t[0]]:t[1]};if("Dictionary"===e(n)){const t={};for(let r=1;r<s(n);r++){const u=a(f(n,r));u&&(t[u[0]]=u[1])}return t}return null}function p(n,t){const r=e(n);if(null!==r)return[t(r),...(o(n)??[]).map(t)];const u=g(n);if(null!==u){const n=Object.keys(u),r={};for(const l of n)r[l]=t(u[l]);return{dict:r}}return t(n)}function h(n,t){let u=null;if(Array.isArray(n)&&(u=n),r(n)&&(u=n.fn),null===u)return[];let l=1;const e=[];for(;l<u.length;)e.push(t(u[l])),l+=1;return e}const A="0.12.0";export{p as applyRecursively,g as getDictionary,l as getStringValue,e as head,i as headName,u as isDictionaryObject,r as isFunctionObject,t as isStringObject,n as isSymbolObject,h as mapArgs,s as nops,f as op,y as symbol,A as version};
|
package/dist/math-json.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** MathJSON 0.
|
|
2
|
-
var global,factory;global=this,factory=function(n){function t(n){return null!==n&&"object"==typeof n&&"sym"in n}function r(n){return null!==n&&"object"==typeof n&&"fn"in n}function l(n){return null==n?null:"object"==typeof n&&"str"in n?n.str:"string"!=typeof n||n.length<2||"'"!==n[0]||"'"!==n[n.length-1]?null:n.substring(1,n.length-1)}function e(n){return null==n?null:Array.isArray(n)?n[0]:r(n)?n.fn[0]:null}function u(n){return null==n?null:Array.isArray(n)?n.slice(1):r(n)?n.fn.slice(1):null}function o(n,t){var l,e;return null==n?null:Array.isArray(n)?null!==(l=n[t])&&void 0!==l?l:null:r(n)&&null!==(e=n.fn[t])&&void 0!==e?e:null}function i(n){return o(n,2)}function f(n){return null==n?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function c(n){var t;const r=e(n);if("KeyValuePair"===r||"Tuple"===r||"Pair"===r){const r=l(function(n){return o(n,1)}(n));return r?[r,null!==(t=i(n))&&void 0!==t?t:"Nothing"]:null}return null}function s(n){if(null===n)return null;if("object"==typeof n&&"dict"in n)return n.dict;const t=c(n);if(t)return{[t[0]]:t[1]};if("Dictionary"===e(n)){const t={};for(let r=1;r<f(n);r++){const l=c(o(n,r));l&&(t[l[0]]=l[1])}return t}return null}n.applyRecursively=function(n,t){var r;const l=e(n);if(null!==l)return[t(l),...(null!==(r=u(n))&&void 0!==r?r:[]).map(t)];const o=s(n);if(null!==o){const n=Object.keys(o),r={};for(const l of n)r[l]=t(o[l]);return{dict:r}}return t(n)},n.getDictionary=s,n.getStringValue=l,n.head=e,n.headName=function(n){const t=e(n);return"string"==typeof t?t:""},n.isDictionaryObject=function(n){return null!==n&&"object"==typeof n&&"dict"in n},n.isFunctionObject=r,n.isStringObject=function(n){return null!==n&&"object"==typeof n&&"str"in n},n.isSymbolObject=t,n.mapArgs=function(n,t){let l=null;if(Array.isArray(n)&&(l=n),r(n)&&(l=n.fn),null===l)return[];let e=1;const u=[];for(;e<l.length;)u.push(t(l[e])),e+=1;return u},n.nops=f,n.op=o,n.symbol=function(n){if(null==n)return null;if("string"==typeof n){if(/^[+\-\.0-9]/.test(n))return null;if(n.length>=2&&"'"===n[0]&&"'"===n[n.length-1])return null}const r=t(n)?n.sym:n;return"string"!=typeof r?null:r},n.version="0.
|
|
1
|
+
/** MathJSON 0.12.0 */
|
|
2
|
+
var global,factory;global=this,factory=function(n){function t(n){return null!==n&&"object"==typeof n&&"sym"in n}function r(n){return null!==n&&"object"==typeof n&&"fn"in n}function l(n){return null==n?null:"object"==typeof n&&"str"in n?n.str:"string"!=typeof n||n.length<2||"'"!==n[0]||"'"!==n[n.length-1]?null:n.substring(1,n.length-1)}function e(n){return null==n?null:Array.isArray(n)?n[0]:r(n)?n.fn[0]:null}function u(n){return null==n?null:Array.isArray(n)?n.slice(1):r(n)?n.fn.slice(1):null}function o(n,t){var l,e;return null==n?null:Array.isArray(n)?null!==(l=n[t])&&void 0!==l?l:null:r(n)&&null!==(e=n.fn[t])&&void 0!==e?e:null}function i(n){return o(n,2)}function f(n){return null==n?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function c(n){var t;const r=e(n);if("KeyValuePair"===r||"Tuple"===r||"Pair"===r){const r=l(function(n){return o(n,1)}(n));return r?[r,null!==(t=i(n))&&void 0!==t?t:"Nothing"]:null}return null}function s(n){if(null===n)return null;if("object"==typeof n&&"dict"in n)return n.dict;const t=c(n);if(t)return{[t[0]]:t[1]};if("Dictionary"===e(n)){const t={};for(let r=1;r<f(n);r++){const l=c(o(n,r));l&&(t[l[0]]=l[1])}return t}return null}n.applyRecursively=function(n,t){var r;const l=e(n);if(null!==l)return[t(l),...(null!==(r=u(n))&&void 0!==r?r:[]).map(t)];const o=s(n);if(null!==o){const n=Object.keys(o),r={};for(const l of n)r[l]=t(o[l]);return{dict:r}}return t(n)},n.getDictionary=s,n.getStringValue=l,n.head=e,n.headName=function(n){const t=e(n);return"string"==typeof t?t:""},n.isDictionaryObject=function(n){return null!==n&&"object"==typeof n&&"dict"in n},n.isFunctionObject=r,n.isStringObject=function(n){return null!==n&&"object"==typeof n&&"str"in n},n.isSymbolObject=t,n.mapArgs=function(n,t){let l=null;if(Array.isArray(n)&&(l=n),r(n)&&(l=n.fn),null===l)return[];let e=1;const u=[];for(;e<l.length;)u.push(t(l[e])),e+=1;return u},n.nops=f,n.op=o,n.symbol=function(n){if(null==n)return null;if("string"==typeof n){if(/^[+\-\.0-9]/.test(n))return null;if(n.length>=2&&"'"===n[0]&&"'"===n[n.length-1])return null}const r=t(n)?n.sym:n;return"string"!=typeof r?null:r},n.version="0.12.0",Object.defineProperty(n,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).MathJson={});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
/* 0.12.0 */
|
|
2
|
+
export type SignalCode = RuntimeSignalCode | ('invalid-name' | 'expected-predicate' | 'expected-symbol' | 'operator-requires-one-operand' | 'postfix-operator-requires-one-operand' | 'prefix-operator-requires-one-operand' | 'unbalanced-symbols' | 'expected-argument' | 'unexpected-command' | 'cyclic-definition' | 'invalid-supersets' | 'expected-supersets' | 'unknown-domain' | 'duplicate-wikidata' | 'invalid-dictionary-entry' | 'syntax-error');
|
|
3
|
+
export type SignalMessage = SignalCode | [SignalCode, ...any[]];
|
|
4
|
+
export type SignalOrigin = {
|
|
5
5
|
url?: string;
|
|
6
6
|
source?: string;
|
|
7
7
|
offset?: number;
|
|
@@ -9,7 +9,7 @@ export declare type SignalOrigin = {
|
|
|
9
9
|
column?: number;
|
|
10
10
|
around?: string;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type Signal = {
|
|
13
13
|
severity?: 'warning' | 'error';
|
|
14
14
|
/** An error/warning code or, a code with one or more arguments specific to
|
|
15
15
|
* the signal code.
|
|
@@ -22,13 +22,13 @@ export declare type Signal = {
|
|
|
22
22
|
/** Location where the signal was raised. */
|
|
23
23
|
origin?: SignalOrigin;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type ErrorSignal = Signal & {
|
|
26
26
|
severity: 'error';
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type WarningSignal = Signal & {
|
|
29
29
|
severity: 'warning';
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type WarningSignalHandler = (warnings: WarningSignal[]) => void;
|
|
32
32
|
/**
|
|
33
33
|
* The error codes can be used in an `ErrorCode` expression:
|
|
34
34
|
*
|
|
@@ -83,4 +83,4 @@ export declare type WarningSignalHandler = (warnings: WarningSignal[]) => void;
|
|
|
83
83
|
* * `base-out-of-range`: The base is expected to be between 2 and 36.
|
|
84
84
|
*
|
|
85
85
|
*/
|
|
86
|
-
export
|
|
86
|
+
export type ErrorCode = 'expected-argument' | 'unexpected-argument' | 'expected-operator' | 'expected-operand' | 'invalid-name' | 'invalid-dictionary-entry' | 'unknown-symbol' | 'unknown-operator' | 'unknown-function' | 'unknown-command' | 'unexpected-command' | 'unbalanced-symbols' | 'unexpected-superscript' | 'unexpected-subscript' | 'unexpected-sequence' | 'non-associative-operator' | 'function-has-too-many-arguments' | 'function-has-too-few-arguments' | 'operator-requires-one-operand' | 'infix-operator-requires-two-operands' | 'prefix-operator-requires-one-operand' | 'postfix-operator-requires-one-operand' | 'associative-function-has-too-few-arguments' | 'commutative-function-has-too-few-arguments' | 'threadable-function-has-too-few-arguments' | 'hold-first-function-has-too-few-arguments' | 'hold-rest-function-has-too-few-arguments' | 'base-out-of-range' | 'syntax-error';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { Complex } from 'complex.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
4
|
import { BoxedExpression, BoxedFunctionDefinition, BoxedRuleSet, BoxedSymbolDefinition, BoxedDomain, EvaluateOptions, IComputeEngine, LatexString, Metadata, NOptions, PatternMatchOptions, SemiBoxedExpression, SimplifyOptions, Substitution, RuntimeScope, DomainCompatibility, DomainLiteral, BoxedBaseDefinition, Rational, BoxedSubstitution } from '../public';
|
|
@@ -40,7 +40,8 @@ export declare abstract class AbstractBoxedExpression implements BoxedExpression
|
|
|
40
40
|
get string(): string | null;
|
|
41
41
|
getSubexpressions(head: string): BoxedExpression[];
|
|
42
42
|
get subexpressions(): BoxedExpression[];
|
|
43
|
-
get symbols():
|
|
43
|
+
get symbols(): string[];
|
|
44
|
+
get freeVars(): string[];
|
|
44
45
|
get errors(): BoxedExpression[];
|
|
45
46
|
get ops(): null | BoxedExpression[];
|
|
46
47
|
get nops(): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { IComputeEngine, SemiBoxedExpression, BoxedExpression, Metadata, Rational } from '../public';
|
|
4
4
|
import { MathJsonNumber } from '../../math-json/math-json-format';
|
|
@@ -54,7 +54,7 @@ import { MathJsonNumber } from '../../math-json/math-json-format';
|
|
|
54
54
|
* Note: `boxNumber()` should only be called from `ce.number()` in order to
|
|
55
55
|
* benefit from number expression caching.
|
|
56
56
|
*/
|
|
57
|
-
export declare function boxNumber(ce: IComputeEngine, num: MathJsonNumber | number | string | Complex | Decimal | Rational, options?: {
|
|
57
|
+
export declare function boxNumber(ce: IComputeEngine, num: MathJsonNumber | number | string | Complex | Decimal | Rational | [Decimal, Decimal], options?: {
|
|
58
58
|
metadata?: Metadata;
|
|
59
59
|
canonical?: boolean;
|
|
60
60
|
}): BoxedExpression | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, ReplaceOptions, Substitution, Metadata, PatternMatchOptions, BoxedDomain, BoxedSubstitution } from '../public';
|
|
3
3
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { BoxedDomain, BoxedExpression, BoxedSubstitution, DomainCompatibility, DomainConstructor, DomainExpression, DomainLiteral, IComputeEngine, Metadata, PatternMatchOptions } from '../public';
|
|
3
3
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
4
4
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
export declare function makeFunctionDefinition(engine: IComputeEngine, def: FunctionDefinition): BoxedFunctionDefinition;
|
|
1
|
+
/* 0.12.0 */
|
|
2
|
+
export declare function makeFunctionDefinition(engine: IComputeEngine, name: string, def: FunctionDefinition | BoxedFunctionDefinition): BoxedFunctionDefinition;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { Expression } from '../../math-json/math-json-format';
|
|
3
3
|
import { BoxedExpression, BoxedFunctionDefinition, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, Substitution, ReplaceOptions, Metadata, PatternMatchOptions, BoxedDomain, RuntimeScope, BoxedSubstitution } from '../public';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { Complex } from 'complex.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
4
|
import { BoxedExpression, BoxedDomain, IComputeEngine, Metadata, NOptions, PatternMatchOptions, Rational, SimplifyOptions, BoxedSubstitution } from '../public';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
3
3
|
import { BoxedExpression, BoxedSubstitution, BoxedDomain, IComputeEngine, LatexString, Metadata, Pattern, PatternMatchOptions, SemiBoxedExpression, Substitution } from '../public';
|
|
4
4
|
export declare class BoxedPattern extends AbstractBoxedExpression implements Pattern {
|
|
@@ -1,54 +1,46 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
|
|
1
|
+
/* 0.12.0 */
|
|
2
|
+
/**
|
|
3
|
+
* THEORY OF OPERATIONS
|
|
4
|
+
*
|
|
5
|
+
* - The value or domain of a constant cannot be changed.
|
|
6
|
+
* - If set explicitly, the value is the source of truth: it overrides any
|
|
7
|
+
* flags.
|
|
8
|
+
* - Once the domain has been set, it can only be changed from a numeric domain
|
|
9
|
+
* to another numeric domain (some expressions may have been validated with
|
|
10
|
+
* assumptions that the domain was numeric).
|
|
11
|
+
* - When the domain is changed, the value is preserved if it is compatible
|
|
12
|
+
* with the new domain, otherwise it is reset to no value. Flags are adjusted
|
|
13
|
+
* to match the domain (discarded if not a numeric domain).
|
|
14
|
+
* - When the value is changed, the domain is unaffected. If the value is not
|
|
15
|
+
* compatible with the domain (setting a def with a numeric domain to a value
|
|
16
|
+
* of `True` for example), the value is discarded.
|
|
17
|
+
* - When getting a flag, if a value is available, it is the source of truth.
|
|
18
|
+
* Otherwise, the stored flags are (the stored flags are also set when the domain is changed)
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
3
21
|
export declare class BoxedSymbolDefinitionImpl implements BoxedSymbolDefinition {
|
|
4
22
|
readonly name: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
23
|
+
readonly wikidata?: string;
|
|
24
|
+
readonly description?: string | string[];
|
|
25
|
+
readonly url?: string;
|
|
8
26
|
private _engine;
|
|
9
27
|
readonly scope: RuntimeScope | undefined;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
private
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
private _real;
|
|
17
|
-
private _extendedReal;
|
|
18
|
-
private _complex;
|
|
19
|
-
private _extendedComplex;
|
|
20
|
-
private _imaginary;
|
|
21
|
-
private _positive;
|
|
22
|
-
private _nonPositive;
|
|
23
|
-
private _negative;
|
|
24
|
-
private _nonNegative;
|
|
25
|
-
private _zero;
|
|
26
|
-
private _notZero;
|
|
27
|
-
private _one;
|
|
28
|
-
private _negativeOne;
|
|
29
|
-
private _infinity;
|
|
30
|
-
private _NaN;
|
|
31
|
-
private _finite;
|
|
32
|
-
private _even;
|
|
33
|
-
private _odd;
|
|
34
|
-
private _prime;
|
|
35
|
-
private _composite;
|
|
28
|
+
private _defValue?;
|
|
29
|
+
private _value;
|
|
30
|
+
private _domain;
|
|
31
|
+
private _flags;
|
|
32
|
+
readonly constant: boolean;
|
|
33
|
+
readonly holdUntil: 'never' | 'simplify' | 'evaluate' | 'N';
|
|
36
34
|
private _at;
|
|
37
35
|
at?: (index: string | number) => undefined | BoxedExpression;
|
|
38
|
-
readonly constant: boolean;
|
|
39
|
-
readonly hold: boolean;
|
|
40
36
|
prototype?: BoxedFunctionDefinition;
|
|
41
37
|
self?: unknown;
|
|
42
|
-
constructor(ce: IComputeEngine, def: SymbolDefinition);
|
|
38
|
+
constructor(ce: IComputeEngine, name: string, def: SymbolDefinition);
|
|
43
39
|
reset(): void;
|
|
44
|
-
unbind(): void;
|
|
45
|
-
bind(): void;
|
|
46
40
|
get value(): BoxedExpression | undefined;
|
|
47
41
|
set value(val: SemiBoxedExpression | number | undefined);
|
|
48
42
|
get domain(): BoxedDomain | undefined;
|
|
49
43
|
set domain(domain: BoxedDomain | DomainExpression | undefined);
|
|
50
|
-
updateFlags(flags: Partial<SymbolFlags>): void;
|
|
51
|
-
setProps(props: Omit<Partial<BoxedSymbolDefinition>, 'domain' | 'value'>): void;
|
|
52
44
|
get number(): boolean | undefined;
|
|
53
45
|
set number(val: boolean | undefined);
|
|
54
46
|
get integer(): boolean | undefined;
|
|
@@ -97,4 +89,6 @@ export declare class BoxedSymbolDefinitionImpl implements BoxedSymbolDefinition
|
|
|
97
89
|
set prime(val: boolean | undefined);
|
|
98
90
|
get composite(): boolean | undefined;
|
|
99
91
|
set composite(val: boolean | undefined);
|
|
92
|
+
updateFlags(flags: Partial<SymbolFlags>): void;
|
|
100
93
|
}
|
|
94
|
+
export declare function domainToFlags(dom: BoxedDomain | undefined | null): Partial<SymbolFlags>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
3
3
|
import { BoxedExpression, BoxedRuleSet, BoxedSymbolDefinition, IComputeEngine, EvaluateOptions, NOptions, ReplaceOptions, SimplifyOptions, Substitution, Metadata, PatternMatchOptions, BoxedDomain, RuntimeScope, BoxedFunctionDefinition, BoxedBaseDefinition, DomainExpression, BoxedSubstitution } from '../public';
|
|
4
4
|
/**
|
|
@@ -22,6 +22,7 @@ export declare class BoxedSymbol extends AbstractBoxedExpression {
|
|
|
22
22
|
constructor(ce: IComputeEngine, name: string, options?: {
|
|
23
23
|
metadata?: Metadata;
|
|
24
24
|
canonical?: boolean;
|
|
25
|
+
def?: BoxedSymbolDefinition | BoxedFunctionDefinition;
|
|
25
26
|
});
|
|
26
27
|
get hash(): number;
|
|
27
28
|
unbind(): void;
|
|
@@ -83,7 +84,7 @@ export declare class BoxedSymbol extends AbstractBoxedExpression {
|
|
|
83
84
|
get isComplex(): boolean | undefined;
|
|
84
85
|
get isImaginary(): boolean | undefined;
|
|
85
86
|
simplify(options?: SimplifyOptions): BoxedExpression;
|
|
86
|
-
evaluate(
|
|
87
|
+
evaluate(options?: EvaluateOptions): BoxedExpression;
|
|
87
88
|
N(options?: NOptions): BoxedExpression;
|
|
88
89
|
replace(rules: BoxedRuleSet, options?: ReplaceOptions): BoxedExpression | null;
|
|
89
90
|
subs(sub: Substitution, options?: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
export
|
|
1
|
+
/* 0.12.0 */
|
|
2
|
+
export type Order = 'lex' | 'dexlex' | 'grevlex' | 'elim';
|
|
3
3
|
export declare const DEFAULT_COMPLEXITY = 100000;
|
|
4
4
|
/**
|
|
5
5
|
* Sort by higher total degree (sum of degree), if tied, sort by max degree,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { Expression } from '../../math-json/math-json-format';
|
|
3
3
|
import { BoxedExpression, IComputeEngine } from '../public';
|
|
4
4
|
export declare function isLatexString(s: unknown): s is string;
|
|
@@ -15,9 +15,12 @@ export declare function getImaginaryCoef(expr: BoxedExpression): number | null;
|
|
|
15
15
|
/**
|
|
16
16
|
* Return the free symbols in the expression, recursively.
|
|
17
17
|
* A variable, or free symbol, is a symbol that is not bound to a value.
|
|
18
|
+
* Note: do not use `isFree`: it has a side effect of creating a definition
|
|
19
|
+
* if one does not exist, and we want to avoid that. For example, `assume()`
|
|
20
|
+
* relies on `expr.freeVars` *not* creating a definition.
|
|
18
21
|
*/
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function getSymbols(expr: BoxedExpression, set: Set<string>):
|
|
22
|
+
export declare function getFreeVars(expr: BoxedExpression, set: Set<string>): void;
|
|
23
|
+
export declare function getSymbols(expr: BoxedExpression, set: Set<string>): void;
|
|
21
24
|
export declare function getSubexpressions(expr: BoxedExpression, head: string): BoxedExpression[];
|
|
22
25
|
/**
|
|
23
26
|
* For any numeric result, if `bignumPreferred()` is true, calculate using
|
|
@@ -52,3 +55,5 @@ export declare function getListLike(expr: BoxedExpression): BoxedExpression[];
|
|
|
52
55
|
* truncate bignums to machine numbers
|
|
53
56
|
*/
|
|
54
57
|
export declare function bignumValue(ce: IComputeEngine, expr: Expression | null | undefined): Decimal | null;
|
|
58
|
+
export declare function bigintValue(ce: IComputeEngine, expr: Expression | null | undefined): bigint | null;
|
|
59
|
+
export declare function asBigint(expr: BoxedExpression): bigint | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare function validateArgumentCount(ce: IComputeEngine, ops: BoxedExpression[], count: number): BoxedExpression[];
|
|
3
3
|
/**
|
|
4
4
|
* Validation of arguments is normally done by checking the signature of the
|
|
@@ -9,10 +9,11 @@ export declare function validateArgumentCount(ce: IComputeEngine, ops: BoxedExpr
|
|
|
9
9
|
* value), we do a simple numeric check of all arguments, and verify we have
|
|
10
10
|
* the number of expected arguments.
|
|
11
11
|
*/
|
|
12
|
-
export declare function validateNumericArgs(ce: IComputeEngine, ops:
|
|
12
|
+
export declare function validateNumericArgs(ce: IComputeEngine, ops: BoxedExpression[], count?: number): BoxedExpression[];
|
|
13
13
|
/** Return `null` if the `ops` match the sig. Otherwise, return an array
|
|
14
14
|
* of expressions indicating the mismatched arguments.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
export declare function validateSignature(sig: BoxedDomain, ops: BoxedExpression[], codomain?: BoxedExpression): BoxedExpression[] | null;
|
|
18
|
-
export declare function validateArgument(ce: IComputeEngine, arg: BoxedExpression | undefined,
|
|
18
|
+
export declare function validateArgument(ce: IComputeEngine, arg: BoxedExpression | undefined, dom: BoxedDomain | DomainLiteral | undefined): BoxedExpression;
|
|
19
|
+
export declare function validateArguments(ce: IComputeEngine, args: BoxedExpression[], doms: (BoxedDomain | DomainLiteral)[]): BoxedExpression[];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { Complex } from 'complex.js';
|
|
3
3
|
import { Expression, MathJsonNumber } from '../math-json/math-json-format';
|
|
4
|
-
import { SignalMessage, WarningSignal } from '../common/signals';
|
|
5
4
|
import type { LibraryCategory, LatexDictionary, LatexDictionaryEntry, LatexString, NumberFormattingOptions, ParseLatexOptions, SerializeLatexOptions } from './latex-syntax/public';
|
|
6
|
-
import { AssumeResult, BoxedExpression, BoxedFunctionDefinition, BoxedSymbolDefinition, IComputeEngine,
|
|
5
|
+
import { AssumeResult, BoxedExpression, BoxedFunctionDefinition, BoxedSymbolDefinition, IComputeEngine, IdTable, ExpressionMapInterface, NumericMode, Pattern, RuntimeScope, Scope, SemiBoxedExpression, SymbolDefinition, BoxedRuleSet, Rule, JsonSerializationOptions, ComputeEngineStats, Metadata, BoxedDomain, DomainExpression, FunctionDefinition, Rational, BoxedSubstitution, Substitution } from './public';
|
|
7
6
|
/**
|
|
8
7
|
*
|
|
9
8
|
* To use the CortexJS Compute Engine, create a `ComputeEngine` instance.
|
|
@@ -114,20 +113,22 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
114
113
|
*/
|
|
115
114
|
deadline?: number;
|
|
116
115
|
/**
|
|
117
|
-
* Return
|
|
116
|
+
* Return identifier tables suitable for the specified categories, or `"all"`
|
|
118
117
|
* for all categories (`"arithmetic"`, `"algebra"`, etc...).
|
|
119
118
|
*
|
|
120
|
-
*
|
|
121
|
-
* expression should be interpreted, i.e. how to evaluate and
|
|
119
|
+
* An identifier table defines how the symbols and function names in a
|
|
120
|
+
* MathJSON expression should be interpreted, i.e. how to evaluate and
|
|
121
|
+
* manipulate them.
|
|
122
122
|
*
|
|
123
123
|
*/
|
|
124
|
-
static
|
|
124
|
+
static getStandardLibrary(categories?: LibraryCategory[] | LibraryCategory | 'all'): Readonly<IdTable>[];
|
|
125
125
|
/**
|
|
126
126
|
* Construct a new `ComputeEngine` instance.
|
|
127
127
|
*
|
|
128
|
-
*
|
|
129
|
-
* the
|
|
130
|
-
*
|
|
128
|
+
* Identifier tables define functions and symbols (in `options.ids`).
|
|
129
|
+
* If no table is provided the standard library is used (`ComputeEngine.getStandardLibrary()`)
|
|
130
|
+
*
|
|
131
|
+
* The LaTeX syntax dictionary is defined in `options.latexDictionary`.
|
|
131
132
|
*
|
|
132
133
|
* The order of the dictionaries matter: the definitions from the later ones
|
|
133
134
|
* override the definitions from earlier ones. The first dictionary should
|
|
@@ -149,12 +150,11 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
149
150
|
* be a variable in this domain. **Default** `ExtendedRealNumber`
|
|
150
151
|
*/
|
|
151
152
|
constructor(options?: {
|
|
152
|
-
symbolTables?: Readonly<SymbolTable>[];
|
|
153
|
-
latexDictionary?: readonly LatexDictionaryEntry[];
|
|
154
153
|
numericMode?: NumericMode;
|
|
155
154
|
numericPrecision?: number;
|
|
155
|
+
ids?: Readonly<IdTable>[];
|
|
156
|
+
latexDictionary?: readonly LatexDictionaryEntry[];
|
|
156
157
|
tolerance?: number;
|
|
157
|
-
assumptions?: (LatexString | Expression)[];
|
|
158
158
|
defaultDomain?: string;
|
|
159
159
|
});
|
|
160
160
|
/** After the configuration of the engine has changed, clear the caches
|
|
@@ -211,7 +211,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
211
211
|
get tolerance(): number;
|
|
212
212
|
set tolerance(val: number);
|
|
213
213
|
/** @internal */
|
|
214
|
-
bignum(a: Decimal.Value): Decimal;
|
|
214
|
+
bignum(a: Decimal.Value | bigint): Decimal;
|
|
215
215
|
/** @internal */
|
|
216
216
|
complex(a: number | Complex, b?: number): Complex;
|
|
217
217
|
/** Replace a number that is close to 0 with the exact integer 0.
|
|
@@ -244,8 +244,8 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
244
244
|
/**
|
|
245
245
|
* Add (or replace) a definition for a symbol in the current scope.
|
|
246
246
|
*/
|
|
247
|
-
defineSymbol(def: SymbolDefinition): BoxedSymbolDefinition;
|
|
248
|
-
defineFunction(def: FunctionDefinition): BoxedFunctionDefinition;
|
|
247
|
+
defineSymbol(name: string, def: SymbolDefinition): BoxedSymbolDefinition;
|
|
248
|
+
defineFunction(name: string, def: FunctionDefinition): BoxedFunctionDefinition;
|
|
249
249
|
/**
|
|
250
250
|
*
|
|
251
251
|
* Create a new scope and add it to the top of the scope stack
|
|
@@ -254,20 +254,12 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
254
254
|
* etc... for this scope
|
|
255
255
|
*
|
|
256
256
|
*/
|
|
257
|
-
pushScope(
|
|
258
|
-
symbolTable?: Readonly<SymbolTable> | Readonly<SymbolTable>[];
|
|
259
|
-
assumptions?: (LatexString | Expression)[];
|
|
260
|
-
scope?: Partial<Scope>;
|
|
261
|
-
}): void;
|
|
257
|
+
pushScope(ids?: Readonly<IdTable> | Readonly<IdTable>[], scope?: Partial<Scope>): void;
|
|
262
258
|
/** Remove the topmost scope from the scope stack.
|
|
263
259
|
*/
|
|
264
260
|
popScope(): void;
|
|
265
|
-
set(identifiers:
|
|
266
|
-
|
|
267
|
-
}): void;
|
|
268
|
-
let(identifiers: {
|
|
269
|
-
[identifier: string]: SymbolDefinition | FunctionDefinition;
|
|
270
|
-
}): void;
|
|
261
|
+
set(identifiers: Substitution<SemiBoxedExpression | null | undefined>): void;
|
|
262
|
+
let(identifiers: IdTable): void;
|
|
271
263
|
get assumptions(): ExpressionMapInterface<boolean>;
|
|
272
264
|
/**
|
|
273
265
|
* Return false if the execution should stop.
|
|
@@ -281,24 +273,12 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
281
273
|
shouldContinueExecution(): boolean;
|
|
282
274
|
/** @internal */
|
|
283
275
|
checkContinueExecution(): void;
|
|
284
|
-
assert(condition: boolean, expr: BoxedExpression, msg: string, code?: SignalMessage): void;
|
|
285
|
-
/**
|
|
286
|
-
* Call this function if an unexpected condition occurs during execution of a
|
|
287
|
-
* function in the engine.
|
|
288
|
-
*
|
|
289
|
-
* An `ErrorSignal` is a problem that cannot be recovered from.
|
|
290
|
-
*
|
|
291
|
-
* A `WarningSignal` indicates a minor problem that does not prevent the
|
|
292
|
-
* execution to continue.
|
|
293
|
-
*
|
|
294
|
-
*/
|
|
295
|
-
signal(expr: BoxedExpression, msg: string, code?: SignalMessage): void;
|
|
296
|
-
signal(sig: WarningSignal): void;
|
|
297
276
|
/** @internal */
|
|
298
277
|
cache<T>(cacheName: string, build: () => T, purge: (T: any) => T | undefined): T;
|
|
299
278
|
box(expr: Decimal | Complex | [num: number, denom: number] | SemiBoxedExpression, options?: {
|
|
300
279
|
canonical?: boolean;
|
|
301
280
|
}): BoxedExpression;
|
|
281
|
+
canonical(xs: SemiBoxedExpression[]): BoxedExpression[];
|
|
302
282
|
fn(head: string, ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
303
283
|
/** @internal */
|
|
304
284
|
_fn(head: string | BoxedExpression, ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
@@ -306,12 +286,12 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
306
286
|
error(message: string | [string, ...SemiBoxedExpression[]], where?: SemiBoxedExpression): BoxedExpression;
|
|
307
287
|
hold(expr: SemiBoxedExpression): BoxedExpression;
|
|
308
288
|
add(ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
309
|
-
|
|
289
|
+
neg(expr: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
310
290
|
mul(ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
311
|
-
|
|
291
|
+
div(num: BoxedExpression, denom: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
312
292
|
sqrt(base: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
313
|
-
|
|
314
|
-
|
|
293
|
+
pow(base: BoxedExpression, exponent: number | Rational | BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
294
|
+
inv(expr: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
315
295
|
pair(first: BoxedExpression, second: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
316
296
|
tuple(elements: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
317
297
|
string(s: string, metadata?: Metadata): BoxedExpression;
|
|
@@ -320,7 +300,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
320
300
|
canonical?: boolean;
|
|
321
301
|
}): BoxedExpression;
|
|
322
302
|
domain(domain: BoxedExpression | DomainExpression | BoxedDomain, metadata?: Metadata): BoxedDomain;
|
|
323
|
-
number(value: number | string | MathJsonNumber | Decimal | Complex | Rational, options?: {
|
|
303
|
+
number(value: number | bigint | string | MathJsonNumber | Decimal | Complex | Rational, options?: {
|
|
324
304
|
canonical?: boolean;
|
|
325
305
|
metadata?: Metadata;
|
|
326
306
|
}): BoxedExpression;
|
|
@@ -352,7 +332,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
352
332
|
*/
|
|
353
333
|
ask(pattern: LatexString | SemiBoxedExpression): BoxedSubstitution[];
|
|
354
334
|
infer(symbol: BoxedExpression | string, _domain: BoxedDomain | DomainExpression): AssumeResult;
|
|
355
|
-
assume(symbol: LatexString | SemiBoxedExpression, domainValue: BoxedDomain |
|
|
335
|
+
assume(symbol: LatexString | SemiBoxedExpression, domainValue: BoxedDomain | Expression | BoxedExpression): AssumeResult;
|
|
356
336
|
assume(predicate: LatexString | SemiBoxedExpression): AssumeResult;
|
|
357
337
|
forget(symbol: undefined | string | string[]): void;
|
|
358
338
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
|
-
import { BoxedExpression } from './public';
|
|
3
|
+
import { BoxedExpression, Rational } from './public';
|
|
4
4
|
/** Quickly determine the numeric domain of a number or constant
|
|
5
5
|
* For the symbols, this is a hard-coded optimization that doesn't rely on the
|
|
6
6
|
* dictionaries. The regular path is in `internalDomain()`
|
|
7
7
|
*/
|
|
8
|
-
export declare function inferNumericDomain(value: number | Decimal | Complex |
|
|
8
|
+
export declare function inferNumericDomain(value: number | Decimal | Complex | Rational): string;
|
|
9
9
|
/**
|
|
10
10
|
* Simple description of a numeric domain as a base domain, a min and
|
|
11
11
|
* max value, possibly open ends, and some excluded values.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type NumericDomainInfo = {
|
|
14
14
|
domain?: string;
|
|
15
15
|
min?: number;
|
|
16
16
|
max?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare const DEFINITIONS_CALCULUS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare const DEFINITIONS_CORE: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare const DEFINITIONS_INEQUALITIES: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare const DEFINITIONS_LOGIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare const DEFINITIONS_OTHERS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare const DEFINITIONS_SETS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.12.0 */
|
|
2
2
|
export declare const DEFINITIONS_SYMBOLS: LatexDictionary;
|