@cortex-js/compute-engine 0.20.0 → 0.20.1
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 +180 -142
- package/dist/compute-engine.js +180 -142
- package/dist/compute-engine.min.esm.js +10 -10
- package/dist/compute-engine.min.js +10 -10
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +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 +1 -1
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +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 +1 -1
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/domains.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +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 +1 -1
- package/dist/types/compute-engine/rules.d.ts +1 -1
- package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/solve.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +2 -2
- package/dist/types/math-json/math-json-format.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +2 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +1 -1
package/dist/compute-engine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS Compute Engine 0.20.
|
|
1
|
+
/** CortexJS Compute Engine 0.20.1 */
|
|
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.ComputeEngine = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
var ComputeEngine = (() => {
|
|
4
4
|
var __create = Object.create;
|
|
@@ -3980,6 +3980,13 @@ var ComputeEngine = (() => {
|
|
|
3980
3980
|
return Math.max(0, expr.fn.length - 1);
|
|
3981
3981
|
return 0;
|
|
3982
3982
|
}
|
|
3983
|
+
function unhold(expr) {
|
|
3984
|
+
if (expr === null || expr === void 0)
|
|
3985
|
+
return null;
|
|
3986
|
+
if (head(expr) === "Hold")
|
|
3987
|
+
return op(expr, 1);
|
|
3988
|
+
return expr;
|
|
3989
|
+
}
|
|
3983
3990
|
function symbol(expr) {
|
|
3984
3991
|
if (expr === null || expr === void 0)
|
|
3985
3992
|
return null;
|
|
@@ -5396,16 +5403,14 @@ var ComputeEngine = (() => {
|
|
|
5396
5403
|
lhs = op(lhs, 1) ?? "Nothing";
|
|
5397
5404
|
if (head(lhs) === "Sequence") {
|
|
5398
5405
|
for (const x of ops(lhs) ?? []) {
|
|
5399
|
-
if (symbol(x))
|
|
5400
|
-
params.push(symbol(x));
|
|
5401
|
-
else
|
|
5406
|
+
if (!symbol(x))
|
|
5402
5407
|
return null;
|
|
5408
|
+
params.push(symbol(x));
|
|
5403
5409
|
}
|
|
5404
5410
|
} else {
|
|
5405
|
-
if (symbol(lhs))
|
|
5406
|
-
params = [symbol(lhs)];
|
|
5407
|
-
else
|
|
5411
|
+
if (!symbol(lhs))
|
|
5408
5412
|
return null;
|
|
5413
|
+
params = [symbol(lhs)];
|
|
5409
5414
|
}
|
|
5410
5415
|
let rhs = parser.parseExpression({ minPrec: ARROW_PRECEDENCE }) ?? "Nothing";
|
|
5411
5416
|
if (head(rhs) === "Delimiter")
|
|
@@ -5478,8 +5483,23 @@ var ComputeEngine = (() => {
|
|
|
5478
5483
|
// return ['Assign', lhs, rhs];
|
|
5479
5484
|
// },
|
|
5480
5485
|
serialize: (serializer, expr) => {
|
|
5486
|
+
const id = unhold(op(expr, 1));
|
|
5487
|
+
if (head(op(expr, 2)) === "Function") {
|
|
5488
|
+
const op_2 = op(expr, 2);
|
|
5489
|
+
const body = unhold(op(op_2, 1));
|
|
5490
|
+
const args = ops(op_2)?.slice(1) ?? [];
|
|
5491
|
+
return joinLatex([
|
|
5492
|
+
serializer.serialize(id),
|
|
5493
|
+
serializer.wrapString(
|
|
5494
|
+
args.map((x) => serializer.serialize(x)).join(", "),
|
|
5495
|
+
serializer.options.applyFunctionStyle(expr, serializer.level)
|
|
5496
|
+
),
|
|
5497
|
+
"\\coloneq",
|
|
5498
|
+
serializer.serialize(body)
|
|
5499
|
+
]);
|
|
5500
|
+
}
|
|
5481
5501
|
return joinLatex([
|
|
5482
|
-
serializer.serialize(
|
|
5502
|
+
serializer.serialize(id),
|
|
5483
5503
|
"\\coloneq",
|
|
5484
5504
|
serializer.serialize(op(expr, 2))
|
|
5485
5505
|
]);
|
|
@@ -5585,107 +5605,6 @@ var ComputeEngine = (() => {
|
|
|
5585
5605
|
return serializer.wrapString(body, style, open + close);
|
|
5586
5606
|
}
|
|
5587
5607
|
},
|
|
5588
|
-
// The first argument is the matrix data.
|
|
5589
|
-
// The second, optional, argument are the delimiters.
|
|
5590
|
-
// The third, optional, argument is the column specification.
|
|
5591
|
-
{
|
|
5592
|
-
name: "Matrix",
|
|
5593
|
-
// https://ctan.math.illinois.edu/macros/latex/required/tools/array.pdf
|
|
5594
|
-
serialize: (serializer, expr) => {
|
|
5595
|
-
const body = op(expr, 1);
|
|
5596
|
-
const delims = op(expr, 2) ?? "()";
|
|
5597
|
-
let columns = "";
|
|
5598
|
-
if (op(expr, 3) !== null) {
|
|
5599
|
-
const colsSpec = stringValue(op(expr, 3)) ?? "";
|
|
5600
|
-
for (const c of colsSpec) {
|
|
5601
|
-
if (c === "<")
|
|
5602
|
-
columns += "l";
|
|
5603
|
-
else if (c === ">")
|
|
5604
|
-
columns += "r";
|
|
5605
|
-
else if (c === "=")
|
|
5606
|
-
columns += "c";
|
|
5607
|
-
else if (c === "|")
|
|
5608
|
-
columns += "|";
|
|
5609
|
-
else if (c === ":")
|
|
5610
|
-
columns += ":";
|
|
5611
|
-
}
|
|
5612
|
-
}
|
|
5613
|
-
let [open, close] = ["", ""];
|
|
5614
|
-
if (typeof delims === "string" && delims.length === 2)
|
|
5615
|
-
[open, close] = delims;
|
|
5616
|
-
const rows = [];
|
|
5617
|
-
for (const row of ops(body) ?? []) {
|
|
5618
|
-
const cells = [];
|
|
5619
|
-
for (const cell of ops(row) ?? [])
|
|
5620
|
-
cells.push(serializer.serialize(cell));
|
|
5621
|
-
rows.push(cells.join(" & "));
|
|
5622
|
-
}
|
|
5623
|
-
const tabular = rows.join("\\\\\n");
|
|
5624
|
-
const optColumns = columns.length > 0 ? `[${columns}]` : "";
|
|
5625
|
-
if (open === "(" && close === ")")
|
|
5626
|
-
return joinLatex([
|
|
5627
|
-
"\\begin{pmatrix}",
|
|
5628
|
-
optColumns,
|
|
5629
|
-
tabular,
|
|
5630
|
-
"\\end{pmatrix}"
|
|
5631
|
-
]);
|
|
5632
|
-
if (open === "[" && close === "]")
|
|
5633
|
-
return joinLatex([
|
|
5634
|
-
"\\begin{bmatrix}",
|
|
5635
|
-
optColumns,
|
|
5636
|
-
tabular,
|
|
5637
|
-
"\\end{bmatrix}"
|
|
5638
|
-
]);
|
|
5639
|
-
if (open === "{" && close === "}")
|
|
5640
|
-
return joinLatex([
|
|
5641
|
-
"\\begin{Bmatrix}",
|
|
5642
|
-
optColumns,
|
|
5643
|
-
tabular,
|
|
5644
|
-
"\\end{Bmatrix}"
|
|
5645
|
-
]);
|
|
5646
|
-
if (open === "|" && close === "|")
|
|
5647
|
-
return joinLatex([
|
|
5648
|
-
"\\begin{vmatrix}",
|
|
5649
|
-
optColumns,
|
|
5650
|
-
tabular,
|
|
5651
|
-
"\\end{vmatrix}"
|
|
5652
|
-
]);
|
|
5653
|
-
if (open === "\u2016" && close === "\u2016")
|
|
5654
|
-
return joinLatex([
|
|
5655
|
-
"\\begin{Vmatrix}",
|
|
5656
|
-
optColumns,
|
|
5657
|
-
tabular,
|
|
5658
|
-
"\\end{Vmatrix}"
|
|
5659
|
-
]);
|
|
5660
|
-
if (open === "{" && close === ".")
|
|
5661
|
-
return joinLatex([
|
|
5662
|
-
"\\begin{dcases}",
|
|
5663
|
-
optColumns,
|
|
5664
|
-
tabular,
|
|
5665
|
-
"\\end{dcases}"
|
|
5666
|
-
]);
|
|
5667
|
-
if (open === "." && close === "}")
|
|
5668
|
-
return joinLatex([
|
|
5669
|
-
"\\begin{rcases}",
|
|
5670
|
-
optColumns,
|
|
5671
|
-
tabular,
|
|
5672
|
-
"\\end{rcases}"
|
|
5673
|
-
]);
|
|
5674
|
-
if (columns || open !== "." || close !== ".") {
|
|
5675
|
-
return joinLatex([
|
|
5676
|
-
"\\left",
|
|
5677
|
-
DELIMITERS_SHORTHAND[open] ?? open,
|
|
5678
|
-
"\\begin{array}",
|
|
5679
|
-
`{${columns}}`,
|
|
5680
|
-
tabular,
|
|
5681
|
-
"\\end{array}",
|
|
5682
|
-
"\\right",
|
|
5683
|
-
DELIMITERS_SHORTHAND[close] ?? close
|
|
5684
|
-
]);
|
|
5685
|
-
}
|
|
5686
|
-
return joinLatex(["\\begin{matrix}", tabular, "\\end{matrix}"]);
|
|
5687
|
-
}
|
|
5688
|
-
},
|
|
5689
5608
|
{
|
|
5690
5609
|
name: "Domain",
|
|
5691
5610
|
serialize: (serializer, expr) => {
|
|
@@ -6326,11 +6245,11 @@ var ComputeEngine = (() => {
|
|
|
6326
6245
|
"(": "(",
|
|
6327
6246
|
")": ")",
|
|
6328
6247
|
"[": "\\lbrack",
|
|
6248
|
+
"]": "\\rbrack",
|
|
6329
6249
|
"\u27E6": "\\llbrack",
|
|
6330
6250
|
// U+27E6 MATHEMATICAL LEFT WHITE SQUARE BRACKET
|
|
6331
6251
|
"\u27E7": "\\rrbrack",
|
|
6332
6252
|
// U+27E7 MATHEMATICAL RIGHT WHITE SQUARE BRACKET
|
|
6333
|
-
"]": "\\rbrack",
|
|
6334
6253
|
"{": "\\lbrace",
|
|
6335
6254
|
"}": "\\rbrace",
|
|
6336
6255
|
"<": "\\langle",
|
|
@@ -6377,6 +6296,16 @@ var ComputeEngine = (() => {
|
|
|
6377
6296
|
}
|
|
6378
6297
|
return ["Assign", fn, ["Function", rhs2, ...args ?? []]];
|
|
6379
6298
|
}
|
|
6299
|
+
if (typeof head(lhs) === "string") {
|
|
6300
|
+
const fn = head(lhs);
|
|
6301
|
+
const args = ops(lhs) ?? [];
|
|
6302
|
+
const rhs2 = parser.parseExpression({ minPrec: 0 });
|
|
6303
|
+
if (rhs2 === null) {
|
|
6304
|
+
parser.index = index;
|
|
6305
|
+
return null;
|
|
6306
|
+
}
|
|
6307
|
+
return ["Assign", fn, ["Function", rhs2, ...args]];
|
|
6308
|
+
}
|
|
6380
6309
|
if (!symbol(lhs))
|
|
6381
6310
|
return null;
|
|
6382
6311
|
const rhs = parser.parseExpression({ minPrec: 0 });
|
|
@@ -6787,6 +6716,111 @@ var ComputeEngine = (() => {
|
|
|
6787
6716
|
}
|
|
6788
6717
|
];
|
|
6789
6718
|
|
|
6719
|
+
// src/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.ts
|
|
6720
|
+
var DEFINITIONS_LINEAR_ALGEBRA = [
|
|
6721
|
+
// The first argument is the matrix data.
|
|
6722
|
+
// The second, optional, argument are the delimiters.
|
|
6723
|
+
// The third, optional, argument is the column specification.
|
|
6724
|
+
{
|
|
6725
|
+
name: "Matrix",
|
|
6726
|
+
// https://ctan.math.illinois.edu/macros/latex/required/tools/array.pdf
|
|
6727
|
+
serialize: (serializer, expr) => {
|
|
6728
|
+
const body = op(expr, 1);
|
|
6729
|
+
const delims = op(expr, 2) ?? "()";
|
|
6730
|
+
let columns = "";
|
|
6731
|
+
if (op(expr, 3) !== null) {
|
|
6732
|
+
const colsSpec = stringValue(op(expr, 3)) ?? "";
|
|
6733
|
+
for (const c of colsSpec) {
|
|
6734
|
+
if (c === "<")
|
|
6735
|
+
columns += "l";
|
|
6736
|
+
else if (c === ">")
|
|
6737
|
+
columns += "r";
|
|
6738
|
+
else if (c === "=")
|
|
6739
|
+
columns += "c";
|
|
6740
|
+
else if (c === "|")
|
|
6741
|
+
columns += "|";
|
|
6742
|
+
else if (c === ":")
|
|
6743
|
+
columns += ":";
|
|
6744
|
+
}
|
|
6745
|
+
}
|
|
6746
|
+
let [open, close] = ["", ""];
|
|
6747
|
+
if (typeof delims === "string" && delims.length === 2)
|
|
6748
|
+
[open, close] = delims;
|
|
6749
|
+
const rows = [];
|
|
6750
|
+
for (const row of ops(body) ?? []) {
|
|
6751
|
+
const cells = [];
|
|
6752
|
+
for (const cell of ops(row) ?? [])
|
|
6753
|
+
cells.push(serializer.serialize(cell));
|
|
6754
|
+
rows.push(cells.join(" & "));
|
|
6755
|
+
}
|
|
6756
|
+
const tabular = rows.join("\\\\\n");
|
|
6757
|
+
const optColumns = columns.length > 0 ? `[${columns}]` : "";
|
|
6758
|
+
if (open === "(" && close === ")")
|
|
6759
|
+
return joinLatex([
|
|
6760
|
+
"\\begin{pmatrix}",
|
|
6761
|
+
optColumns,
|
|
6762
|
+
tabular,
|
|
6763
|
+
"\\end{pmatrix}"
|
|
6764
|
+
]);
|
|
6765
|
+
if (open === "[" && close === "]")
|
|
6766
|
+
return joinLatex([
|
|
6767
|
+
"\\begin{bmatrix}",
|
|
6768
|
+
optColumns,
|
|
6769
|
+
tabular,
|
|
6770
|
+
"\\end{bmatrix}"
|
|
6771
|
+
]);
|
|
6772
|
+
if (open === "{" && close === "}")
|
|
6773
|
+
return joinLatex([
|
|
6774
|
+
"\\begin{Bmatrix}",
|
|
6775
|
+
optColumns,
|
|
6776
|
+
tabular,
|
|
6777
|
+
"\\end{Bmatrix}"
|
|
6778
|
+
]);
|
|
6779
|
+
if (open === "|" && close === "|")
|
|
6780
|
+
return joinLatex([
|
|
6781
|
+
"\\begin{vmatrix}",
|
|
6782
|
+
optColumns,
|
|
6783
|
+
tabular,
|
|
6784
|
+
"\\end{vmatrix}"
|
|
6785
|
+
]);
|
|
6786
|
+
if (open === "\u2016" && close === "\u2016")
|
|
6787
|
+
return joinLatex([
|
|
6788
|
+
"\\begin{Vmatrix}",
|
|
6789
|
+
optColumns,
|
|
6790
|
+
tabular,
|
|
6791
|
+
"\\end{Vmatrix}"
|
|
6792
|
+
]);
|
|
6793
|
+
if (open === "{" && close === ".")
|
|
6794
|
+
return joinLatex([
|
|
6795
|
+
"\\begin{dcases}",
|
|
6796
|
+
optColumns,
|
|
6797
|
+
tabular,
|
|
6798
|
+
"\\end{dcases}"
|
|
6799
|
+
]);
|
|
6800
|
+
if (open === "." && close === "}")
|
|
6801
|
+
return joinLatex([
|
|
6802
|
+
"\\begin{rcases}",
|
|
6803
|
+
optColumns,
|
|
6804
|
+
tabular,
|
|
6805
|
+
"\\end{rcases}"
|
|
6806
|
+
]);
|
|
6807
|
+
if (columns || open !== "." || close !== ".") {
|
|
6808
|
+
return joinLatex([
|
|
6809
|
+
"\\left",
|
|
6810
|
+
DELIMITERS_SHORTHAND[open] ?? open,
|
|
6811
|
+
"\\begin{array}",
|
|
6812
|
+
`{${columns}}`,
|
|
6813
|
+
tabular,
|
|
6814
|
+
"\\end{array}",
|
|
6815
|
+
"\\right",
|
|
6816
|
+
DELIMITERS_SHORTHAND[close] ?? close
|
|
6817
|
+
]);
|
|
6818
|
+
}
|
|
6819
|
+
return joinLatex(["\\begin{matrix}", tabular, "\\end{matrix}"]);
|
|
6820
|
+
}
|
|
6821
|
+
}
|
|
6822
|
+
];
|
|
6823
|
+
|
|
6790
6824
|
// src/compute-engine/latex-syntax/dictionary/definitions-logic.ts
|
|
6791
6825
|
var DEFINITIONS_LOGIC = [
|
|
6792
6826
|
// Constants
|
|
@@ -8828,25 +8862,26 @@ var ComputeEngine = (() => {
|
|
|
8828
8862
|
return true;
|
|
8829
8863
|
}
|
|
8830
8864
|
var DEFAULT_LATEX_DICTIONARY = {
|
|
8831
|
-
algebra: DEFINITIONS_ALGEBRA,
|
|
8832
|
-
arithmetic: DEFINITIONS_ARITHMETIC,
|
|
8833
|
-
calculus: DEFINITIONS_CALCULUS,
|
|
8834
|
-
complex: DEFINITIONS_COMPLEX,
|
|
8835
|
-
core: DEFINITIONS_CORE,
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8865
|
+
"algebra": DEFINITIONS_ALGEBRA,
|
|
8866
|
+
"arithmetic": DEFINITIONS_ARITHMETIC,
|
|
8867
|
+
"calculus": DEFINITIONS_CALCULUS,
|
|
8868
|
+
"complex": DEFINITIONS_COMPLEX,
|
|
8869
|
+
"core": DEFINITIONS_CORE,
|
|
8870
|
+
"linear-algebra": DEFINITIONS_LINEAR_ALGEBRA,
|
|
8871
|
+
"logic": DEFINITIONS_LOGIC,
|
|
8872
|
+
"relop": DEFINITIONS_INEQUALITIES,
|
|
8873
|
+
"other": DEFINITIONS_OTHERS,
|
|
8874
|
+
"physics": [
|
|
8840
8875
|
{
|
|
8841
8876
|
name: "mu0",
|
|
8842
8877
|
kind: "symbol",
|
|
8843
8878
|
latexTrigger: "\\mu_0"
|
|
8844
8879
|
}
|
|
8845
8880
|
],
|
|
8846
|
-
sets: DEFINITIONS_SETS,
|
|
8847
|
-
statistics: DEFINITIONS_STATISTICS,
|
|
8848
|
-
symbols: DEFINITIONS_SYMBOLS,
|
|
8849
|
-
trigonometry: DEFINITIONS_TRIGONOMETRY
|
|
8881
|
+
"sets": DEFINITIONS_SETS,
|
|
8882
|
+
"statistics": DEFINITIONS_STATISTICS,
|
|
8883
|
+
"symbols": DEFINITIONS_SYMBOLS,
|
|
8884
|
+
"trigonometry": DEFINITIONS_TRIGONOMETRY
|
|
8850
8885
|
};
|
|
8851
8886
|
|
|
8852
8887
|
// src/compute-engine/latex-syntax/parse-identifier.ts
|
|
@@ -15168,7 +15203,7 @@ var ComputeEngine = (() => {
|
|
|
15168
15203
|
}
|
|
15169
15204
|
if (h === "Function") {
|
|
15170
15205
|
const params = args.slice(1).map((x) => x.symbol);
|
|
15171
|
-
return `((${params.join(", ")}) => ${compile(args[0], {
|
|
15206
|
+
return `((${params.join(", ")}) => ${compile(args[0].canonical, {
|
|
15172
15207
|
...target,
|
|
15173
15208
|
var: (id) => params.includes(id) ? id : target.var(id)
|
|
15174
15209
|
})})`;
|
|
@@ -23172,18 +23207,6 @@ var ComputeEngine = (() => {
|
|
|
23172
23207
|
}
|
|
23173
23208
|
}
|
|
23174
23209
|
},
|
|
23175
|
-
Matrix: {
|
|
23176
|
-
complexity: 9e3,
|
|
23177
|
-
hold: "all",
|
|
23178
|
-
signature: {
|
|
23179
|
-
params: ["Lists"],
|
|
23180
|
-
optParams: ["Strings", "Strings"],
|
|
23181
|
-
result: "Lists",
|
|
23182
|
-
canonical: canonicalMatrix,
|
|
23183
|
-
evaluate: (_ce, ops2) => ops2[0].evaluate(),
|
|
23184
|
-
N: (_ce, ops2) => ops2[0].N()
|
|
23185
|
-
}
|
|
23186
|
-
},
|
|
23187
23210
|
Error: {
|
|
23188
23211
|
/**
|
|
23189
23212
|
* - The first argument is either a string or an `["ErrorCode"]`
|
|
@@ -23335,7 +23358,7 @@ var ComputeEngine = (() => {
|
|
|
23335
23358
|
if (!op12.symbol)
|
|
23336
23359
|
return null;
|
|
23337
23360
|
const op22 = args[1];
|
|
23338
|
-
return ce._fn("Assign", [
|
|
23361
|
+
return ce._fn("Assign", [op12, op22]);
|
|
23339
23362
|
},
|
|
23340
23363
|
evaluate: (ce, ops2) => {
|
|
23341
23364
|
const op12 = ops2[0];
|
|
@@ -23674,6 +23697,24 @@ var ComputeEngine = (() => {
|
|
|
23674
23697
|
return ce._fn("Multiply", flattenOps(ops2, "Multiply"));
|
|
23675
23698
|
return ce._fn("Tuple", ops2);
|
|
23676
23699
|
}
|
|
23700
|
+
|
|
23701
|
+
// src/compute-engine/library/linear-algebra.ts
|
|
23702
|
+
var LINEAR_ALGEBRA_LIBRARY = [
|
|
23703
|
+
{
|
|
23704
|
+
Matrix: {
|
|
23705
|
+
complexity: 9e3,
|
|
23706
|
+
hold: "all",
|
|
23707
|
+
signature: {
|
|
23708
|
+
params: ["Lists"],
|
|
23709
|
+
optParams: ["Strings", "Strings"],
|
|
23710
|
+
result: "Lists",
|
|
23711
|
+
canonical: canonicalMatrix,
|
|
23712
|
+
evaluate: (_ce, ops2) => ops2[0].evaluate(),
|
|
23713
|
+
N: (_ce, ops2) => ops2[0].N()
|
|
23714
|
+
}
|
|
23715
|
+
}
|
|
23716
|
+
}
|
|
23717
|
+
];
|
|
23677
23718
|
function canonicalMatrix(ce, ops2) {
|
|
23678
23719
|
if (ops2.length === 0)
|
|
23679
23720
|
return ce._fn("Matrix", []);
|
|
@@ -23689,9 +23730,6 @@ var ComputeEngine = (() => {
|
|
|
23689
23730
|
return ce._fn("Matrix", [body]);
|
|
23690
23731
|
}
|
|
23691
23732
|
|
|
23692
|
-
// src/compute-engine/library/linear-algebra.ts
|
|
23693
|
-
var LINEAR_ALGEBRA_LIBRARY = [];
|
|
23694
|
-
|
|
23695
23733
|
// src/compute-engine/library/logic.ts
|
|
23696
23734
|
var LOGIC_LIBRARY = {
|
|
23697
23735
|
True: { wikidata: "Q16751793", domain: "Booleans", constant: true },
|
|
@@ -28813,10 +28851,10 @@ ${JSON.stringify(entry)}`
|
|
|
28813
28851
|
}
|
|
28814
28852
|
|
|
28815
28853
|
// src/compute-engine.ts
|
|
28816
|
-
var version = "0.20.
|
|
28854
|
+
var version = "0.20.1";
|
|
28817
28855
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
28818
28856
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
28819
|
-
version: "0.20.
|
|
28857
|
+
version: "0.20.1"
|
|
28820
28858
|
};
|
|
28821
28859
|
return __toCommonJS(compute_engine_exports);
|
|
28822
28860
|
})();
|