@cortex-js/compute-engine 0.56.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compile.esm.js +450 -42
- package/dist/compile.min.esm.js +57 -57
- package/dist/compile.min.umd.cjs +58 -58
- package/dist/compile.umd.cjs +450 -42
- package/dist/compute-engine.esm.js +677 -49
- package/dist/compute-engine.min.esm.js +62 -62
- package/dist/compute-engine.min.umd.cjs +62 -62
- package/dist/compute-engine.umd.cjs +677 -49
- package/dist/core.esm.js +676 -48
- package/dist/core.min.esm.js +61 -61
- package/dist/core.min.umd.cjs +61 -61
- package/dist/core.umd.cjs +676 -48
- package/dist/interval.esm.js +228 -16
- package/dist/interval.min.esm.js +6 -6
- package/dist/interval.min.umd.cjs +6 -6
- package/dist/interval.umd.cjs +228 -16
- package/dist/latex-syntax.esm.js +269 -16
- package/dist/latex-syntax.min.esm.js +6 -6
- package/dist/latex-syntax.min.umd.cjs +6 -6
- package/dist/latex-syntax.umd.cjs +269 -16
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.umd.cjs +2 -2
- package/dist/math-json.umd.cjs +2 -2
- package/dist/numerics.esm.js +2 -2
- package/dist/numerics.min.esm.js +2 -2
- package/dist/numerics.min.umd.cjs +2 -2
- package/dist/numerics.umd.cjs +2 -2
- package/dist/types/big-decimal/big-decimal.d.ts +1 -1
- package/dist/types/big-decimal/index.d.ts +1 -1
- package/dist/types/big-decimal/transcendentals.d.ts +1 -1
- package/dist/types/big-decimal/utils.d.ts +1 -1
- 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/compile.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 +6 -1
- 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 +1 -1
- 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 +1 -1
- 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 +55 -6
- package/dist/types/compute-engine/compilation/compile-expression.d.ts +1 -1
- package/dist/types/compute-engine/compilation/constant-folding.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 +1 -1
- package/dist/types/compute-engine/compilation/interval-javascript-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-library-bootstrap.d.ts +1 -1
- package/dist/types/compute-engine/engine-numeric-configuration.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 +3 -2
- 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/default-dictionary.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-colors.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/latex-syntax.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 +40 -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 +5 -3
- 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/fractals.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/linear-algebra.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 +18 -1
- package/dist/types/compute-engine/types-evaluation.d.ts +1 -1
- package/dist/types/compute-engine/types-expression.d.ts +1 -1
- 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/core.d.ts +1 -1
- package/dist/types/interval.d.ts +1 -1
- package/dist/types/latex-syntax.d.ts +2 -2
- 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/dist/types/numerics.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** LatexSyntax 0.
|
|
1
|
+
/** LatexSyntax 0.57.0 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LatexSyntax = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
var LatexSyntax = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -3725,6 +3725,64 @@ var LatexSyntax = (() => {
|
|
|
3725
3725
|
}
|
|
3726
3726
|
|
|
3727
3727
|
// src/compute-engine/latex-syntax/dictionary/definitions-core.ts
|
|
3728
|
+
var COMPONENT_ACCESS_HEADS = {
|
|
3729
|
+
x: "First",
|
|
3730
|
+
y: "Second",
|
|
3731
|
+
z: "Third",
|
|
3732
|
+
real: "Real",
|
|
3733
|
+
re: "Real",
|
|
3734
|
+
imag: "Imaginary",
|
|
3735
|
+
im: "Imaginary",
|
|
3736
|
+
count: "Length",
|
|
3737
|
+
total: "Sum",
|
|
3738
|
+
max: "Max",
|
|
3739
|
+
min: "Min"
|
|
3740
|
+
};
|
|
3741
|
+
function memberHead(name) {
|
|
3742
|
+
return COMPONENT_ACCESS_HEADS[name] ?? null;
|
|
3743
|
+
}
|
|
3744
|
+
function parseComponentAccess(parser, lhs) {
|
|
3745
|
+
parser.skipVisualSpace();
|
|
3746
|
+
if (parser.match("\\operatorname")) {
|
|
3747
|
+
const name = parser.parseStringGroup();
|
|
3748
|
+
if (name === null) return null;
|
|
3749
|
+
const head = memberHead(name.trim());
|
|
3750
|
+
if (head === null) return null;
|
|
3751
|
+
return [head, lhs];
|
|
3752
|
+
}
|
|
3753
|
+
const tok = parser.peek;
|
|
3754
|
+
if (typeof tok === "string" && tok.startsWith("\\")) {
|
|
3755
|
+
const bare = tok.slice(1);
|
|
3756
|
+
const head = memberHead(bare);
|
|
3757
|
+
if (head !== null) {
|
|
3758
|
+
parser.nextToken();
|
|
3759
|
+
return [head, lhs];
|
|
3760
|
+
}
|
|
3761
|
+
return null;
|
|
3762
|
+
}
|
|
3763
|
+
if (typeof tok === "string" && /^[a-zA-Z]$/.test(tok)) {
|
|
3764
|
+
const head = memberHead(tok);
|
|
3765
|
+
if (head === null) return null;
|
|
3766
|
+
parser.nextToken();
|
|
3767
|
+
return [head, lhs];
|
|
3768
|
+
}
|
|
3769
|
+
return null;
|
|
3770
|
+
}
|
|
3771
|
+
function parseWhenRestriction(parser, lhs, close) {
|
|
3772
|
+
parser.addBoundary(close);
|
|
3773
|
+
parser.skipVisualSpace();
|
|
3774
|
+
const cond = parser.parseExpression({ minPrec: 0 });
|
|
3775
|
+
if (cond === null) {
|
|
3776
|
+
parser.removeBoundary();
|
|
3777
|
+
return null;
|
|
3778
|
+
}
|
|
3779
|
+
parser.skipVisualSpace();
|
|
3780
|
+
if (!parser.matchBoundary()) {
|
|
3781
|
+
parser.removeBoundary();
|
|
3782
|
+
return null;
|
|
3783
|
+
}
|
|
3784
|
+
return ["When", lhs, cond];
|
|
3785
|
+
}
|
|
3728
3786
|
function parseSequence(parser, terminator, lhs, prec, sep) {
|
|
3729
3787
|
if (terminator && terminator.minPrec >= prec) return null;
|
|
3730
3788
|
const result = lhs ? [lhs] : ["Nothing"];
|
|
@@ -4196,6 +4254,15 @@ var LatexSyntax = (() => {
|
|
|
4196
4254
|
}
|
|
4197
4255
|
},
|
|
4198
4256
|
{ name: "LatexTokens", serialize: serializeLatexTokens },
|
|
4257
|
+
// Component-access postfix: expr.member (C3)
|
|
4258
|
+
// The '.' trigger is consumed before the parse function is called.
|
|
4259
|
+
// Precedence 850 > 810 (At/indexing) so .x chains tightly.
|
|
4260
|
+
{
|
|
4261
|
+
kind: "postfix",
|
|
4262
|
+
precedence: 850,
|
|
4263
|
+
latexTrigger: ["."],
|
|
4264
|
+
parse: parseComponentAccess
|
|
4265
|
+
},
|
|
4199
4266
|
{
|
|
4200
4267
|
name: "At",
|
|
4201
4268
|
kind: "postfix",
|
|
@@ -4216,6 +4283,29 @@ var LatexSyntax = (() => {
|
|
|
4216
4283
|
latexTrigger: ["\\left", "\\lbrack"],
|
|
4217
4284
|
parse: parseAt("\\right", "\\rbrack")
|
|
4218
4285
|
},
|
|
4286
|
+
// When-restriction: `expr\left\{cond\right\}` → `When(expr, cond)` (D3)
|
|
4287
|
+
{
|
|
4288
|
+
name: "When",
|
|
4289
|
+
kind: "postfix",
|
|
4290
|
+
precedence: 800,
|
|
4291
|
+
latexTrigger: ["\\left", "\\{"],
|
|
4292
|
+
parse: (parser, lhs) => parseWhenRestriction(parser, lhs, ["\\right", "\\}"]),
|
|
4293
|
+
serialize: (serializer, expr) => {
|
|
4294
|
+
const e = operand(expr, 1);
|
|
4295
|
+
const cond = operand(expr, 2);
|
|
4296
|
+
if (!e || !cond) return "";
|
|
4297
|
+
const clauses = operator(cond) === "And" ? operands(cond) ?? [] : [cond];
|
|
4298
|
+
const inner = clauses.map((c) => `\\left\\{${serializer.serialize(c)}\\right\\}`).join("");
|
|
4299
|
+
return `${serializer.serialize(e)}${inner}`;
|
|
4300
|
+
}
|
|
4301
|
+
},
|
|
4302
|
+
// When-restriction: bare `expr\{cond\}` → `When(expr, cond)`
|
|
4303
|
+
{
|
|
4304
|
+
kind: "postfix",
|
|
4305
|
+
precedence: 800,
|
|
4306
|
+
latexTrigger: ["\\{"],
|
|
4307
|
+
parse: (parser, lhs) => parseWhenRestriction(parser, lhs, ["\\}"])
|
|
4308
|
+
},
|
|
4219
4309
|
{
|
|
4220
4310
|
kind: "postfix",
|
|
4221
4311
|
latexTrigger: ["_"],
|
|
@@ -4298,6 +4388,29 @@ var LatexSyntax = (() => {
|
|
|
4298
4388
|
return "";
|
|
4299
4389
|
}
|
|
4300
4390
|
},
|
|
4391
|
+
// Additional triggers for Range: `...`, `\ldots`, and `\dots` are
|
|
4392
|
+
// equivalent to `..` when used as infix operators (e.g. `[1...9]`).
|
|
4393
|
+
// No `name` field here — names must be unique per the dictionary rules;
|
|
4394
|
+
// the first Range entry owns the name. When there is no LHS the symbol
|
|
4395
|
+
// entries near the top of the file still fire (ContinuationPlaceholder).
|
|
4396
|
+
{
|
|
4397
|
+
latexTrigger: [".", ".", "."],
|
|
4398
|
+
kind: "infix",
|
|
4399
|
+
precedence: 800,
|
|
4400
|
+
parse: parseRange
|
|
4401
|
+
},
|
|
4402
|
+
{
|
|
4403
|
+
latexTrigger: ["\\ldots"],
|
|
4404
|
+
kind: "infix",
|
|
4405
|
+
precedence: 800,
|
|
4406
|
+
parse: parseRange
|
|
4407
|
+
},
|
|
4408
|
+
{
|
|
4409
|
+
latexTrigger: ["\\dots"],
|
|
4410
|
+
kind: "infix",
|
|
4411
|
+
precedence: 800,
|
|
4412
|
+
parse: parseRange
|
|
4413
|
+
},
|
|
4301
4414
|
{
|
|
4302
4415
|
latexTrigger: [";"],
|
|
4303
4416
|
kind: "infix",
|
|
@@ -4482,13 +4595,24 @@ var LatexSyntax = (() => {
|
|
|
4482
4595
|
const args = operands(expr);
|
|
4483
4596
|
if (!args || args.length < 2) return "";
|
|
4484
4597
|
const body = args[0];
|
|
4485
|
-
const
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4598
|
+
const elements = args.slice(1);
|
|
4599
|
+
const allElements = elements.every((e) => operator(e) === "Element");
|
|
4600
|
+
if (!allElements) {
|
|
4601
|
+
return joinLatex([
|
|
4602
|
+
"\\operatorname{Loop}(",
|
|
4603
|
+
serializer.serialize(body),
|
|
4604
|
+
", ",
|
|
4605
|
+
serializer.serialize(elements[0]),
|
|
4606
|
+
")"
|
|
4607
|
+
]);
|
|
4608
|
+
}
|
|
4609
|
+
if (elements.length === 1) {
|
|
4610
|
+
const elem = elements[0];
|
|
4611
|
+
const index = operand(elem, 1);
|
|
4612
|
+
const coll = operand(elem, 2);
|
|
4613
|
+
if (operator(coll) === "Range") {
|
|
4614
|
+
const lo = operand(coll, 1);
|
|
4615
|
+
const hi = operand(coll, 2);
|
|
4492
4616
|
return joinLatex([
|
|
4493
4617
|
"\\text{for }",
|
|
4494
4618
|
serializer.serialize(index),
|
|
@@ -4500,13 +4624,27 @@ var LatexSyntax = (() => {
|
|
|
4500
4624
|
serializer.serialize(body)
|
|
4501
4625
|
]);
|
|
4502
4626
|
}
|
|
4627
|
+
return joinLatex([
|
|
4628
|
+
serializer.serialize(body),
|
|
4629
|
+
" \\operatorname{for} ",
|
|
4630
|
+
serializer.serialize(index),
|
|
4631
|
+
" = ",
|
|
4632
|
+
serializer.serialize(coll)
|
|
4633
|
+
]);
|
|
4503
4634
|
}
|
|
4635
|
+
const bindings = elements.map((elem) => {
|
|
4636
|
+
const name = operand(elem, 1);
|
|
4637
|
+
const coll = operand(elem, 2);
|
|
4638
|
+
return joinLatex([
|
|
4639
|
+
serializer.serialize(name),
|
|
4640
|
+
" = ",
|
|
4641
|
+
serializer.serialize(coll)
|
|
4642
|
+
]);
|
|
4643
|
+
}).join(", ");
|
|
4504
4644
|
return joinLatex([
|
|
4505
|
-
"\\operatorname{Loop}(",
|
|
4506
4645
|
serializer.serialize(body),
|
|
4507
|
-
"
|
|
4508
|
-
|
|
4509
|
-
")"
|
|
4646
|
+
" \\operatorname{for} ",
|
|
4647
|
+
bindings
|
|
4510
4648
|
]);
|
|
4511
4649
|
}
|
|
4512
4650
|
},
|
|
@@ -4539,6 +4677,18 @@ var LatexSyntax = (() => {
|
|
|
4539
4677
|
precedence: 245,
|
|
4540
4678
|
parse: (parser, until) => parseForExpression(parser, until)
|
|
4541
4679
|
},
|
|
4680
|
+
// \operatorname{for} as postfix infix (list comprehension):
|
|
4681
|
+
// `body \operatorname{for} x = L_1, y = L_2`
|
|
4682
|
+
// Precedence 19 — just below comma (20) so the body is allowed to use
|
|
4683
|
+
// any operator (including comma sequencing) up to the keyword, and the
|
|
4684
|
+
// bindings can be comma-separated below us.
|
|
4685
|
+
{
|
|
4686
|
+
symbolTrigger: "for",
|
|
4687
|
+
kind: "infix",
|
|
4688
|
+
associativity: "none",
|
|
4689
|
+
precedence: 19,
|
|
4690
|
+
parse: (parser, lhs, until) => parseForComprehension(parser, lhs, until)
|
|
4691
|
+
},
|
|
4542
4692
|
// \operatorname{break}
|
|
4543
4693
|
{
|
|
4544
4694
|
symbolTrigger: "break",
|
|
@@ -4743,7 +4893,10 @@ var LatexSyntax = (() => {
|
|
|
4743
4893
|
if (!sym || !parser.getSymbolType(sym).matches("function")) return null;
|
|
4744
4894
|
parser.addBoundary([")"]);
|
|
4745
4895
|
const expr = parser.parseExpression(until);
|
|
4746
|
-
if (!parser.matchBoundary())
|
|
4896
|
+
if (!parser.matchBoundary()) {
|
|
4897
|
+
parser.removeBoundary();
|
|
4898
|
+
return null;
|
|
4899
|
+
}
|
|
4747
4900
|
if (!parser.match("<}>")) return null;
|
|
4748
4901
|
return ["Derivative", lhs, expr];
|
|
4749
4902
|
}
|
|
@@ -5184,7 +5337,12 @@ var LatexSyntax = (() => {
|
|
|
5184
5337
|
if (isEmptySequence(body)) return ["List"];
|
|
5185
5338
|
const h = operator(body);
|
|
5186
5339
|
if (h === "Range" || h === "Linspace") return body;
|
|
5187
|
-
if (h === "Sequence")
|
|
5340
|
+
if (h === "Sequence") {
|
|
5341
|
+
const elems = operands(body);
|
|
5342
|
+
const inferred = tryInferRangeFromElements(elems, parser);
|
|
5343
|
+
if (inferred) return inferred;
|
|
5344
|
+
return ["List", ...elems];
|
|
5345
|
+
}
|
|
5188
5346
|
if (h === "Delimiter") {
|
|
5189
5347
|
const delim = stringValue(operand(body, 2)) ?? "...";
|
|
5190
5348
|
if (delim === ";" || delim === ".;.") {
|
|
@@ -5197,12 +5355,37 @@ var LatexSyntax = (() => {
|
|
|
5197
5355
|
}
|
|
5198
5356
|
if (delim === "," || delim === ".,.") {
|
|
5199
5357
|
body = operand(body, 1);
|
|
5200
|
-
if (operator(body) === "Sequence")
|
|
5358
|
+
if (operator(body) === "Sequence") {
|
|
5359
|
+
const elems = operands(body);
|
|
5360
|
+
const inferred = tryInferRangeFromElements(elems, parser);
|
|
5361
|
+
if (inferred) return inferred;
|
|
5362
|
+
return ["List", ...elems];
|
|
5363
|
+
}
|
|
5201
5364
|
return ["List", body ?? "Nothing"];
|
|
5202
5365
|
}
|
|
5203
5366
|
}
|
|
5204
5367
|
return ["List", body];
|
|
5205
5368
|
}
|
|
5369
|
+
function tryInferRangeFromElements(elems, parser) {
|
|
5370
|
+
if (elems.length < 4) return null;
|
|
5371
|
+
const penultimate = elems[elems.length - 2];
|
|
5372
|
+
if (symbol(penultimate) !== "ContinuationPlaceholder") return null;
|
|
5373
|
+
const samples = elems.slice(0, -2);
|
|
5374
|
+
const endExpr = elems[elems.length - 1];
|
|
5375
|
+
if (samples.length < 2) return null;
|
|
5376
|
+
const sampleNums = samples.map(machineValue);
|
|
5377
|
+
if (sampleNums.some((n) => n === null)) return null;
|
|
5378
|
+
const nums = sampleNums;
|
|
5379
|
+
const step = nums[nums.length - 1] - nums[nums.length - 2];
|
|
5380
|
+
const tol = parser.options.tolerance;
|
|
5381
|
+
if (Math.abs(step) < tol)
|
|
5382
|
+
return parser.error("degenerate-range-step", parser.index);
|
|
5383
|
+
for (let i = 1; i < nums.length; i++) {
|
|
5384
|
+
if (Math.abs(nums[i] - nums[i - 1] - step) > tol)
|
|
5385
|
+
return parser.error("inconsistent-range-samples", parser.index);
|
|
5386
|
+
}
|
|
5387
|
+
return ["Range", nums[0], endExpr, step];
|
|
5388
|
+
}
|
|
5206
5389
|
function serializeList(serializer, expr) {
|
|
5207
5390
|
if (nops(expr) > 1 && operands(expr).every((x) => {
|
|
5208
5391
|
const op = operator(x);
|
|
@@ -5454,6 +5637,35 @@ var LatexSyntax = (() => {
|
|
|
5454
5637
|
["Element", index, ["Range", lower, upper]]
|
|
5455
5638
|
];
|
|
5456
5639
|
}
|
|
5640
|
+
function parseForComprehension(parser, lhs, until) {
|
|
5641
|
+
const bindingTerminator = {
|
|
5642
|
+
minPrec: 21,
|
|
5643
|
+
// Above comma (20) and ; (19), so `x = L_1` is captured whole
|
|
5644
|
+
condition: (p) => {
|
|
5645
|
+
if (until?.condition?.(p)) return true;
|
|
5646
|
+
const saved = p.index;
|
|
5647
|
+
p.skipVisualSpace();
|
|
5648
|
+
const isComma = p.peek === ",";
|
|
5649
|
+
p.index = saved;
|
|
5650
|
+
return isComma;
|
|
5651
|
+
}
|
|
5652
|
+
};
|
|
5653
|
+
const elements = [];
|
|
5654
|
+
do {
|
|
5655
|
+
parser.skipVisualSpace();
|
|
5656
|
+
const binding = parser.parseExpression(bindingTerminator);
|
|
5657
|
+
if (binding === null) break;
|
|
5658
|
+
const op = operator(binding);
|
|
5659
|
+
if (op !== "Equal" && op !== "Assign") return null;
|
|
5660
|
+
const name = operand(binding, 1);
|
|
5661
|
+
const list = operand(binding, 2);
|
|
5662
|
+
if (!name || !list) return null;
|
|
5663
|
+
elements.push(["Element", name, list]);
|
|
5664
|
+
parser.skipVisualSpace();
|
|
5665
|
+
} while (parser.match(","));
|
|
5666
|
+
if (elements.length === 0) return null;
|
|
5667
|
+
return ["Loop", lhs, ...elements];
|
|
5668
|
+
}
|
|
5457
5669
|
function parseWhereExpression(parser, lhs, until) {
|
|
5458
5670
|
const bindingTerminator = {
|
|
5459
5671
|
minPrec: 21,
|
|
@@ -14510,6 +14722,19 @@ var LatexSyntax = (() => {
|
|
|
14510
14722
|
} while (postfix !== null);
|
|
14511
14723
|
}
|
|
14512
14724
|
if (result !== null) result = this.parseSupsub(result);
|
|
14725
|
+
if (result !== null) {
|
|
14726
|
+
let postfix = null;
|
|
14727
|
+
let index = this.index;
|
|
14728
|
+
do {
|
|
14729
|
+
postfix = this.parsePostfixOperator(result, until);
|
|
14730
|
+
result = postfix ?? result;
|
|
14731
|
+
if (this.index === index && postfix !== null) {
|
|
14732
|
+
console.assert(this.index !== index, "No token consumed");
|
|
14733
|
+
break;
|
|
14734
|
+
}
|
|
14735
|
+
index = this.index;
|
|
14736
|
+
} while (postfix !== null);
|
|
14737
|
+
}
|
|
14513
14738
|
if (result === null) {
|
|
14514
14739
|
result = this.options.parseUnexpectedToken?.(null, this) ?? null;
|
|
14515
14740
|
if (result === null && this.peek.startsWith("\\")) {
|
|
@@ -15018,6 +15243,28 @@ var LatexSyntax = (() => {
|
|
|
15018
15243
|
}
|
|
15019
15244
|
|
|
15020
15245
|
// src/compute-engine/latex-syntax/serializer.ts
|
|
15246
|
+
var DOT_NOTATION_MAP = {
|
|
15247
|
+
First: ".x",
|
|
15248
|
+
Second: ".y",
|
|
15249
|
+
Third: ".z",
|
|
15250
|
+
Real: ".\\operatorname{real}",
|
|
15251
|
+
Imaginary: ".\\operatorname{imag}",
|
|
15252
|
+
Length: ".\\operatorname{count}",
|
|
15253
|
+
Sum: ".\\operatorname{total}",
|
|
15254
|
+
Max: ".\\max",
|
|
15255
|
+
Min: ".\\min"
|
|
15256
|
+
};
|
|
15257
|
+
function trySerializeDotNotation(serializer, expr) {
|
|
15258
|
+
if (!serializer.options.dotNotation) return null;
|
|
15259
|
+
const ops = operands(expr);
|
|
15260
|
+
if (!ops || ops.length !== 1) return null;
|
|
15261
|
+
const head = operator(expr);
|
|
15262
|
+
if (!head) return null;
|
|
15263
|
+
const suffix = DOT_NOTATION_MAP[head];
|
|
15264
|
+
if (suffix === void 0) return null;
|
|
15265
|
+
const lhs = serializer.wrap(ops[0], 810);
|
|
15266
|
+
return `${lhs}${suffix}`;
|
|
15267
|
+
}
|
|
15021
15268
|
var ACCENT_MODIFIERS = {
|
|
15022
15269
|
deg: (s) => `${s}\\degree`,
|
|
15023
15270
|
prime: (s) => `${s}^{\\prime}`,
|
|
@@ -15061,6 +15308,7 @@ var LatexSyntax = (() => {
|
|
|
15061
15308
|
constructor(dictionary, options) {
|
|
15062
15309
|
this.dictionary = dictionary;
|
|
15063
15310
|
this.options = {
|
|
15311
|
+
dotNotation: false,
|
|
15064
15312
|
dmsFormat: false,
|
|
15065
15313
|
angleNormalization: "none",
|
|
15066
15314
|
...options
|
|
@@ -15159,6 +15407,8 @@ var LatexSyntax = (() => {
|
|
|
15159
15407
|
return def?.serialize?.(this, expr) ?? serializeSymbol(symbol(expr)) ?? "";
|
|
15160
15408
|
}
|
|
15161
15409
|
serializeFunction(expr, def) {
|
|
15410
|
+
const dotResult = trySerializeDotNotation(this, expr);
|
|
15411
|
+
if (dotResult !== null) return dotResult;
|
|
15162
15412
|
if (def?.serialize) return def.serialize(this, expr);
|
|
15163
15413
|
const h = operator(expr);
|
|
15164
15414
|
return serializeSymbol(h, "auto") + this.wrapArguments(expr);
|
|
@@ -15401,6 +15651,8 @@ var LatexSyntax = (() => {
|
|
|
15401
15651
|
preserveLatex: opts.preserveLatex ?? false,
|
|
15402
15652
|
quantifierScope: opts.quantifierScope ?? "tight",
|
|
15403
15653
|
timeDerivativeVariable: opts.timeDerivativeVariable ?? "t",
|
|
15654
|
+
// Standalone mode has no engine; use the same default as ComputeEngine
|
|
15655
|
+
tolerance: 1e-7,
|
|
15404
15656
|
// Callbacks -- standalone mode has no engine, so these are stubs
|
|
15405
15657
|
getSymbolType: (_id) => BoxedType.unknown,
|
|
15406
15658
|
hasSubscriptEvaluate: (_id) => false,
|
|
@@ -15433,6 +15685,7 @@ var LatexSyntax = (() => {
|
|
|
15433
15685
|
invisiblePlus: "",
|
|
15434
15686
|
multiply: "\\times",
|
|
15435
15687
|
missingSymbol: "\\blacksquare",
|
|
15688
|
+
dotNotation: false,
|
|
15436
15689
|
dmsFormat: false,
|
|
15437
15690
|
angleNormalization: "none",
|
|
15438
15691
|
// Style callbacks -- use same defaults as the engine
|
|
@@ -15501,7 +15754,7 @@ var LatexSyntax = (() => {
|
|
|
15501
15754
|
}
|
|
15502
15755
|
|
|
15503
15756
|
// src/latex-syntax.ts
|
|
15504
|
-
var version = "0.
|
|
15757
|
+
var version = "0.57.0";
|
|
15505
15758
|
return __toCommonJS(latex_syntax_exports);
|
|
15506
15759
|
})();
|
|
15507
15760
|
Object.assign(exports, LatexSyntax); Object.defineProperty(exports, '__esModule', { value: true });}));
|
package/dist/math-json.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.
|
|
1
|
+
/** Compute Engine 0.57.0 */
|
|
2
2
|
|
|
3
3
|
// src/math-json/utils.ts
|
|
4
4
|
function isNumberObject(expr) {
|
|
@@ -115,7 +115,7 @@ function expressionToDictionaryValue(expr) {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// src/math-json.ts
|
|
118
|
-
var version = "0.
|
|
118
|
+
var version = "0.57.0";
|
|
119
119
|
export {
|
|
120
120
|
dictionaryFromExpression,
|
|
121
121
|
isFunctionObject,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** Compute Engine 0.
|
|
2
|
-
function b(n){return n!==null&&typeof n=="object"&&"num"in n}function s(n){return n!==null&&typeof n=="object"&&"sym"in n}function f(n){return n!==null&&typeof n=="object"&&"str"in n}function M(n){return n!==null&&typeof n=="object"&&"dict"in n&&typeof n.dict=="object"&&!Array.isArray(n.dict)&&n.dict!==null}function r(n){return n!==null&&typeof n=="object"&&"fn"in n&&Array.isArray(n.fn)&&n.fn.length>0&&typeof n.fn[0]=="string"}function c(n){return n==null?null:typeof n=="object"&&"str"in n?n.str:typeof n!="string"?null:n.length>=2&&n.at(0)==="'"&&n.at(-1)==="'"?n.substring(1,n.length-1):j(n)||y(n)?null:n}function l(n){return Array.isArray(n)?n[0]:n==null?"":r(n)?n.fn[0]:""}function h(n){return Array.isArray(n)?n.slice(1):n!==void 0&&r(n)?n.fn.slice(1):[]}function d(n,t){return Array.isArray(n)?n[t]??null:n===null||!r(n)?null:n.fn[t]??null}function J(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function m(n){return typeof n=="string"&&y(n)?n.length>=2&&n.at(0)==="`"&&n.at(-1)==="`"?n.slice(1,-1):n:n==null?null:s(n)?n.sym:null}function a(n){let t=l(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let[i,o]=h(n),e=c(i);return e?[e,o??"Nothing"]:null}return null}function E(n){if(n===null)return null;if(M(n))return n;let t=a(n);if(t)return{[t[0]]:t[1]};if(l(n)==="Dictionary"){let i={},o=h(n);for(let e=1;e<J(n);e++){let u=a(o[e]);u&&(i[u[0]]=O(u[1])??"Nothing")}return{dict:i}}return null}function g(n,t){let i=null;if(Array.isArray(n)&&(i=n),r(n)&&(i=n.fn),i===null)return[];let o=1,e=[];for(;o<i.length;)e.push(t(i[o])),o+=1;return e}function j(n){return/^(nan|oo|\+oo|-oo|infinity|\+infinity|-infinity)$/i.test(n)||/^[+-]?(0|[1-9][0-9]*)(\.[0-9]+)?(\([0-9]+\))?([eE][+-]?[0-9]+)?$/.test(n)}function y(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||n.length>=2&&n[0]==="`"&&n[n.length-1]==="`"}function O(n){return n==null?null:f(n)?n.str:b(n)?parseFloat(n.num):s(n)?n.sym:typeof n=="string"||typeof n=="number"?n:Array.isArray(n)?{fn:n}:n}var S="0.
|
|
1
|
+
/** Compute Engine 0.57.0 */
|
|
2
|
+
function b(n){return n!==null&&typeof n=="object"&&"num"in n}function s(n){return n!==null&&typeof n=="object"&&"sym"in n}function f(n){return n!==null&&typeof n=="object"&&"str"in n}function M(n){return n!==null&&typeof n=="object"&&"dict"in n&&typeof n.dict=="object"&&!Array.isArray(n.dict)&&n.dict!==null}function r(n){return n!==null&&typeof n=="object"&&"fn"in n&&Array.isArray(n.fn)&&n.fn.length>0&&typeof n.fn[0]=="string"}function c(n){return n==null?null:typeof n=="object"&&"str"in n?n.str:typeof n!="string"?null:n.length>=2&&n.at(0)==="'"&&n.at(-1)==="'"?n.substring(1,n.length-1):j(n)||y(n)?null:n}function l(n){return Array.isArray(n)?n[0]:n==null?"":r(n)?n.fn[0]:""}function h(n){return Array.isArray(n)?n.slice(1):n!==void 0&&r(n)?n.fn.slice(1):[]}function d(n,t){return Array.isArray(n)?n[t]??null:n===null||!r(n)?null:n.fn[t]??null}function J(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function m(n){return typeof n=="string"&&y(n)?n.length>=2&&n.at(0)==="`"&&n.at(-1)==="`"?n.slice(1,-1):n:n==null?null:s(n)?n.sym:null}function a(n){let t=l(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let[i,o]=h(n),e=c(i);return e?[e,o??"Nothing"]:null}return null}function E(n){if(n===null)return null;if(M(n))return n;let t=a(n);if(t)return{[t[0]]:t[1]};if(l(n)==="Dictionary"){let i={},o=h(n);for(let e=1;e<J(n);e++){let u=a(o[e]);u&&(i[u[0]]=O(u[1])??"Nothing")}return{dict:i}}return null}function g(n,t){let i=null;if(Array.isArray(n)&&(i=n),r(n)&&(i=n.fn),i===null)return[];let o=1,e=[];for(;o<i.length;)e.push(t(i[o])),o+=1;return e}function j(n){return/^(nan|oo|\+oo|-oo|infinity|\+infinity|-infinity)$/i.test(n)||/^[+-]?(0|[1-9][0-9]*)(\.[0-9]+)?(\([0-9]+\))?([eE][+-]?[0-9]+)?$/.test(n)}function y(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||n.length>=2&&n[0]==="`"&&n[n.length-1]==="`"}function O(n){return n==null?null:f(n)?n.str:b(n)?parseFloat(n.num):s(n)?n.sym:typeof n=="string"||typeof n=="number"?n:Array.isArray(n)?{fn:n}:n}var S="0.57.0";export{E as dictionaryFromExpression,r as isFunctionObject,f as isStringObject,s as isSymbolObject,g as mapArgs,d as operand,l as operator,c as stringValue,m as symbol,S as version};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** MathJSON 0.
|
|
1
|
+
/** MathJSON 0.57.0 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MathJson = {}));})(this, (function (exports) { 'use strict';
|
|
3
|
-
var MathJson=(()=>{var a=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var O=(n,t)=>{for(var i in t)a(n,i,{get:t[i],enumerable:!0})},A=(n,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of g(t))!j.call(n,e)&&e!==i&&a(n,e,{get:()=>t[e],enumerable:!(o=E(t,e))||o.enumerable});return n};var S=n=>A(a({},"__esModule",{value:!0}),n);var T={};O(T,{dictionaryFromExpression:()=>d,isFunctionObject:()=>r,isStringObject:()=>f,isSymbolObject:()=>u,mapArgs:()=>J,operand:()=>b,operator:()=>s,stringValue:()=>c,symbol:()=>M,version:()=>V});function N(n){return n!==null&&typeof n=="object"&&"num"in n}function u(n){return n!==null&&typeof n=="object"&&"sym"in n}function f(n){return n!==null&&typeof n=="object"&&"str"in n}function p(n){return n!==null&&typeof n=="object"&&"dict"in n&&typeof n.dict=="object"&&!Array.isArray(n.dict)&&n.dict!==null}function r(n){return n!==null&&typeof n=="object"&&"fn"in n&&Array.isArray(n.fn)&&n.fn.length>0&&typeof n.fn[0]=="string"}function c(n){return n==null?null:typeof n=="object"&&"str"in n?n.str:typeof n!="string"?null:n.length>=2&&n.at(0)==="'"&&n.at(-1)==="'"?n.substring(1,n.length-1):k(n)||m(n)?null:n}function s(n){return Array.isArray(n)?n[0]:n==null?"":r(n)?n.fn[0]:""}function y(n){return Array.isArray(n)?n.slice(1):n!==void 0&&r(n)?n.fn.slice(1):[]}function b(n,t){return Array.isArray(n)?n[t]??null:n===null||!r(n)?null:n.fn[t]??null}function D(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function M(n){return typeof n=="string"&&m(n)?n.length>=2&&n.at(0)==="`"&&n.at(-1)==="`"?n.slice(1,-1):n:n==null?null:u(n)?n.sym:null}function h(n){let t=s(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let[i,o]=y(n),e=c(i);return e?[e,o??"Nothing"]:null}return null}function d(n){if(n===null)return null;if(p(n))return n;let t=h(n);if(t)return{[t[0]]:t[1]};if(s(n)==="Dictionary"){let i={},o=y(n);for(let e=1;e<D(n);e++){let l=h(o[e]);l&&(i[l[0]]=F(l[1])??"Nothing")}return{dict:i}}return null}function J(n,t){let i=null;if(Array.isArray(n)&&(i=n),r(n)&&(i=n.fn),i===null)return[];let o=1,e=[];for(;o<i.length;)e.push(t(i[o])),o+=1;return e}function k(n){return/^(nan|oo|\+oo|-oo|infinity|\+infinity|-infinity)$/i.test(n)||/^[+-]?(0|[1-9][0-9]*)(\.[0-9]+)?(\([0-9]+\))?([eE][+-]?[0-9]+)?$/.test(n)}function m(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||n.length>=2&&n[0]==="`"&&n[n.length-1]==="`"}function F(n){return n==null?null:f(n)?n.str:N(n)?parseFloat(n.num):u(n)?n.sym:typeof n=="string"||typeof n=="number"?n:Array.isArray(n)?{fn:n}:n}var V="0.
|
|
3
|
+
var MathJson=(()=>{var a=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var O=(n,t)=>{for(var i in t)a(n,i,{get:t[i],enumerable:!0})},A=(n,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of g(t))!j.call(n,e)&&e!==i&&a(n,e,{get:()=>t[e],enumerable:!(o=E(t,e))||o.enumerable});return n};var S=n=>A(a({},"__esModule",{value:!0}),n);var T={};O(T,{dictionaryFromExpression:()=>d,isFunctionObject:()=>r,isStringObject:()=>f,isSymbolObject:()=>u,mapArgs:()=>J,operand:()=>b,operator:()=>s,stringValue:()=>c,symbol:()=>M,version:()=>V});function N(n){return n!==null&&typeof n=="object"&&"num"in n}function u(n){return n!==null&&typeof n=="object"&&"sym"in n}function f(n){return n!==null&&typeof n=="object"&&"str"in n}function p(n){return n!==null&&typeof n=="object"&&"dict"in n&&typeof n.dict=="object"&&!Array.isArray(n.dict)&&n.dict!==null}function r(n){return n!==null&&typeof n=="object"&&"fn"in n&&Array.isArray(n.fn)&&n.fn.length>0&&typeof n.fn[0]=="string"}function c(n){return n==null?null:typeof n=="object"&&"str"in n?n.str:typeof n!="string"?null:n.length>=2&&n.at(0)==="'"&&n.at(-1)==="'"?n.substring(1,n.length-1):k(n)||m(n)?null:n}function s(n){return Array.isArray(n)?n[0]:n==null?"":r(n)?n.fn[0]:""}function y(n){return Array.isArray(n)?n.slice(1):n!==void 0&&r(n)?n.fn.slice(1):[]}function b(n,t){return Array.isArray(n)?n[t]??null:n===null||!r(n)?null:n.fn[t]??null}function D(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):r(n)?Math.max(0,n.fn.length-1):0}function M(n){return typeof n=="string"&&m(n)?n.length>=2&&n.at(0)==="`"&&n.at(-1)==="`"?n.slice(1,-1):n:n==null?null:u(n)?n.sym:null}function h(n){let t=s(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let[i,o]=y(n),e=c(i);return e?[e,o??"Nothing"]:null}return null}function d(n){if(n===null)return null;if(p(n))return n;let t=h(n);if(t)return{[t[0]]:t[1]};if(s(n)==="Dictionary"){let i={},o=y(n);for(let e=1;e<D(n);e++){let l=h(o[e]);l&&(i[l[0]]=F(l[1])??"Nothing")}return{dict:i}}return null}function J(n,t){let i=null;if(Array.isArray(n)&&(i=n),r(n)&&(i=n.fn),i===null)return[];let o=1,e=[];for(;o<i.length;)e.push(t(i[o])),o+=1;return e}function k(n){return/^(nan|oo|\+oo|-oo|infinity|\+infinity|-infinity)$/i.test(n)||/^[+-]?(0|[1-9][0-9]*)(\.[0-9]+)?(\([0-9]+\))?([eE][+-]?[0-9]+)?$/.test(n)}function m(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||n.length>=2&&n[0]==="`"&&n[n.length-1]==="`"}function F(n){return n==null?null:f(n)?n.str:N(n)?parseFloat(n.num):u(n)?n.sym:typeof n=="string"||typeof n=="number"?n:Array.isArray(n)?{fn:n}:n}var V="0.57.0";return S(T);})();
|
|
4
4
|
Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
|
package/dist/math-json.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** MathJSON 0.
|
|
1
|
+
/** MathJSON 0.57.0 */
|
|
2
2
|
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MathJson = {}));})(this, (function (exports) { 'use strict';
|
|
3
3
|
var MathJson = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -149,7 +149,7 @@ var MathJson = (() => {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
// src/math-json.ts
|
|
152
|
-
var version = "0.
|
|
152
|
+
var version = "0.57.0";
|
|
153
153
|
return __toCommonJS(math_json_exports);
|
|
154
154
|
})();
|
|
155
155
|
Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
|
package/dist/numerics.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.
|
|
1
|
+
/** Compute Engine 0.57.0 */
|
|
2
2
|
|
|
3
3
|
// src/compute-engine/numeric-value/types.ts
|
|
4
4
|
var NumericValue = class {
|
|
@@ -8475,7 +8475,7 @@ function gammaln2(c) {
|
|
|
8475
8475
|
}
|
|
8476
8476
|
|
|
8477
8477
|
// src/numerics.ts
|
|
8478
|
-
var version = "0.
|
|
8478
|
+
var version = "0.57.0";
|
|
8479
8479
|
export {
|
|
8480
8480
|
BigNumericValue,
|
|
8481
8481
|
DEFAULT_PRECISION,
|