math-exercises 3.0.211 → 3.0.213

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 (103) hide show
  1. package/lib/exercises/math/arithmetic/congruenceBasicEquation.d.ts +9 -0
  2. package/lib/exercises/math/arithmetic/congruenceBasicEquation.d.ts.map +1 -0
  3. package/lib/exercises/math/arithmetic/congruenceBasicEquation.js +116 -0
  4. package/lib/exercises/math/arithmetic/diophantianEquationSimpleSolution.d.ts +9 -0
  5. package/lib/exercises/math/arithmetic/diophantianEquationSimpleSolution.d.ts.map +1 -0
  6. package/lib/exercises/math/arithmetic/diophantianEquationSimpleSolution.js +129 -0
  7. package/lib/exercises/math/arithmetic/fermatUsageOnBigPowers.d.ts +9 -0
  8. package/lib/exercises/math/arithmetic/fermatUsageOnBigPowers.d.ts.map +1 -0
  9. package/lib/exercises/math/arithmetic/fermatUsageOnBigPowers.js +140 -0
  10. package/lib/exercises/math/arithmetic/fillCongruenceTableFirstDegree.d.ts +9 -0
  11. package/lib/exercises/math/arithmetic/fillCongruenceTableFirstDegree.d.ts.map +1 -0
  12. package/lib/exercises/math/arithmetic/fillCongruenceTableFirstDegree.js +106 -0
  13. package/lib/exercises/math/arithmetic/findBezoutCoefficients.d.ts +8 -0
  14. package/lib/exercises/math/arithmetic/findBezoutCoefficients.d.ts.map +1 -0
  15. package/lib/exercises/math/arithmetic/findBezoutCoefficients.js +175 -0
  16. package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.d.ts +9 -0
  17. package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.d.ts.map +1 -0
  18. package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.js +105 -0
  19. package/lib/exercises/math/arithmetic/index.d.ts +8 -0
  20. package/lib/exercises/math/arithmetic/index.d.ts.map +1 -1
  21. package/lib/exercises/math/arithmetic/index.js +8 -0
  22. package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.d.ts +10 -0
  23. package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.d.ts.map +1 -0
  24. package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.js +136 -0
  25. package/lib/exercises/math/arithmetic/pgcdHomogenuity.d.ts +8 -0
  26. package/lib/exercises/math/arithmetic/pgcdHomogenuity.d.ts.map +1 -0
  27. package/lib/exercises/math/arithmetic/pgcdHomogenuity.js +124 -0
  28. package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +2 -2
  29. package/lib/exercises/math/complex/argumentFromAlgebraicComplex.d.ts +3 -0
  30. package/lib/exercises/math/complex/argumentFromAlgebraicComplex.d.ts.map +1 -1
  31. package/lib/exercises/math/complex/argumentFromAlgebraicComplex.js +92 -3
  32. package/lib/exercises/math/complex/conjugateDivideComplex.d.ts.map +1 -1
  33. package/lib/exercises/math/complex/conjugateDivideComplex.js +67 -6
  34. package/lib/exercises/math/complex/conjugateMultiplyComplex.d.ts.map +1 -1
  35. package/lib/exercises/math/complex/conjugateMultiplyComplex.js +54 -15
  36. package/lib/exercises/math/complex/divideComplex.d.ts.map +1 -1
  37. package/lib/exercises/math/complex/divideComplex.js +60 -6
  38. package/lib/exercises/math/complex/exp/complexAlgebraicFromExpForm.d.ts +9 -0
  39. package/lib/exercises/math/complex/exp/complexAlgebraicFromExpForm.d.ts.map +1 -0
  40. package/lib/exercises/math/complex/exp/complexAlgebraicFromExpForm.js +178 -0
  41. package/lib/exercises/math/complex/exp/complexExpFormPowerSimplify.d.ts +10 -0
  42. package/lib/exercises/math/complex/exp/complexExpFormPowerSimplify.d.ts.map +1 -0
  43. package/lib/exercises/math/complex/exp/complexExpFormPowerSimplify.js +152 -0
  44. package/lib/exercises/math/complex/exp/complexExpFormProductSimplify.d.ts +11 -0
  45. package/lib/exercises/math/complex/exp/complexExpFormProductSimplify.d.ts.map +1 -0
  46. package/lib/exercises/math/complex/exp/complexExpFormProductSimplify.js +165 -0
  47. package/lib/exercises/math/complex/exp/complexExpFormQuotientSimplify.d.ts +11 -0
  48. package/lib/exercises/math/complex/exp/complexExpFormQuotientSimplify.d.ts.map +1 -0
  49. package/lib/exercises/math/complex/exp/complexExpFormQuotientSimplify.js +164 -0
  50. package/lib/exercises/math/complex/exp/complexExpFromAlgebraicForm.d.ts +9 -0
  51. package/lib/exercises/math/complex/exp/complexExpFromAlgebraicForm.d.ts.map +1 -0
  52. package/lib/exercises/math/complex/exp/complexExpFromAlgebraicForm.js +175 -0
  53. package/lib/exercises/math/complex/exp/index.d.ts +5 -0
  54. package/lib/exercises/math/complex/exp/index.d.ts.map +1 -0
  55. package/lib/exercises/math/complex/exp/index.js +5 -0
  56. package/lib/exercises/math/complex/index.d.ts +1 -0
  57. package/lib/exercises/math/complex/index.d.ts.map +1 -1
  58. package/lib/exercises/math/complex/index.js +1 -0
  59. package/lib/exercises/math/complex/inverseComplex.d.ts.map +1 -1
  60. package/lib/exercises/math/complex/inverseComplex.js +35 -2
  61. package/lib/exercises/math/complex/linearCombinaisonComplex.d.ts.map +1 -1
  62. package/lib/exercises/math/complex/linearCombinaisonComplex.js +36 -5
  63. package/lib/exercises/math/complex/moduloFromAlgebraicComplex.d.ts.map +1 -1
  64. package/lib/exercises/math/complex/moduloFromAlgebraicComplex.js +38 -9
  65. package/lib/exercises/math/derivation/problems/index.d.ts +0 -1
  66. package/lib/exercises/math/derivation/problems/index.d.ts.map +1 -1
  67. package/lib/exercises/math/derivation/problems/index.js +1 -1
  68. package/lib/exercises/math/trigonometry/formulas/index.d.ts +2 -0
  69. package/lib/exercises/math/trigonometry/formulas/index.d.ts.map +1 -0
  70. package/lib/exercises/math/trigonometry/formulas/index.js +1 -0
  71. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts +8 -0
  72. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -0
  73. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +217 -0
  74. package/lib/exercises/math/trigonometry/index.d.ts +1 -0
  75. package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
  76. package/lib/exercises/math/trigonometry/index.js +1 -0
  77. package/lib/index.d.ts +52 -7
  78. package/lib/index.d.ts.map +1 -1
  79. package/lib/math/utils/arithmetic/bezout.d.ts +2 -0
  80. package/lib/math/utils/arithmetic/bezout.d.ts.map +1 -0
  81. package/lib/math/utils/arithmetic/bezout.js +10 -0
  82. package/lib/playground.d.ts +0 -5
  83. package/lib/playground.d.ts.map +1 -1
  84. package/lib/playground.js +3 -9
  85. package/lib/tree/nodes/algebraicNode.d.ts +2 -0
  86. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  87. package/lib/tree/nodes/complex/complexNode.d.ts +3 -0
  88. package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
  89. package/lib/tree/nodes/complex/complexNode.js +8 -0
  90. package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
  91. package/lib/tree/nodes/functions/absNode.js +6 -1
  92. package/lib/tree/nodes/functions/expNode.d.ts +2 -2
  93. package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
  94. package/lib/tree/nodes/functions/expNode.js +2 -2
  95. package/lib/tree/nodes/node.d.ts +2 -0
  96. package/lib/tree/nodes/node.d.ts.map +1 -1
  97. package/lib/tree/nodes/operators/addNode.js +6 -0
  98. package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -1
  99. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  100. package/lib/tree/nodes/operators/multiplyNode.js +11 -6
  101. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  102. package/lib/tree/nodes/operators/powerNode.js +2 -0
  103. package/package.json +1 -1
@@ -27,7 +27,9 @@ export const multiply = (a, b, opts) => {
27
27
  const nodeB = typeof b === "number" ? b.toTree() : typeof b === "string" ? b.toTree() : b;
28
28
  return new MultiplyNode(nodeA, nodeB, opts);
29
29
  };
30
- export const sortMultiplyNodes = (arr) => {
30
+ export const sortMultiplyNodes = (arr, opts) => {
31
+ if (opts?.noMultiplyOrder)
32
+ return 0;
31
33
  arr.sort((a, b) => {
32
34
  return (Number(b.isNumeric) - Number(a.isNumeric) ||
33
35
  Number(isNumberNode(b) && b.value === -1) -
@@ -102,7 +104,8 @@ export class MultiplyNode {
102
104
  // }
103
105
  }
104
106
  //!this is atrocious
105
- let showTimesSign = !opts?.forceDotSign &&
107
+ let showTimesSign = !opts?.forceNoTimesSign &&
108
+ !opts?.forceDotSign &&
106
109
  (opts?.forceTimesSign ||
107
110
  !isNaN(+rightTex[0]) ||
108
111
  (this.rightChild.isNumeric &&
@@ -114,7 +117,7 @@ export class MultiplyNode {
114
117
  isVariableNode(this.rightChild) &&
115
118
  this.leftChild.name === this.rightChild.name) ||
116
119
  (isSqrtNode(this.leftChild) && isSqrtNode(this.rightChild)));
117
- if (isOperatorNode(this.rightChild)) {
120
+ if (!opts?.forceNoTimesSign && isOperatorNode(this.rightChild)) {
118
121
  showTimesSign ||= [OperatorIds.fraction].includes(this.rightChild.id);
119
122
  if (isFractionNode(this.rightChild.leftChild)) {
120
123
  showTimesSign = true;
@@ -261,6 +264,8 @@ export class MultiplyNode {
261
264
  const leftSimplified = this.leftChild.simplify(opts, log);
262
265
  const rightSimplified = this.rightChild.simplify(opts, log);
263
266
  const copy = new MultiplyNode(leftSimplified, rightSimplified, this.opts);
267
+ if (opts?.forbidMultiplications)
268
+ return copy;
264
269
  /**get externals nodes (= extremités du sous arbre non multiplicatif)
265
270
  * les opposites sont supprimés et on ajoute *-1 à la fin si leur nb est impair
266
271
  */
@@ -319,8 +324,8 @@ export class MultiplyNode {
319
324
  if (nums.some((node) => isNumberNode(node) && node.value === 0)) {
320
325
  return new NumberNode(0);
321
326
  }
322
- sortMultiplyNodes(nums);
323
- sortMultiplyNodes(denums);
327
+ sortMultiplyNodes(nums, opts);
328
+ sortMultiplyNodes(denums, opts);
324
329
  const numNode = operatorComposition(MultiplyNode, nums);
325
330
  const denumNode = denums.length === 1
326
331
  ? denums[0]
@@ -403,7 +408,7 @@ export class MultiplyNode {
403
408
  return new NumberNode(1);
404
409
  if (externals.length === 1)
405
410
  return externals[0];
406
- sortMultiplyNodes(externals);
411
+ sortMultiplyNodes(externals, opts);
407
412
  return operatorComposition(MultiplyNode, externals);
408
413
  }
409
414
  toSimplificationTex(opts) {
@@ -1 +1 @@
1
- {"version":3,"file":"powerNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/powerNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAgB,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,YAAY,EAA4B,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAOrE,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,UAAU,CAErD;AACD,eAAO,MAAM,MAAM,GAAI,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,eAKxD,CAAC;AAEF,eAAO,MAAM,KAAK,GAChB,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,OAAO,WAAW,cAOnB,CAAC;AAEF,qBAAa,SAAU,YAAW,YAAY;IAC5C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU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 -101,6 +101,8 @@ export class PowerNode {
101
101
  const needBrace = rightTex.length > 1;
102
102
  if (needBrace)
103
103
  return `${leftTex}^{${rightTex}}`;
104
+ if (opts?.hidePowerOfOne && rightTex === "1")
105
+ return leftTex;
104
106
  else
105
107
  return `${leftTex}^${rightTex}`;
106
108
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.211",
4
+ "version": "3.0.213",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [