@cortex-js/compute-engine 0.35.5 → 0.35.6

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 +148 -30
  2. package/dist/compute-engine.min.esm.js +107 -38
  3. package/dist/compute-engine.min.umd.js +107 -38
  4. package/dist/compute-engine.umd.js +148 -30
  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 +3 -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 +18 -1
  85. package/dist/types/compute-engine/interval/index.d.ts +5 -3
  86. package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
  87. package/dist/types/compute-engine/interval/types.d.ts +1 -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 +3 -2
@@ -1,4 +1,4 @@
1
- /** Compute Engine 0.35.5 */
1
+ /** Compute Engine 0.35.6 */
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;
@@ -15099,22 +15099,22 @@ var ComputeEngine = (() => {
15099
15099
  if (dividendDeg < divisorDeg) {
15100
15100
  return [ce.Zero, dividend];
15101
15101
  }
15102
- const remainder = dividendCoeffs.map((c) => c);
15102
+ const remainder2 = dividendCoeffs.map((c) => c);
15103
15103
  const quotientCoeffs = new Array(
15104
15104
  dividendDeg - divisorDeg + 1
15105
15105
  ).fill(ce.Zero);
15106
15106
  const leadingDivisor = divisorCoeffs[divisorDeg];
15107
15107
  for (let i = dividendDeg; i >= divisorDeg; i--) {
15108
- if (remainder[i].is(0)) continue;
15109
- const quotientCoef = remainder[i].div(leadingDivisor);
15108
+ if (remainder2[i].is(0)) continue;
15109
+ const quotientCoef = remainder2[i].div(leadingDivisor);
15110
15110
  quotientCoeffs[i - divisorDeg] = quotientCoef;
15111
15111
  for (let j = 0; j <= divisorDeg; j++) {
15112
15112
  const product = quotientCoef.mul(divisorCoeffs[j]);
15113
- remainder[i - divisorDeg + j] = remainder[i - divisorDeg + j].sub(product);
15113
+ remainder2[i - divisorDeg + j] = remainder2[i - divisorDeg + j].sub(product);
15114
15114
  }
15115
15115
  }
15116
15116
  const quotient = fromCoefficients(quotientCoeffs, variable);
15117
- const remainderPoly = fromCoefficients(remainder, variable);
15117
+ const remainderPoly = fromCoefficients(remainder2, variable);
15118
15118
  return [quotient, remainderPoly];
15119
15119
  }
15120
15120
  function polynomialGCD(a, b, variable) {
@@ -15141,9 +15141,9 @@ var ComputeEngine = (() => {
15141
15141
  if (!divResult) {
15142
15142
  return ce.One;
15143
15143
  }
15144
- const [, remainder] = divResult;
15144
+ const [, remainder2] = divResult;
15145
15145
  p = q;
15146
- q = remainder;
15146
+ q = remainder2;
15147
15147
  }
15148
15148
  return makeMonic(p, variable);
15149
15149
  }
@@ -20814,6 +20814,7 @@ var ComputeEngine = (() => {
20814
20814
  });
20815
20815
  } catch (e) {
20816
20816
  if (options?.fallback ?? true) {
20817
+ console.warn(`Compilation fallback for "${this.operator}": ${e.message}`);
20817
20818
  const { applicableN1: applicableN12 } = (init_function_utils(), __toCommonJS(function_utils_exports));
20818
20819
  return applicableN12(this);
20819
20820
  }
@@ -32550,26 +32551,23 @@ ${lines.join("\n")}`;
32550
32551
  for (let i = 0; i < n; i++) {
32551
32552
  const u = Math.random();
32552
32553
  const x = Math.tan(Math.PI * (u - 0.5));
32553
- const jacobian = Math.PI * (1 + x * x);
32554
- const val = f(x) / jacobian;
32554
+ const val = f(x) * Math.PI * (1 + x * x);
32555
32555
  sum2 += val;
32556
32556
  sumSq += val * val;
32557
32557
  }
32558
32558
  } else if (a === -Infinity) {
32559
32559
  for (let i = 0; i < n; i++) {
32560
32560
  const u = Math.random();
32561
- const x = b - Math.log(1 - u);
32562
- const jacobian = 1 / (1 - u);
32563
- const val = f(x) / jacobian;
32561
+ const x = b + Math.log(u);
32562
+ const val = f(x) / u;
32564
32563
  sum2 += val;
32565
32564
  sumSq += val * val;
32566
32565
  }
32567
32566
  } else if (b === Infinity) {
32568
32567
  for (let i = 0; i < n; i++) {
32569
32568
  const u = Math.random();
32570
- const x = a + Math.log(u);
32571
- const jacobian = 1 / u;
32572
- const val = f(x) / jacobian;
32569
+ const x = a - Math.log(u);
32570
+ const val = f(x) / u;
32573
32571
  sum2 += val;
32574
32572
  sumSq += val * val;
32575
32573
  }
@@ -32583,7 +32581,7 @@ ${lines.join("\n")}`;
32583
32581
  const mean2 = sum2 / n;
32584
32582
  const variance2 = (sumSq - n * mean2 * mean2) / (n - 1);
32585
32583
  const stdError = Math.sqrt(variance2 / n);
32586
- const scale = b - a;
32584
+ const scale = isFinite(a) && isFinite(b) ? b - a : 1;
32587
32585
  const estimate = mean2 * scale;
32588
32586
  const error = stdError * scale;
32589
32587
  const rounded = roundEstimateToError(estimate, error);
@@ -34163,10 +34161,10 @@ ${lines.join("\n")}`;
34163
34161
  if (numDeg >= 0 && denDeg >= 0 && numDeg >= denDeg) {
34164
34162
  const divResult = polynomialDivide(fn.op1, fn.op2, index);
34165
34163
  if (divResult) {
34166
- const [quotient, remainder] = divResult;
34164
+ const [quotient, remainder2] = divResult;
34167
34165
  const quotientIntegral = antiderivative(quotient, index);
34168
- if (!remainder.is(0)) {
34169
- const remainderFraction = remainder.div(fn.op2);
34166
+ if (!remainder2.is(0)) {
34167
+ const remainderFraction = remainder2.div(fn.op2);
34170
34168
  const remainderIntegral = antiderivative(remainderFraction, index);
34171
34169
  return add3(quotientIntegral, remainderIntegral);
34172
34170
  }
@@ -34421,8 +34419,8 @@ ${lines.join("\n")}`;
34421
34419
  const linearFactor = ce.symbol(index).sub(r);
34422
34420
  const quotient = polynomialDivide(denominator, linearFactor, index);
34423
34421
  if (quotient) {
34424
- const [quad, remainder] = quotient;
34425
- if (remainder.is(0)) {
34422
+ const [quad, remainder2] = quotient;
34423
+ if (remainder2.is(0)) {
34426
34424
  const quadCoeffs = getQuadraticCoefficients(quad, index);
34427
34425
  if (quadCoeffs) {
34428
34426
  const { a: qa, b: qb, c: qc } = quadCoeffs;
@@ -51723,7 +51721,18 @@ Error in definition of "${name}"`,
51723
51721
  Sinh: "Math.sinh",
51724
51722
  Sqrt: "Math.sqrt",
51725
51723
  Tan: "Math.tan",
51726
- Tanh: "Math.tanh"
51724
+ Tanh: "Math.tanh",
51725
+ Mod: ([a, b], compile) => {
51726
+ if (a === null || b === null) throw new Error("Mod: missing argument");
51727
+ const ca = compile(a);
51728
+ const cb = compile(b);
51729
+ return `((${ca} % ${cb}) + ${cb}) % ${cb}`;
51730
+ },
51731
+ Truncate: "Math.trunc",
51732
+ Remainder: ([a, b], compile) => {
51733
+ if (a === null || b === null) throw new Error("Remainder: missing argument");
51734
+ return `(${compile(a)} - ${compile(b)} * Math.round(${compile(a)} / ${compile(b)}))`;
51735
+ }
51727
51736
  };
51728
51737
  var ComputeEngineFunction = class extends Function {
51729
51738
  SYS = {
@@ -52011,6 +52020,11 @@ Error in definition of "${name}"`,
52011
52020
  Sqrt: "sqrt",
52012
52021
  Step: "step",
52013
52022
  Tan: "tan",
52023
+ Truncate: "trunc",
52024
+ Remainder: ([a, b], compile) => {
52025
+ if (a === null || b === null) throw new Error("Remainder: missing argument");
52026
+ return `(${compile(a)} - ${compile(b)} * round(${compile(a)} / ${compile(b)}))`;
52027
+ },
52014
52028
  // Reciprocal trigonometric functions (no GLSL built-ins)
52015
52029
  Cot: ([x], compile) => {
52016
52030
  if (x === null) throw new Error("Cot: no argument");
@@ -52672,6 +52686,22 @@ Error in definition of "${name}"`,
52672
52686
  }
52673
52687
  return { kind: "singular", at: flo + 1, continuity: "right" };
52674
52688
  }
52689
+ function trunc2(x) {
52690
+ const unwrapped = unwrapOrPropagate(x);
52691
+ if (!Array.isArray(unwrapped)) return unwrapped;
52692
+ const [xVal] = unwrapped;
52693
+ const tlo = Math.trunc(xVal.lo);
52694
+ const thi = Math.trunc(xVal.hi);
52695
+ if (tlo === thi) return ok({ lo: tlo, hi: thi });
52696
+ if (xVal.lo >= 0) {
52697
+ return { kind: "singular", at: tlo + 1, continuity: "right" };
52698
+ }
52699
+ const firstInt = Math.ceil(xVal.lo);
52700
+ if (firstInt !== 0) {
52701
+ return { kind: "singular", at: firstInt, continuity: "left" };
52702
+ }
52703
+ return { kind: "singular", at: 1, continuity: "right" };
52704
+ }
52675
52705
  function min2(a, b) {
52676
52706
  const unwrapped = unwrapOrPropagate(a, b);
52677
52707
  if (!Array.isArray(unwrapped)) return unwrapped;
@@ -52709,6 +52739,9 @@ Error in definition of "${name}"`,
52709
52739
  const modHi = aVal.hi - period * flo;
52710
52740
  return ok({ lo: Math.min(modLo, modHi), hi: Math.max(modLo, modHi) });
52711
52741
  }
52742
+ function remainder(a, b) {
52743
+ return sub2(a, mul4(b, round2(div3(a, b))));
52744
+ }
52712
52745
  function sign2(x) {
52713
52746
  const unwrapped = unwrapOrPropagate(x);
52714
52747
  if (!Array.isArray(unwrapped)) return unwrapped;
@@ -53199,9 +53232,11 @@ Error in definition of "${name}"`,
53199
53232
  ceil: ceil2,
53200
53233
  round: round2,
53201
53234
  fract,
53235
+ trunc: trunc2,
53202
53236
  min: min2,
53203
53237
  max: max2,
53204
53238
  mod: mod2,
53239
+ remainder,
53205
53240
  sign: sign2,
53206
53241
  // Trigonometric
53207
53242
  sin: sin2,
@@ -53389,14 +53424,12 @@ Error in definition of "${name}"`,
53389
53424
  Arcoth: (args, compile) => `_IA.acoth(${compile(args[0])})`,
53390
53425
  Arcsch: (args, compile) => `_IA.acsch(${compile(args[0])})`,
53391
53426
  Arsech: (args, compile) => `_IA.asech(${compile(args[0])})`,
53392
- // Inverse trig (alternative names)
53393
- Asin: (args, compile) => `_IA.asin(${compile(args[0])})`,
53394
- Acos: (args, compile) => `_IA.acos(${compile(args[0])})`,
53395
- Atan: (args, compile) => `_IA.atan(${compile(args[0])})`,
53396
53427
  // Elementary
53397
53428
  Fract: (args, compile) => `_IA.fract(${compile(args[0])})`,
53398
- // Mod
53429
+ Truncate: (args, compile) => `_IA.trunc(${compile(args[0])})`,
53430
+ // Mod / Remainder
53399
53431
  Mod: (args, compile) => `_IA.mod(${compile(args[0])}, ${compile(args[1])})`,
53432
+ Remainder: (args, compile) => `_IA.remainder(${compile(args[0])}, ${compile(args[1])})`,
53400
53433
  // Conditionals
53401
53434
  If: (args, compile) => {
53402
53435
  if (args.length !== 3) throw new Error("If: wrong number of arguments");
@@ -53716,6 +53749,22 @@ IntervalResult ia_ln(vec2 x) {
53716
53749
  return ia_partial(vec2(-IA_HUGE, log(x.y) + IA_EPS), IA_PARTIAL_LO);
53717
53750
  }
53718
53751
 
53752
+ // Log base 2
53753
+ IntervalResult ia_log2(vec2 x) {
53754
+ const float INV_LN2 = 1.44269504089;
53755
+ if (x.y <= 0.0) return ia_empty();
53756
+ if (x.x > 0.0) return ia_ok(vec2(log2(x.x) - IA_EPS, log2(x.y) + IA_EPS));
53757
+ return ia_partial(vec2(-IA_HUGE, log2(x.y) + IA_EPS), IA_PARTIAL_LO);
53758
+ }
53759
+
53760
+ // Log base 10
53761
+ IntervalResult ia_log10(vec2 x) {
53762
+ const float INV_LN10 = 0.43429448190;
53763
+ if (x.y <= 0.0) return ia_empty();
53764
+ if (x.x > 0.0) return ia_ok(vec2(log(x.x) * INV_LN10 - IA_EPS, log(x.y) * INV_LN10 + IA_EPS));
53765
+ return ia_partial(vec2(-IA_HUGE, log(x.y) * INV_LN10 + IA_EPS), IA_PARTIAL_LO);
53766
+ }
53767
+
53719
53768
  // Absolute value
53720
53769
  IntervalResult ia_abs(vec2 x) {
53721
53770
  if (x.x >= 0.0) {
@@ -53789,6 +53838,18 @@ IntervalResult ia_fract(vec2 x) {
53789
53838
  return ia_singular_right(flo + 1.0);
53790
53839
  }
53791
53840
 
53841
+ // Truncate toward zero - floor for positive, ceil for negative
53842
+ // Discontinuous at every non-zero integer, continuous at zero
53843
+ IntervalResult ia_trunc(vec2 x) {
53844
+ float tlo = trunc(x.x);
53845
+ float thi = trunc(x.y);
53846
+ if (tlo == thi) return ia_ok(vec2(tlo, thi));
53847
+ if (x.x >= 0.0) return ia_singular_right(tlo + 1.0); // like floor
53848
+ float firstInt = ceil(x.x);
53849
+ if (firstInt != 0.0) return ia_singular_left(firstInt); // like ceil
53850
+ return ia_singular_right(1.0); // spans zero, first discontinuity at +1
53851
+ }
53852
+
53792
53853
  // Mod - periodic discontinuities at multiples of the modulus
53793
53854
  // mod(x, y) = x - y * floor(x / y)
53794
53855
  IntervalResult ia_mod(vec2 x, vec2 y) {
@@ -53822,6 +53883,16 @@ IntervalResult ia_mod(vec2 x, vec2 y) {
53822
53883
  return ia_sub(x, ia_mul_raw(y, fq.value));
53823
53884
  }
53824
53885
 
53886
+ // IEEE remainder: a - b * round(a / b)
53887
+ // Discontinuities arise from round when a/b spans a half-integer
53888
+ IntervalResult ia_remainder(vec2 a, vec2 b) {
53889
+ IntervalResult q = ia_div(a, b);
53890
+ if (ia_is_error(q.status)) return q;
53891
+ IntervalResult rq = ia_round(q.value);
53892
+ if (ia_is_error(rq.status)) return rq;
53893
+ return ia_sub(a, ia_mul_raw(b, rq.value));
53894
+ }
53895
+
53825
53896
  // Min of two intervals
53826
53897
  IntervalResult ia_min(vec2 a, vec2 b) {
53827
53898
  return ia_ok(vec2(min(a.x, b.x), min(a.y, b.y)));
@@ -54088,6 +54159,16 @@ IntervalResult ia_ln(IntervalResult x) {
54088
54159
  return ia_ln(x.value);
54089
54160
  }
54090
54161
 
54162
+ IntervalResult ia_log2(IntervalResult x) {
54163
+ if (ia_is_error(x.status)) return x;
54164
+ return ia_log2(x.value);
54165
+ }
54166
+
54167
+ IntervalResult ia_log10(IntervalResult x) {
54168
+ if (ia_is_error(x.status)) return x;
54169
+ return ia_log10(x.value);
54170
+ }
54171
+
54091
54172
  IntervalResult ia_abs(IntervalResult x) {
54092
54173
  if (ia_is_error(x.status)) return x;
54093
54174
  return ia_abs(x.value);
@@ -54118,6 +54199,11 @@ IntervalResult ia_fract(IntervalResult x) {
54118
54199
  return ia_fract(x.value);
54119
54200
  }
54120
54201
 
54202
+ IntervalResult ia_trunc(IntervalResult x) {
54203
+ if (ia_is_error(x.status)) return x;
54204
+ return ia_trunc(x.value);
54205
+ }
54206
+
54121
54207
  IntervalResult ia_mod(IntervalResult a, IntervalResult b) {
54122
54208
  if (ia_is_error(a.status)) return a;
54123
54209
  if (ia_is_error(b.status)) return b;
@@ -54134,6 +54220,22 @@ IntervalResult ia_mod(vec2 a, IntervalResult b) {
54134
54220
  return ia_mod(a, b.value);
54135
54221
  }
54136
54222
 
54223
+ IntervalResult ia_remainder(IntervalResult a, IntervalResult b) {
54224
+ if (ia_is_error(a.status)) return a;
54225
+ if (ia_is_error(b.status)) return b;
54226
+ return ia_remainder(a.value, b.value);
54227
+ }
54228
+
54229
+ IntervalResult ia_remainder(IntervalResult a, vec2 b) {
54230
+ if (ia_is_error(a.status)) return a;
54231
+ return ia_remainder(a.value, b);
54232
+ }
54233
+
54234
+ IntervalResult ia_remainder(vec2 a, IntervalResult b) {
54235
+ if (ia_is_error(b.status)) return b;
54236
+ return ia_remainder(a, b.value);
54237
+ }
54238
+
54137
54239
  IntervalResult ia_min(IntervalResult a, IntervalResult b) {
54138
54240
  if (ia_is_error(a.status)) return a;
54139
54241
  if (ia_is_error(b.status)) return b;
@@ -54524,8 +54626,15 @@ float ia_notEqual(IntervalResult a, IntervalResult b) {
54524
54626
  Exp: (args, compile) => `ia_exp(${compile(args[0])})`,
54525
54627
  Floor: (args, compile) => `ia_floor(${compile(args[0])})`,
54526
54628
  Fract: (args, compile) => `ia_fract(${compile(args[0])})`,
54629
+ Truncate: (args, compile) => `ia_trunc(${compile(args[0])})`,
54630
+ Lb: (args, compile) => `ia_log2(${compile(args[0])})`,
54527
54631
  Ln: (args, compile) => `ia_ln(${compile(args[0])})`,
54632
+ Log: (args, compile) => {
54633
+ if (args.length === 1) return `ia_log10(${compile(args[0])})`;
54634
+ return `ia_div(ia_ln(${compile(args[0])}), ia_ln(${compile(args[1])}))`;
54635
+ },
54528
54636
  Mod: (args, compile) => `ia_mod(${compile(args[0])}, ${compile(args[1])})`,
54637
+ Remainder: (args, compile) => `ia_remainder(${compile(args[0])}, ${compile(args[1])})`,
54529
54638
  Max: (args, compile) => {
54530
54639
  if (args.length === 0) return "ia_point(-1e38)";
54531
54640
  if (args.length === 1) return compile(args[0]);
@@ -54558,6 +54667,15 @@ float ia_notEqual(IntervalResult a, IntervalResult b) {
54558
54667
  }
54559
54668
  throw new Error("Interval GLSL does not support variable exponents");
54560
54669
  },
54670
+ Root: (args, compile) => {
54671
+ const [arg, exp3] = args;
54672
+ if (arg === null) throw new Error("Root: no argument");
54673
+ if (exp3 === null || exp3?.re === 2) return `ia_sqrt(${compile(arg)})`;
54674
+ if (exp3?.isNumberLiteral && exp3.im === 0) {
54675
+ return `ia_pow(${compile(arg)}, ${1 / exp3.re})`;
54676
+ }
54677
+ throw new Error("Interval GLSL does not support variable root indices");
54678
+ },
54561
54679
  Round: (args, compile) => `ia_round(${compile(args[0])})`,
54562
54680
  Sign: (args, compile) => `ia_sign(${compile(args[0])})`,
54563
54681
  Sqrt: (args, compile) => `ia_sqrt(${compile(args[0])})`,
@@ -56500,10 +56618,10 @@ IntervalResult ${functionName}(${params}) {
56500
56618
  // src/compute-engine.ts
56501
56619
  init_types6();
56502
56620
  init_base_compiler();
56503
- var version = "0.35.5";
56621
+ var version = "0.35.6";
56504
56622
  globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
56505
56623
  ComputeEngine: ComputeEngine.prototype.constructor,
56506
- version: "0.35.5"
56624
+ version: "0.35.6"
56507
56625
  };
56508
56626
  return __toCommonJS(compute_engine_exports);
56509
56627
  })();
@@ -1,4 +1,4 @@
1
- /** Compute Engine 0.35.5 */
1
+ /** Compute Engine 0.35.6 */
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.5";
118
+ var version = "0.35.6";
119
119
  export {
120
120
  dictionaryFromExpression,
121
121
  isFunctionObject,
@@ -1,2 +1,2 @@
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
+ /** Compute Engine 0.35.6 */
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.6";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.5 */
1
+ /** MathJSON 0.35.6 */
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.5";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.6";return S(T);})();
4
4
  Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
@@ -1,4 +1,4 @@
1
- /** MathJSON 0.35.5 */
1
+ /** MathJSON 0.35.6 */
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.5";
152
+ var version = "0.35.6";
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.5 */
1
+ /* 0.35.6 */
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.5 */
1
+ /* 0.35.6 */
2
2
  private _listeners;
3
3
  private _pending;
4
4
  private _version;
@@ -1,2 +1,2 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  export declare function fuzzyStringMatch(invalidWord: string, validWords: string[]): string | null;
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  /**
3
3
  * Return a string or an array of graphemes.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  cause: unknown;
3
3
  value: T;
4
4
  constructor({ message, value, cause, }?: {
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  infer Head,
3
3
  ...infer Rem
4
4
  ] ? MergeTypes<Rem, Res & Head> : Res;
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
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.5 */
1
+ /* 0.35.6 */
2
2
  kind: string;
3
3
  position: number;
4
4
  line: number;
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  /** @category Type */
3
3
  export declare class BoxedType {
4
4
  static unknown: BoxedType;
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  export interface Token {
3
3
  type: TokenType;
4
4
  value: string;
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  /**
3
3
  * BNF grammar for the type parser:
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
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.5 */
1
+ /* 0.35.6 */
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.5 */
1
+ /* 0.35.6 */
2
2
  /**
3
3
  * Reduce the input type
4
4
  *
@@ -1,2 +1,2 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  export declare function typeToString(type: Type, precedence?: number): string;
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
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.5 */
1
+ /* 0.35.6 */
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.5 */
1
+ /* 0.35.6 */
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.5 */
1
+ /* 0.35.6 */
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.5 */
1
+ /* 0.35.6 */
2
2
  *
3
3
  * <!--
4
4
  * !@consider?
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  /**
3
3
  * Add an assumption, in the form of a predicate, for example:
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  import type { Expression, MathJsonSymbol } from '../../math-json/types';
3
3
  import type { Type, TypeString } from '../../common/type/types';
4
4
  import { BoxedType } from '../../common/type/boxed-type';
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import type { BoxedExpression } from '../global-types';
4
4
  export declare function apply(expr: BoxedExpression, fn: (x: number) => number | Complex, bigFn?: (x: Decimal) => Decimal | Complex | number, complexFn?: (x: Complex) => number | Complex): BoxedExpression | undefined;
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  import { BoxedType } from '../../common/type/boxed-type';
3
3
  import type { BoxedExpression, ComputeEngine } from '../global-types';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  /**
3
3
  * Canonical form of 'Divide' (and 'Rational')
4
4
  * - remove denominator of 1
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  import type { Rational } from '../numerics/types';
3
3
  export declare function asRadical(expr: BoxedExpression): Rational | null;
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  export type AsciiMathSerializer = (expr: BoxedExpression, precedence?: number) => string;
3
3
  export type AsciiMathOptions = {
4
4
  symbols: Record<string, string>;
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  import { MathJsonSymbol } from '../../math-json/types';
3
3
  import { NumericValue } from '../numeric-value/types';
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  import { _BoxedExpression } from './abstract-boxed-expression';
3
3
  import { BoxedType } from '../../common/type/boxed-type';
4
4
  import { DictionaryValue, Expression } from '../../math-json/types';
@@ -1,4 +1,4 @@
1
- /* 0.35.5 */
1
+ /* 0.35.6 */
2
2
  import type { SimplifyOptions, ReplaceOptions, PatternMatchOptions, BoxedExpression, BoxedBaseDefinition, BoxedOperatorDefinition, BoxedRuleSet, BoxedSubstitution, CanonicalOptions, EvaluateOptions, ComputeEngine, Metadata, Rule, Sign, Substitution, Scope, BoxedValueDefinition } from '../global-types';
3
3
  import { Type } from '../../common/type/types';
4
4
  import { BoxedType } from '../../common/type/boxed-type';