@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** CortexJS Compute Engine 0.20.
|
|
1
|
+
/** CortexJS Compute Engine 0.20.1 */
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -3950,6 +3950,13 @@ function nops(expr) {
|
|
|
3950
3950
|
return Math.max(0, expr.fn.length - 1);
|
|
3951
3951
|
return 0;
|
|
3952
3952
|
}
|
|
3953
|
+
function unhold(expr) {
|
|
3954
|
+
if (expr === null || expr === void 0)
|
|
3955
|
+
return null;
|
|
3956
|
+
if (head(expr) === "Hold")
|
|
3957
|
+
return op(expr, 1);
|
|
3958
|
+
return expr;
|
|
3959
|
+
}
|
|
3953
3960
|
function symbol(expr) {
|
|
3954
3961
|
if (expr === null || expr === void 0)
|
|
3955
3962
|
return null;
|
|
@@ -5366,16 +5373,14 @@ var DEFINITIONS_CORE = [
|
|
|
5366
5373
|
lhs = op(lhs, 1) ?? "Nothing";
|
|
5367
5374
|
if (head(lhs) === "Sequence") {
|
|
5368
5375
|
for (const x of ops(lhs) ?? []) {
|
|
5369
|
-
if (symbol(x))
|
|
5370
|
-
params.push(symbol(x));
|
|
5371
|
-
else
|
|
5376
|
+
if (!symbol(x))
|
|
5372
5377
|
return null;
|
|
5378
|
+
params.push(symbol(x));
|
|
5373
5379
|
}
|
|
5374
5380
|
} else {
|
|
5375
|
-
if (symbol(lhs))
|
|
5376
|
-
params = [symbol(lhs)];
|
|
5377
|
-
else
|
|
5381
|
+
if (!symbol(lhs))
|
|
5378
5382
|
return null;
|
|
5383
|
+
params = [symbol(lhs)];
|
|
5379
5384
|
}
|
|
5380
5385
|
let rhs = parser.parseExpression({ minPrec: ARROW_PRECEDENCE }) ?? "Nothing";
|
|
5381
5386
|
if (head(rhs) === "Delimiter")
|
|
@@ -5448,8 +5453,23 @@ var DEFINITIONS_CORE = [
|
|
|
5448
5453
|
// return ['Assign', lhs, rhs];
|
|
5449
5454
|
// },
|
|
5450
5455
|
serialize: (serializer, expr) => {
|
|
5456
|
+
const id = unhold(op(expr, 1));
|
|
5457
|
+
if (head(op(expr, 2)) === "Function") {
|
|
5458
|
+
const op_2 = op(expr, 2);
|
|
5459
|
+
const body = unhold(op(op_2, 1));
|
|
5460
|
+
const args = ops(op_2)?.slice(1) ?? [];
|
|
5461
|
+
return joinLatex([
|
|
5462
|
+
serializer.serialize(id),
|
|
5463
|
+
serializer.wrapString(
|
|
5464
|
+
args.map((x) => serializer.serialize(x)).join(", "),
|
|
5465
|
+
serializer.options.applyFunctionStyle(expr, serializer.level)
|
|
5466
|
+
),
|
|
5467
|
+
"\\coloneq",
|
|
5468
|
+
serializer.serialize(body)
|
|
5469
|
+
]);
|
|
5470
|
+
}
|
|
5451
5471
|
return joinLatex([
|
|
5452
|
-
serializer.serialize(
|
|
5472
|
+
serializer.serialize(id),
|
|
5453
5473
|
"\\coloneq",
|
|
5454
5474
|
serializer.serialize(op(expr, 2))
|
|
5455
5475
|
]);
|
|
@@ -5555,107 +5575,6 @@ var DEFINITIONS_CORE = [
|
|
|
5555
5575
|
return serializer.wrapString(body, style, open + close);
|
|
5556
5576
|
}
|
|
5557
5577
|
},
|
|
5558
|
-
// The first argument is the matrix data.
|
|
5559
|
-
// The second, optional, argument are the delimiters.
|
|
5560
|
-
// The third, optional, argument is the column specification.
|
|
5561
|
-
{
|
|
5562
|
-
name: "Matrix",
|
|
5563
|
-
// https://ctan.math.illinois.edu/macros/latex/required/tools/array.pdf
|
|
5564
|
-
serialize: (serializer, expr) => {
|
|
5565
|
-
const body = op(expr, 1);
|
|
5566
|
-
const delims = op(expr, 2) ?? "()";
|
|
5567
|
-
let columns = "";
|
|
5568
|
-
if (op(expr, 3) !== null) {
|
|
5569
|
-
const colsSpec = stringValue(op(expr, 3)) ?? "";
|
|
5570
|
-
for (const c of colsSpec) {
|
|
5571
|
-
if (c === "<")
|
|
5572
|
-
columns += "l";
|
|
5573
|
-
else if (c === ">")
|
|
5574
|
-
columns += "r";
|
|
5575
|
-
else if (c === "=")
|
|
5576
|
-
columns += "c";
|
|
5577
|
-
else if (c === "|")
|
|
5578
|
-
columns += "|";
|
|
5579
|
-
else if (c === ":")
|
|
5580
|
-
columns += ":";
|
|
5581
|
-
}
|
|
5582
|
-
}
|
|
5583
|
-
let [open, close] = ["", ""];
|
|
5584
|
-
if (typeof delims === "string" && delims.length === 2)
|
|
5585
|
-
[open, close] = delims;
|
|
5586
|
-
const rows = [];
|
|
5587
|
-
for (const row of ops(body) ?? []) {
|
|
5588
|
-
const cells = [];
|
|
5589
|
-
for (const cell of ops(row) ?? [])
|
|
5590
|
-
cells.push(serializer.serialize(cell));
|
|
5591
|
-
rows.push(cells.join(" & "));
|
|
5592
|
-
}
|
|
5593
|
-
const tabular = rows.join("\\\\\n");
|
|
5594
|
-
const optColumns = columns.length > 0 ? `[${columns}]` : "";
|
|
5595
|
-
if (open === "(" && close === ")")
|
|
5596
|
-
return joinLatex([
|
|
5597
|
-
"\\begin{pmatrix}",
|
|
5598
|
-
optColumns,
|
|
5599
|
-
tabular,
|
|
5600
|
-
"\\end{pmatrix}"
|
|
5601
|
-
]);
|
|
5602
|
-
if (open === "[" && close === "]")
|
|
5603
|
-
return joinLatex([
|
|
5604
|
-
"\\begin{bmatrix}",
|
|
5605
|
-
optColumns,
|
|
5606
|
-
tabular,
|
|
5607
|
-
"\\end{bmatrix}"
|
|
5608
|
-
]);
|
|
5609
|
-
if (open === "{" && close === "}")
|
|
5610
|
-
return joinLatex([
|
|
5611
|
-
"\\begin{Bmatrix}",
|
|
5612
|
-
optColumns,
|
|
5613
|
-
tabular,
|
|
5614
|
-
"\\end{Bmatrix}"
|
|
5615
|
-
]);
|
|
5616
|
-
if (open === "|" && close === "|")
|
|
5617
|
-
return joinLatex([
|
|
5618
|
-
"\\begin{vmatrix}",
|
|
5619
|
-
optColumns,
|
|
5620
|
-
tabular,
|
|
5621
|
-
"\\end{vmatrix}"
|
|
5622
|
-
]);
|
|
5623
|
-
if (open === "\u2016" && close === "\u2016")
|
|
5624
|
-
return joinLatex([
|
|
5625
|
-
"\\begin{Vmatrix}",
|
|
5626
|
-
optColumns,
|
|
5627
|
-
tabular,
|
|
5628
|
-
"\\end{Vmatrix}"
|
|
5629
|
-
]);
|
|
5630
|
-
if (open === "{" && close === ".")
|
|
5631
|
-
return joinLatex([
|
|
5632
|
-
"\\begin{dcases}",
|
|
5633
|
-
optColumns,
|
|
5634
|
-
tabular,
|
|
5635
|
-
"\\end{dcases}"
|
|
5636
|
-
]);
|
|
5637
|
-
if (open === "." && close === "}")
|
|
5638
|
-
return joinLatex([
|
|
5639
|
-
"\\begin{rcases}",
|
|
5640
|
-
optColumns,
|
|
5641
|
-
tabular,
|
|
5642
|
-
"\\end{rcases}"
|
|
5643
|
-
]);
|
|
5644
|
-
if (columns || open !== "." || close !== ".") {
|
|
5645
|
-
return joinLatex([
|
|
5646
|
-
"\\left",
|
|
5647
|
-
DELIMITERS_SHORTHAND[open] ?? open,
|
|
5648
|
-
"\\begin{array}",
|
|
5649
|
-
`{${columns}}`,
|
|
5650
|
-
tabular,
|
|
5651
|
-
"\\end{array}",
|
|
5652
|
-
"\\right",
|
|
5653
|
-
DELIMITERS_SHORTHAND[close] ?? close
|
|
5654
|
-
]);
|
|
5655
|
-
}
|
|
5656
|
-
return joinLatex(["\\begin{matrix}", tabular, "\\end{matrix}"]);
|
|
5657
|
-
}
|
|
5658
|
-
},
|
|
5659
5578
|
{
|
|
5660
5579
|
name: "Domain",
|
|
5661
5580
|
serialize: (serializer, expr) => {
|
|
@@ -6296,11 +6215,11 @@ var DELIMITERS_SHORTHAND = {
|
|
|
6296
6215
|
"(": "(",
|
|
6297
6216
|
")": ")",
|
|
6298
6217
|
"[": "\\lbrack",
|
|
6218
|
+
"]": "\\rbrack",
|
|
6299
6219
|
"\u27E6": "\\llbrack",
|
|
6300
6220
|
// U+27E6 MATHEMATICAL LEFT WHITE SQUARE BRACKET
|
|
6301
6221
|
"\u27E7": "\\rrbrack",
|
|
6302
6222
|
// U+27E7 MATHEMATICAL RIGHT WHITE SQUARE BRACKET
|
|
6303
|
-
"]": "\\rbrack",
|
|
6304
6223
|
"{": "\\lbrace",
|
|
6305
6224
|
"}": "\\rbrace",
|
|
6306
6225
|
"<": "\\langle",
|
|
@@ -6347,6 +6266,16 @@ function parseAssign(parser, lhs) {
|
|
|
6347
6266
|
}
|
|
6348
6267
|
return ["Assign", fn, ["Function", rhs2, ...args ?? []]];
|
|
6349
6268
|
}
|
|
6269
|
+
if (typeof head(lhs) === "string") {
|
|
6270
|
+
const fn = head(lhs);
|
|
6271
|
+
const args = ops(lhs) ?? [];
|
|
6272
|
+
const rhs2 = parser.parseExpression({ minPrec: 0 });
|
|
6273
|
+
if (rhs2 === null) {
|
|
6274
|
+
parser.index = index;
|
|
6275
|
+
return null;
|
|
6276
|
+
}
|
|
6277
|
+
return ["Assign", fn, ["Function", rhs2, ...args]];
|
|
6278
|
+
}
|
|
6350
6279
|
if (!symbol(lhs))
|
|
6351
6280
|
return null;
|
|
6352
6281
|
const rhs = parser.parseExpression({ minPrec: 0 });
|
|
@@ -6757,6 +6686,111 @@ var DEFINITIONS_INEQUALITIES = [
|
|
|
6757
6686
|
}
|
|
6758
6687
|
];
|
|
6759
6688
|
|
|
6689
|
+
// src/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.ts
|
|
6690
|
+
var DEFINITIONS_LINEAR_ALGEBRA = [
|
|
6691
|
+
// The first argument is the matrix data.
|
|
6692
|
+
// The second, optional, argument are the delimiters.
|
|
6693
|
+
// The third, optional, argument is the column specification.
|
|
6694
|
+
{
|
|
6695
|
+
name: "Matrix",
|
|
6696
|
+
// https://ctan.math.illinois.edu/macros/latex/required/tools/array.pdf
|
|
6697
|
+
serialize: (serializer, expr) => {
|
|
6698
|
+
const body = op(expr, 1);
|
|
6699
|
+
const delims = op(expr, 2) ?? "()";
|
|
6700
|
+
let columns = "";
|
|
6701
|
+
if (op(expr, 3) !== null) {
|
|
6702
|
+
const colsSpec = stringValue(op(expr, 3)) ?? "";
|
|
6703
|
+
for (const c of colsSpec) {
|
|
6704
|
+
if (c === "<")
|
|
6705
|
+
columns += "l";
|
|
6706
|
+
else if (c === ">")
|
|
6707
|
+
columns += "r";
|
|
6708
|
+
else if (c === "=")
|
|
6709
|
+
columns += "c";
|
|
6710
|
+
else if (c === "|")
|
|
6711
|
+
columns += "|";
|
|
6712
|
+
else if (c === ":")
|
|
6713
|
+
columns += ":";
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6716
|
+
let [open, close] = ["", ""];
|
|
6717
|
+
if (typeof delims === "string" && delims.length === 2)
|
|
6718
|
+
[open, close] = delims;
|
|
6719
|
+
const rows = [];
|
|
6720
|
+
for (const row of ops(body) ?? []) {
|
|
6721
|
+
const cells = [];
|
|
6722
|
+
for (const cell of ops(row) ?? [])
|
|
6723
|
+
cells.push(serializer.serialize(cell));
|
|
6724
|
+
rows.push(cells.join(" & "));
|
|
6725
|
+
}
|
|
6726
|
+
const tabular = rows.join("\\\\\n");
|
|
6727
|
+
const optColumns = columns.length > 0 ? `[${columns}]` : "";
|
|
6728
|
+
if (open === "(" && close === ")")
|
|
6729
|
+
return joinLatex([
|
|
6730
|
+
"\\begin{pmatrix}",
|
|
6731
|
+
optColumns,
|
|
6732
|
+
tabular,
|
|
6733
|
+
"\\end{pmatrix}"
|
|
6734
|
+
]);
|
|
6735
|
+
if (open === "[" && close === "]")
|
|
6736
|
+
return joinLatex([
|
|
6737
|
+
"\\begin{bmatrix}",
|
|
6738
|
+
optColumns,
|
|
6739
|
+
tabular,
|
|
6740
|
+
"\\end{bmatrix}"
|
|
6741
|
+
]);
|
|
6742
|
+
if (open === "{" && close === "}")
|
|
6743
|
+
return joinLatex([
|
|
6744
|
+
"\\begin{Bmatrix}",
|
|
6745
|
+
optColumns,
|
|
6746
|
+
tabular,
|
|
6747
|
+
"\\end{Bmatrix}"
|
|
6748
|
+
]);
|
|
6749
|
+
if (open === "|" && close === "|")
|
|
6750
|
+
return joinLatex([
|
|
6751
|
+
"\\begin{vmatrix}",
|
|
6752
|
+
optColumns,
|
|
6753
|
+
tabular,
|
|
6754
|
+
"\\end{vmatrix}"
|
|
6755
|
+
]);
|
|
6756
|
+
if (open === "\u2016" && close === "\u2016")
|
|
6757
|
+
return joinLatex([
|
|
6758
|
+
"\\begin{Vmatrix}",
|
|
6759
|
+
optColumns,
|
|
6760
|
+
tabular,
|
|
6761
|
+
"\\end{Vmatrix}"
|
|
6762
|
+
]);
|
|
6763
|
+
if (open === "{" && close === ".")
|
|
6764
|
+
return joinLatex([
|
|
6765
|
+
"\\begin{dcases}",
|
|
6766
|
+
optColumns,
|
|
6767
|
+
tabular,
|
|
6768
|
+
"\\end{dcases}"
|
|
6769
|
+
]);
|
|
6770
|
+
if (open === "." && close === "}")
|
|
6771
|
+
return joinLatex([
|
|
6772
|
+
"\\begin{rcases}",
|
|
6773
|
+
optColumns,
|
|
6774
|
+
tabular,
|
|
6775
|
+
"\\end{rcases}"
|
|
6776
|
+
]);
|
|
6777
|
+
if (columns || open !== "." || close !== ".") {
|
|
6778
|
+
return joinLatex([
|
|
6779
|
+
"\\left",
|
|
6780
|
+
DELIMITERS_SHORTHAND[open] ?? open,
|
|
6781
|
+
"\\begin{array}",
|
|
6782
|
+
`{${columns}}`,
|
|
6783
|
+
tabular,
|
|
6784
|
+
"\\end{array}",
|
|
6785
|
+
"\\right",
|
|
6786
|
+
DELIMITERS_SHORTHAND[close] ?? close
|
|
6787
|
+
]);
|
|
6788
|
+
}
|
|
6789
|
+
return joinLatex(["\\begin{matrix}", tabular, "\\end{matrix}"]);
|
|
6790
|
+
}
|
|
6791
|
+
}
|
|
6792
|
+
];
|
|
6793
|
+
|
|
6760
6794
|
// src/compute-engine/latex-syntax/dictionary/definitions-logic.ts
|
|
6761
6795
|
var DEFINITIONS_LOGIC = [
|
|
6762
6796
|
// Constants
|
|
@@ -8798,25 +8832,26 @@ function isValidEntry(entry, onError) {
|
|
|
8798
8832
|
return true;
|
|
8799
8833
|
}
|
|
8800
8834
|
var DEFAULT_LATEX_DICTIONARY = {
|
|
8801
|
-
algebra: DEFINITIONS_ALGEBRA,
|
|
8802
|
-
arithmetic: DEFINITIONS_ARITHMETIC,
|
|
8803
|
-
calculus: DEFINITIONS_CALCULUS,
|
|
8804
|
-
complex: DEFINITIONS_COMPLEX,
|
|
8805
|
-
core: DEFINITIONS_CORE,
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8835
|
+
"algebra": DEFINITIONS_ALGEBRA,
|
|
8836
|
+
"arithmetic": DEFINITIONS_ARITHMETIC,
|
|
8837
|
+
"calculus": DEFINITIONS_CALCULUS,
|
|
8838
|
+
"complex": DEFINITIONS_COMPLEX,
|
|
8839
|
+
"core": DEFINITIONS_CORE,
|
|
8840
|
+
"linear-algebra": DEFINITIONS_LINEAR_ALGEBRA,
|
|
8841
|
+
"logic": DEFINITIONS_LOGIC,
|
|
8842
|
+
"relop": DEFINITIONS_INEQUALITIES,
|
|
8843
|
+
"other": DEFINITIONS_OTHERS,
|
|
8844
|
+
"physics": [
|
|
8810
8845
|
{
|
|
8811
8846
|
name: "mu0",
|
|
8812
8847
|
kind: "symbol",
|
|
8813
8848
|
latexTrigger: "\\mu_0"
|
|
8814
8849
|
}
|
|
8815
8850
|
],
|
|
8816
|
-
sets: DEFINITIONS_SETS,
|
|
8817
|
-
statistics: DEFINITIONS_STATISTICS,
|
|
8818
|
-
symbols: DEFINITIONS_SYMBOLS,
|
|
8819
|
-
trigonometry: DEFINITIONS_TRIGONOMETRY
|
|
8851
|
+
"sets": DEFINITIONS_SETS,
|
|
8852
|
+
"statistics": DEFINITIONS_STATISTICS,
|
|
8853
|
+
"symbols": DEFINITIONS_SYMBOLS,
|
|
8854
|
+
"trigonometry": DEFINITIONS_TRIGONOMETRY
|
|
8820
8855
|
};
|
|
8821
8856
|
|
|
8822
8857
|
// src/compute-engine/latex-syntax/parse-identifier.ts
|
|
@@ -15138,7 +15173,7 @@ function compileExpr(h, args, prec, target) {
|
|
|
15138
15173
|
}
|
|
15139
15174
|
if (h === "Function") {
|
|
15140
15175
|
const params = args.slice(1).map((x) => x.symbol);
|
|
15141
|
-
return `((${params.join(", ")}) => ${compile(args[0], {
|
|
15176
|
+
return `((${params.join(", ")}) => ${compile(args[0].canonical, {
|
|
15142
15177
|
...target,
|
|
15143
15178
|
var: (id) => params.includes(id) ? id : target.var(id)
|
|
15144
15179
|
})})`;
|
|
@@ -23142,18 +23177,6 @@ var CORE_LIBRARY = [
|
|
|
23142
23177
|
}
|
|
23143
23178
|
}
|
|
23144
23179
|
},
|
|
23145
|
-
Matrix: {
|
|
23146
|
-
complexity: 9e3,
|
|
23147
|
-
hold: "all",
|
|
23148
|
-
signature: {
|
|
23149
|
-
params: ["Lists"],
|
|
23150
|
-
optParams: ["Strings", "Strings"],
|
|
23151
|
-
result: "Lists",
|
|
23152
|
-
canonical: canonicalMatrix,
|
|
23153
|
-
evaluate: (_ce, ops2) => ops2[0].evaluate(),
|
|
23154
|
-
N: (_ce, ops2) => ops2[0].N()
|
|
23155
|
-
}
|
|
23156
|
-
},
|
|
23157
23180
|
Error: {
|
|
23158
23181
|
/**
|
|
23159
23182
|
* - The first argument is either a string or an `["ErrorCode"]`
|
|
@@ -23305,7 +23328,7 @@ var CORE_LIBRARY = [
|
|
|
23305
23328
|
if (!op12.symbol)
|
|
23306
23329
|
return null;
|
|
23307
23330
|
const op22 = args[1];
|
|
23308
|
-
return ce._fn("Assign", [
|
|
23331
|
+
return ce._fn("Assign", [op12, op22]);
|
|
23309
23332
|
},
|
|
23310
23333
|
evaluate: (ce, ops2) => {
|
|
23311
23334
|
const op12 = ops2[0];
|
|
@@ -23644,6 +23667,24 @@ function canonicalInvisibleOperator(ce, ops2) {
|
|
|
23644
23667
|
return ce._fn("Multiply", flattenOps(ops2, "Multiply"));
|
|
23645
23668
|
return ce._fn("Tuple", ops2);
|
|
23646
23669
|
}
|
|
23670
|
+
|
|
23671
|
+
// src/compute-engine/library/linear-algebra.ts
|
|
23672
|
+
var LINEAR_ALGEBRA_LIBRARY = [
|
|
23673
|
+
{
|
|
23674
|
+
Matrix: {
|
|
23675
|
+
complexity: 9e3,
|
|
23676
|
+
hold: "all",
|
|
23677
|
+
signature: {
|
|
23678
|
+
params: ["Lists"],
|
|
23679
|
+
optParams: ["Strings", "Strings"],
|
|
23680
|
+
result: "Lists",
|
|
23681
|
+
canonical: canonicalMatrix,
|
|
23682
|
+
evaluate: (_ce, ops2) => ops2[0].evaluate(),
|
|
23683
|
+
N: (_ce, ops2) => ops2[0].N()
|
|
23684
|
+
}
|
|
23685
|
+
}
|
|
23686
|
+
}
|
|
23687
|
+
];
|
|
23647
23688
|
function canonicalMatrix(ce, ops2) {
|
|
23648
23689
|
if (ops2.length === 0)
|
|
23649
23690
|
return ce._fn("Matrix", []);
|
|
@@ -23659,9 +23700,6 @@ function canonicalMatrix(ce, ops2) {
|
|
|
23659
23700
|
return ce._fn("Matrix", [body]);
|
|
23660
23701
|
}
|
|
23661
23702
|
|
|
23662
|
-
// src/compute-engine/library/linear-algebra.ts
|
|
23663
|
-
var LINEAR_ALGEBRA_LIBRARY = [];
|
|
23664
|
-
|
|
23665
23703
|
// src/compute-engine/library/logic.ts
|
|
23666
23704
|
var LOGIC_LIBRARY = {
|
|
23667
23705
|
True: { wikidata: "Q16751793", domain: "Booleans", constant: true },
|
|
@@ -28783,10 +28821,10 @@ function isFunctionValue(value) {
|
|
|
28783
28821
|
}
|
|
28784
28822
|
|
|
28785
28823
|
// src/compute-engine.ts
|
|
28786
|
-
var version = "0.20.
|
|
28824
|
+
var version = "0.20.1";
|
|
28787
28825
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
28788
28826
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
28789
|
-
version: "0.20.
|
|
28827
|
+
version: "0.20.1"
|
|
28790
28828
|
};
|
|
28791
28829
|
export {
|
|
28792
28830
|
ADDITION_PRECEDENCE,
|