@cortex-js/compute-engine 0.35.3 → 0.35.5

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.
Files changed (177) hide show
  1. package/dist/compute-engine.esm.js +129 -40
  2. package/dist/compute-engine.min.esm.js +49 -34
  3. package/dist/compute-engine.min.umd.js +49 -34
  4. package/dist/compute-engine.umd.js +129 -40
  5. package/dist/math-json.esm.js +2 -2
  6. package/dist/math-json.min.esm.js +2 -2
  7. package/dist/math-json.min.umd.js +2 -2
  8. package/dist/math-json.umd.js +2 -2
  9. package/dist/types/common/ansi-codes.d.ts +1 -1
  10. package/dist/types/common/configuration-change.d.ts +1 -1
  11. package/dist/types/common/fuzzy-string-match.d.ts +1 -1
  12. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  13. package/dist/types/common/interruptible.d.ts +1 -1
  14. package/dist/types/common/one-of.d.ts +1 -1
  15. package/dist/types/common/signals.d.ts +1 -1
  16. package/dist/types/common/type/ast-nodes.d.ts +1 -1
  17. package/dist/types/common/type/boxed-type.d.ts +1 -1
  18. package/dist/types/common/type/lexer.d.ts +1 -1
  19. package/dist/types/common/type/parse.d.ts +1 -1
  20. package/dist/types/common/type/parser.d.ts +1 -1
  21. package/dist/types/common/type/primitive.d.ts +1 -1
  22. package/dist/types/common/type/reduce.d.ts +1 -1
  23. package/dist/types/common/type/serialize.d.ts +1 -1
  24. package/dist/types/common/type/subtype.d.ts +1 -1
  25. package/dist/types/common/type/type-builder.d.ts +1 -1
  26. package/dist/types/common/type/types.d.ts +1 -1
  27. package/dist/types/common/type/utils.d.ts +1 -1
  28. package/dist/types/common/utils.d.ts +1 -1
  29. package/dist/types/compute-engine/assume.d.ts +1 -1
  30. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
  31. package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
  32. package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
  33. package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
  34. package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
  35. package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
  36. package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
  37. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
  38. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
  39. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
  40. package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +1 -1
  41. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
  42. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
  43. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
  44. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
  45. package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
  46. package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
  47. package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
  48. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
  49. package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
  50. package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
  51. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  52. package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
  53. package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
  54. package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
  55. package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
  56. package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
  57. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
  58. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  59. package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
  60. package/dist/types/compute-engine/boxed-expression/product.d.ts +1 -1
  61. package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
  62. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
  63. package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
  64. package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
  65. package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
  66. package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
  67. package/dist/types/compute-engine/boxed-expression/terms.d.ts +1 -1
  68. package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
  69. package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
  70. package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
  71. package/dist/types/compute-engine/collection-utils.d.ts +1 -1
  72. package/dist/types/compute-engine/compilation/base-compiler.d.ts +1 -1
  73. package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
  74. package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +1 -1
  75. package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +1 -1
  76. package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
  77. package/dist/types/compute-engine/compilation/types.d.ts +1 -1
  78. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  79. package/dist/types/compute-engine/function-utils.d.ts +1 -1
  80. package/dist/types/compute-engine/global-types.d.ts +1 -1
  81. package/dist/types/compute-engine/index.d.ts +1 -1
  82. package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
  83. package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
  84. package/dist/types/compute-engine/interval/elementary.d.ts +1 -1
  85. package/dist/types/compute-engine/interval/index.d.ts +1 -1
  86. package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
  87. package/dist/types/compute-engine/interval/types.d.ts +2 -1
  88. package/dist/types/compute-engine/interval/util.d.ts +1 -1
  89. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  90. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  91. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  92. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  93. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  94. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  95. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  96. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  97. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
  98. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  99. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  100. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  101. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  102. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
  103. package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
  104. package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
  105. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  106. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
  107. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
  108. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  109. package/dist/types/compute-engine/latex-syntax/types.d.ts +1 -1
  110. package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
  111. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  112. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  113. package/dist/types/compute-engine/library/collections.d.ts +1 -1
  114. package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
  115. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  116. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  117. package/dist/types/compute-engine/library/core.d.ts +1 -1
  118. package/dist/types/compute-engine/library/invisible-operator.d.ts +1 -1
  119. package/dist/types/compute-engine/library/library.d.ts +1 -1
  120. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  121. package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
  122. package/dist/types/compute-engine/library/logic-utils.d.ts +1 -1
  123. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  124. package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
  125. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  126. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  127. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  128. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  129. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  130. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  131. package/dist/types/compute-engine/library/utils.d.ts +1 -1
  132. package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
  133. package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
  134. package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
  135. package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
  136. package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
  137. package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
  138. package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
  139. package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
  140. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  141. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  142. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  143. package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
  144. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  145. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
  146. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  147. package/dist/types/compute-engine/numerics/special-functions.d.ts +1 -1
  148. package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
  149. package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
  150. package/dist/types/compute-engine/numerics/types.d.ts +1 -1
  151. package/dist/types/compute-engine/oeis.d.ts +1 -1
  152. package/dist/types/compute-engine/sequence.d.ts +1 -1
  153. package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
  154. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  155. package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
  156. package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
  157. package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
  158. package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
  159. package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
  160. package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
  161. package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
  162. package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
  163. package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
  164. package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
  165. package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
  166. package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
  167. package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
  168. package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
  169. package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
  170. package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
  171. package/dist/types/compute-engine/types.d.ts +1 -1
  172. package/dist/types/compute-engine.d.ts +1 -1
  173. package/dist/types/math-json/symbols.d.ts +1 -1
  174. package/dist/types/math-json/types.d.ts +1 -1
  175. package/dist/types/math-json/utils.d.ts +1 -1
  176. package/dist/types/math-json.d.ts +2 -2
  177. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /** Compute Engine 0.35.3 */
1
+ /** Compute Engine 0.35.5 */
2
2
  (function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComputeEngine = {}));})(this, (function (exports) { 'use strict';
3
3
  var ComputeEngine = (() => {
4
4
  var __defProp = Object.defineProperty;
@@ -23826,7 +23826,8 @@ ${e.message}`);
23826
23826
  }
23827
23827
  if (type2.kind === "list" || type2.kind === "set" || type2.kind === "tuple")
23828
23828
  return true;
23829
- if (type2.kind === "union") return type2.types.some((t) => typeCouldBeCollection(t));
23829
+ if (type2.kind === "union")
23830
+ return type2.types.some((t) => typeCouldBeCollection(t));
23830
23831
  return false;
23831
23832
  }
23832
23833
  function typeCouldBeNumericCollection(type2) {
@@ -24634,6 +24635,16 @@ ${lines.join("\n")}`;
24634
24635
  return engine.function("Power", [engine.E, ...args]);
24635
24636
  }
24636
24637
  },
24638
+ Exp2: {
24639
+ description: "Base-2 exponential: 2^x",
24640
+ complexity: 3500,
24641
+ broadcastable: true,
24642
+ signature: "(number) -> number",
24643
+ canonical: (args, { engine }) => {
24644
+ args = checkNumericArgs(engine, args, 1);
24645
+ return engine.function("Power", [engine.number(2), ...args]);
24646
+ }
24647
+ },
24637
24648
  Factorial: {
24638
24649
  description: "Factorial function: the product of all positive integers less than or equal to n",
24639
24650
  wikidata: "Q120976",
@@ -24723,6 +24734,22 @@ ${lines.join("\n")}`;
24723
24734
  (z) => z.floor(0)
24724
24735
  )
24725
24736
  },
24737
+ Fract: {
24738
+ description: "Fractional part of a number: x - floor(x)",
24739
+ complexity: 1250,
24740
+ broadcastable: true,
24741
+ signature: "(number) -> number",
24742
+ sgn: ([x]) => {
24743
+ if (x.isNonNegative) return "non-negative";
24744
+ return void 0;
24745
+ },
24746
+ evaluate: ([x]) => apply(
24747
+ x,
24748
+ (x2) => x2 - Math.floor(x2),
24749
+ (x2) => x2.sub(x2.floor()),
24750
+ (z) => z.sub(z.floor(0))
24751
+ )
24752
+ },
24726
24753
  Gamma: {
24727
24754
  wikidata: "Q190573",
24728
24755
  complexity: 8e3,
@@ -24938,6 +24965,22 @@ ${lines.join("\n")}`;
24938
24965
  sgn: ([x]) => lnSign(x),
24939
24966
  canonical: ([x], { engine }) => engine._fn("Log", [x])
24940
24967
  },
24968
+ Log10: {
24969
+ description: "Base-10 Logarithm",
24970
+ complexity: 4100,
24971
+ broadcastable: true,
24972
+ signature: "(number) -> number",
24973
+ sgn: ([x]) => lnSign(x),
24974
+ canonical: ([x], { engine }) => engine._fn("Log", [x])
24975
+ },
24976
+ Log2: {
24977
+ description: "Base-2 Logarithm",
24978
+ complexity: 4100,
24979
+ broadcastable: true,
24980
+ signature: "(number) -> number",
24981
+ sgn: ([x]) => lnSign(x),
24982
+ canonical: ([x], { engine }) => engine._fn("Log", [x, engine.number(2)])
24983
+ },
24941
24984
  Mod: {
24942
24985
  description: "Modulo",
24943
24986
  wikidata: "Q1799665",
@@ -25180,6 +25223,18 @@ ${lines.join("\n")}`;
25180
25223
  },
25181
25224
  evaluate: ([x, n], { numericApproximation }) => root(x, n, { numericApproximation })
25182
25225
  },
25226
+ Remainder: {
25227
+ description: "IEEE remainder: the signed remainder after dividing x by y, with the quotient rounded to the nearest integer",
25228
+ complexity: 2500,
25229
+ broadcastable: true,
25230
+ signature: "(number, number) -> number",
25231
+ evaluate: ([a, b]) => apply2(
25232
+ a,
25233
+ b,
25234
+ (a2, b2) => a2 - b2 * Math.round(a2 / b2),
25235
+ (a2, b2) => a2.sub(b2.mul(a2.div(b2).round()))
25236
+ )
25237
+ },
25183
25238
  Round: {
25184
25239
  complexity: 1250,
25185
25240
  broadcastable: true,
@@ -25311,6 +25366,19 @@ ${lines.join("\n")}`;
25311
25366
  const rest = args.slice(1);
25312
25367
  return canonicalAdd(engine, [first, ...rest.map((x) => x.neg())]);
25313
25368
  }
25369
+ },
25370
+ Truncate: {
25371
+ description: "Rounds a number towards zero (removes the fractional part)",
25372
+ complexity: 1250,
25373
+ broadcastable: true,
25374
+ signature: "(number) -> integer",
25375
+ sgn: ([x]) => x.sgn,
25376
+ evaluate: ([x]) => apply(
25377
+ x,
25378
+ Math.trunc,
25379
+ (x2) => x2.trunc(),
25380
+ (z) => z.trunc(0)
25381
+ )
25314
25382
  }
25315
25383
  },
25316
25384
  {
@@ -32617,7 +32685,7 @@ ${lines.join("\n")}`;
32617
32685
  ]
32618
32686
  ],
32619
32687
  // d/dx ln(Γ(x)) = ψ(x) (digamma function)
32620
- LogGamma: ["Digamma", "_"],
32688
+ GammaLn: ["Digamma", "_"],
32621
32689
  // d/dx ψ(x) = ψ₁(x) (trigamma function)
32622
32690
  // https://en.wikipedia.org/wiki/Trigamma_function
32623
32691
  Digamma: ["Trigamma", "_"],
@@ -35609,8 +35677,7 @@ ${lines.join("\n")}`;
35609
35677
  function multiplyForm(expr) {
35610
35678
  if (!expr.ops) return expr;
35611
35679
  const ops = expr.ops.map(multiplyForm);
35612
- if (expr.operator === "Multiply")
35613
- return canonicalMultiply(expr.engine, ops);
35680
+ if (expr.operator === "Multiply") return canonicalMultiply(expr.engine, ops);
35614
35681
  if (expr.operator === "Negate")
35615
35682
  return canonicalMultiply(expr.engine, [ops[0], expr.engine.NegativeOne]);
35616
35683
  return expr;
@@ -45983,7 +46050,8 @@ Error in definition of "${name}"`,
45983
46050
  return this.numeratorDenominator[1];
45984
46051
  }
45985
46052
  get numeratorDenominator() {
45986
- if (!(this.isCanonical || this.isStructural)) return [this, this.engine.One];
46053
+ if (!(this.isCanonical || this.isStructural))
46054
+ return [this, this.engine.One];
45987
46055
  if (this.isNumber !== true)
45988
46056
  return [this.engine.Nothing, this.engine.Nothing];
45989
46057
  const operator2 = this.operator;
@@ -46021,11 +46089,13 @@ Error in definition of "${name}"`,
46021
46089
  // ALGEBRAIC OPERATIONS
46022
46090
  //
46023
46091
  neg() {
46024
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46092
+ if (!(this.isCanonical || this.isStructural))
46093
+ throw new Error("Not canonical");
46025
46094
  return negate(this);
46026
46095
  }
46027
46096
  inv() {
46028
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46097
+ if (!(this.isCanonical || this.isStructural))
46098
+ throw new Error("Not canonical");
46029
46099
  if (this.isOne) return this;
46030
46100
  if (this.isNegativeOne) return this;
46031
46101
  if (this.operator === "Sqrt") return this.op1.inv().sqrt();
@@ -46046,7 +46116,8 @@ Error in definition of "${name}"`,
46046
46116
  return this.engine._fn("Divide", [this.engine.One, this]);
46047
46117
  }
46048
46118
  abs() {
46049
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46119
+ if (!(this.isCanonical || this.isStructural))
46120
+ throw new Error("Not canonical");
46050
46121
  if (this.operator === "Abs" || this.operator === "Negate") return this;
46051
46122
  if (this.isNonNegative) return this;
46052
46123
  if (this.isNonPositive) return this.neg();
@@ -46054,11 +46125,13 @@ Error in definition of "${name}"`,
46054
46125
  }
46055
46126
  add(rhs) {
46056
46127
  if (rhs === 0) return this;
46057
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46128
+ if (!(this.isCanonical || this.isStructural))
46129
+ throw new Error("Not canonical");
46058
46130
  return add3(this, this.engine.box(rhs));
46059
46131
  }
46060
46132
  mul(rhs) {
46061
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46133
+ if (!(this.isCanonical || this.isStructural))
46134
+ throw new Error("Not canonical");
46062
46135
  if (rhs === 0) return this.engine.Zero;
46063
46136
  if (rhs === 1) return this;
46064
46137
  if (rhs === -1) return this.neg();
@@ -46070,7 +46143,8 @@ Error in definition of "${name}"`,
46070
46143
  return mul3(this, this.engine.box(rhs));
46071
46144
  }
46072
46145
  div(rhs) {
46073
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46146
+ if (!(this.isCanonical || this.isStructural))
46147
+ throw new Error("Not canonical");
46074
46148
  return div2(this, rhs);
46075
46149
  }
46076
46150
  pow(exp3) {
@@ -46136,7 +46210,8 @@ Error in definition of "${name}"`,
46136
46210
  }
46137
46211
  ln(semiBase) {
46138
46212
  const base = semiBase ? this.engine.box(semiBase) : void 0;
46139
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46213
+ if (!(this.isCanonical || this.isStructural))
46214
+ throw new Error("Not canonical");
46140
46215
  if (this.is(0)) return this.engine.NegativeInfinity;
46141
46216
  if (this.operator === "Exp") {
46142
46217
  if (!base) return this.op1;
@@ -51471,7 +51546,7 @@ Error in definition of "${name}"`,
51471
51546
  Arsinh: "Math.asinh",
51472
51547
  Arctan: "Math.atan",
51473
51548
  Artanh: "Math.atanh",
51474
- Ceiling: "Math.ceil",
51549
+ Ceil: "Math.ceil",
51475
51550
  Chop: "_SYS.chop",
51476
51551
  Cos: "Math.cos",
51477
51552
  Cosh: "Math.cosh",
@@ -51501,10 +51576,7 @@ Error in definition of "${name}"`,
51501
51576
  Floor: "Math.floor",
51502
51577
  Fract: ([x], compile) => {
51503
51578
  if (x === null) throw new Error("Fract: no argument");
51504
- return BaseCompiler.inlineExpression(
51505
- "${x} - Math.floor(${x})",
51506
- compile(x)
51507
- );
51579
+ return BaseCompiler.inlineExpression("${x} - Math.floor(${x})", compile(x));
51508
51580
  },
51509
51581
  Gamma: "_SYS.gamma",
51510
51582
  GCD: "_SYS.gcd",
@@ -51517,7 +51589,7 @@ Error in definition of "${name}"`,
51517
51589
  if (args.length === 1) return `Math.log10(${compile(args[0])})`;
51518
51590
  return `(Math.log(${compile(args[0])}) / Math.log(${compile(args[1])}))`;
51519
51591
  },
51520
- LogGamma: "_SYS.lngamma",
51592
+ GammaLn: "_SYS.lngamma",
51521
51593
  Lb: "Math.log2",
51522
51594
  Max: "Math.max",
51523
51595
  Mean: (args, compile) => {
@@ -51646,7 +51718,7 @@ Error in definition of "${name}"`,
51646
51718
  if (arg === null) throw new Error("Sech: no argument");
51647
51719
  return `1 / Math.cosh(${compile(arg)})`;
51648
51720
  },
51649
- Sgn: "Math.sign",
51721
+ Sign: "Math.sign",
51650
51722
  Sin: "Math.sin",
51651
51723
  Sinh: "Math.sinh",
51652
51724
  Sqrt: "Math.sqrt",
@@ -51914,7 +51986,7 @@ Error in definition of "${name}"`,
51914
51986
  Arccos: "acos",
51915
51987
  Arcsin: "asin",
51916
51988
  Arctan: "atan",
51917
- Ceiling: "ceil",
51989
+ Ceil: "ceil",
51918
51990
  Clamp: "clamp",
51919
51991
  Cos: "cos",
51920
51992
  Degrees: "degrees",
@@ -52002,7 +52074,7 @@ Error in definition of "${name}"`,
52002
52074
  return `acosh(1.0 / (${compile(x)}))`;
52003
52075
  },
52004
52076
  // Additional math functions
52005
- Sgn: "sign",
52077
+ // Sign is already registered in the standard functions above
52006
52078
  Lb: "log2",
52007
52079
  Log: (args, compile) => {
52008
52080
  if (args.length === 0) throw new Error("Log: no argument");
@@ -52569,7 +52641,7 @@ Error in definition of "${name}"`,
52569
52641
  const flo = Math.floor(xVal.lo);
52570
52642
  const fhi = Math.floor(xVal.hi);
52571
52643
  if (flo === fhi) return ok({ lo: flo, hi: fhi });
52572
- return { kind: "singular", at: flo + 1 };
52644
+ return { kind: "singular", at: flo + 1, continuity: "right" };
52573
52645
  }
52574
52646
  function ceil2(x) {
52575
52647
  const unwrapped = unwrapOrPropagate(x);
@@ -52578,7 +52650,7 @@ Error in definition of "${name}"`,
52578
52650
  const clo = Math.ceil(xVal.lo);
52579
52651
  const chi = Math.ceil(xVal.hi);
52580
52652
  if (clo === chi) return ok({ lo: clo, hi: chi });
52581
- return { kind: "singular", at: clo };
52653
+ return { kind: "singular", at: clo, continuity: "left" };
52582
52654
  }
52583
52655
  function round2(x) {
52584
52656
  const unwrapped = unwrapOrPropagate(x);
@@ -52587,7 +52659,7 @@ Error in definition of "${name}"`,
52587
52659
  const rlo = Math.round(xVal.lo);
52588
52660
  const rhi = Math.round(xVal.hi);
52589
52661
  if (rlo === rhi) return ok({ lo: rlo, hi: rhi });
52590
- return { kind: "singular", at: rlo + 0.5 };
52662
+ return { kind: "singular", at: rlo + 0.5, continuity: "right" };
52591
52663
  }
52592
52664
  function fract(x) {
52593
52665
  const unwrapped = unwrapOrPropagate(x);
@@ -52598,7 +52670,7 @@ Error in definition of "${name}"`,
52598
52670
  if (flo === fhi) {
52599
52671
  return ok({ lo: xVal.lo - flo, hi: xVal.hi - flo });
52600
52672
  }
52601
- return { kind: "singular", at: flo + 1 };
52673
+ return { kind: "singular", at: flo + 1, continuity: "right" };
52602
52674
  }
52603
52675
  function min2(a, b) {
52604
52676
  const unwrapped = unwrapOrPropagate(a, b);
@@ -52625,11 +52697,13 @@ Error in definition of "${name}"`,
52625
52697
  if (containsZero(bVal)) {
52626
52698
  return { kind: "singular" };
52627
52699
  }
52628
- const period = Math.abs(bVal.lo === bVal.hi ? bVal.lo : Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi)));
52700
+ const period = Math.abs(
52701
+ bVal.lo === bVal.hi ? bVal.lo : Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi))
52702
+ );
52629
52703
  const flo = Math.floor(aVal.lo / period);
52630
52704
  const fhi = Math.floor(aVal.hi / period);
52631
52705
  if (flo !== fhi) {
52632
- return { kind: "singular", at: (flo + 1) * period };
52706
+ return { kind: "singular", at: (flo + 1) * period, continuity: "right" };
52633
52707
  }
52634
52708
  const modLo = aVal.lo - period * flo;
52635
52709
  const modHi = aVal.hi - period * flo;
@@ -53233,7 +53307,7 @@ Error in definition of "${name}"`,
53233
53307
  Negate: (args, compile) => `_IA.negate(${compile(args[0])})`,
53234
53308
  // Elementary functions
53235
53309
  Abs: (args, compile) => `_IA.abs(${compile(args[0])})`,
53236
- Ceiling: (args, compile) => `_IA.ceil(${compile(args[0])})`,
53310
+ Ceil: (args, compile) => `_IA.ceil(${compile(args[0])})`,
53237
53311
  Exp: (args, compile) => `_IA.exp(${compile(args[0])})`,
53238
53312
  Floor: (args, compile) => `_IA.floor(${compile(args[0])})`,
53239
53313
  Ln: (args, compile) => `_IA.ln(${compile(args[0])})`,
@@ -53286,7 +53360,7 @@ Error in definition of "${name}"`,
53286
53360
  return `_IA.powInterval(${compile(arg)}, _IA.div(_IA.point(1), ${compile(exp3)}))`;
53287
53361
  },
53288
53362
  Round: (args, compile) => `_IA.round(${compile(args[0])})`,
53289
- Sgn: (args, compile) => `_IA.sign(${compile(args[0])})`,
53363
+ Sign: (args, compile) => `_IA.sign(${compile(args[0])})`,
53290
53364
  Sqrt: (args, compile) => `_IA.sqrt(${compile(args[0])})`,
53291
53365
  Square: (args, compile) => `_IA.square(${compile(args[0])})`,
53292
53366
  // Trigonometric functions
@@ -53482,6 +53556,8 @@ const float IA_SINGULAR = 3.0;
53482
53556
  const float IA_PARTIAL_LO = 4.0;
53483
53557
  const float IA_PARTIAL_HI = 5.0;
53484
53558
  const float IA_PARTIAL_BOTH = 6.0;
53559
+ const float IA_SINGULAR_RIGHT = 7.0;
53560
+ const float IA_SINGULAR_LEFT = 8.0;
53485
53561
 
53486
53562
  // Interval result struct
53487
53563
  struct IntervalResult {
@@ -53515,12 +53591,20 @@ IntervalResult ia_singular(float at) {
53515
53591
  return IntervalResult(vec2(at, at), IA_SINGULAR);
53516
53592
  }
53517
53593
 
53594
+ IntervalResult ia_singular_right(float at) {
53595
+ return IntervalResult(vec2(at, at), IA_SINGULAR_RIGHT);
53596
+ }
53597
+
53598
+ IntervalResult ia_singular_left(float at) {
53599
+ return IntervalResult(vec2(at, at), IA_SINGULAR_LEFT);
53600
+ }
53601
+
53518
53602
  IntervalResult ia_partial(vec2 v, float clip) {
53519
53603
  return IntervalResult(v, clip);
53520
53604
  }
53521
53605
 
53522
53606
  bool ia_is_error(float status) {
53523
- return status == IA_EMPTY || status == IA_ENTIRE || status == IA_SINGULAR;
53607
+ return status == IA_EMPTY || status == IA_ENTIRE || status == IA_SINGULAR || status == IA_SINGULAR_RIGHT || status == IA_SINGULAR_LEFT;
53524
53608
  }
53525
53609
 
53526
53610
  // Addition
@@ -53660,7 +53744,8 @@ IntervalResult ia_floor(vec2 x) {
53660
53744
  return ia_ok(vec2(flo, fhi));
53661
53745
  }
53662
53746
  // Interval spans an integer boundary - discontinuity at first integer > x.x
53663
- return ia_singular(flo + 1.0);
53747
+ // floor is right-continuous
53748
+ return ia_singular_right(flo + 1.0);
53664
53749
  }
53665
53750
 
53666
53751
  // Ceiling - has jump discontinuities at every integer
@@ -53671,7 +53756,8 @@ IntervalResult ia_ceil(vec2 x) {
53671
53756
  return ia_ok(vec2(clo, chi));
53672
53757
  }
53673
53758
  // Interval spans an integer boundary - discontinuity at ceil(x.x)
53674
- return ia_singular(clo);
53759
+ // ceil is left-continuous
53760
+ return ia_singular_left(clo);
53675
53761
  }
53676
53762
 
53677
53763
  // Round - has jump discontinuities at every half-integer
@@ -53685,7 +53771,8 @@ IntervalResult ia_round(vec2 x) {
53685
53771
  return ia_ok(vec2(rlo, rhi));
53686
53772
  }
53687
53773
  // Interval spans a half-integer boundary - discontinuity
53688
- return ia_singular(rlo + 0.5);
53774
+ // round is right-continuous (with round-half-up convention)
53775
+ return ia_singular_right(rlo + 0.5);
53689
53776
  }
53690
53777
 
53691
53778
  // Fract - sawtooth discontinuities at every integer
@@ -53698,7 +53785,8 @@ IntervalResult ia_fract(vec2 x) {
53698
53785
  return ia_ok(vec2(fract(x.x) - IA_EPS, fract(x.y) + IA_EPS));
53699
53786
  }
53700
53787
  // Interval spans an integer - sawtooth discontinuity
53701
- return ia_singular(flo + 1.0);
53788
+ // fract is right-continuous (inherits from floor)
53789
+ return ia_singular_right(flo + 1.0);
53702
53790
  }
53703
53791
 
53704
53792
  // Mod - periodic discontinuities at multiples of the modulus
@@ -53721,7 +53809,8 @@ IntervalResult ia_mod(vec2 x, vec2 y) {
53721
53809
  return ia_ok(vec2(min(mlo, mhi) - IA_EPS, max(mlo, mhi) + IA_EPS));
53722
53810
  }
53723
53811
  // Discontinuity at first multiple of period in the interval
53724
- return ia_singular((flo + 1.0) * period);
53812
+ // mod has sawtooth discontinuities, right-continuous
53813
+ return ia_singular_right((flo + 1.0) * period);
53725
53814
  }
53726
53815
 
53727
53816
  // General case: compose from existing operations
@@ -54431,7 +54520,7 @@ float ia_notEqual(IntervalResult a, IntervalResult b) {
54431
54520
  Negate: (args, compile) => `ia_negate(${compile(args[0])})`,
54432
54521
  // Elementary functions
54433
54522
  Abs: (args, compile) => `ia_abs(${compile(args[0])})`,
54434
- Ceiling: (args, compile) => `ia_ceil(${compile(args[0])})`,
54523
+ Ceil: (args, compile) => `ia_ceil(${compile(args[0])})`,
54435
54524
  Exp: (args, compile) => `ia_exp(${compile(args[0])})`,
54436
54525
  Floor: (args, compile) => `ia_floor(${compile(args[0])})`,
54437
54526
  Fract: (args, compile) => `ia_fract(${compile(args[0])})`,
@@ -54470,7 +54559,7 @@ float ia_notEqual(IntervalResult a, IntervalResult b) {
54470
54559
  throw new Error("Interval GLSL does not support variable exponents");
54471
54560
  },
54472
54561
  Round: (args, compile) => `ia_round(${compile(args[0])})`,
54473
- Sgn: (args, compile) => `ia_sign(${compile(args[0])})`,
54562
+ Sign: (args, compile) => `ia_sign(${compile(args[0])})`,
54474
54563
  Sqrt: (args, compile) => `ia_sqrt(${compile(args[0])})`,
54475
54564
  Square: (args, compile) => `ia_square(${compile(args[0])})`,
54476
54565
  // Trigonometric functions
@@ -56411,10 +56500,10 @@ IntervalResult ${functionName}(${params}) {
56411
56500
  // src/compute-engine.ts
56412
56501
  init_types6();
56413
56502
  init_base_compiler();
56414
- var version = "0.35.3";
56503
+ var version = "0.35.5";
56415
56504
  globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
56416
56505
  ComputeEngine: ComputeEngine.prototype.constructor,
56417
- version: "0.35.3"
56506
+ version: "0.35.5"
56418
56507
  };
56419
56508
  return __toCommonJS(compute_engine_exports);
56420
56509
  })();
@@ -1,4 +1,4 @@
1
- /** Compute Engine 0.35.3 */
1
+ /** Compute Engine 0.35.5 */
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.35.3";
118
+ var version = "0.35.5";
119
119
  export {
120
120
  dictionaryFromExpression,
121
121
  isFunctionObject,
@@ -1,2 +1,2 @@
1
- /** Compute Engine 0.35.3 */
2
- function d(n){return n!==null&&typeof n=="object"&&"num"in n}function s(n){return n!==null&&typeof n=="object"&&"sym"in n}function a(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 u(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):M(n)||b(n)?null:n}function l(n){return Array.isArray(n)?n[0]:n==null?"":u(n)?n.fn[0]:""}function y(n){return Array.isArray(n)?n.slice(1):n!==void 0&&u(n)?n.fn.slice(1):[]}function E(n,t){return Array.isArray(n)?n[t]??null:n===null||!u(n)?null:n.fn[t]??null}function h(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):u(n)?Math.max(0,n.fn.length-1):0}function g(n){return typeof n=="string"&&b(n)?n.length>=2&&n.at(0)==="`"&&n.at(-1)==="`"?n.slice(1,-1):n:n==null?null:s(n)?n.sym:null}function f(n){let t=l(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let[i,r]=y(n),e=c(i);return e?[e,r??"Nothing"]:null}return null}function j(n){if(n===null)return null;if(m(n))return n;let t=f(n);if(t)return{[t[0]]:t[1]};if(l(n)==="Dictionary"){let i={},r=y(n);for(let e=1;e<h(n);e++){let o=f(r[e]);o&&(i[o[0]]=A(o[1])??"Nothing")}return{dict:i}}return null}function O(n,t){let i=null;if(Array.isArray(n)&&(i=n),u(n)&&(i=n.fn),i===null)return[];let r=1,e=[];for(;r<i.length;)e.push(t(i[r])),r+=1;return e}function M(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 b(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||n.length>=2&&n[0]==="`"&&n[n.length-1]==="`"}function A(n){return n==null?null:a(n)?n.str:d(n)?parseFloat(n.num):s(n)?n.sym:typeof n=="string"||typeof n=="number"?n:Array.isArray(n)?{fn:n}:n}var S="0.35.3";export{j as dictionaryFromExpression,u as isFunctionObject,a as isStringObject,s as isSymbolObject,O as mapArgs,E as operand,l as operator,c as stringValue,g as symbol,S as version};
1
+ /** Compute Engine 0.35.5 */
2
+ function d(n){return n!==null&&typeof n=="object"&&"num"in n}function s(n){return n!==null&&typeof n=="object"&&"sym"in n}function a(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 u(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):M(n)||b(n)?null:n}function l(n){return Array.isArray(n)?n[0]:n==null?"":u(n)?n.fn[0]:""}function y(n){return Array.isArray(n)?n.slice(1):n!==void 0&&u(n)?n.fn.slice(1):[]}function E(n,t){return Array.isArray(n)?n[t]??null:n===null||!u(n)?null:n.fn[t]??null}function h(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):u(n)?Math.max(0,n.fn.length-1):0}function g(n){return typeof n=="string"&&b(n)?n.length>=2&&n.at(0)==="`"&&n.at(-1)==="`"?n.slice(1,-1):n:n==null?null:s(n)?n.sym:null}function f(n){let t=l(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let[i,r]=y(n),e=c(i);return e?[e,r??"Nothing"]:null}return null}function j(n){if(n===null)return null;if(m(n))return n;let t=f(n);if(t)return{[t[0]]:t[1]};if(l(n)==="Dictionary"){let i={},r=y(n);for(let e=1;e<h(n);e++){let o=f(r[e]);o&&(i[o[0]]=A(o[1])??"Nothing")}return{dict:i}}return null}function O(n,t){let i=null;if(Array.isArray(n)&&(i=n),u(n)&&(i=n.fn),i===null)return[];let r=1,e=[];for(;r<i.length;)e.push(t(i[r])),r+=1;return e}function M(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 b(n){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||n.length>=2&&n[0]==="`"&&n[n.length-1]==="`"}function A(n){return n==null?null:a(n)?n.str:d(n)?parseFloat(n.num):s(n)?n.sym:typeof n=="string"||typeof n=="number"?n:Array.isArray(n)?{fn:n}:n}var S="0.35.5";export{j as dictionaryFromExpression,u as isFunctionObject,a as isStringObject,s as isSymbolObject,O as mapArgs,E as operand,l as operator,c as stringValue,g as symbol,S as version};
@@ -1,4 +1,4 @@
1
- /** MathJSON 0.35.3 */
1
+ /** MathJSON 0.35.5 */
2
2
  (function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MathJson = {}));})(this, (function (exports) { 'use strict';
3
- var MathJson=(()=>{var f=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var A=(n,t)=>{for(var i in t)f(n,i,{get:t[i],enumerable:!0})},J=(n,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of O(t))!M.call(n,e)&&e!==i&&f(n,e,{get:()=>t[e],enumerable:!(r=j(t,e))||r.enumerable});return n};var S=n=>J(f({},"__esModule",{value:!0}),n);var T={};A(T,{dictionaryFromExpression:()=>E,isFunctionObject:()=>u,isStringObject:()=>a,isSymbolObject:()=>o,mapArgs:()=>h,operand:()=>d,operator:()=>s,stringValue:()=>c,symbol:()=>m,version:()=>V});function N(n){return n!==null&&typeof n=="object"&&"num"in n}function o(n){return n!==null&&typeof n=="object"&&"sym"in n}function a(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 u(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)||g(n)?null:n}function s(n){return Array.isArray(n)?n[0]:n==null?"":u(n)?n.fn[0]:""}function b(n){return Array.isArray(n)?n.slice(1):n!==void 0&&u(n)?n.fn.slice(1):[]}function d(n,t){return Array.isArray(n)?n[t]??null:n===null||!u(n)?null:n.fn[t]??null}function D(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):u(n)?Math.max(0,n.fn.length-1):0}function m(n){return typeof n=="string"&&g(n)?n.length>=2&&n.at(0)==="`"&&n.at(-1)==="`"?n.slice(1,-1):n:n==null?null:o(n)?n.sym:null}function y(n){let t=s(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let[i,r]=b(n),e=c(i);return e?[e,r??"Nothing"]:null}return null}function E(n){if(n===null)return null;if(p(n))return n;let t=y(n);if(t)return{[t[0]]:t[1]};if(s(n)==="Dictionary"){let i={},r=b(n);for(let e=1;e<D(n);e++){let l=y(r[e]);l&&(i[l[0]]=F(l[1])??"Nothing")}return{dict:i}}return null}function h(n,t){let i=null;if(Array.isArray(n)&&(i=n),u(n)&&(i=n.fn),i===null)return[];let r=1,e=[];for(;r<i.length;)e.push(t(i[r])),r+=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 g(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:a(n)?n.str:N(n)?parseFloat(n.num):o(n)?n.sym:typeof n=="string"||typeof n=="number"?n:Array.isArray(n)?{fn:n}:n}var V="0.35.3";return S(T);})();
3
+ var MathJson=(()=>{var f=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var A=(n,t)=>{for(var i in t)f(n,i,{get:t[i],enumerable:!0})},J=(n,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of O(t))!M.call(n,e)&&e!==i&&f(n,e,{get:()=>t[e],enumerable:!(r=j(t,e))||r.enumerable});return n};var S=n=>J(f({},"__esModule",{value:!0}),n);var T={};A(T,{dictionaryFromExpression:()=>E,isFunctionObject:()=>u,isStringObject:()=>a,isSymbolObject:()=>o,mapArgs:()=>h,operand:()=>d,operator:()=>s,stringValue:()=>c,symbol:()=>m,version:()=>V});function N(n){return n!==null&&typeof n=="object"&&"num"in n}function o(n){return n!==null&&typeof n=="object"&&"sym"in n}function a(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 u(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)||g(n)?null:n}function s(n){return Array.isArray(n)?n[0]:n==null?"":u(n)?n.fn[0]:""}function b(n){return Array.isArray(n)?n.slice(1):n!==void 0&&u(n)?n.fn.slice(1):[]}function d(n,t){return Array.isArray(n)?n[t]??null:n===null||!u(n)?null:n.fn[t]??null}function D(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):u(n)?Math.max(0,n.fn.length-1):0}function m(n){return typeof n=="string"&&g(n)?n.length>=2&&n.at(0)==="`"&&n.at(-1)==="`"?n.slice(1,-1):n:n==null?null:o(n)?n.sym:null}function y(n){let t=s(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let[i,r]=b(n),e=c(i);return e?[e,r??"Nothing"]:null}return null}function E(n){if(n===null)return null;if(p(n))return n;let t=y(n);if(t)return{[t[0]]:t[1]};if(s(n)==="Dictionary"){let i={},r=b(n);for(let e=1;e<D(n);e++){let l=y(r[e]);l&&(i[l[0]]=F(l[1])??"Nothing")}return{dict:i}}return null}function h(n,t){let i=null;if(Array.isArray(n)&&(i=n),u(n)&&(i=n.fn),i===null)return[];let r=1,e=[];for(;r<i.length;)e.push(t(i[r])),r+=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 g(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:a(n)?n.str:N(n)?parseFloat(n.num):o(n)?n.sym:typeof n=="string"||typeof n=="number"?n:Array.isArray(n)?{fn:n}:n}var V="0.35.5";return S(T);})();
4
4
  Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
@@ -1,4 +1,4 @@
1
- /** MathJSON 0.35.3 */
1
+ /** MathJSON 0.35.5 */
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.35.3";
152
+ var version = "0.35.5";
153
153
  return __toCommonJS(math_json_exports);
154
154
  })();
155
155
  Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  export declare const DEFAULT_COLOR = "\u001B[39m";
3
3
  export declare const DEFAULT_BG = "\u001B[49m";
4
4
  export declare const WHITE_BG = "\u001B[47m";
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  private _listeners;
3
3
  private _pending;
4
4
  private _version;
@@ -1,2 +1,2 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  export declare function fuzzyStringMatch(invalidWord: string, validWords: string[]): string | null;
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  /**
3
3
  * Return a string or an array of graphemes.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  cause: unknown;
3
3
  value: T;
4
4
  constructor({ message, value, cause, }?: {
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  infer Head,
3
3
  ...infer Rem
4
4
  ] ? MergeTypes<Rem, Res & Head> : Res;
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  export type RuntimeSignalCode = 'timeout' | 'out-of-memory' | 'recursion-depth-exceeded' | 'iteration-limit-exceeded';
3
3
  /** @category Error Handling */
4
4
  export type SignalCode = RuntimeSignalCode | ('invalid-name' | 'expected-predicate' | 'expected-symbol' | 'operator-requires-one-operand' | 'postfix-operator-requires-one-operand' | 'prefix-operator-requires-one-operand' | 'unbalanced-symbols' | 'expected-argument' | 'unexpected-command' | 'cyclic-definition' | 'invalid-supersets' | 'expected-supersets' | 'unknown-domain' | 'duplicate-wikidata' | 'invalid-dictionary-entry' | 'syntax-error');
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  kind: string;
3
3
  position: number;
4
4
  line: number;
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  /** @category Type */
3
3
  export declare class BoxedType {
4
4
  static unknown: BoxedType;
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  export interface Token {
3
3
  type: TokenType;
4
4
  value: string;
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  /**
3
3
  * BNF grammar for the type parser:
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  import { TypeNode } from './ast-nodes';
3
3
  import { TypeResolver } from './types';
4
4
  export declare class Parser {
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  /** All the types representing numeric values */
3
3
  export declare const NUMERIC_TYPES: NumericPrimitiveType[];
4
4
  export declare const INDEXED_COLLECTION_TYPES: PrimitiveType[];
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  /**
3
3
  * Reduce the input type
4
4
  *
@@ -1,2 +1,2 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  export declare function typeToString(type: Type, precedence?: number): string;
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  /** Return true if lhs is a subtype of rhs */
3
3
  export declare function isPrimitiveSubtype(lhs: PrimitiveType, rhs: PrimitiveType): boolean;
4
4
  /** Return true if lhs is a subtype of rhs */
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  import { Type, TypeResolver } from './types';
3
3
  export declare class TypeBuilder implements ASTVisitor<Type> {
4
4
  private typeResolver;
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  * A primitive type is a simple type that represents a concrete value.
3
3
  *
4
4
  * - `any`: the top type
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  /** Convert two or more types into a more specific type that is a subtype of
3
3
  * all the input types. The resulting type is usually more constrained and
4
4
  * only encompasses values that belong to both input types.
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  *
3
3
  * <!--
4
4
  * !@consider?
@@ -1,4 +1,4 @@
1
- /* 0.35.3 */
1
+ /* 0.35.5 */
2
2
  /**
3
3
  * Add an assumption, in the form of a predicate, for example:
4
4
  *