@cortex-js/compute-engine 0.10.0 → 0.11.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 +2672 -3024
- 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 +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 +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 +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/compute-engine.d.ts +16 -19
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.d.ts +2 -2
- 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 +30 -30
- 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 +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 +1 -1
- 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/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-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 +1 -1
- 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/public.d.ts +90 -79
- 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 +1 -1
- package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
- 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 +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 +7 -7
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +1 -1
package/dist/math-json.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** MathJSON 0.
|
|
1
|
+
/** MathJSON 0.11.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.11.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.11.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.11.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.11.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.11.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.11.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.11.0 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.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';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.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.11.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.11.0 */
|
|
2
|
+
export declare function makeFunctionDefinition(engine: IComputeEngine, name: string, def: FunctionDefinition | BoxedFunctionDefinition): BoxedFunctionDefinition;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.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.11.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.11.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.11.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.11.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.11.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,9 +1,9 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
import { Complex } from 'complex.js';
|
|
3
3
|
import { Expression, MathJsonNumber } from '../math-json/math-json-format';
|
|
4
4
|
import { SignalMessage, WarningSignal } from '../common/signals';
|
|
5
5
|
import type { LibraryCategory, LatexDictionary, LatexDictionaryEntry, LatexString, NumberFormattingOptions, ParseLatexOptions, SerializeLatexOptions } from './latex-syntax/public';
|
|
6
|
-
import { AssumeResult, BoxedExpression, BoxedFunctionDefinition, BoxedSymbolDefinition, IComputeEngine,
|
|
6
|
+
import { AssumeResult, BoxedExpression, BoxedFunctionDefinition, BoxedSymbolDefinition, IComputeEngine, IDTable, ExpressionMapInterface, NumericMode as NumericMode, Pattern, RuntimeScope, Scope, SemiBoxedExpression, SymbolDefinition, BoxedRuleSet, Rule, JsonSerializationOptions, ComputeEngineStats, Metadata, BoxedDomain, DomainExpression, FunctionDefinition, Rational, BoxedSubstitution } from './public';
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
* To use the CortexJS Compute Engine, create a `ComputeEngine` instance.
|
|
@@ -114,20 +114,22 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
114
114
|
*/
|
|
115
115
|
deadline?: number;
|
|
116
116
|
/**
|
|
117
|
-
* Return
|
|
117
|
+
* Return identifier tables suitable for the specified categories, or `"all"`
|
|
118
118
|
* for all categories (`"arithmetic"`, `"algebra"`, etc...).
|
|
119
119
|
*
|
|
120
|
-
*
|
|
121
|
-
* expression should be interpreted, i.e. how to evaluate and
|
|
120
|
+
* An identifier table defines how the symbols and function names in a
|
|
121
|
+
* MathJSON expression should be interpreted, i.e. how to evaluate and
|
|
122
|
+
* manipulate them.
|
|
122
123
|
*
|
|
123
124
|
*/
|
|
124
|
-
static
|
|
125
|
+
static getStandardLibrary(categories?: LibraryCategory[] | LibraryCategory | 'all'): Readonly<IDTable>[];
|
|
125
126
|
/**
|
|
126
127
|
* Construct a new `ComputeEngine` instance.
|
|
127
128
|
*
|
|
128
|
-
*
|
|
129
|
-
* the
|
|
130
|
-
*
|
|
129
|
+
* Identifier tables define functions and symbols (in `options.ids`).
|
|
130
|
+
* If no table is provided the standard library is used (`ComputeEngine.getStandardLibrary()`)
|
|
131
|
+
*
|
|
132
|
+
* The LaTeX syntax dictionary is defined in `options.latexDictionary`.
|
|
131
133
|
*
|
|
132
134
|
* The order of the dictionaries matter: the definitions from the later ones
|
|
133
135
|
* override the definitions from earlier ones. The first dictionary should
|
|
@@ -149,12 +151,11 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
149
151
|
* be a variable in this domain. **Default** `ExtendedRealNumber`
|
|
150
152
|
*/
|
|
151
153
|
constructor(options?: {
|
|
152
|
-
symbolTables?: Readonly<SymbolTable>[];
|
|
153
|
-
latexDictionary?: readonly LatexDictionaryEntry[];
|
|
154
154
|
numericMode?: NumericMode;
|
|
155
155
|
numericPrecision?: number;
|
|
156
|
+
ids?: Readonly<IDTable>[];
|
|
157
|
+
latexDictionary?: readonly LatexDictionaryEntry[];
|
|
156
158
|
tolerance?: number;
|
|
157
|
-
assumptions?: (LatexString | Expression)[];
|
|
158
159
|
defaultDomain?: string;
|
|
159
160
|
});
|
|
160
161
|
/** After the configuration of the engine has changed, clear the caches
|
|
@@ -244,8 +245,8 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
244
245
|
/**
|
|
245
246
|
* Add (or replace) a definition for a symbol in the current scope.
|
|
246
247
|
*/
|
|
247
|
-
defineSymbol(def: SymbolDefinition): BoxedSymbolDefinition;
|
|
248
|
-
defineFunction(def: FunctionDefinition): BoxedFunctionDefinition;
|
|
248
|
+
defineSymbol(name: string, def: SymbolDefinition): BoxedSymbolDefinition;
|
|
249
|
+
defineFunction(name: string, def: FunctionDefinition): BoxedFunctionDefinition;
|
|
249
250
|
/**
|
|
250
251
|
*
|
|
251
252
|
* Create a new scope and add it to the top of the scope stack
|
|
@@ -254,11 +255,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
254
255
|
* etc... for this scope
|
|
255
256
|
*
|
|
256
257
|
*/
|
|
257
|
-
pushScope(
|
|
258
|
-
symbolTable?: Readonly<SymbolTable> | Readonly<SymbolTable>[];
|
|
259
|
-
assumptions?: (LatexString | Expression)[];
|
|
260
|
-
scope?: Partial<Scope>;
|
|
261
|
-
}): void;
|
|
258
|
+
pushScope(ids?: Readonly<IDTable> | Readonly<IDTable>[], scope?: Partial<Scope>): void;
|
|
262
259
|
/** Remove the topmost scope from the scope stack.
|
|
263
260
|
*/
|
|
264
261
|
popScope(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { BoxedExpression } from './public';
|
|
4
4
|
/** Quickly determine the numeric domain of a number or constant
|
|
@@ -10,7 +10,7 @@ export declare function inferNumericDomain(value: number | Decimal | Complex | [
|
|
|
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.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_CALCULUS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_CORE: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_INEQUALITIES: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_LOGIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_OTHERS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_SETS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_SYMBOLS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
export declare const DEFINITIONS_TRIGONOMETRY: LatexDictionary;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.11.0 */
|
|
2
2
|
import { WarningSignal } from '../../../common/signals';
|
|
3
|
-
export
|
|
3
|
+
export type CommonEntry = {
|
|
4
4
|
name?: string;
|
|
5
5
|
serialize: SerializeHandler | LatexString;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type SymbolEntry = CommonEntry & {
|
|
8
8
|
kind: 'symbol';
|
|
9
9
|
precedence: number;
|
|
10
10
|
parse: SymbolParseHandler;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type FunctionEntry = CommonEntry & {
|
|
13
13
|
kind: 'function';
|
|
14
14
|
parse: FunctionParseHandler;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type MatchfixEntry = CommonEntry & {
|
|
17
17
|
kind: 'matchfix';
|
|
18
18
|
openDelimiter: Delimiter | LatexToken[];
|
|
19
19
|
closeDelimiter: Delimiter | LatexToken[];
|
|
20
20
|
parse: MatchfixParseHandler;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type InfixEntry = CommonEntry & {
|
|
23
23
|
kind: 'infix';
|
|
24
24
|
associativity: 'right' | 'left' | 'non' | 'both';
|
|
25
25
|
precedence: number;
|
|
26
26
|
parse: InfixParseHandler;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type PrefixEntry = CommonEntry & {
|
|
29
29
|
kind: 'prefix';
|
|
30
30
|
precedence: number;
|
|
31
31
|
parse: PrefixParseHandler;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type PostfixEntry = CommonEntry & {
|
|
34
34
|
kind: 'postfix';
|
|
35
35
|
precedence: number;
|
|
36
36
|
parse: PostfixParseHandler;
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type EnvironmentEntry = CommonEntry & {
|
|
39
39
|
kind: 'environment';
|
|
40
40
|
parse: EnvironmentParseHandler;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
43
|
-
export
|
|
42
|
+
export type IndexedLatexDictionaryEntry = FunctionEntry | SymbolEntry | MatchfixEntry | InfixEntry | PrefixEntry | PostfixEntry | EnvironmentEntry;
|
|
43
|
+
export type IndexedLatexDictionary = {
|
|
44
44
|
lookahead: number;
|
|
45
45
|
name: Map<string, IndexedLatexDictionaryEntry>;
|
|
46
46
|
function: Map<string, FunctionEntry[]>;
|