@cortex-js/compute-engine 0.52.0 → 0.52.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/README.md +2 -4
- package/dist/compute-engine.esm.js +607 -68
- package/dist/compute-engine.min.esm.js +103 -75
- package/dist/compute-engine.min.umd.js +104 -76
- package/dist/compute-engine.umd.js +607 -68
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.umd.js +2 -2
- package/dist/math-json.umd.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/configuration-change.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/type/ast-nodes.d.ts +1 -1
- package/dist/types/common/type/boxed-type.d.ts +1 -1
- package/dist/types/common/type/lexer.d.ts +1 -1
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/parser.d.ts +1 -1
- package/dist/types/common/type/primitive.d.ts +1 -1
- package/dist/types/common/type/reduce.d.ts +1 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/type-builder.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +1 -1
- package/dist/types/common/type/utils.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 +2 -2
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/ascii-math.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-function.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +3 -2
- package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.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.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/constants.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/init-lazy-refs.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/predicates.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/stochastic-equal.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/type-guards.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/compilation/base-compiler.d.ts +1 -1
- package/dist/types/compute-engine/compilation/compile-expression.d.ts +1 -1
- package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/gpu-target.d.ts +2 -2
- package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/interval-wgsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/python-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/types.d.ts +1 -1
- package/dist/types/compute-engine/compilation/wgsl-target.d.ts +1 -1
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/engine-assumptions.d.ts +1 -1
- package/dist/types/compute-engine/engine-cache.d.ts +1 -1
- package/dist/types/compute-engine/engine-common-symbols.d.ts +1 -1
- package/dist/types/compute-engine/engine-compilation-targets.d.ts +1 -1
- package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +1 -1
- package/dist/types/compute-engine/engine-declarations.d.ts +1 -1
- package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +1 -1
- package/dist/types/compute-engine/engine-extension-contracts.d.ts +1 -1
- package/dist/types/compute-engine/engine-latex-dictionary-state.d.ts +1 -1
- package/dist/types/compute-engine/engine-library-bootstrap.d.ts +1 -1
- package/dist/types/compute-engine/engine-numeric-configuration.d.ts +1 -1
- package/dist/types/compute-engine/engine-parse-entrypoint.d.ts +1 -1
- package/dist/types/compute-engine/engine-runtime-state.d.ts +1 -1
- package/dist/types/compute-engine/engine-scope.d.ts +1 -1
- package/dist/types/compute-engine/engine-sequences.d.ts +1 -1
- package/dist/types/compute-engine/engine-simplification-rules.d.ts +1 -1
- package/dist/types/compute-engine/engine-startup-coordinator.d.ts +1 -1
- package/dist/types/compute-engine/engine-type-resolver.d.ts +1 -1
- package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +1 -1
- package/dist/types/compute-engine/free-functions.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/global-types.d.ts +1 -1
- package/dist/types/compute-engine/index.d.ts +1 -1
- package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
- package/dist/types/compute-engine/interval/elementary.d.ts +1 -1
- package/dist/types/compute-engine/interval/index.d.ts +1 -1
- package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
- package/dist/types/compute-engine/interval/types.d.ts +1 -1
- package/dist/types/compute-engine/interval/util.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-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-units.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-dms.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/latex-syntax/types.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/utils.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/colors.d.ts +1 -1
- package/dist/types/compute-engine/library/combinatorics.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/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/quantity-arithmetic.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/type-handlers.d.ts +1 -1
- package/dist/types/compute-engine/library/unit-data.d.ts +1 -1
- package/dist/types/compute-engine/library/units.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.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/numerics/special-functions.d.ts +1 -1
- package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/numerics/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/unit-data.d.ts +1 -1
- package/dist/types/compute-engine/oeis.d.ts +1 -1
- package/dist/types/compute-engine/sequence.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/logic-utils.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-factorial.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
- package/dist/types/compute-engine/types-definitions.d.ts +1 -1
- package/dist/types/compute-engine/types-engine.d.ts +1 -1
- package/dist/types/compute-engine/types-evaluation.d.ts +1 -1
- package/dist/types/compute-engine/types-expression.d.ts +9 -3
- package/dist/types/compute-engine/types-kernel-evaluation.d.ts +1 -1
- package/dist/types/compute-engine/types-kernel-serialization.d.ts +1 -1
- package/dist/types/compute-engine/types-serialization.d.ts +1 -1
- package/dist/types/compute-engine/types.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +1 -1
- package/dist/types/math-json/symbols.d.ts +1 -1
- package/dist/types/math-json/types.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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.52.
|
|
1
|
+
/** Compute Engine 0.52.1 */
|
|
2
2
|
|
|
3
3
|
// node_modules/complex-esm/dist/src/complex.js
|
|
4
4
|
var cosh = Math.cosh || function(x) {
|
|
@@ -8131,6 +8131,58 @@ function splitGraphemes(string) {
|
|
|
8131
8131
|
}
|
|
8132
8132
|
|
|
8133
8133
|
// src/compute-engine/latex-syntax/tokenizer.ts
|
|
8134
|
+
var UNICODE_SUPERSCRIPT_MAP = {
|
|
8135
|
+
"\u2070": "0",
|
|
8136
|
+
// ⁰
|
|
8137
|
+
"\xB9": "1",
|
|
8138
|
+
// ¹
|
|
8139
|
+
"\xB2": "2",
|
|
8140
|
+
// ²
|
|
8141
|
+
"\xB3": "3",
|
|
8142
|
+
// ³
|
|
8143
|
+
"\u2074": "4",
|
|
8144
|
+
// ⁴
|
|
8145
|
+
"\u2075": "5",
|
|
8146
|
+
// ⁵
|
|
8147
|
+
"\u2076": "6",
|
|
8148
|
+
// ⁶
|
|
8149
|
+
"\u2077": "7",
|
|
8150
|
+
// ⁷
|
|
8151
|
+
"\u2078": "8",
|
|
8152
|
+
// ⁸
|
|
8153
|
+
"\u2079": "9",
|
|
8154
|
+
// ⁹
|
|
8155
|
+
"\u207B": "-",
|
|
8156
|
+
// ⁻
|
|
8157
|
+
"\u2071": "i",
|
|
8158
|
+
// ⁱ
|
|
8159
|
+
"\u207F": "n"
|
|
8160
|
+
// ⁿ
|
|
8161
|
+
};
|
|
8162
|
+
var UNICODE_SUBSCRIPT_MAP = {
|
|
8163
|
+
"\u2080": "0",
|
|
8164
|
+
// ₀
|
|
8165
|
+
"\u2081": "1",
|
|
8166
|
+
// ₁
|
|
8167
|
+
"\u2082": "2",
|
|
8168
|
+
// ₂
|
|
8169
|
+
"\u2083": "3",
|
|
8170
|
+
// ₃
|
|
8171
|
+
"\u2084": "4",
|
|
8172
|
+
// ₄
|
|
8173
|
+
"\u2085": "5",
|
|
8174
|
+
// ₅
|
|
8175
|
+
"\u2086": "6",
|
|
8176
|
+
// ₆
|
|
8177
|
+
"\u2087": "7",
|
|
8178
|
+
// ₇
|
|
8179
|
+
"\u2088": "8",
|
|
8180
|
+
// ₈
|
|
8181
|
+
"\u2089": "9",
|
|
8182
|
+
// ₉
|
|
8183
|
+
"\u208B": "-"
|
|
8184
|
+
// ₋
|
|
8185
|
+
};
|
|
8134
8186
|
var Tokenizer = class {
|
|
8135
8187
|
s;
|
|
8136
8188
|
pos;
|
|
@@ -8138,6 +8190,14 @@ var Tokenizer = class {
|
|
|
8138
8190
|
constructor(s) {
|
|
8139
8191
|
s = s.replace(/[\u200E\u200F\u2066-\u2069\u202A-\u202E]/g, "");
|
|
8140
8192
|
s = s.replace(/\u2212/g, "-");
|
|
8193
|
+
s = s.replace(/[⁰¹²³⁴⁵⁶⁷⁸⁹⁻ⁱⁿ]+/g, (m) => {
|
|
8194
|
+
const digits = Array.from(m).map((c) => UNICODE_SUPERSCRIPT_MAP[c]).join("");
|
|
8195
|
+
return `^{${digits}}`;
|
|
8196
|
+
});
|
|
8197
|
+
s = s.replace(/[₀₁₂₃₄₅₆₇₈₉₋]+/g, (m) => {
|
|
8198
|
+
const digits = Array.from(m).map((c) => UNICODE_SUBSCRIPT_MAP[c]).join("");
|
|
8199
|
+
return `_{${digits}}`;
|
|
8200
|
+
});
|
|
8141
8201
|
this.s = splitGraphemes(s);
|
|
8142
8202
|
this.pos = 0;
|
|
8143
8203
|
}
|
|
@@ -9335,6 +9395,7 @@ function parseSequence(parser, terminator, lhs, prec, sep) {
|
|
|
9335
9395
|
result.push("Nothing");
|
|
9336
9396
|
parser.skipSpace();
|
|
9337
9397
|
}
|
|
9398
|
+
parser.skipVisualSpace();
|
|
9338
9399
|
if (parser.atTerminator(terminator)) {
|
|
9339
9400
|
result.push("Nothing");
|
|
9340
9401
|
} else {
|
|
@@ -9345,6 +9406,7 @@ function parseSequence(parser, terminator, lhs, prec, sep) {
|
|
|
9345
9406
|
if (!done) {
|
|
9346
9407
|
parser.skipSpace();
|
|
9347
9408
|
done = !parser.match(sep);
|
|
9409
|
+
if (!done) parser.skipVisualSpace();
|
|
9348
9410
|
}
|
|
9349
9411
|
}
|
|
9350
9412
|
return result;
|
|
@@ -9914,7 +9976,7 @@ var DEFINITIONS_CORE = [
|
|
|
9914
9976
|
const args = operands(expr);
|
|
9915
9977
|
if (!args || args.length === 0) return "";
|
|
9916
9978
|
const parts = args.filter((a) => operator(a) !== "Declare").map((a) => serializer.serialize(a));
|
|
9917
|
-
return parts.join("
|
|
9979
|
+
return parts.join("; ");
|
|
9918
9980
|
}
|
|
9919
9981
|
},
|
|
9920
9982
|
// Serializer for If expressions (separate from the parser entry
|
|
@@ -10701,6 +10763,7 @@ var DELIMITERS_SHORTHAND = {
|
|
|
10701
10763
|
// '⎿': '', // U+23BF RIGHT PARENTHESIS LOWER HOOK
|
|
10702
10764
|
};
|
|
10703
10765
|
function parseAssign(parser, lhs, until) {
|
|
10766
|
+
const isLocalBindingContext = (until?.minPrec ?? 0) >= 19;
|
|
10704
10767
|
const lhsSymbol = symbol(lhs);
|
|
10705
10768
|
if (lhsSymbol && lhsSymbol.includes("_")) {
|
|
10706
10769
|
const underscoreIndex = lhsSymbol.indexOf("_");
|
|
@@ -10708,7 +10771,10 @@ function parseAssign(parser, lhs, until) {
|
|
|
10708
10771
|
const subscriptStr = lhsSymbol.substring(underscoreIndex + 1);
|
|
10709
10772
|
const subscriptNum = parseInt(subscriptStr, 10);
|
|
10710
10773
|
const subscript = !isNaN(subscriptNum) && String(subscriptNum) === subscriptStr ? subscriptNum : subscriptStr;
|
|
10711
|
-
|
|
10774
|
+
const simpleSequenceLikeSubscript = subscript !== "" && (typeof subscript === "number" || typeof subscript === "string" && subscript.length === 1);
|
|
10775
|
+
if (parser.getSymbolType(baseName).matches("indexed_collection") || !isLocalBindingContext && simpleSequenceLikeSubscript) {
|
|
10776
|
+
lhs = ["Subscript", baseName, subscript];
|
|
10777
|
+
}
|
|
10712
10778
|
}
|
|
10713
10779
|
if (operator(lhs) === "InvisibleOperator" && nops(lhs) === 2 && operator(operand(lhs, 2)) === "Delimiter") {
|
|
10714
10780
|
const fn2 = symbol(operand(lhs, 1));
|
|
@@ -10723,7 +10789,15 @@ function parseAssign(parser, lhs, until) {
|
|
|
10723
10789
|
}
|
|
10724
10790
|
if (operator(lhs) === "Subscript" && symbol(operand(lhs, 1))) {
|
|
10725
10791
|
const fn2 = symbol(operand(lhs, 1));
|
|
10726
|
-
if (!fn2)
|
|
10792
|
+
if (!parser.getSymbolType(fn2).matches("indexed_collection")) {
|
|
10793
|
+
const sub4 = operand(lhs, 2);
|
|
10794
|
+
const subStr = (sub4 !== null && typeof sub4 === "string" ? sub4 : void 0) ?? (sub4 !== null && typeof sub4 === "number" ? String(sub4) : void 0);
|
|
10795
|
+
if (subStr && isLocalBindingContext) {
|
|
10796
|
+
const rhs3 = parser.parseExpression({ ...until ?? {}, minPrec: 20 });
|
|
10797
|
+
if (rhs3 === null) return null;
|
|
10798
|
+
return ["Assign", fn2 + "_" + subStr, rhs3];
|
|
10799
|
+
}
|
|
10800
|
+
}
|
|
10727
10801
|
const rhs2 = parser.parseExpression({ ...until ?? {}, minPrec: 20 });
|
|
10728
10802
|
if (rhs2 === null) return null;
|
|
10729
10803
|
const sub3 = operand(lhs, 2);
|
|
@@ -10804,6 +10878,7 @@ function matchTextKeyword(parser, keyword) {
|
|
|
10804
10878
|
}
|
|
10805
10879
|
function matchKeyword(parser, keyword) {
|
|
10806
10880
|
const start = parser.index;
|
|
10881
|
+
parser.skipVisualSpace();
|
|
10807
10882
|
if (parser.match("\\text")) {
|
|
10808
10883
|
if (matchTextKeyword(parser, keyword)) return true;
|
|
10809
10884
|
parser.index = start;
|
|
@@ -10821,18 +10896,21 @@ function peekKeyword(parser, keyword) {
|
|
|
10821
10896
|
return result;
|
|
10822
10897
|
}
|
|
10823
10898
|
function parseIfExpression(parser, until) {
|
|
10899
|
+
parser.skipVisualSpace();
|
|
10824
10900
|
const condition = parser.parseExpression({
|
|
10825
10901
|
minPrec: 0,
|
|
10826
10902
|
condition: (p) => peekKeyword(p, "then")
|
|
10827
10903
|
});
|
|
10828
10904
|
if (condition === null) return null;
|
|
10829
10905
|
if (!matchKeyword(parser, "then")) return null;
|
|
10906
|
+
parser.skipVisualSpace();
|
|
10830
10907
|
const trueBranch = parser.parseExpression({
|
|
10831
10908
|
minPrec: 0,
|
|
10832
10909
|
condition: (p) => peekKeyword(p, "else")
|
|
10833
10910
|
});
|
|
10834
10911
|
if (trueBranch === null) return null;
|
|
10835
10912
|
if (!matchKeyword(parser, "else")) return null;
|
|
10913
|
+
parser.skipVisualSpace();
|
|
10836
10914
|
const falseBranch = parser.parseExpression(until) ?? "Nothing";
|
|
10837
10915
|
return ["If", condition, trueBranch, falseBranch];
|
|
10838
10916
|
}
|
|
@@ -10887,11 +10965,12 @@ function parseWhereExpression(parser, lhs, until) {
|
|
|
10887
10965
|
if (bindings.length === 0) return null;
|
|
10888
10966
|
const block = [];
|
|
10889
10967
|
for (const b of bindings) {
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
block.push(
|
|
10968
|
+
const normalized = normalizeLocalAssign(b);
|
|
10969
|
+
if (operator(normalized) === "Assign") {
|
|
10970
|
+
block.push(["Declare", operand(normalized, 1)]);
|
|
10971
|
+
block.push(normalized);
|
|
10893
10972
|
} else {
|
|
10894
|
-
block.push(
|
|
10973
|
+
block.push(normalized);
|
|
10895
10974
|
}
|
|
10896
10975
|
}
|
|
10897
10976
|
block.push(lhs);
|
|
@@ -10900,13 +10979,25 @@ function parseWhereExpression(parser, lhs, until) {
|
|
|
10900
10979
|
function buildBlockFromSequence(seq) {
|
|
10901
10980
|
const block = [];
|
|
10902
10981
|
for (const s of seq) {
|
|
10903
|
-
|
|
10904
|
-
|
|
10982
|
+
const normalized = normalizeLocalAssign(s);
|
|
10983
|
+
if (operator(normalized) === "Assign") {
|
|
10984
|
+
block.push(["Declare", operand(normalized, 1)]);
|
|
10905
10985
|
}
|
|
10906
|
-
block.push(
|
|
10986
|
+
block.push(normalized);
|
|
10907
10987
|
}
|
|
10908
10988
|
return ["Block", ...block];
|
|
10909
10989
|
}
|
|
10990
|
+
function normalizeLocalAssign(expr) {
|
|
10991
|
+
if (operator(expr) !== "Assign") return expr;
|
|
10992
|
+
const lhs = operand(expr, 1);
|
|
10993
|
+
if (operator(lhs) !== "Subscript") return expr;
|
|
10994
|
+
const base = symbol(operand(lhs, 1));
|
|
10995
|
+
if (!base) return expr;
|
|
10996
|
+
const sub3 = operand(lhs, 2);
|
|
10997
|
+
const subStr = (typeof sub3 === "string" ? sub3 : void 0) ?? (typeof sub3 === "number" ? String(sub3) : void 0);
|
|
10998
|
+
if (!subStr) return expr;
|
|
10999
|
+
return ["Assign", `${base}_${subStr}`, operand(expr, 2) ?? "Nothing"];
|
|
11000
|
+
}
|
|
10910
11001
|
function parseAt(...close) {
|
|
10911
11002
|
return (parser, lhs) => {
|
|
10912
11003
|
if (!symbol(lhs) && operator(lhs) !== "List") return null;
|
|
@@ -12363,14 +12454,14 @@ var _BoxedExpression = class __BoxedExpression {
|
|
|
12363
12454
|
get numeratorDenominator() {
|
|
12364
12455
|
return [this, this.engine.One];
|
|
12365
12456
|
}
|
|
12366
|
-
is(other) {
|
|
12457
|
+
is(other, tolerance) {
|
|
12367
12458
|
if (this.isSame(other)) return true;
|
|
12368
|
-
if (
|
|
12459
|
+
if (this.freeVariables.length > 0) return false;
|
|
12369
12460
|
if (typeof other === "number" || typeof other === "bigint") {
|
|
12370
12461
|
const n = this.N();
|
|
12371
12462
|
if (n === this) return false;
|
|
12372
12463
|
if (!isNumber(n)) return false;
|
|
12373
|
-
const tol = this.engine.tolerance;
|
|
12464
|
+
const tol = tolerance ?? this.engine.tolerance;
|
|
12374
12465
|
const nRe = n.re;
|
|
12375
12466
|
const nIm = n.im;
|
|
12376
12467
|
if (typeof other === "number") {
|
|
@@ -12381,11 +12472,11 @@ var _BoxedExpression = class __BoxedExpression {
|
|
|
12381
12472
|
return Math.abs(nRe - Number(other)) <= tol && Math.abs(nIm) <= tol;
|
|
12382
12473
|
}
|
|
12383
12474
|
if (other instanceof __BoxedExpression) {
|
|
12384
|
-
if (
|
|
12475
|
+
if (other.freeVariables.length > 0) return false;
|
|
12385
12476
|
const nThis = this.N();
|
|
12386
12477
|
const nOther = other.N();
|
|
12387
12478
|
if (!isNumber(nThis) || !isNumber(nOther)) return false;
|
|
12388
|
-
const tol = this.engine.tolerance;
|
|
12479
|
+
const tol = tolerance ?? this.engine.tolerance;
|
|
12389
12480
|
return Math.abs(nThis.re - nOther.re) <= tol && Math.abs(nThis.im - nOther.im) <= tol;
|
|
12390
12481
|
}
|
|
12391
12482
|
return false;
|
|
@@ -12766,7 +12857,6 @@ var _BoxedValueDefinition = class {
|
|
|
12766
12857
|
if (def.neq) this.neq = def.neq;
|
|
12767
12858
|
if (def.cmp) this.cmp = def.cmp;
|
|
12768
12859
|
if (def.collection) {
|
|
12769
|
-
if (name === "Take") debugger;
|
|
12770
12860
|
this.collection = defaultCollectionHandlers(def.collection);
|
|
12771
12861
|
}
|
|
12772
12862
|
if (def.subscriptEvaluate) this.subscriptEvaluate = def.subscriptEvaluate;
|
|
@@ -12946,7 +13036,8 @@ function getImaginaryFactor(expr) {
|
|
|
12946
13036
|
if (expr.re === 0) return ce.number(expr.im);
|
|
12947
13037
|
if (isFunction2(expr, "Negate")) return getImaginaryFactor(expr.op1)?.neg();
|
|
12948
13038
|
if (isFunction2(expr, "Complex")) {
|
|
12949
|
-
if (expr.op1.isSame(0) && !isNaN(expr.op2.re))
|
|
13039
|
+
if (expr.op1.isSame(0) && !isNaN(expr.op2.re))
|
|
13040
|
+
return ce.number(expr.op2.re);
|
|
12950
13041
|
return void 0;
|
|
12951
13042
|
}
|
|
12952
13043
|
if (isFunction2(expr, "Multiply") && expr.nops === 2) {
|
|
@@ -23414,6 +23505,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
23414
23505
|
// Functions
|
|
23415
23506
|
//
|
|
23416
23507
|
Abs: {
|
|
23508
|
+
description: "Absolute value (magnitude) of a number.",
|
|
23417
23509
|
wikidata: "Q3317982",
|
|
23418
23510
|
// magnitude 'Q120812 (for reals)
|
|
23419
23511
|
broadcastable: true,
|
|
@@ -23429,6 +23521,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
23429
23521
|
evaluate: ([x]) => evaluateAbs(x)
|
|
23430
23522
|
},
|
|
23431
23523
|
Add: {
|
|
23524
|
+
description: "Sum of two or more values.",
|
|
23432
23525
|
wikidata: "Q32043",
|
|
23433
23526
|
associative: true,
|
|
23434
23527
|
commutative: true,
|
|
@@ -23483,6 +23576,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
23483
23576
|
)
|
|
23484
23577
|
},
|
|
23485
23578
|
Chop: {
|
|
23579
|
+
description: "Replace tiny numeric values with zero.",
|
|
23486
23580
|
associative: true,
|
|
23487
23581
|
broadcastable: true,
|
|
23488
23582
|
idempotent: true,
|
|
@@ -23506,6 +23600,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
23506
23600
|
// complexity: 500,
|
|
23507
23601
|
// },
|
|
23508
23602
|
Divide: {
|
|
23603
|
+
description: "Quotient of a numerator and one or more denominators.",
|
|
23509
23604
|
wikidata: "Q1226939",
|
|
23510
23605
|
complexity: 2500,
|
|
23511
23606
|
broadcastable: true,
|
|
@@ -23554,6 +23649,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
23554
23649
|
}
|
|
23555
23650
|
},
|
|
23556
23651
|
Exp: {
|
|
23652
|
+
description: "Natural exponential function: e^x.",
|
|
23557
23653
|
wikidata: "Q168698",
|
|
23558
23654
|
broadcastable: true,
|
|
23559
23655
|
complexity: 3500,
|
|
@@ -23663,6 +23759,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
23663
23759
|
}
|
|
23664
23760
|
},
|
|
23665
23761
|
Floor: {
|
|
23762
|
+
description: "Rounds a number down to the nearest integer.",
|
|
23666
23763
|
wikidata: "Q56860783",
|
|
23667
23764
|
complexity: 1250,
|
|
23668
23765
|
broadcastable: true,
|
|
@@ -23702,6 +23799,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
23702
23799
|
)
|
|
23703
23800
|
},
|
|
23704
23801
|
Gamma: {
|
|
23802
|
+
description: "Gamma function, extending factorial to complex numbers.",
|
|
23705
23803
|
wikidata: "Q190573",
|
|
23706
23804
|
complexity: 8e3,
|
|
23707
23805
|
broadcastable: true,
|
|
@@ -23716,6 +23814,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
23716
23814
|
) : void 0
|
|
23717
23815
|
},
|
|
23718
23816
|
GammaLn: {
|
|
23817
|
+
description: "Natural logarithm of the gamma function.",
|
|
23719
23818
|
complexity: 8e3,
|
|
23720
23819
|
broadcastable: true,
|
|
23721
23820
|
signature: "(number) -> number",
|
|
@@ -23987,6 +24086,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
23987
24086
|
)
|
|
23988
24087
|
},
|
|
23989
24088
|
Multiply: {
|
|
24089
|
+
description: "Product of two or more values.",
|
|
23990
24090
|
wikidata: "Q40276",
|
|
23991
24091
|
associative: true,
|
|
23992
24092
|
commutative: true,
|
|
@@ -24083,6 +24183,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
24083
24183
|
evaluate: ([x, y], { engine }) => engine.tuple(x.add(y.neg()), x.add(y))
|
|
24084
24184
|
},
|
|
24085
24185
|
Power: {
|
|
24186
|
+
description: "Exponentiation: raise a base to a power.",
|
|
24086
24187
|
wikidata: "Q33456",
|
|
24087
24188
|
broadcastable: true,
|
|
24088
24189
|
complexity: 3500,
|
|
@@ -24141,6 +24242,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
24141
24242
|
// https://proofwiki.org/wiki/Square_Root_of_Prime_is_Irrational
|
|
24142
24243
|
},
|
|
24143
24244
|
Rational: {
|
|
24245
|
+
description: "Construct a rational number from a numerator and denominator.",
|
|
24144
24246
|
complexity: 2400,
|
|
24145
24247
|
signature: "(number, integer?) -> rational",
|
|
24146
24248
|
sgn: ([n]) => n.sgn,
|
|
@@ -24177,6 +24279,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
24177
24279
|
}
|
|
24178
24280
|
},
|
|
24179
24281
|
Root: {
|
|
24282
|
+
description: "n-th root of a value.",
|
|
24180
24283
|
complexity: 3200,
|
|
24181
24284
|
broadcastable: true,
|
|
24182
24285
|
signature: "(number, number) -> number",
|
|
@@ -24237,6 +24340,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
24237
24340
|
)
|
|
24238
24341
|
},
|
|
24239
24342
|
Round: {
|
|
24343
|
+
description: "Rounds a number to the nearest integer.",
|
|
24240
24344
|
complexity: 1250,
|
|
24241
24345
|
broadcastable: true,
|
|
24242
24346
|
signature: "(number) -> integer",
|
|
@@ -24266,6 +24370,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
24266
24370
|
},
|
|
24267
24371
|
/** Heaviside step function: H(x) = 0 for x < 0, 1/2 for x = 0, 1 for x > 0 */
|
|
24268
24372
|
Heaviside: {
|
|
24373
|
+
description: "Heaviside step function.",
|
|
24269
24374
|
complexity: 1200,
|
|
24270
24375
|
broadcastable: true,
|
|
24271
24376
|
signature: "(number) -> real",
|
|
@@ -24279,6 +24384,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
24279
24384
|
}
|
|
24280
24385
|
},
|
|
24281
24386
|
Sign: {
|
|
24387
|
+
description: "Sign of a number: -1, 0, or 1.",
|
|
24282
24388
|
complexity: 1200,
|
|
24283
24389
|
broadcastable: true,
|
|
24284
24390
|
signature: "(number) -> integer",
|
|
@@ -24350,6 +24456,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
24350
24456
|
// https://proofwiki.org/wiki/Square_Root_of_Prime_is_Irrational
|
|
24351
24457
|
},
|
|
24352
24458
|
Square: {
|
|
24459
|
+
description: "Square of a number: x^2.",
|
|
24353
24460
|
wikidata: "Q3075175",
|
|
24354
24461
|
complexity: 3100,
|
|
24355
24462
|
broadcastable: true,
|
|
@@ -24372,6 +24479,7 @@ var ARITHMETIC_LIBRARY = [
|
|
|
24372
24479
|
}
|
|
24373
24480
|
},
|
|
24374
24481
|
Subtract: {
|
|
24482
|
+
description: "Difference between two or more values.",
|
|
24375
24483
|
wikidata: "Q40754",
|
|
24376
24484
|
complexity: 1350,
|
|
24377
24485
|
broadcastable: true,
|
|
@@ -24546,9 +24654,11 @@ var ARITHMETIC_LIBRARY = [
|
|
|
24546
24654
|
},
|
|
24547
24655
|
{
|
|
24548
24656
|
PreIncrement: {
|
|
24657
|
+
description: "Increment a number by one.",
|
|
24549
24658
|
signature: "(number) -> number"
|
|
24550
24659
|
},
|
|
24551
24660
|
PreDecrement: {
|
|
24661
|
+
description: "Decrement a number by one.",
|
|
24552
24662
|
signature: "(number) -> number"
|
|
24553
24663
|
}
|
|
24554
24664
|
},
|
|
@@ -29090,6 +29200,7 @@ var CALCULUS_LIBRARY = [
|
|
|
29090
29200
|
// with values of the order that can be either fractional or negative
|
|
29091
29201
|
//
|
|
29092
29202
|
Derivative: {
|
|
29203
|
+
description: "Derivative operator that returns a derivative function.",
|
|
29093
29204
|
broadcastable: false,
|
|
29094
29205
|
lazy: true,
|
|
29095
29206
|
signature: "(function, order:number?) -> function",
|
|
@@ -29117,6 +29228,7 @@ var CALCULUS_LIBRARY = [
|
|
|
29117
29228
|
//
|
|
29118
29229
|
// This is equivalent to `["Apply", ["Derivative", "Sin"], "x"]`
|
|
29119
29230
|
D: {
|
|
29231
|
+
description: "Symbolic partial derivative with respect to one or more variables.",
|
|
29120
29232
|
broadcastable: false,
|
|
29121
29233
|
scoped: true,
|
|
29122
29234
|
lazy: true,
|
|
@@ -29161,6 +29273,7 @@ var CALCULUS_LIBRARY = [
|
|
|
29161
29273
|
},
|
|
29162
29274
|
// Evaluate a numerical approximation of a derivative at point x
|
|
29163
29275
|
ND: {
|
|
29276
|
+
description: "Numerical derivative evaluated at a point.",
|
|
29164
29277
|
broadcastable: false,
|
|
29165
29278
|
lazy: true,
|
|
29166
29279
|
signature: "(function, at:number) -> number",
|
|
@@ -29179,6 +29292,7 @@ var CALCULUS_LIBRARY = [
|
|
|
29179
29292
|
}
|
|
29180
29293
|
},
|
|
29181
29294
|
Integrate: {
|
|
29295
|
+
description: "Symbolic integral with optional bounds.",
|
|
29182
29296
|
wikidata: "Q80091",
|
|
29183
29297
|
broadcastable: false,
|
|
29184
29298
|
lazy: true,
|
|
@@ -29259,6 +29373,7 @@ var CALCULUS_LIBRARY = [
|
|
|
29259
29373
|
}
|
|
29260
29374
|
},
|
|
29261
29375
|
NIntegrate: {
|
|
29376
|
+
description: "Numerical approximation of a definite integral.",
|
|
29262
29377
|
broadcastable: false,
|
|
29263
29378
|
lazy: true,
|
|
29264
29379
|
signature: "(function, limits:(tuple|symbol)?) -> number",
|
|
@@ -33103,6 +33218,7 @@ var COLORS_LIBRARY = {
|
|
|
33103
33218
|
var CONTROL_STRUCTURES_LIBRARY = [
|
|
33104
33219
|
{
|
|
33105
33220
|
Block: {
|
|
33221
|
+
description: "Evaluate a sequence of expressions in a local scope.",
|
|
33106
33222
|
lazy: true,
|
|
33107
33223
|
scoped: true,
|
|
33108
33224
|
signature: "(unknown*) -> unknown",
|
|
@@ -33116,6 +33232,7 @@ var CONTROL_STRUCTURES_LIBRARY = [
|
|
|
33116
33232
|
// A condition expression tests for one or more conditions of an expression
|
|
33117
33233
|
// ['Condition', value, "positive"]
|
|
33118
33234
|
Condition: {
|
|
33235
|
+
description: "Test whether a value satisfies one or more conditions.",
|
|
33119
33236
|
lazy: true,
|
|
33120
33237
|
signature: "(value, symbol) -> boolean",
|
|
33121
33238
|
evaluate: ([value, conds], { engine }) => {
|
|
@@ -33130,6 +33247,7 @@ var CONTROL_STRUCTURES_LIBRARY = [
|
|
|
33130
33247
|
}
|
|
33131
33248
|
},
|
|
33132
33249
|
If: {
|
|
33250
|
+
description: "Conditional branch: evaluate one of two expressions.",
|
|
33133
33251
|
lazy: true,
|
|
33134
33252
|
signature: "(expression, expression, expression) -> any",
|
|
33135
33253
|
type: ([_cond, ifTrue, ifFalse]) => widen(ifTrue.type.type, ifFalse.type.type),
|
|
@@ -33146,6 +33264,7 @@ var CONTROL_STRUCTURES_LIBRARY = [
|
|
|
33146
33264
|
}
|
|
33147
33265
|
},
|
|
33148
33266
|
Loop: {
|
|
33267
|
+
description: "Evaluate a body expression over elements of a collection.",
|
|
33149
33268
|
lazy: true,
|
|
33150
33269
|
signature: "(body:expression, collection:expression) -> any",
|
|
33151
33270
|
type: ([body]) => body.type,
|
|
@@ -33153,6 +33272,7 @@ var CONTROL_STRUCTURES_LIBRARY = [
|
|
|
33153
33272
|
evaluateAsync: async ([body, collection], { engine: ce, signal }) => runAsync(runLoop(body, collection, ce), ce._timeRemaining, signal)
|
|
33154
33273
|
},
|
|
33155
33274
|
Which: {
|
|
33275
|
+
description: "Return the value for the first condition that is true.",
|
|
33156
33276
|
lazy: true,
|
|
33157
33277
|
signature: "(expression+) -> unknown",
|
|
33158
33278
|
type: (args) => {
|
|
@@ -33170,7 +33290,11 @@ var CONTROL_STRUCTURES_LIBRARY = [
|
|
|
33170
33290
|
},
|
|
33171
33291
|
evaluate: (ops, options) => evaluateWhich(ops, options)
|
|
33172
33292
|
},
|
|
33173
|
-
FixedPoint: {
|
|
33293
|
+
FixedPoint: {
|
|
33294
|
+
description: "Iterate a function until a fixed point is reached.",
|
|
33295
|
+
lazy: true,
|
|
33296
|
+
signature: "(any) -> unknown"
|
|
33297
|
+
}
|
|
33174
33298
|
}
|
|
33175
33299
|
];
|
|
33176
33300
|
function evaluateWhich(args, options) {
|
|
@@ -33250,6 +33374,7 @@ function* runLoop(body, collection, ce) {
|
|
|
33250
33374
|
var COMBINATORICS_LIBRARY = [
|
|
33251
33375
|
{
|
|
33252
33376
|
Choose: {
|
|
33377
|
+
description: "Binomial coefficient: number of ways to choose k items from n.",
|
|
33253
33378
|
complexity: 1200,
|
|
33254
33379
|
signature: "(n:number, m:number) -> number",
|
|
33255
33380
|
type: () => "finite_integer",
|
|
@@ -33507,6 +33632,7 @@ function binomial(n, k) {
|
|
|
33507
33632
|
var COMPLEX_LIBRARY = [
|
|
33508
33633
|
{
|
|
33509
33634
|
Real: {
|
|
33635
|
+
description: "Real part of a complex number.",
|
|
33510
33636
|
// @todo: could be extended to return an expression, i.e. ["Real", ["Add", "x", ["Complex", 0, 5]]] -> "x". Not for any operator, but at least for Add, Multiply, Negate, etc.
|
|
33511
33637
|
broadcastable: true,
|
|
33512
33638
|
complexity: 1200,
|
|
@@ -33526,6 +33652,7 @@ var COMPLEX_LIBRARY = [
|
|
|
33526
33652
|
}
|
|
33527
33653
|
},
|
|
33528
33654
|
Imaginary: {
|
|
33655
|
+
description: "Imaginary part of a complex number.",
|
|
33529
33656
|
broadcastable: true,
|
|
33530
33657
|
complexity: 1200,
|
|
33531
33658
|
signature: "(number) -> real",
|
|
@@ -33544,6 +33671,7 @@ var COMPLEX_LIBRARY = [
|
|
|
33544
33671
|
}
|
|
33545
33672
|
},
|
|
33546
33673
|
Argument: {
|
|
33674
|
+
description: "Complex argument (phase angle) of a number.",
|
|
33547
33675
|
broadcastable: true,
|
|
33548
33676
|
complexity: 1200,
|
|
33549
33677
|
signature: "(number) -> real",
|
|
@@ -33558,6 +33686,7 @@ var COMPLEX_LIBRARY = [
|
|
|
33558
33686
|
},
|
|
33559
33687
|
// For Abs (magnitude) see src/compute-engine/library/processAbs
|
|
33560
33688
|
AbsArg: {
|
|
33689
|
+
description: "Tuple of magnitude and argument of a complex number.",
|
|
33561
33690
|
broadcastable: true,
|
|
33562
33691
|
complexity: 1200,
|
|
33563
33692
|
signature: "(number) -> tuple<real, real>",
|
|
@@ -33570,6 +33699,7 @@ var COMPLEX_LIBRARY = [
|
|
|
33570
33699
|
}
|
|
33571
33700
|
},
|
|
33572
33701
|
Conjugate: {
|
|
33702
|
+
description: "Complex conjugate of a number.",
|
|
33573
33703
|
broadcastable: true,
|
|
33574
33704
|
complexity: 1200,
|
|
33575
33705
|
signature: "(number) -> number",
|
|
@@ -33583,6 +33713,7 @@ var COMPLEX_LIBRARY = [
|
|
|
33583
33713
|
}
|
|
33584
33714
|
},
|
|
33585
33715
|
ComplexRoots: {
|
|
33716
|
+
description: "All n-th complex roots of a number.",
|
|
33586
33717
|
broadcastable: true,
|
|
33587
33718
|
complexity: 1200,
|
|
33588
33719
|
signature: "(number, number) -> list<number>",
|
|
@@ -34534,6 +34665,7 @@ var CORE_LIBRARY = [
|
|
|
34534
34665
|
*
|
|
34535
34666
|
*/
|
|
34536
34667
|
InvisibleOperator: {
|
|
34668
|
+
description: "Implicit operator used for juxtapositions such as function application or multiplication.",
|
|
34537
34669
|
complexity: 9e3,
|
|
34538
34670
|
lazy: true,
|
|
34539
34671
|
signature: "function",
|
|
@@ -34548,6 +34680,7 @@ var CORE_LIBRARY = [
|
|
|
34548
34680
|
},
|
|
34549
34681
|
/** See above for a theory of operations */
|
|
34550
34682
|
Sequence: {
|
|
34683
|
+
description: "Ordered sequence of expressions.",
|
|
34551
34684
|
lazy: true,
|
|
34552
34685
|
signature: "function",
|
|
34553
34686
|
type: (args) => {
|
|
@@ -34564,6 +34697,7 @@ var CORE_LIBRARY = [
|
|
|
34564
34697
|
},
|
|
34565
34698
|
/** See above for a theory of operations */
|
|
34566
34699
|
Delimiter: {
|
|
34700
|
+
description: "Group expressions with explicit delimiters.",
|
|
34567
34701
|
// Use to represent groups of expressions.
|
|
34568
34702
|
// Named after https://en.wikipedia.org/wiki/Delimiter
|
|
34569
34703
|
complexity: 9e3,
|
|
@@ -34606,6 +34740,7 @@ var CORE_LIBRARY = [
|
|
|
34606
34740
|
}
|
|
34607
34741
|
},
|
|
34608
34742
|
Error: {
|
|
34743
|
+
description: "Represent an error expression.",
|
|
34609
34744
|
/**
|
|
34610
34745
|
* - The first argument is either a string or an `["ErrorCode"]`
|
|
34611
34746
|
* expression indicating the nature of the error.
|
|
@@ -34620,6 +34755,7 @@ var CORE_LIBRARY = [
|
|
|
34620
34755
|
canonical: (args, { engine: ce }) => ce._fn("Error", args)
|
|
34621
34756
|
},
|
|
34622
34757
|
ErrorCode: {
|
|
34758
|
+
description: "Structured error code with optional arguments.",
|
|
34623
34759
|
complexity: 500,
|
|
34624
34760
|
lazy: true,
|
|
34625
34761
|
signature: "(string, any*) -> error",
|
|
@@ -34676,6 +34812,7 @@ var CORE_LIBRARY = [
|
|
|
34676
34812
|
}
|
|
34677
34813
|
},
|
|
34678
34814
|
HorizontalSpacing: {
|
|
34815
|
+
description: "Horizontal spacing annotation.",
|
|
34679
34816
|
signature: "(number) -> nothing",
|
|
34680
34817
|
canonical: (args, { engine: ce }) => {
|
|
34681
34818
|
if (args.length === 2) return args[0].canonical;
|
|
@@ -34683,6 +34820,7 @@ var CORE_LIBRARY = [
|
|
|
34683
34820
|
}
|
|
34684
34821
|
},
|
|
34685
34822
|
Annotated: {
|
|
34823
|
+
description: "Attach metadata or style annotations to an expression.",
|
|
34686
34824
|
signature: "(expression, dictionary) -> expression",
|
|
34687
34825
|
type: ([x]) => x.type,
|
|
34688
34826
|
complexity: 9e3,
|
|
@@ -34884,6 +35022,7 @@ var CORE_LIBRARY = [
|
|
|
34884
35022
|
evaluate: (ops, { engine: ce }) => ce.symbol(ce.assume(ops[0]))
|
|
34885
35023
|
},
|
|
34886
35024
|
Declare: {
|
|
35025
|
+
description: "Declare a symbol and optionally assign a type.",
|
|
34887
35026
|
lazy: true,
|
|
34888
35027
|
pure: false,
|
|
34889
35028
|
signature: "(symbol, type: string | symbol) -> nothing",
|
|
@@ -34914,11 +35053,13 @@ var CORE_LIBRARY = [
|
|
|
34914
35053
|
},
|
|
34915
35054
|
/** Return the type of an expression */
|
|
34916
35055
|
Type: {
|
|
35056
|
+
description: "Return the type of an expression as a string.",
|
|
34917
35057
|
lazy: true,
|
|
34918
35058
|
signature: "(any) -> string",
|
|
34919
35059
|
evaluate: ([x], { engine: ce }) => ce.string(x.type.toString() ?? "unknown")
|
|
34920
35060
|
},
|
|
34921
35061
|
Evaluate: {
|
|
35062
|
+
description: "Evaluate an expression.",
|
|
34922
35063
|
lazy: true,
|
|
34923
35064
|
signature: "(any) -> unknown",
|
|
34924
35065
|
type: ([x]) => x.type,
|
|
@@ -34928,6 +35069,7 @@ var CORE_LIBRARY = [
|
|
|
34928
35069
|
// Evaluate an expression at a specific point, potentially symbolically
|
|
34929
35070
|
// i.e. it's the `f|_{a}` notation
|
|
34930
35071
|
EvaluateAt: {
|
|
35072
|
+
description: "Evaluate a function at one point or between two bounds.",
|
|
34931
35073
|
lazy: true,
|
|
34932
35074
|
signature: "(function, lower:number, upper:number) -> number",
|
|
34933
35075
|
type: ([x]) => functionResult(x.type.type) ?? "number",
|
|
@@ -34955,6 +35097,7 @@ var CORE_LIBRARY = [
|
|
|
34955
35097
|
}
|
|
34956
35098
|
},
|
|
34957
35099
|
BuiltinFunction: {
|
|
35100
|
+
description: "Return a built-in function symbol by name.",
|
|
34958
35101
|
complexity: 9876,
|
|
34959
35102
|
lazy: true,
|
|
34960
35103
|
signature: "(symbol | string) -> symbol",
|
|
@@ -34974,6 +35117,7 @@ var CORE_LIBRARY = [
|
|
|
34974
35117
|
}
|
|
34975
35118
|
},
|
|
34976
35119
|
Rule: {
|
|
35120
|
+
description: "Pattern replacement rule.",
|
|
34977
35121
|
lazy: true,
|
|
34978
35122
|
signature: "(match: expression, replace: expression, predicate: function?) -> expression",
|
|
34979
35123
|
evaluate: ([_match, _replace, _predicate], { engine: _ce }) => {
|
|
@@ -34981,6 +35125,7 @@ var CORE_LIBRARY = [
|
|
|
34981
35125
|
}
|
|
34982
35126
|
},
|
|
34983
35127
|
Simplify: {
|
|
35128
|
+
description: "Simplify an expression.",
|
|
34984
35129
|
lazy: true,
|
|
34985
35130
|
signature: "(any) -> expression",
|
|
34986
35131
|
canonical: (ops, { engine: ce }) => ce._fn("Simplify", checkArity(ce, ops, 1)),
|
|
@@ -35049,6 +35194,7 @@ var CORE_LIBRARY = [
|
|
|
35049
35194
|
},
|
|
35050
35195
|
// @todo: need review
|
|
35051
35196
|
Signature: {
|
|
35197
|
+
description: "Return the signature string of an operator.",
|
|
35052
35198
|
lazy: true,
|
|
35053
35199
|
signature: "(symbol) -> string | nothing",
|
|
35054
35200
|
evaluate: ([x], { engine: ce }) => {
|
|
@@ -35057,6 +35203,7 @@ var CORE_LIBRARY = [
|
|
|
35057
35203
|
}
|
|
35058
35204
|
},
|
|
35059
35205
|
Subscript: {
|
|
35206
|
+
description: "Subscript notation for indexing or compound symbols.",
|
|
35060
35207
|
/**
|
|
35061
35208
|
* The `Subscript` function can take several forms:
|
|
35062
35209
|
*
|
|
@@ -35227,6 +35374,7 @@ var CORE_LIBRARY = [
|
|
|
35227
35374
|
//
|
|
35228
35375
|
{
|
|
35229
35376
|
Wildcard: {
|
|
35377
|
+
description: "Single-expression pattern wildcard.",
|
|
35230
35378
|
signature: "(symbol) -> symbol",
|
|
35231
35379
|
canonical: (args, { engine: ce }) => {
|
|
35232
35380
|
if (args.length !== 1) return ce.symbol("_");
|
|
@@ -35234,6 +35382,7 @@ var CORE_LIBRARY = [
|
|
|
35234
35382
|
}
|
|
35235
35383
|
},
|
|
35236
35384
|
WildcardSequence: {
|
|
35385
|
+
description: "Pattern wildcard matching one or more expressions.",
|
|
35237
35386
|
signature: "(symbol) -> symbol",
|
|
35238
35387
|
canonical: (args, { engine: ce }) => {
|
|
35239
35388
|
if (args.length !== 1) return ce.symbol("__");
|
|
@@ -35241,6 +35390,7 @@ var CORE_LIBRARY = [
|
|
|
35241
35390
|
}
|
|
35242
35391
|
},
|
|
35243
35392
|
WildcardOptionalSequence: {
|
|
35393
|
+
description: "Pattern wildcard matching zero or more expressions.",
|
|
35244
35394
|
signature: "(symbol) -> symbol",
|
|
35245
35395
|
canonical: (args, { engine: ce }) => {
|
|
35246
35396
|
if (args.length !== 1) return ce.symbol("___");
|
|
@@ -35461,6 +35611,7 @@ var CORE_LIBRARY = [
|
|
|
35461
35611
|
},
|
|
35462
35612
|
{
|
|
35463
35613
|
RandomExpression: {
|
|
35614
|
+
description: "Generate a random expression.",
|
|
35464
35615
|
signature: "() -> expression",
|
|
35465
35616
|
evaluate: (_ops, { engine }) => engine.box(randomExpression())
|
|
35466
35617
|
}
|
|
@@ -35471,6 +35622,7 @@ var CORE_LIBRARY = [
|
|
|
35471
35622
|
var LINEAR_ALGEBRA_LIBRARY = [
|
|
35472
35623
|
{
|
|
35473
35624
|
Matrix: {
|
|
35625
|
+
description: "Matrix constructor and canonicalizer.",
|
|
35474
35626
|
complexity: 9e3,
|
|
35475
35627
|
lazy: true,
|
|
35476
35628
|
signature: "(matrix, string?, string?) -> matrix",
|
|
@@ -35481,6 +35633,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35481
35633
|
// Vector is a specialized collection to represent a column vector.
|
|
35482
35634
|
// ["Vector", a, b, c] is a shorthand for ["List", ["List", a], ["List", b], ["List", c]]
|
|
35483
35635
|
Vector: {
|
|
35636
|
+
description: "Construct a column vector.",
|
|
35484
35637
|
complexity: 9e3,
|
|
35485
35638
|
lazy: true,
|
|
35486
35639
|
signature: "(number+) -> vector",
|
|
@@ -35501,6 +35654,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35501
35654
|
{
|
|
35502
35655
|
// Corresponds to monadic Shape `⍴` in APL
|
|
35503
35656
|
Shape: {
|
|
35657
|
+
description: "Return the shape tuple of an expression.",
|
|
35504
35658
|
complexity: 8200,
|
|
35505
35659
|
signature: "(value) -> tuple",
|
|
35506
35660
|
evaluate: ([xs], { engine: ce }) => ce.tuple(...xs.shape)
|
|
@@ -35515,6 +35669,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35515
35669
|
// Corresponds to ArrayReshape in Mathematica
|
|
35516
35670
|
// and dyadic Shape `⍴` in APL
|
|
35517
35671
|
Reshape: {
|
|
35672
|
+
description: "Reshape a tensor or collection to a target shape.",
|
|
35518
35673
|
complexity: 8200,
|
|
35519
35674
|
signature: "(value, tuple) -> value",
|
|
35520
35675
|
type: ([value, shape]) => {
|
|
@@ -35559,6 +35714,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35559
35714
|
// Corresponds to Ravel `,` in APL
|
|
35560
35715
|
// Also Enlist `∊``⍋` in APL
|
|
35561
35716
|
Flatten: {
|
|
35717
|
+
description: "Flatten a tensor or collection into a list.",
|
|
35562
35718
|
complexity: 8200,
|
|
35563
35719
|
signature: "(value) -> list",
|
|
35564
35720
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -35578,6 +35734,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35578
35734
|
// Ex: Transpose([[a, b, c], [1, 2, 3]]) = [[a, 1], [b, 2], [c, 3]]
|
|
35579
35735
|
// For rank > 2: Default swaps last two axes, or specify explicit axes
|
|
35580
35736
|
Transpose: {
|
|
35737
|
+
description: "Transpose a matrix or swap two tensor axes.",
|
|
35581
35738
|
complexity: 8200,
|
|
35582
35739
|
signature: "(value, axis1: integer?, axis2: integer?) -> value",
|
|
35583
35740
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -35606,6 +35763,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35606
35763
|
// Conjugate transpose (Hermitian adjoint): transpose + complex conjugate
|
|
35607
35764
|
// For rank > 2: Default swaps last two axes, or specify explicit axes
|
|
35608
35765
|
ConjugateTranspose: {
|
|
35766
|
+
description: "Conjugate transpose (Hermitian adjoint) of a matrix or tensor.",
|
|
35609
35767
|
complexity: 8200,
|
|
35610
35768
|
signature: "(value, axis1: integer?, axis2: integer?) -> value",
|
|
35611
35769
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -35635,6 +35793,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35635
35793
|
}
|
|
35636
35794
|
},
|
|
35637
35795
|
Determinant: {
|
|
35796
|
+
description: "Determinant of a square matrix.",
|
|
35638
35797
|
complexity: 8200,
|
|
35639
35798
|
signature: "(matrix) -> number",
|
|
35640
35799
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -35654,6 +35813,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35654
35813
|
}
|
|
35655
35814
|
},
|
|
35656
35815
|
Inverse: {
|
|
35816
|
+
description: "Multiplicative inverse of a square matrix.",
|
|
35657
35817
|
complexity: 8200,
|
|
35658
35818
|
signature: "(matrix) -> matrix",
|
|
35659
35819
|
type: ([matrix]) => matrix.type,
|
|
@@ -35674,6 +35834,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35674
35834
|
}
|
|
35675
35835
|
},
|
|
35676
35836
|
PseudoInverse: {
|
|
35837
|
+
description: "Moore-Penrose pseudoinverse of a matrix.",
|
|
35677
35838
|
complexity: 8200,
|
|
35678
35839
|
signature: "(matrix) -> matrix",
|
|
35679
35840
|
evaluate: ([matrix], { engine: ce }) => {
|
|
@@ -35698,6 +35859,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35698
35859
|
// },
|
|
35699
35860
|
// },
|
|
35700
35861
|
AdjugateMatrix: {
|
|
35862
|
+
description: "Adjugate (classical adjoint) of a square matrix.",
|
|
35701
35863
|
complexity: 8200,
|
|
35702
35864
|
signature: "(matrix) -> matrix",
|
|
35703
35865
|
evaluate: (ops) => {
|
|
@@ -35722,6 +35884,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35722
35884
|
// For rank > 2 tensors: returns tensor of traces over last two axes (batch trace)
|
|
35723
35885
|
// Optional axis1, axis2 to specify which axes to trace over (default: last two)
|
|
35724
35886
|
Trace: {
|
|
35887
|
+
description: "Trace of a matrix or pair of tensor axes.",
|
|
35725
35888
|
complexity: 8200,
|
|
35726
35889
|
signature: "(value, axis1: integer?, axis2: integer?) -> value",
|
|
35727
35890
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -35830,6 +35993,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35830
35993
|
// Matrix multiplication: A (m×n) × B (n×p) → result (m×p)
|
|
35831
35994
|
// Handles matrix × matrix, matrix × vector, vector × matrix
|
|
35832
35995
|
MatrixMultiply: {
|
|
35996
|
+
description: "Matrix and vector multiplication.",
|
|
35833
35997
|
complexity: 8300,
|
|
35834
35998
|
signature: "(matrix|vector, matrix|vector) -> matrix|vector",
|
|
35835
35999
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -35915,6 +36079,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35915
36079
|
// 2. Extract the diagonal from a matrix as a vector
|
|
35916
36080
|
// 3. For a scalar, return the scalar (or could create 1x1 matrix)
|
|
35917
36081
|
Diagonal: {
|
|
36082
|
+
description: "Extract a matrix diagonal or build a diagonal matrix.",
|
|
35918
36083
|
complexity: 8200,
|
|
35919
36084
|
signature: "(value) -> value",
|
|
35920
36085
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -35951,6 +36116,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35951
36116
|
},
|
|
35952
36117
|
// Creates an n×n identity matrix
|
|
35953
36118
|
IdentityMatrix: {
|
|
36119
|
+
description: "n-by-n identity matrix.",
|
|
35954
36120
|
complexity: 8100,
|
|
35955
36121
|
signature: "(integer) -> matrix",
|
|
35956
36122
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -35971,6 +36137,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35971
36137
|
},
|
|
35972
36138
|
// Creates an m×n matrix of zeros
|
|
35973
36139
|
ZeroMatrix: {
|
|
36140
|
+
description: "Matrix filled with zeros.",
|
|
35974
36141
|
complexity: 8100,
|
|
35975
36142
|
signature: "(integer, integer?) -> matrix",
|
|
35976
36143
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -35998,6 +36165,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
35998
36165
|
},
|
|
35999
36166
|
// Creates an m×n matrix of ones
|
|
36000
36167
|
OnesMatrix: {
|
|
36168
|
+
description: "Matrix filled with ones.",
|
|
36001
36169
|
complexity: 8100,
|
|
36002
36170
|
signature: "(integer, integer?) -> matrix",
|
|
36003
36171
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -36032,6 +36200,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
36032
36200
|
// For matrices:
|
|
36033
36201
|
// - Frobenius (default): √(ΣΣ|aij|²)
|
|
36034
36202
|
Norm: {
|
|
36203
|
+
description: "Vector or matrix norm.",
|
|
36035
36204
|
complexity: 8200,
|
|
36036
36205
|
signature: "(value, number|string?) -> number",
|
|
36037
36206
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -36153,6 +36322,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
36153
36322
|
// For 2×2 matrices: uses characteristic polynomial (symbolic)
|
|
36154
36323
|
// For larger matrices: uses QR algorithm (numeric)
|
|
36155
36324
|
Eigenvalues: {
|
|
36325
|
+
description: "Eigenvalues of a square matrix.",
|
|
36156
36326
|
complexity: 8500,
|
|
36157
36327
|
signature: "(matrix) -> list",
|
|
36158
36328
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -36198,6 +36368,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
36198
36368
|
// Compute the eigenvectors of a square matrix
|
|
36199
36369
|
// Returns a list of eigenvectors (as column vectors)
|
|
36200
36370
|
Eigenvectors: {
|
|
36371
|
+
description: "Eigenvectors of a square matrix.",
|
|
36201
36372
|
complexity: 8600,
|
|
36202
36373
|
signature: "(matrix) -> list",
|
|
36203
36374
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -36228,6 +36399,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
36228
36399
|
// Compute both eigenvalues and eigenvectors
|
|
36229
36400
|
// Returns a tuple: [eigenvalues, eigenvectors]
|
|
36230
36401
|
Eigen: {
|
|
36402
|
+
description: "Eigenvalue-eigenvector decomposition of a square matrix.",
|
|
36231
36403
|
complexity: 8700,
|
|
36232
36404
|
signature: "(matrix) -> tuple",
|
|
36233
36405
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -36247,6 +36419,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
36247
36419
|
// LU Decomposition: A = LU (or PA = LU with pivoting)
|
|
36248
36420
|
// Returns [L, U] for no pivoting or [P, L, U] with pivoting
|
|
36249
36421
|
LUDecomposition: {
|
|
36422
|
+
description: "LU decomposition of a square matrix.",
|
|
36250
36423
|
complexity: 8600,
|
|
36251
36424
|
signature: "(matrix) -> tuple",
|
|
36252
36425
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -36266,6 +36439,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
36266
36439
|
// QR Decomposition: A = QR
|
|
36267
36440
|
// Returns [Q, R] where Q is orthogonal and R is upper triangular
|
|
36268
36441
|
QRDecomposition: {
|
|
36442
|
+
description: "QR decomposition of a matrix.",
|
|
36269
36443
|
complexity: 8600,
|
|
36270
36444
|
signature: "(matrix) -> tuple",
|
|
36271
36445
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -36285,6 +36459,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
36285
36459
|
// Cholesky Decomposition: A = LL^T (for positive definite matrices)
|
|
36286
36460
|
// Returns L (lower triangular matrix)
|
|
36287
36461
|
CholeskyDecomposition: {
|
|
36462
|
+
description: "Cholesky decomposition of a positive-definite matrix.",
|
|
36288
36463
|
complexity: 8600,
|
|
36289
36464
|
signature: "(matrix) -> matrix",
|
|
36290
36465
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -36301,6 +36476,7 @@ var LINEAR_ALGEBRA_LIBRARY = [
|
|
|
36301
36476
|
// Singular Value Decomposition: A = UΣV^T
|
|
36302
36477
|
// Returns [U, Σ, V] where U and V are orthogonal, Σ is diagonal
|
|
36303
36478
|
SVD: {
|
|
36479
|
+
description: "Singular value decomposition of a matrix.",
|
|
36304
36480
|
complexity: 8700,
|
|
36305
36481
|
signature: "(matrix) -> tuple",
|
|
36306
36482
|
evaluate: (ops, { engine: ce }) => {
|
|
@@ -39758,6 +39934,7 @@ function bigInterquartileRange(values) {
|
|
|
39758
39934
|
var STATISTICS_LIBRARY = [
|
|
39759
39935
|
{
|
|
39760
39936
|
Erf: {
|
|
39937
|
+
description: "Gauss error function",
|
|
39761
39938
|
complexity: 7500,
|
|
39762
39939
|
signature: "(number) -> number",
|
|
39763
39940
|
type: () => "finite_real",
|
|
@@ -39768,6 +39945,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39768
39945
|
}
|
|
39769
39946
|
},
|
|
39770
39947
|
Erfc: {
|
|
39948
|
+
description: "Complementary error function: 1 - Erf(x)",
|
|
39771
39949
|
complexity: 7500,
|
|
39772
39950
|
signature: "(number) -> number",
|
|
39773
39951
|
type: () => "finite_real",
|
|
@@ -39778,6 +39956,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39778
39956
|
}
|
|
39779
39957
|
},
|
|
39780
39958
|
ErfInv: {
|
|
39959
|
+
description: "Inverse of the error function",
|
|
39781
39960
|
complexity: 7500,
|
|
39782
39961
|
signature: "(number) -> number",
|
|
39783
39962
|
type: () => "finite_real",
|
|
@@ -39796,7 +39975,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39796
39975
|
broadcastable: false,
|
|
39797
39976
|
signature: "((collection|number)+) -> number",
|
|
39798
39977
|
type: () => "finite_real",
|
|
39799
|
-
description: "
|
|
39978
|
+
description: "Arithmetic mean of a collection of numbers.",
|
|
39800
39979
|
evaluate: (ops, { engine, numericApproximation: numericApproximation2 }) => {
|
|
39801
39980
|
const xs = ops.map((x) => x.evaluate({ numericApproximation: numericApproximation2 }));
|
|
39802
39981
|
return engine.number(
|
|
@@ -39809,7 +39988,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39809
39988
|
broadcastable: false,
|
|
39810
39989
|
signature: "((collection|number)+) -> number",
|
|
39811
39990
|
type: () => "finite_real",
|
|
39812
|
-
description: "
|
|
39991
|
+
description: "Median of a collection of numbers.",
|
|
39813
39992
|
examples: ["Mode([1, 2, 2, 3]) // Returns 2"],
|
|
39814
39993
|
evaluate: (ops, { engine, numericApproximation: numericApproximation2 }) => {
|
|
39815
39994
|
const xs = ops.map((x) => x.evaluate({ numericApproximation: numericApproximation2 }));
|
|
@@ -39819,6 +39998,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39819
39998
|
}
|
|
39820
39999
|
},
|
|
39821
40000
|
Variance: {
|
|
40001
|
+
description: "Sample variance of a collection of numbers.",
|
|
39822
40002
|
complexity: 1200,
|
|
39823
40003
|
broadcastable: false,
|
|
39824
40004
|
signature: "((collection|number)+) -> number",
|
|
@@ -39831,6 +40011,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39831
40011
|
}
|
|
39832
40012
|
},
|
|
39833
40013
|
PopulationVariance: {
|
|
40014
|
+
description: "Population variance of a collection of numbers.",
|
|
39834
40015
|
complexity: 1200,
|
|
39835
40016
|
broadcastable: false,
|
|
39836
40017
|
signature: "((collection|number)+) -> number",
|
|
@@ -39878,6 +40059,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39878
40059
|
}
|
|
39879
40060
|
},
|
|
39880
40061
|
Kurtosis: {
|
|
40062
|
+
description: "Kurtosis of a collection of numbers.",
|
|
39881
40063
|
complexity: 1200,
|
|
39882
40064
|
broadcastable: false,
|
|
39883
40065
|
signature: "((collection|number)+) -> number",
|
|
@@ -39890,6 +40072,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39890
40072
|
}
|
|
39891
40073
|
},
|
|
39892
40074
|
Skewness: {
|
|
40075
|
+
description: "Skewness of a collection of numbers.",
|
|
39893
40076
|
complexity: 1200,
|
|
39894
40077
|
broadcastable: false,
|
|
39895
40078
|
signature: "((collection|number)+) -> number",
|
|
@@ -39902,6 +40085,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39902
40085
|
}
|
|
39903
40086
|
},
|
|
39904
40087
|
Mode: {
|
|
40088
|
+
description: "Most frequently occurring value in a collection.",
|
|
39905
40089
|
complexity: 1200,
|
|
39906
40090
|
broadcastable: false,
|
|
39907
40091
|
signature: "((collection|number)+) -> number",
|
|
@@ -39914,6 +40098,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39914
40098
|
}
|
|
39915
40099
|
},
|
|
39916
40100
|
Quartiles: {
|
|
40101
|
+
description: "Lower quartile, median, and upper quartile of a collection.",
|
|
39917
40102
|
complexity: 1200,
|
|
39918
40103
|
broadcastable: false,
|
|
39919
40104
|
signature: "((collection|number)+) -> tuple<mid:number, lower:number, upper:number>",
|
|
@@ -39925,6 +40110,7 @@ var STATISTICS_LIBRARY = [
|
|
|
39925
40110
|
}
|
|
39926
40111
|
},
|
|
39927
40112
|
InterquartileRange: {
|
|
40113
|
+
description: "Interquartile range (Q3 - Q1) of a collection.",
|
|
39928
40114
|
complexity: 1200,
|
|
39929
40115
|
broadcastable: false,
|
|
39930
40116
|
signature: "((collection|number)+) -> number",
|
|
@@ -40679,6 +40865,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40679
40865
|
},
|
|
40680
40866
|
{
|
|
40681
40867
|
Degrees: {
|
|
40868
|
+
description: "Convert an angle in degrees.",
|
|
40682
40869
|
/* = Pi / 180 */
|
|
40683
40870
|
signature: "(real) -> real",
|
|
40684
40871
|
type: () => "finite_real",
|
|
@@ -40708,6 +40895,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40708
40895
|
},
|
|
40709
40896
|
// DMS(degrees, minutes?, seconds?) — programmatic angle construction
|
|
40710
40897
|
DMS: {
|
|
40898
|
+
description: "Construct an angle from degrees, minutes, and seconds.",
|
|
40711
40899
|
signature: "(real, real?, real?) -> real",
|
|
40712
40900
|
type: () => "finite_real",
|
|
40713
40901
|
canonical: (ops, { engine: ce }) => {
|
|
@@ -40731,6 +40919,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40731
40919
|
},
|
|
40732
40920
|
// Hypot: sqrt(x*x + y*y)
|
|
40733
40921
|
Hypot: {
|
|
40922
|
+
description: "Hypotenuse length: sqrt(x^2 + y^2).",
|
|
40734
40923
|
broadcastable: true,
|
|
40735
40924
|
signature: "(real, real) -> real",
|
|
40736
40925
|
type: () => "finite_real",
|
|
@@ -40747,6 +40936,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40747
40936
|
// (may be used in the definition of other functions below)
|
|
40748
40937
|
//
|
|
40749
40938
|
Arctan: {
|
|
40939
|
+
description: "Inverse tangent.",
|
|
40750
40940
|
wikidata: "Q2257242",
|
|
40751
40941
|
complexity: 5200,
|
|
40752
40942
|
broadcastable: true,
|
|
@@ -40756,6 +40946,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40756
40946
|
evaluate: ([x], { numericApproximation: numericApproximation2 }) => numericApproximation2 ? evalTrig("Arctan", x) : constructibleValues("Arctan", x) ?? evalTrig("Arctan", x)
|
|
40757
40947
|
},
|
|
40758
40948
|
Arctan2: {
|
|
40949
|
+
description: "Two-argument arctangent giving the angle of a vector.",
|
|
40759
40950
|
wikidata: "Q776598",
|
|
40760
40951
|
complexity: 5200,
|
|
40761
40952
|
broadcastable: true,
|
|
@@ -40801,6 +40992,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40801
40992
|
Sinh: trigFunction("Sinh", 6e3),
|
|
40802
40993
|
/** = sin(z/2)^2 = (1 - cos z) / 2*/
|
|
40803
40994
|
Haversine: {
|
|
40995
|
+
description: "Haversine function.",
|
|
40804
40996
|
wikidata: "Q2528380",
|
|
40805
40997
|
broadcastable: true,
|
|
40806
40998
|
signature: "(real) -> number",
|
|
@@ -40809,6 +41001,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40809
41001
|
},
|
|
40810
41002
|
/** = 2 * Arcsin(Sqrt(z)) */
|
|
40811
41003
|
InverseHaversine: {
|
|
41004
|
+
description: "Inverse haversine function.",
|
|
40812
41005
|
// Range ['Interval', [['Negate', 'Pi'], 'Pi'],
|
|
40813
41006
|
broadcastable: true,
|
|
40814
41007
|
signature: "(real) -> real",
|
|
@@ -40832,6 +41025,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40832
41025
|
Coth: trigFunction("Coth", 6300),
|
|
40833
41026
|
/** sinc(x) = sin(x)/x with sinc(0) = 1 (unnormalized cardinal sine) */
|
|
40834
41027
|
Sinc: {
|
|
41028
|
+
description: "Unnormalized sinc function: sin(x)/x with sinc(0)=1.",
|
|
40835
41029
|
complexity: 5100,
|
|
40836
41030
|
broadcastable: true,
|
|
40837
41031
|
signature: "(number) -> real",
|
|
@@ -40843,6 +41037,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40843
41037
|
},
|
|
40844
41038
|
/** FresnelS(x) = ∫₀ˣ sin(πt²/2) dt — odd function, S(∞) = 1/2 */
|
|
40845
41039
|
FresnelS: {
|
|
41040
|
+
description: "Fresnel sine integral.",
|
|
40846
41041
|
complexity: 5200,
|
|
40847
41042
|
broadcastable: true,
|
|
40848
41043
|
signature: "(number) -> real",
|
|
@@ -40854,6 +41049,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40854
41049
|
},
|
|
40855
41050
|
/** FresnelC(x) = ∫₀ˣ cos(πt²/2) dt — odd function, C(∞) = 1/2 */
|
|
40856
41051
|
FresnelC: {
|
|
41052
|
+
description: "Fresnel cosine integral.",
|
|
40857
41053
|
complexity: 5200,
|
|
40858
41054
|
broadcastable: true,
|
|
40859
41055
|
signature: "(number) -> real",
|
|
@@ -40869,6 +41065,7 @@ var TRIGONOMETRY_LIBRARY = [
|
|
|
40869
41065
|
// outputDomain: ['TupleOf', 'RealNumbers', 'RealNumbers'],
|
|
40870
41066
|
// },
|
|
40871
41067
|
InverseFunction: {
|
|
41068
|
+
description: "Inverse of a function.",
|
|
40872
41069
|
lazy: true,
|
|
40873
41070
|
signature: "(function) -> function",
|
|
40874
41071
|
canonical: (ops, { engine }) => {
|
|
@@ -41245,6 +41442,18 @@ function parseRoot(parser) {
|
|
|
41245
41442
|
if (degree !== null) return ["Root", base, degree];
|
|
41246
41443
|
return ["Sqrt", base];
|
|
41247
41444
|
}
|
|
41445
|
+
function negateNumberLiteral(expr) {
|
|
41446
|
+
if (typeof expr === "number") return -expr;
|
|
41447
|
+
if (typeof expr === "string") {
|
|
41448
|
+
if (expr.startsWith("-")) return expr.slice(1);
|
|
41449
|
+
if (expr.startsWith("+")) return "-" + expr.slice(1);
|
|
41450
|
+
return "-" + expr;
|
|
41451
|
+
}
|
|
41452
|
+
const num = expr.num;
|
|
41453
|
+
if (num.startsWith("-")) return { num: num.slice(1) };
|
|
41454
|
+
if (num.startsWith("+")) return { num: "-" + num.slice(1) };
|
|
41455
|
+
return { num: "-" + num };
|
|
41456
|
+
}
|
|
41248
41457
|
function serializeRoot(serializer, style, base, degree) {
|
|
41249
41458
|
if (base === null || base === void 0) return "\\sqrt{}";
|
|
41250
41459
|
degree = degree ?? 2;
|
|
@@ -41810,6 +42019,11 @@ var DEFINITIONS_ARITHMETIC = [
|
|
|
41810
42019
|
minPrec: ADDITION_PRECEDENCE
|
|
41811
42020
|
});
|
|
41812
42021
|
if (rhs === null) return null;
|
|
42022
|
+
if (operator(rhs) === "Negate") {
|
|
42023
|
+
const value = operand(rhs, 1);
|
|
42024
|
+
if (isNumberExpression(value))
|
|
42025
|
+
return foldAssociativeOperator("Add", lhs, negateNumberLiteral(value));
|
|
42026
|
+
}
|
|
41813
42027
|
return foldAssociativeOperator("Add", lhs, rhs);
|
|
41814
42028
|
},
|
|
41815
42029
|
serialize: serializeAdd
|
|
@@ -42468,13 +42682,12 @@ var DEFINITIONS_ARITHMETIC = [
|
|
|
42468
42682
|
associativity: "left",
|
|
42469
42683
|
precedence: ADDITION_PRECEDENCE + 2,
|
|
42470
42684
|
parse: (parser, lhs, terminator) => {
|
|
42471
|
-
parser.index -= 1;
|
|
42472
42685
|
const rhs = parser.parseExpression({
|
|
42473
42686
|
...terminator,
|
|
42474
42687
|
minPrec: ADDITION_PRECEDENCE + 3
|
|
42475
42688
|
});
|
|
42476
42689
|
if (rhs === null) return null;
|
|
42477
|
-
return ["
|
|
42690
|
+
return ["Subtract", lhs, rhs];
|
|
42478
42691
|
},
|
|
42479
42692
|
serialize: (serializer, expr) => {
|
|
42480
42693
|
const lhs = serializer.wrap(operand(expr, 1), ADDITION_PRECEDENCE + 2);
|
|
@@ -47679,7 +47892,8 @@ var BoxedFunction = class extends _BoxedExpression {
|
|
|
47679
47892
|
const exponent = asSmallInteger(expr.op2);
|
|
47680
47893
|
if (exponent !== null)
|
|
47681
47894
|
return [coef.pow(exponent), ce.function("Power", [base, expr.op2])];
|
|
47682
|
-
if (expr.op2.isSame(0.5))
|
|
47895
|
+
if (expr.op2.isSame(0.5))
|
|
47896
|
+
return [coef.sqrt(), ce.function("Sqrt", [base])];
|
|
47683
47897
|
return [ce._numericValue(1), this];
|
|
47684
47898
|
}
|
|
47685
47899
|
if (isFunction2(expr, "Sqrt")) {
|
|
@@ -49984,7 +50198,7 @@ var BaseCompiler = class _BaseCompiler {
|
|
|
49984
50198
|
if (args.length === 1 && locals.length === 0) {
|
|
49985
50199
|
return _BaseCompiler.compile(args[0], target);
|
|
49986
50200
|
}
|
|
49987
|
-
const result = args.map(
|
|
50201
|
+
const result = args.filter((a) => !isSymbol2(a, "Nothing")).map(
|
|
49988
50202
|
(arg) => _BaseCompiler.compile(arg, {
|
|
49989
50203
|
...target,
|
|
49990
50204
|
var: (id) => {
|
|
@@ -49992,7 +50206,8 @@ var BaseCompiler = class _BaseCompiler {
|
|
|
49992
50206
|
return target.var(id);
|
|
49993
50207
|
}
|
|
49994
50208
|
})
|
|
49995
|
-
);
|
|
50209
|
+
).filter((s) => s !== "");
|
|
50210
|
+
if (result.length === 0) return "";
|
|
49996
50211
|
result[result.length - 1] = `return ${result[result.length - 1]}`;
|
|
49997
50212
|
return `(() => {${target.ws("\n")}${result.join(
|
|
49998
50213
|
`;${target.ws("\n")}`
|
|
@@ -53300,7 +53515,8 @@ function simplifyDivide(x) {
|
|
|
53300
53515
|
if (numBase && denomBase && numBase.isSame(denomBase)) {
|
|
53301
53516
|
if (!asRational(numExp) || !asRational(denomExp)) {
|
|
53302
53517
|
const diffExp = ce.function("Add", [numExp, denomExp.neg()]);
|
|
53303
|
-
if (diffExp.isSame(0))
|
|
53518
|
+
if (diffExp.isSame(0))
|
|
53519
|
+
return { value: ce.One, because: "x^a/x^a -> 1" };
|
|
53304
53520
|
if (diffExp.isSame(1))
|
|
53305
53521
|
return { value: numBase, because: "x^a/x^b -> x when a-b=1" };
|
|
53306
53522
|
return {
|
|
@@ -53756,7 +53972,8 @@ var SIMPLIFY_RULES = [
|
|
|
53756
53972
|
const ce = expr.engine;
|
|
53757
53973
|
if (y.isFinite === false && x.isFinite === false)
|
|
53758
53974
|
return { value: ce.NaN, because: "arctan2" };
|
|
53759
|
-
if (y.isSame(0) && x.isSame(0))
|
|
53975
|
+
if (y.isSame(0) && x.isSame(0))
|
|
53976
|
+
return { value: ce.Zero, because: "arctan2" };
|
|
53760
53977
|
if (x.isFinite === false)
|
|
53761
53978
|
return { value: x.isPositive ? ce.Zero : ce.Pi, because: "arctan2" };
|
|
53762
53979
|
if (y.isFinite === false)
|
|
@@ -55174,10 +55391,10 @@ var BoxedSymbol = class extends _BoxedExpression {
|
|
|
55174
55391
|
if (this._def) return this;
|
|
55175
55392
|
return this.engine.symbol(this._id);
|
|
55176
55393
|
}
|
|
55177
|
-
is(other) {
|
|
55178
|
-
if (this.isSame(other)) return true;
|
|
55394
|
+
is(other, tolerance) {
|
|
55395
|
+
if (tolerance === void 0 && this.isSame(other)) return true;
|
|
55179
55396
|
const val = this.value;
|
|
55180
|
-
if (val && val !== this) return val.is(other);
|
|
55397
|
+
if (val && val !== this) return val.is(other, tolerance);
|
|
55181
55398
|
return false;
|
|
55182
55399
|
}
|
|
55183
55400
|
isSame(other) {
|
|
@@ -57239,21 +57456,23 @@ function compileGPUMatrix(args, compile3, vecFn, matFn, arrayFn) {
|
|
|
57239
57456
|
var GPU_GAMMA_PREAMBLE = `
|
|
57240
57457
|
float _gpu_gamma(float z) {
|
|
57241
57458
|
const float PI = 3.14159265358979;
|
|
57242
|
-
|
|
57243
|
-
|
|
57244
|
-
|
|
57245
|
-
|
|
57459
|
+
// For z < 0.5, use reflection formula with inlined Lanczos (non-recursive)
|
|
57460
|
+
float w = z;
|
|
57461
|
+
if (z < 0.5) w = 1.0 - z;
|
|
57462
|
+
w -= 1.0;
|
|
57246
57463
|
float x = 0.99999999999980993;
|
|
57247
|
-
x += 676.5203681218851 / (
|
|
57248
|
-
x += -1259.1392167224028 / (
|
|
57249
|
-
x += 771.32342877765313 / (
|
|
57250
|
-
x += -176.61502916214059 / (
|
|
57251
|
-
x += 12.507343278686905 / (
|
|
57252
|
-
x += -0.13857109526572012 / (
|
|
57253
|
-
x += 9.9843695780195716e-6 / (
|
|
57254
|
-
x += 1.5056327351493116e-7 / (
|
|
57255
|
-
float t =
|
|
57256
|
-
|
|
57464
|
+
x += 676.5203681218851 / (w + 1.0);
|
|
57465
|
+
x += -1259.1392167224028 / (w + 2.0);
|
|
57466
|
+
x += 771.32342877765313 / (w + 3.0);
|
|
57467
|
+
x += -176.61502916214059 / (w + 4.0);
|
|
57468
|
+
x += 12.507343278686905 / (w + 5.0);
|
|
57469
|
+
x += -0.13857109526572012 / (w + 6.0);
|
|
57470
|
+
x += 9.9843695780195716e-6 / (w + 7.0);
|
|
57471
|
+
x += 1.5056327351493116e-7 / (w + 8.0);
|
|
57472
|
+
float t = w + 7.5;
|
|
57473
|
+
float g = sqrt(2.0 * PI) * pow(t, w + 0.5) * exp(-t) * x;
|
|
57474
|
+
if (z < 0.5) return PI / (sin(PI * z) * g);
|
|
57475
|
+
return g;
|
|
57257
57476
|
}
|
|
57258
57477
|
|
|
57259
57478
|
float _gpu_gammaln(float z) {
|
|
@@ -60614,21 +60833,23 @@ IntervalResult ia_asech(IntervalResult x) {
|
|
|
60614
60833
|
// Poles at non-positive integers; minimum at x \u2248 1.4616
|
|
60615
60834
|
float _gpu_gamma(float z) {
|
|
60616
60835
|
const float PI = 3.14159265358979;
|
|
60617
|
-
|
|
60618
|
-
|
|
60619
|
-
|
|
60620
|
-
|
|
60836
|
+
// For z < 0.5, use reflection formula with inlined Lanczos (non-recursive)
|
|
60837
|
+
float w = z;
|
|
60838
|
+
if (z < 0.5) w = 1.0 - z;
|
|
60839
|
+
w -= 1.0;
|
|
60621
60840
|
float x = 0.99999999999980993;
|
|
60622
|
-
x += 676.5203681218851 / (
|
|
60623
|
-
x += -1259.1392167224028 / (
|
|
60624
|
-
x += 771.32342877765313 / (
|
|
60625
|
-
x += -176.61502916214059 / (
|
|
60626
|
-
x += 12.507343278686905 / (
|
|
60627
|
-
x += -0.13857109526572012 / (
|
|
60628
|
-
x += 9.9843695780195716e-6 / (
|
|
60629
|
-
x += 1.5056327351493116e-7 / (
|
|
60630
|
-
float t =
|
|
60631
|
-
|
|
60841
|
+
x += 676.5203681218851 / (w + 1.0);
|
|
60842
|
+
x += -1259.1392167224028 / (w + 2.0);
|
|
60843
|
+
x += 771.32342877765313 / (w + 3.0);
|
|
60844
|
+
x += -176.61502916214059 / (w + 4.0);
|
|
60845
|
+
x += 12.507343278686905 / (w + 5.0);
|
|
60846
|
+
x += -0.13857109526572012 / (w + 6.0);
|
|
60847
|
+
x += 9.9843695780195716e-6 / (w + 7.0);
|
|
60848
|
+
x += 1.5056327351493116e-7 / (w + 8.0);
|
|
60849
|
+
float t = w + 7.5;
|
|
60850
|
+
float g = sqrt(2.0 * PI) * pow(t, w + 0.5) * exp(-t) * x;
|
|
60851
|
+
if (z < 0.5) return PI / (sin(PI * z) * g);
|
|
60852
|
+
return g;
|
|
60632
60853
|
}
|
|
60633
60854
|
|
|
60634
60855
|
// Interval gamma function
|
|
@@ -60801,6 +61022,128 @@ float ia_notEqual(IntervalResult a, IntervalResult b) {
|
|
|
60801
61022
|
return ia_notEqual(a.value, b.value);
|
|
60802
61023
|
}
|
|
60803
61024
|
`;
|
|
61025
|
+
var _preambleHeader = "";
|
|
61026
|
+
var _preambleFunctions = /* @__PURE__ */ new Map();
|
|
61027
|
+
var _preambleParsed = false;
|
|
61028
|
+
var GLSL_FUNC_RE = /^(IntervalResult|vec2|float|bool|void)\s+(ia_\w+|_gpu_\w+)\s*\(/;
|
|
61029
|
+
var GLSL_CALL_RE = /\b(ia_\w+|_gpu_\w+)\s*\(/g;
|
|
61030
|
+
var GLSL_CONST_RE = /^const\s+float\s+(IA_\w+)\s*=/;
|
|
61031
|
+
function parsePreamble() {
|
|
61032
|
+
if (_preambleParsed) return;
|
|
61033
|
+
_preambleParsed = true;
|
|
61034
|
+
const lines = GLSL_INTERVAL_LIBRARY.split("\n");
|
|
61035
|
+
let headerDone = false;
|
|
61036
|
+
const headerLines = [];
|
|
61037
|
+
let currentBlock = [];
|
|
61038
|
+
let currentName = null;
|
|
61039
|
+
let braceDepth = 0;
|
|
61040
|
+
let inFunction = false;
|
|
61041
|
+
let pendingComments = [];
|
|
61042
|
+
let pendingConstants = [];
|
|
61043
|
+
for (const line of lines) {
|
|
61044
|
+
const constMatch = !inFunction && GLSL_CONST_RE.exec(line);
|
|
61045
|
+
if (constMatch && headerDone) {
|
|
61046
|
+
pendingConstants.push(line);
|
|
61047
|
+
continue;
|
|
61048
|
+
}
|
|
61049
|
+
const funcMatch = !inFunction && GLSL_FUNC_RE.exec(line);
|
|
61050
|
+
if (funcMatch) {
|
|
61051
|
+
if (!headerDone) {
|
|
61052
|
+
_preambleHeader = headerLines.join("\n");
|
|
61053
|
+
headerDone = true;
|
|
61054
|
+
}
|
|
61055
|
+
currentName = funcMatch[2];
|
|
61056
|
+
currentBlock = [...pendingComments, ...pendingConstants, line];
|
|
61057
|
+
pendingComments = [];
|
|
61058
|
+
pendingConstants = [];
|
|
61059
|
+
inFunction = true;
|
|
61060
|
+
braceDepth = 0;
|
|
61061
|
+
for (const ch of line) {
|
|
61062
|
+
if (ch === "{") braceDepth++;
|
|
61063
|
+
if (ch === "}") braceDepth--;
|
|
61064
|
+
}
|
|
61065
|
+
if (braceDepth <= 0) {
|
|
61066
|
+
finishFunction(currentName, currentBlock.join("\n"));
|
|
61067
|
+
inFunction = false;
|
|
61068
|
+
currentName = null;
|
|
61069
|
+
}
|
|
61070
|
+
} else if (inFunction) {
|
|
61071
|
+
currentBlock.push(line);
|
|
61072
|
+
for (const ch of line) {
|
|
61073
|
+
if (ch === "{") braceDepth++;
|
|
61074
|
+
if (ch === "}") braceDepth--;
|
|
61075
|
+
}
|
|
61076
|
+
if (braceDepth <= 0) {
|
|
61077
|
+
finishFunction(currentName, currentBlock.join("\n"));
|
|
61078
|
+
inFunction = false;
|
|
61079
|
+
currentName = null;
|
|
61080
|
+
}
|
|
61081
|
+
} else if (!headerDone) {
|
|
61082
|
+
headerLines.push(line);
|
|
61083
|
+
} else {
|
|
61084
|
+
const trimmed = line.trim();
|
|
61085
|
+
if (trimmed.startsWith("//") || trimmed === "") {
|
|
61086
|
+
pendingComments.push(line);
|
|
61087
|
+
}
|
|
61088
|
+
}
|
|
61089
|
+
}
|
|
61090
|
+
if (pendingConstants.length > 0) {
|
|
61091
|
+
_preambleHeader += "\n" + pendingConstants.join("\n");
|
|
61092
|
+
}
|
|
61093
|
+
}
|
|
61094
|
+
function finishFunction(name, source) {
|
|
61095
|
+
const deps = /* @__PURE__ */ new Set();
|
|
61096
|
+
let match2;
|
|
61097
|
+
const callRe = new RegExp(GLSL_CALL_RE.source, "g");
|
|
61098
|
+
while ((match2 = callRe.exec(source)) !== null) {
|
|
61099
|
+
const callee = match2[1];
|
|
61100
|
+
if (callee !== name) deps.add(callee);
|
|
61101
|
+
}
|
|
61102
|
+
const existing = _preambleFunctions.get(name);
|
|
61103
|
+
if (existing) {
|
|
61104
|
+
existing.source += "\n\n" + source;
|
|
61105
|
+
for (const d of deps) existing.deps.push(d);
|
|
61106
|
+
} else {
|
|
61107
|
+
_preambleFunctions.set(name, {
|
|
61108
|
+
name,
|
|
61109
|
+
source,
|
|
61110
|
+
deps: [...deps]
|
|
61111
|
+
});
|
|
61112
|
+
}
|
|
61113
|
+
}
|
|
61114
|
+
function buildIntervalPreamble(code) {
|
|
61115
|
+
parsePreamble();
|
|
61116
|
+
const needed = /* @__PURE__ */ new Set();
|
|
61117
|
+
let match2;
|
|
61118
|
+
const callRe = new RegExp(GLSL_CALL_RE.source, "g");
|
|
61119
|
+
while ((match2 = callRe.exec(code)) !== null) {
|
|
61120
|
+
needed.add(match2[1]);
|
|
61121
|
+
}
|
|
61122
|
+
if (needed.size === 0) return _preambleHeader;
|
|
61123
|
+
const resolved = /* @__PURE__ */ new Set();
|
|
61124
|
+
function resolve(name) {
|
|
61125
|
+
if (resolved.has(name)) return;
|
|
61126
|
+
const block = _preambleFunctions.get(name);
|
|
61127
|
+
if (!block) return;
|
|
61128
|
+
for (const dep of block.deps) resolve(dep);
|
|
61129
|
+
resolved.add(name);
|
|
61130
|
+
}
|
|
61131
|
+
for (const name of needed) resolve(name);
|
|
61132
|
+
const parts = [_preambleHeader];
|
|
61133
|
+
const needsComparisonConstants = [...resolved].some(
|
|
61134
|
+
(name) => name.startsWith("ia_less") || name.startsWith("ia_greater") || name.startsWith("ia_equal") || name.startsWith("ia_notEqual") || name === "ia_and" || name === "ia_or" || name === "ia_not"
|
|
61135
|
+
);
|
|
61136
|
+
if (needsComparisonConstants) {
|
|
61137
|
+
parts.push(
|
|
61138
|
+
"\nconst float IA_TRUE = 1.0;\nconst float IA_FALSE = 0.0;\nconst float IA_MAYBE = 0.5;"
|
|
61139
|
+
);
|
|
61140
|
+
}
|
|
61141
|
+
for (const name of resolved) {
|
|
61142
|
+
const block = _preambleFunctions.get(name);
|
|
61143
|
+
if (block) parts.push("\n" + block.source);
|
|
61144
|
+
}
|
|
61145
|
+
return parts.join("\n");
|
|
61146
|
+
}
|
|
60804
61147
|
var INTERVAL_GLSL_OPERATORS = {
|
|
60805
61148
|
Add: ["ia_add", 20],
|
|
60806
61149
|
Negate: ["ia_negate", 20],
|
|
@@ -61026,7 +61369,7 @@ var IntervalGLSLTarget = class {
|
|
|
61026
61369
|
target: "interval-glsl",
|
|
61027
61370
|
success: true,
|
|
61028
61371
|
code: glslCode,
|
|
61029
|
-
preamble:
|
|
61372
|
+
preamble: buildIntervalPreamble(glslCode)
|
|
61030
61373
|
};
|
|
61031
61374
|
}
|
|
61032
61375
|
/**
|
|
@@ -61069,7 +61412,7 @@ var IntervalGLSLTarget = class {
|
|
|
61069
61412
|
return `#version ${version2}
|
|
61070
61413
|
precision highp float;
|
|
61071
61414
|
|
|
61072
|
-
${
|
|
61415
|
+
${buildIntervalPreamble(body)}
|
|
61073
61416
|
|
|
61074
61417
|
IntervalResult ${functionName}(${params}) {
|
|
61075
61418
|
return ${body};
|
|
@@ -62180,6 +62523,122 @@ fn ia_notEqual(a: IntervalResult, b: IntervalResult) -> f32 {
|
|
|
62180
62523
|
return ia_notEqual_v(a.value, b.value);
|
|
62181
62524
|
}
|
|
62182
62525
|
`;
|
|
62526
|
+
var _wgslPreambleHeader = "";
|
|
62527
|
+
var _wgslPreambleFunctions = /* @__PURE__ */ new Map();
|
|
62528
|
+
var _wgslPreambleParsed = false;
|
|
62529
|
+
var WGSL_FUNC_RE = /^fn\s+(ia_\w+|_gpu_\w+)\s*\(/;
|
|
62530
|
+
var WGSL_CALL_RE = /\b(ia_\w+|_gpu_\w+)\s*\(/g;
|
|
62531
|
+
var WGSL_CONST_RE = /^const\s+(IA_\w+)\s*:/;
|
|
62532
|
+
function parseWGSLPreamble() {
|
|
62533
|
+
if (_wgslPreambleParsed) return;
|
|
62534
|
+
_wgslPreambleParsed = true;
|
|
62535
|
+
const lines = WGSL_INTERVAL_LIBRARY.split("\n");
|
|
62536
|
+
let headerDone = false;
|
|
62537
|
+
const headerLines = [];
|
|
62538
|
+
let currentBlock = [];
|
|
62539
|
+
let currentName = null;
|
|
62540
|
+
let braceDepth = 0;
|
|
62541
|
+
let inFunction = false;
|
|
62542
|
+
let pendingComments = [];
|
|
62543
|
+
let pendingConstants = [];
|
|
62544
|
+
for (const line of lines) {
|
|
62545
|
+
const constMatch = !inFunction && WGSL_CONST_RE.exec(line);
|
|
62546
|
+
if (constMatch && headerDone) {
|
|
62547
|
+
pendingConstants.push(line);
|
|
62548
|
+
continue;
|
|
62549
|
+
}
|
|
62550
|
+
const funcMatch = !inFunction && WGSL_FUNC_RE.exec(line);
|
|
62551
|
+
if (funcMatch) {
|
|
62552
|
+
if (!headerDone) {
|
|
62553
|
+
_wgslPreambleHeader = headerLines.join("\n");
|
|
62554
|
+
headerDone = true;
|
|
62555
|
+
}
|
|
62556
|
+
currentName = funcMatch[1];
|
|
62557
|
+
currentBlock = [...pendingComments, ...pendingConstants, line];
|
|
62558
|
+
pendingComments = [];
|
|
62559
|
+
pendingConstants = [];
|
|
62560
|
+
inFunction = true;
|
|
62561
|
+
braceDepth = 0;
|
|
62562
|
+
for (const ch of line) {
|
|
62563
|
+
if (ch === "{") braceDepth++;
|
|
62564
|
+
if (ch === "}") braceDepth--;
|
|
62565
|
+
}
|
|
62566
|
+
if (braceDepth <= 0) {
|
|
62567
|
+
finishWGSLFunction(currentName, currentBlock.join("\n"));
|
|
62568
|
+
inFunction = false;
|
|
62569
|
+
currentName = null;
|
|
62570
|
+
}
|
|
62571
|
+
} else if (inFunction) {
|
|
62572
|
+
currentBlock.push(line);
|
|
62573
|
+
for (const ch of line) {
|
|
62574
|
+
if (ch === "{") braceDepth++;
|
|
62575
|
+
if (ch === "}") braceDepth--;
|
|
62576
|
+
}
|
|
62577
|
+
if (braceDepth <= 0) {
|
|
62578
|
+
finishWGSLFunction(currentName, currentBlock.join("\n"));
|
|
62579
|
+
inFunction = false;
|
|
62580
|
+
currentName = null;
|
|
62581
|
+
}
|
|
62582
|
+
} else if (!headerDone) {
|
|
62583
|
+
headerLines.push(line);
|
|
62584
|
+
} else {
|
|
62585
|
+
const trimmed = line.trim();
|
|
62586
|
+
if (trimmed.startsWith("//") || trimmed === "") {
|
|
62587
|
+
pendingComments.push(line);
|
|
62588
|
+
}
|
|
62589
|
+
}
|
|
62590
|
+
}
|
|
62591
|
+
if (pendingConstants.length > 0) {
|
|
62592
|
+
_wgslPreambleHeader += "\n" + pendingConstants.join("\n");
|
|
62593
|
+
}
|
|
62594
|
+
}
|
|
62595
|
+
function finishWGSLFunction(name, source) {
|
|
62596
|
+
const deps = /* @__PURE__ */ new Set();
|
|
62597
|
+
let match2;
|
|
62598
|
+
const callRe = new RegExp(WGSL_CALL_RE.source, "g");
|
|
62599
|
+
while ((match2 = callRe.exec(source)) !== null) {
|
|
62600
|
+
const callee = match2[1];
|
|
62601
|
+
if (callee !== name) deps.add(callee);
|
|
62602
|
+
}
|
|
62603
|
+
_wgslPreambleFunctions.set(name, {
|
|
62604
|
+
name,
|
|
62605
|
+
source,
|
|
62606
|
+
deps: [...deps]
|
|
62607
|
+
});
|
|
62608
|
+
}
|
|
62609
|
+
function buildIntervalWGSLPreamble(code) {
|
|
62610
|
+
parseWGSLPreamble();
|
|
62611
|
+
const needed = /* @__PURE__ */ new Set();
|
|
62612
|
+
let match2;
|
|
62613
|
+
const callRe = new RegExp(WGSL_CALL_RE.source, "g");
|
|
62614
|
+
while ((match2 = callRe.exec(code)) !== null) {
|
|
62615
|
+
needed.add(match2[1]);
|
|
62616
|
+
}
|
|
62617
|
+
if (needed.size === 0) return _wgslPreambleHeader;
|
|
62618
|
+
const resolved = /* @__PURE__ */ new Set();
|
|
62619
|
+
function resolve(name) {
|
|
62620
|
+
if (resolved.has(name)) return;
|
|
62621
|
+
const block = _wgslPreambleFunctions.get(name);
|
|
62622
|
+
if (!block) return;
|
|
62623
|
+
for (const dep of block.deps) resolve(dep);
|
|
62624
|
+
resolved.add(name);
|
|
62625
|
+
}
|
|
62626
|
+
for (const name of needed) resolve(name);
|
|
62627
|
+
const parts = [_wgslPreambleHeader];
|
|
62628
|
+
const needsComparisonConstants = [...resolved].some(
|
|
62629
|
+
(name) => name.startsWith("ia_less") || name.startsWith("ia_greater") || name.startsWith("ia_equal") || name.startsWith("ia_notEqual") || name === "ia_and" || name === "ia_or" || name === "ia_not"
|
|
62630
|
+
);
|
|
62631
|
+
if (needsComparisonConstants) {
|
|
62632
|
+
parts.push(
|
|
62633
|
+
"\nconst IA_TRUE: f32 = 1.0;\nconst IA_FALSE: f32 = 0.0;\nconst IA_MAYBE: f32 = 0.5;"
|
|
62634
|
+
);
|
|
62635
|
+
}
|
|
62636
|
+
for (const name of resolved) {
|
|
62637
|
+
const block = _wgslPreambleFunctions.get(name);
|
|
62638
|
+
if (block) parts.push("\n" + block.source);
|
|
62639
|
+
}
|
|
62640
|
+
return parts.join("\n");
|
|
62641
|
+
}
|
|
62183
62642
|
var INTERVAL_WGSL_OPERATORS = {
|
|
62184
62643
|
Add: ["ia_add", 20],
|
|
62185
62644
|
Negate: ["ia_negate", 20],
|
|
@@ -62403,7 +62862,7 @@ var IntervalWGSLTarget = class {
|
|
|
62403
62862
|
target: "interval-wgsl",
|
|
62404
62863
|
success: true,
|
|
62405
62864
|
code: wgslCode,
|
|
62406
|
-
preamble:
|
|
62865
|
+
preamble: buildIntervalWGSLPreamble(wgslCode)
|
|
62407
62866
|
};
|
|
62408
62867
|
}
|
|
62409
62868
|
/**
|
|
@@ -62439,7 +62898,8 @@ var IntervalWGSLTarget = class {
|
|
|
62439
62898
|
const target = this.createTarget();
|
|
62440
62899
|
const body = BaseCompiler.compile(expr, target);
|
|
62441
62900
|
const params = parameters.map((name) => `${name}: vec2f`).join(", ");
|
|
62442
|
-
|
|
62901
|
+
const preamble = buildIntervalWGSLPreamble(body);
|
|
62902
|
+
return `${preamble}
|
|
62443
62903
|
|
|
62444
62904
|
fn ${functionName}(${params}) -> IntervalResult {
|
|
62445
62905
|
return ${body};
|
|
@@ -62929,7 +63389,23 @@ var BoxedNumber = class extends _BoxedExpression {
|
|
|
62929
63389
|
if (typeof this._value === "number") return true;
|
|
62930
63390
|
return isSubtype(this._value.type, "real");
|
|
62931
63391
|
}
|
|
62932
|
-
|
|
63392
|
+
get isExact() {
|
|
63393
|
+
const n = this._value;
|
|
63394
|
+
if (typeof n === "number")
|
|
63395
|
+
return !Number.isFinite(n) || Number.isInteger(n);
|
|
63396
|
+
return n.isExact;
|
|
63397
|
+
}
|
|
63398
|
+
is(other, tolerance) {
|
|
63399
|
+
if (tolerance === void 0) return this.isSame(other);
|
|
63400
|
+
if (typeof other === "number") {
|
|
63401
|
+
return Math.abs(this.re - other) <= tolerance && Math.abs(this.im) <= tolerance;
|
|
63402
|
+
}
|
|
63403
|
+
if (typeof other === "bigint") {
|
|
63404
|
+
return Math.abs(this.re - Number(other)) <= tolerance && Math.abs(this.im) <= tolerance;
|
|
63405
|
+
}
|
|
63406
|
+
if (other instanceof _BoxedExpression && isNumber(other)) {
|
|
63407
|
+
return Math.abs(this.re - other.re) <= tolerance && Math.abs(this.im - other.im) <= tolerance;
|
|
63408
|
+
}
|
|
62933
63409
|
return this.isSame(other);
|
|
62934
63410
|
}
|
|
62935
63411
|
isSame(other) {
|
|
@@ -65489,6 +65965,58 @@ var _Parser = class __Parser {
|
|
|
65489
65965
|
return null;
|
|
65490
65966
|
}
|
|
65491
65967
|
this.skipSpace();
|
|
65968
|
+
let subscript = null;
|
|
65969
|
+
if (this.peek === "_") {
|
|
65970
|
+
const underIndex = this.index;
|
|
65971
|
+
this.index++;
|
|
65972
|
+
subscript = this.parseGroup();
|
|
65973
|
+
if (subscript === null) {
|
|
65974
|
+
const subStart = this.index;
|
|
65975
|
+
if (!this.atEnd && /^[a-zA-Z]$/.test(this.peek)) {
|
|
65976
|
+
subscript = this.peek;
|
|
65977
|
+
this.index++;
|
|
65978
|
+
} else {
|
|
65979
|
+
let digits = "";
|
|
65980
|
+
while (!this.atEnd && /^[0-9]$/.test(this.peek)) {
|
|
65981
|
+
digits += this.peek;
|
|
65982
|
+
this.index++;
|
|
65983
|
+
}
|
|
65984
|
+
if (digits) subscript = parseInt(digits);
|
|
65985
|
+
}
|
|
65986
|
+
if (subscript === null) {
|
|
65987
|
+
this.index = start;
|
|
65988
|
+
return null;
|
|
65989
|
+
}
|
|
65990
|
+
}
|
|
65991
|
+
this.skipSpace();
|
|
65992
|
+
}
|
|
65993
|
+
let exponent = null;
|
|
65994
|
+
if (this.peek === "^") {
|
|
65995
|
+
const caretIndex = this.index;
|
|
65996
|
+
this.index++;
|
|
65997
|
+
exponent = this.parseGroup();
|
|
65998
|
+
if (exponent === null) {
|
|
65999
|
+
const digitStart = this.index;
|
|
66000
|
+
let neg2 = false;
|
|
66001
|
+
if (this.peek === "-") {
|
|
66002
|
+
neg2 = true;
|
|
66003
|
+
this.index++;
|
|
66004
|
+
}
|
|
66005
|
+
let digits = "";
|
|
66006
|
+
while (!this.atEnd && /^[0-9]$/.test(this.peek)) {
|
|
66007
|
+
digits += this.peek;
|
|
66008
|
+
this.index++;
|
|
66009
|
+
}
|
|
66010
|
+
if (digits) {
|
|
66011
|
+
const num = parseInt(digits);
|
|
66012
|
+
exponent = neg2 ? -num : num;
|
|
66013
|
+
} else {
|
|
66014
|
+
this.index = start;
|
|
66015
|
+
return null;
|
|
66016
|
+
}
|
|
66017
|
+
}
|
|
66018
|
+
this.skipSpace();
|
|
66019
|
+
}
|
|
65492
66020
|
if (this.peek !== "(") {
|
|
65493
66021
|
this.index = start;
|
|
65494
66022
|
return null;
|
|
@@ -65563,8 +66091,19 @@ var _Parser = class __Parser {
|
|
|
65563
66091
|
this.index = start;
|
|
65564
66092
|
return null;
|
|
65565
66093
|
}
|
|
65566
|
-
if (name === "cbrt")
|
|
65567
|
-
|
|
66094
|
+
if (name === "cbrt") {
|
|
66095
|
+
const result2 = ["Root", args[0] ?? "Nothing", 3];
|
|
66096
|
+
return exponent !== null ? ["Power", result2, exponent] : result2;
|
|
66097
|
+
}
|
|
66098
|
+
let result;
|
|
66099
|
+
if (name === "log" && subscript !== null) {
|
|
66100
|
+
if (subscript === 2) result = ["Lb", ...args];
|
|
66101
|
+
else if (subscript === 10) result = ["Log", ...args];
|
|
66102
|
+
else result = ["Log", args[0], subscript];
|
|
66103
|
+
} else {
|
|
66104
|
+
result = [fnName, ...args];
|
|
66105
|
+
}
|
|
66106
|
+
return exponent !== null ? ["Power", result, exponent] : result;
|
|
65568
66107
|
}
|
|
65569
66108
|
static BARE_SYMBOL_MAP = {
|
|
65570
66109
|
// Greek lowercase
|
|
@@ -69466,10 +70005,10 @@ var ComputeEngine = class _ComputeEngine {
|
|
|
69466
70005
|
_setComputeEngineClass(ComputeEngine);
|
|
69467
70006
|
|
|
69468
70007
|
// src/compute-engine.ts
|
|
69469
|
-
var version = "0.52.
|
|
70008
|
+
var version = "0.52.1";
|
|
69470
70009
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
69471
70010
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
69472
|
-
version: "0.52.
|
|
70011
|
+
version: "0.52.1"
|
|
69473
70012
|
};
|
|
69474
70013
|
export {
|
|
69475
70014
|
BaseCompiler,
|