@cortex-js/compute-engine 0.21.0 → 0.22.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/README.md +6 -3
- package/dist/compute-engine.esm.js +6311 -4602
- package/dist/compute-engine.js +6311 -4602
- 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 +4 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +3 -3
- 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 +11 -3
- 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 +2 -1
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +69 -0
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +2 -0
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- 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 +7 -6
- 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 +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-inequalities.d.ts → definitions-relational-operators.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 +1 -1
- package/dist/types/compute-engine/latex-syntax/public.d.ts +1 -1
- 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 +3 -3
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +3 -3
- 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 +2 -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 +5 -5
- 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 +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/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/public.d.ts +64 -30
- package/dist/types/compute-engine/rules.d.ts +9 -13
- package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/solve.d.ts +2 -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 +2 -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/tensor-fields.d.ts +168 -0
- package/dist/types/compute-engine/symbolic/tensors.d.ts +103 -0
- 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 +1 -1
package/dist/math-json.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS Compute Engine 0.
|
|
1
|
+
/** CortexJS Compute Engine 0.22.0 */
|
|
2
2
|
|
|
3
3
|
// src/math-json/utils.ts
|
|
4
4
|
function isSymbolObject(expr) {
|
|
@@ -239,7 +239,7 @@ function mapArgs(expr, fn) {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// src/math-json.ts
|
|
242
|
-
var version = "0.
|
|
242
|
+
var version = "0.22.0";
|
|
243
243
|
export {
|
|
244
244
|
applyRecursively,
|
|
245
245
|
dictionary as getDictionary,
|
package/dist/math-json.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS MathJSON 0.
|
|
1
|
+
/** CortexJS MathJSON 0.22.0 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MathJson = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
var MathJson = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -277,7 +277,7 @@ var MathJson = (() => {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
// src/math-json.ts
|
|
280
|
-
var version = "0.
|
|
280
|
+
var version = "0.22.0";
|
|
281
281
|
return __toCommonJS(math_json_exports);
|
|
282
282
|
})();
|
|
283
283
|
Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS Compute Engine 0.
|
|
1
|
+
/** CortexJS Compute Engine 0.22.0 */
|
|
2
2
|
|
|
3
3
|
// src/math-json/utils.ts
|
|
4
4
|
function isSymbolObject(expr) {
|
|
@@ -239,7 +239,7 @@ function mapArgs(expr, fn) {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// src/math-json.ts
|
|
242
|
-
var version = "0.
|
|
242
|
+
var version = "0.22.0";
|
|
243
243
|
export {
|
|
244
244
|
applyRecursively,
|
|
245
245
|
dictionary as getDictionary,
|
package/dist/math-json.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS MathJSON 0.
|
|
1
|
+
/** CortexJS MathJSON 0.22.0 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MathJson = {}));})(this, (function (exports) { 'use strict';
|
|
3
|
-
var MathJson=(()=>{var f=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var D=(n,t)=>{for(var e in t)f(n,e,{get:t[e],enumerable:!0})},R=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of v(t))!k.call(n,r)&&r!==e&&f(n,r,{get:()=>t[r],enumerable:!(i=T(t,r))||i.enumerable});return n};var _=n=>R(f({},"__esModule",{value:!0}),n);var z={};D(z,{applyRecursively:()=>J,getDictionary:()=>y,getStringValue:()=>m,head:()=>o,headName:()=>I,isDictionaryObject:()=>M,isFunctionObject:()=>u,isStringObject:()=>S,isSymbolObject:()=>d,mapArgs:()=>$,nops:()=>E,op:()=>s,symbol:()=>A,version:()=>X});function d(n){return n!==null&&typeof n=="object"&&"sym"in n}function S(n){return n!==null&&typeof n=="object"&&"str"in n}function u(n){return n!==null&&typeof n=="object"&&"fn"in n}function M(n){return n!==null&&typeof n=="object"&&"dict"in n}var c;function N(n){if(!c){let e=`^[${["Zyyy","Zinh","Arab","Armn","Beng","Bopo","Cyrl","Deva","Ethi","Geor","Grek","Gujr","Guru","Hang","Hani","Hebr","Hira","Kana","Knda","Khmr","Laoo","Latn","Mlym","Mymr","Orya","Sinh","Taml","Telu","Thaa","Thai","Tibt"].map(i=>`\\p{Script=${i}}`).join("")}]*$`;c=new RegExp(e,"u")}return c.test(n)}function a(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||O.test(n)?!0:N(n)?/^[\p{XIDS}_]\p{XIDC}*$/u.test(n):!1}var F="\\u{FE0F}",V="\\u{20E3}",L="\\u{200D}",P="\\p{RI}\\p{RI}",w="(?:[\\u{E0020}-\\u{E007E}]+\\u{E007F})",b=`(?:\\p{EMod}|${F}${V}?|${w})`,C="(?:(?=\\P{XIDC})\\p{Emoji})",h=`(?:${C}${b}*|\\p{Emoji}${b}+|${P})`,j=`(?:${h})(${L}${h})*`,G=new RegExp(`(?:${j})+`,"u"),O=new RegExp(`^(?:${j})+$`,"u");function q(n){return typeof n!="string"?"not-a-string":n===""?"empty-string":n.normalize()!==n?"expected-nfc":/[\u200E\u200F\u2066-\u2069\u202A-\u202E]/.test(n)?"unexpected-bidi-marker":O.test(n)?"valid":/\p{XIDC}/u.test(n)&&G.test(n)?"unexpected-mixed-emoji":N(n)?a(n)?"valid":a(n[0])?"invalid-char":"invalid-first-char":"unexpected-script"}function m(n){return n==null?null:typeof n=="object"&&"str"in n?n.str:typeof n!="string"||n.length<2||n[0]!=="'"||n[n.length-1]!=="'"?null:n.substring(1,n.length-1)}function o(n){return n==null?null:Array.isArray(n)?typeof n[0]=="string"&&!a(n[0])?(console.error(`Invalid identifier "${n[0]}": ${q(n[0])}`),null):n[0]:u(n)?n.fn[0]:null}function I(n){let t=o(n);return typeof t=="string"?t:""}function H(n){return n==null?null:Array.isArray(n)?n.slice(1):u(n)?n.fn.slice(1):null}function s(n,t){return n==null?null:Array.isArray(n)?n[t]??null:u(n)?n.fn[t]??null:null}function K(n){return s(n,1)}function Z(n){return s(n,2)}function E(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):u(n)?Math.max(0,n.fn.length-1):0}function A(n){if(n==null||typeof n=="string"&&(/^[+\-\.0-9]/.test(n)||n.length>=2&&n[0]==="'"&&n[n.length-1]==="'"))return null;let t=d(n)?n.sym:n;return typeof t!="string"?null:t}function p(n){let t=o(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let e=m(K(n));return e?[e,Z(n)??"Nothing"]:null}return null}function y(n){if(n===null)return null;if(typeof n=="object"&&"dict"in n)return n.dict;let t=p(n);if(t)return{[t[0]]:t[1]};if(o(n)==="Dictionary"){let i={};for(let r=1;r<E(n);r++){let l=p(s(n,r));l&&(i[l[0]]=l[1])}return i}return null}function J(n,t){let e=o(n);if(e!==null)return[t(e),...(H(n)??[]).map(t)];let i=y(n);if(i!==null){let r=Object.keys(i),l={};for(let g of r)l[g]=t(i[g]);return{dict:l}}return t(n)}function $(n,t){let e=null;if(Array.isArray(n)&&(e=n),u(n)&&(e=n.fn),e===null)return[];let i=1,r=[];for(;i<e.length;)r.push(t(e[i])),i+=1;return r}var X="0.
|
|
3
|
+
var MathJson=(()=>{var f=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var D=(n,t)=>{for(var e in t)f(n,e,{get:t[e],enumerable:!0})},R=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of v(t))!k.call(n,r)&&r!==e&&f(n,r,{get:()=>t[r],enumerable:!(i=T(t,r))||i.enumerable});return n};var _=n=>R(f({},"__esModule",{value:!0}),n);var z={};D(z,{applyRecursively:()=>J,getDictionary:()=>y,getStringValue:()=>m,head:()=>o,headName:()=>I,isDictionaryObject:()=>M,isFunctionObject:()=>u,isStringObject:()=>S,isSymbolObject:()=>d,mapArgs:()=>$,nops:()=>E,op:()=>s,symbol:()=>A,version:()=>X});function d(n){return n!==null&&typeof n=="object"&&"sym"in n}function S(n){return n!==null&&typeof n=="object"&&"str"in n}function u(n){return n!==null&&typeof n=="object"&&"fn"in n}function M(n){return n!==null&&typeof n=="object"&&"dict"in n}var c;function N(n){if(!c){let e=`^[${["Zyyy","Zinh","Arab","Armn","Beng","Bopo","Cyrl","Deva","Ethi","Geor","Grek","Gujr","Guru","Hang","Hani","Hebr","Hira","Kana","Knda","Khmr","Laoo","Latn","Mlym","Mymr","Orya","Sinh","Taml","Telu","Thaa","Thai","Tibt"].map(i=>`\\p{Script=${i}}`).join("")}]*$`;c=new RegExp(e,"u")}return c.test(n)}function a(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||O.test(n)?!0:N(n)?/^[\p{XIDS}_]\p{XIDC}*$/u.test(n):!1}var F="\\u{FE0F}",V="\\u{20E3}",L="\\u{200D}",P="\\p{RI}\\p{RI}",w="(?:[\\u{E0020}-\\u{E007E}]+\\u{E007F})",b=`(?:\\p{EMod}|${F}${V}?|${w})`,C="(?:(?=\\P{XIDC})\\p{Emoji})",h=`(?:${C}${b}*|\\p{Emoji}${b}+|${P})`,j=`(?:${h})(${L}${h})*`,G=new RegExp(`(?:${j})+`,"u"),O=new RegExp(`^(?:${j})+$`,"u");function q(n){return typeof n!="string"?"not-a-string":n===""?"empty-string":n.normalize()!==n?"expected-nfc":/[\u200E\u200F\u2066-\u2069\u202A-\u202E]/.test(n)?"unexpected-bidi-marker":O.test(n)?"valid":/\p{XIDC}/u.test(n)&&G.test(n)?"unexpected-mixed-emoji":N(n)?a(n)?"valid":a(n[0])?"invalid-char":"invalid-first-char":"unexpected-script"}function m(n){return n==null?null:typeof n=="object"&&"str"in n?n.str:typeof n!="string"||n.length<2||n[0]!=="'"||n[n.length-1]!=="'"?null:n.substring(1,n.length-1)}function o(n){return n==null?null:Array.isArray(n)?typeof n[0]=="string"&&!a(n[0])?(console.error(`Invalid identifier "${n[0]}": ${q(n[0])}`),null):n[0]:u(n)?n.fn[0]:null}function I(n){let t=o(n);return typeof t=="string"?t:""}function H(n){return n==null?null:Array.isArray(n)?n.slice(1):u(n)?n.fn.slice(1):null}function s(n,t){return n==null?null:Array.isArray(n)?n[t]??null:u(n)?n.fn[t]??null:null}function K(n){return s(n,1)}function Z(n){return s(n,2)}function E(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):u(n)?Math.max(0,n.fn.length-1):0}function A(n){if(n==null||typeof n=="string"&&(/^[+\-\.0-9]/.test(n)||n.length>=2&&n[0]==="'"&&n[n.length-1]==="'"))return null;let t=d(n)?n.sym:n;return typeof t!="string"?null:t}function p(n){let t=o(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let e=m(K(n));return e?[e,Z(n)??"Nothing"]:null}return null}function y(n){if(n===null)return null;if(typeof n=="object"&&"dict"in n)return n.dict;let t=p(n);if(t)return{[t[0]]:t[1]};if(o(n)==="Dictionary"){let i={};for(let r=1;r<E(n);r++){let l=p(s(n,r));l&&(i[l[0]]=l[1])}return i}return null}function J(n,t){let e=o(n);if(e!==null)return[t(e),...(H(n)??[]).map(t)];let i=y(n);if(i!==null){let r=Object.keys(i),l={};for(let g of r)l[g]=t(i[g]);return{dict:l}}return t(n)}function $(n,t){let e=null;if(Array.isArray(n)&&(e=n),u(n)&&(e=n.fn),e===null)return[];let i=1,r=[];for(;i<e.length;)r.push(t(e[i])),i+=1;return r}var X="0.22.0";return _(z);})();
|
|
4
4
|
Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
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
3
|
export type SignalMessage = SignalCode | [SignalCode, ...any[]];
|
|
4
4
|
export type SignalOrigin = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import type { Decimal } from 'decimal.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, SimplifyOptions, Substitution, RuntimeScope, DomainCompatibility, DomainLiteral, BoxedBaseDefinition, Rational, BoxedSubstitution } from '../public';
|
|
@@ -28,6 +28,7 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
|
|
|
28
28
|
valueOf(): number | any[] | string | boolean;
|
|
29
29
|
/** Object.toString() */
|
|
30
30
|
toString(): string;
|
|
31
|
+
print(): void;
|
|
31
32
|
[Symbol.toPrimitive](hint: 'number' | 'string' | 'default'): number | string | null;
|
|
32
33
|
/** Called by `JSON.stringify()` when serializing to json */
|
|
33
34
|
toJSON(): Expression;
|
|
@@ -76,6 +77,8 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
|
|
|
76
77
|
get isPrime(): boolean | undefined;
|
|
77
78
|
get isComposite(): boolean | undefined;
|
|
78
79
|
get numericValue(): number | Decimal | Complex | Rational | null;
|
|
80
|
+
get shape(): number[];
|
|
81
|
+
get rank(): number;
|
|
79
82
|
get sgn(): -1 | 0 | 1 | undefined | null;
|
|
80
83
|
isLess(_rhs: BoxedExpression): boolean | undefined;
|
|
81
84
|
isLessEqual(_rhs: BoxedExpression): boolean | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
|
-
import { IComputeEngine, SemiBoxedExpression, BoxedExpression, Metadata, Rational } from '../public';
|
|
3
|
+
import { IComputeEngine, SemiBoxedExpression, BoxedExpression, Metadata, Rational, CanonicalForm } from '../public';
|
|
4
4
|
import { MathJsonNumber } from '../../math-json/math-json-format';
|
|
5
5
|
/**
|
|
6
6
|
* ## THEORY OF OPERATIONS
|
|
@@ -101,5 +101,5 @@ export declare function boxFunction(ce: IComputeEngine, head: string, ops: SemiB
|
|
|
101
101
|
*
|
|
102
102
|
*/
|
|
103
103
|
export declare function box(ce: IComputeEngine, expr: null | undefined | Decimal | Complex | Rational | SemiBoxedExpression, options?: {
|
|
104
|
-
canonical?: boolean;
|
|
104
|
+
canonical?: boolean | CanonicalForm | CanonicalForm[];
|
|
105
105
|
}): BoxedExpression;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, ReplaceOptions, Substitution, Metadata, PatternMatchOptions, BoxedDomain, BoxedSubstitution } from '../public';
|
|
3
3
|
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { BoxedDomain, BoxedExpression, BoxedSubstitution, DomainCompatibility, DomainConstructor, DomainExpression, DomainLiteral, IComputeEngine, Metadata, PatternMatchOptions } from '../public';
|
|
3
3
|
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
4
4
|
/**
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { Expression } from '../../math-json/math-json-format';
|
|
3
3
|
import { BoxedExpression, BoxedFunctionDefinition, IComputeEngine, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, Substitution, ReplaceOptions, Metadata, PatternMatchOptions, BoxedDomain, RuntimeScope, BoxedSubstitution, EvaluateOptions, BoxedBaseDefinition, Hold } from '../public';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A boxed function represent an expression that can be
|
|
6
|
+
* represented by a function call.
|
|
7
|
+
*
|
|
8
|
+
* It is composed of a head (the name of the function) and
|
|
9
|
+
* a list of arguments.
|
|
10
|
+
*
|
|
11
|
+
* It has a definition associated with it, based
|
|
12
|
+
* on the head. The definition contains the signature of the function,
|
|
13
|
+
* and the implementation of the function.
|
|
14
|
+
*
|
|
6
15
|
*/
|
|
7
16
|
export declare class BoxedFunction extends _BoxedExpression {
|
|
8
17
|
private readonly _head;
|
|
@@ -12,7 +21,6 @@ export declare class BoxedFunction extends _BoxedExpression {
|
|
|
12
21
|
private _def;
|
|
13
22
|
private _isPure;
|
|
14
23
|
private _result;
|
|
15
|
-
private _numericValue;
|
|
16
24
|
private _hash;
|
|
17
25
|
constructor(ce: IComputeEngine, head: string | BoxedExpression, ops: BoxedExpression[], options?: {
|
|
18
26
|
metadata?: Metadata;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
4
|
import { BoxedExpression, BoxedDomain, IComputeEngine, Metadata, NOptions, PatternMatchOptions, Rational, SimplifyOptions, BoxedSubstitution, EvaluateOptions } from '../public';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { _BoxedExpression } 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 _BoxedExpression implements Pattern {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
4
|
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
@@ -39,6 +39,7 @@ export declare class BoxedSymbol extends _BoxedExpression {
|
|
|
39
39
|
get isCanonical(): boolean;
|
|
40
40
|
set isCanonical(val: boolean);
|
|
41
41
|
get canonical(): BoxedExpression;
|
|
42
|
+
solve(vars: string[]): null | BoxedExpression[];
|
|
42
43
|
get complexity(): number;
|
|
43
44
|
get head(): string;
|
|
44
45
|
get symbol(): string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* 0.22.0 */
|
|
2
|
+
import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, SimplifyOptions, Metadata, BoxedDomain, BoxedSubstitution, PatternMatchOptions, BoxedBaseDefinition, BoxedFunctionDefinition } from '../public';
|
|
3
|
+
import { DataTypeMap, TensorDataType } from '../symbolic/tensor-fields';
|
|
4
|
+
import { AbstractTensor, TensorData } from '../symbolic/tensors';
|
|
5
|
+
import { _BoxedExpression } from './abstract-boxed-expression';
|
|
6
|
+
/**
|
|
7
|
+
* A boxed tensor represents an expression that can be
|
|
8
|
+
* represented by a tensor. This could be a vector, matrix
|
|
9
|
+
* or multi-dimensional array.
|
|
10
|
+
*
|
|
11
|
+
* The object can be created either from a tensor or from
|
|
12
|
+
* an expression that can be represented as a tensor.
|
|
13
|
+
*
|
|
14
|
+
* The counterpart (expression if input is tensor, or tensor
|
|
15
|
+
* if input is expression) is created lazily.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare class BoxedTensor extends _BoxedExpression {
|
|
19
|
+
private readonly _head?;
|
|
20
|
+
private readonly _ops?;
|
|
21
|
+
private _tensor;
|
|
22
|
+
private _expression;
|
|
23
|
+
constructor(ce: IComputeEngine, input: {
|
|
24
|
+
head?: string;
|
|
25
|
+
ops: BoxedExpression[];
|
|
26
|
+
} | AbstractTensor<'expression'>, options?: {
|
|
27
|
+
canonical?: boolean;
|
|
28
|
+
metadata?: Metadata;
|
|
29
|
+
});
|
|
30
|
+
get expression(): BoxedExpression;
|
|
31
|
+
/** Create the tensor on demand */
|
|
32
|
+
get tensor(): AbstractTensor<'expression'>;
|
|
33
|
+
get baseDefinition(): BoxedBaseDefinition | undefined;
|
|
34
|
+
get functionDefinition(): BoxedFunctionDefinition | undefined;
|
|
35
|
+
bind(): void;
|
|
36
|
+
reset(): void;
|
|
37
|
+
get hash(): number;
|
|
38
|
+
get canonical(): BoxedExpression;
|
|
39
|
+
get isCanonical(): boolean;
|
|
40
|
+
set isCanonical(val: boolean);
|
|
41
|
+
get isPure(): boolean;
|
|
42
|
+
get isValid(): boolean;
|
|
43
|
+
get complexity(): number;
|
|
44
|
+
get head(): string;
|
|
45
|
+
get nops(): number;
|
|
46
|
+
get ops(): BoxedExpression[];
|
|
47
|
+
get op1(): BoxedExpression;
|
|
48
|
+
get op2(): BoxedExpression;
|
|
49
|
+
get op3(): BoxedExpression;
|
|
50
|
+
get shape(): number[];
|
|
51
|
+
get rank(): number;
|
|
52
|
+
get domain(): BoxedDomain | undefined;
|
|
53
|
+
get json(): Expression;
|
|
54
|
+
get rawJson(): Expression;
|
|
55
|
+
/** Structural equality */
|
|
56
|
+
isSame(rhs: BoxedExpression): boolean;
|
|
57
|
+
/** Mathematical equality */
|
|
58
|
+
isEqual(rhs: BoxedExpression): boolean;
|
|
59
|
+
match(rhs: BoxedExpression, options?: PatternMatchOptions): BoxedSubstitution | null;
|
|
60
|
+
evaluate(options?: EvaluateOptions): BoxedExpression;
|
|
61
|
+
simplify(options?: SimplifyOptions): BoxedExpression;
|
|
62
|
+
N(options?: NOptions): BoxedExpression;
|
|
63
|
+
}
|
|
64
|
+
export declare function isBoxedTensor(val: unknown): val is BoxedTensor;
|
|
65
|
+
export declare function expressionTensorInfo(head: string, rows: BoxedExpression[]): {
|
|
66
|
+
shape: number[];
|
|
67
|
+
dtype: keyof DataTypeMap;
|
|
68
|
+
};
|
|
69
|
+
export declare function expressionAsTensor<T extends TensorDataType>(head: string, rows: BoxedExpression[]): TensorData<T> | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { Expression, MathJsonNumber } from '../math-json/math-json-format';
|
|
4
4
|
import type { LibraryCategory, LatexDictionaryEntry, LatexString, NumberFormattingOptions, ParseLatexOptions, SerializeLatexOptions } from './latex-syntax/public';
|
|
5
|
-
import { AssumeResult, BoxedExpression, BoxedFunctionDefinition, BoxedSymbolDefinition, IComputeEngine, IdentifierDefinitions, ExpressionMapInterface, NumericMode, Pattern, RuntimeScope, Scope, SemiBoxedExpression, SymbolDefinition, BoxedRuleSet, Rule, JsonSerializationOptions, ComputeEngineStats, Metadata, BoxedDomain, DomainExpression, FunctionDefinition, Rational, BoxedSubstitution, AssignValue, DomainLiteral, ArrayValue } from './public';
|
|
5
|
+
import { AssumeResult, BoxedExpression, BoxedFunctionDefinition, BoxedSymbolDefinition, IComputeEngine, IdentifierDefinitions, ExpressionMapInterface, NumericMode, Pattern, RuntimeScope, Scope, SemiBoxedExpression, SymbolDefinition, BoxedRuleSet, Rule, JsonSerializationOptions, ComputeEngineStats, Metadata, BoxedDomain, DomainExpression, FunctionDefinition, Rational, BoxedSubstitution, AssignValue, DomainLiteral, ArrayValue, CanonicalForm } from './public';
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* To use the CortexJS Compute Engine, create a `ComputeEngine` instance, or if using a
|
|
@@ -436,7 +436,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
436
436
|
* Return a boxed expression from the input.
|
|
437
437
|
*/
|
|
438
438
|
box(expr: Decimal | Complex | [num: number, denom: number] | SemiBoxedExpression, options?: {
|
|
439
|
-
canonical?: boolean;
|
|
439
|
+
canonical?: boolean | CanonicalForm | CanonicalForm[];
|
|
440
440
|
}): BoxedExpression;
|
|
441
441
|
canonical(xs: SemiBoxedExpression[]): BoxedExpression[];
|
|
442
442
|
/**
|
|
@@ -510,6 +510,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
510
510
|
*
|
|
511
511
|
* The result is canonical.
|
|
512
512
|
*/
|
|
513
|
+
tuple(elements: number[], metadata?: Metadata): BoxedExpression;
|
|
513
514
|
tuple(elements: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
514
515
|
array(elements: ArrayValue[] | ArrayValue[][], metadata?: Metadata): BoxedExpression;
|
|
515
516
|
string(s: string, metadata?: Metadata): BoxedExpression;
|
|
@@ -541,13 +542,13 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
541
542
|
*
|
|
542
543
|
*/
|
|
543
544
|
parse(latex: LatexString | string, options?: {
|
|
544
|
-
canonical?: boolean;
|
|
545
|
+
canonical?: boolean | CanonicalForm | CanonicalForm[];
|
|
545
546
|
}): BoxedExpression;
|
|
546
547
|
parse(s: null, options?: {
|
|
547
|
-
canonical?: boolean;
|
|
548
|
+
canonical?: boolean | CanonicalForm | CanonicalForm[];
|
|
548
549
|
}): null;
|
|
549
550
|
parse(latex: LatexString | string | null, options?: {
|
|
550
|
-
canonical?: boolean;
|
|
551
|
+
canonical?: boolean | CanonicalForm | CanonicalForm[];
|
|
551
552
|
}): null | BoxedExpression;
|
|
552
553
|
/** Serialize a `BoxedExpression` or a `MathJSON` expression to
|
|
553
554
|
* a LaTeX string
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_CALCULUS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_COMPLEX: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_LINEAR_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_LOGIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_OTHERS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_INEQUALITIES: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_SETS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_STATISTICS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare const DEFINITIONS_TRIGONOMETRY: LatexDictionary;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { IndexedLatexDictionary, IndexedLatexDictionaryEntry, IndexedInfixEntry, IndexedPostfixEntry, IndexedPrefixEntry, IndexedSymbolEntry, IndexedExpressionEntry, IndexedFunctionEntry } from './dictionary/definitions';
|
|
3
3
|
import { IComputeEngine } from '../public';
|
|
4
4
|
import { Expression } from '../../math-json/math-json-format';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
export declare function getApplyFunctionStyle(_expr: Expression, _level: number): 'paren' | 'leftright' | 'big' | 'none';
|
|
3
3
|
export declare function getGroupStyle(_expr: Expression, _level: number): 'paren' | 'leftright' | 'big' | 'none';
|
|
4
4
|
export declare function getRootStyle(_expr: Expression | null, level: number): 'radical' | 'quotient' | 'solidus';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
import { WarningSignalHandler } from '../../common/signals';
|
|
3
3
|
import { NumberFormattingOptions, LatexString, SerializeLatexOptions } from './public';
|
|
4
4
|
import { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
/** The canonical form of `Add`:
|
|
3
3
|
* - removes `0`
|
|
4
4
|
* - capture complex numbers (a + ib or ai +b)
|
|
@@ -7,5 +7,5 @@ export declare function canonicalAdd(ce: IComputeEngine, ops: BoxedExpression[])
|
|
|
7
7
|
export declare function domainAdd(_ce: IComputeEngine, args: (undefined | BoxedDomain)[]): BoxedDomain | null | undefined;
|
|
8
8
|
export declare function simplifyAdd(ce: IComputeEngine, args: BoxedExpression[]): BoxedExpression;
|
|
9
9
|
export declare function evalAdd(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression;
|
|
10
|
-
export declare function canonicalSummation(ce: IComputeEngine, body: BoxedExpression,
|
|
11
|
-
export declare function evalSummation(ce: IComputeEngine, expr: BoxedExpression,
|
|
10
|
+
export declare function canonicalSummation(ce: IComputeEngine, body: BoxedExpression, indexingSet: BoxedExpression | undefined): BoxedExpression;
|
|
11
|
+
export declare function evalSummation(ce: IComputeEngine, expr: BoxedExpression, indexingSet: BoxedExpression | undefined, mode: 'simplify' | 'N' | 'evaluate'): BoxedExpression | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.22.0 */
|
|
2
2
|
/** The canonical form of `Multiply`:
|
|
3
3
|
* - remove `1`
|
|
4
4
|
* - combine literal integers and rationals
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
export declare function canonicalMultiply(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
|
|
15
15
|
export declare function simplifyMultiply(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
|
|
16
16
|
export declare function evalMultiply(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression | undefined;
|
|
17
|
-
export declare function canonicalProduct(ce: IComputeEngine, body: BoxedExpression | undefined,
|
|
18
|
-
export declare function evalMultiplication(ce: IComputeEngine, expr: BoxedExpression,
|
|
17
|
+
export declare function canonicalProduct(ce: IComputeEngine, body: BoxedExpression | undefined, indexingSet: BoxedExpression | undefined): BoxedExpression;
|
|
18
|
+
export declare function evalMultiplication(ce: IComputeEngine, expr: BoxedExpression, indexingSet: BoxedExpression | undefined, mode: 'simplify' | 'evaluate' | 'N'): BoxedExpression | undefined;
|