math-exercises 1.3.38 → 1.3.40

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 (222) hide show
  1. package/lib/exercises/calcul/addAndSub.d.ts.map +1 -1
  2. package/lib/exercises/calcul/addAndSub.js +29 -2
  3. package/lib/exercises/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
  4. package/lib/exercises/calcul/addAndSubWithoutRelatives.js +26 -0
  5. package/lib/exercises/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
  6. package/lib/exercises/calcul/arithmetics/primeNumbers.js +48 -9
  7. package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
  8. package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.js +29 -0
  9. package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
  10. package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.js +27 -0
  11. package/lib/exercises/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
  12. package/lib/exercises/calcul/fractions/fractionAndIntegerSum.js +27 -0
  13. package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
  14. package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.js +48 -1
  15. package/lib/exercises/calcul/fractions/fractionsDivision.d.ts.map +1 -1
  16. package/lib/exercises/calcul/fractions/fractionsDivision.js +27 -0
  17. package/lib/exercises/calcul/fractions/fractionsProduct.d.ts.map +1 -1
  18. package/lib/exercises/calcul/fractions/fractionsProduct.js +27 -0
  19. package/lib/exercises/calcul/fractions/fractionsSum.d.ts.map +1 -1
  20. package/lib/exercises/calcul/fractions/fractionsSum.js +27 -0
  21. package/lib/exercises/calcul/fractions/simplifyFraction.d.ts.map +1 -1
  22. package/lib/exercises/calcul/fractions/simplifyFraction.js +26 -0
  23. package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.d.ts.map +1 -1
  24. package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.js +30 -0
  25. package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.d.ts.map +1 -1
  26. package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.js +29 -0
  27. package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.d.ts.map +1 -1
  28. package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.js +26 -0
  29. package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.d.ts.map +1 -1
  30. package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.js +65 -0
  31. package/lib/exercises/calcul/operations/operationsPriorities.d.ts.map +1 -1
  32. package/lib/exercises/calcul/operations/operationsPriorities.js +25 -0
  33. package/lib/exercises/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
  34. package/lib/exercises/calcul/operations/operationsPrioritiesWithoutRelative.js +25 -0
  35. package/lib/exercises/calcul/proportionality/proportionalityTable.d.ts +4 -0
  36. package/lib/exercises/calcul/proportionality/proportionalityTable.d.ts.map +1 -0
  37. package/lib/exercises/calcul/proportionality/proportionalityTable.js +78 -0
  38. package/lib/exercises/calcul/rounding/rounding.d.ts.map +1 -1
  39. package/lib/exercises/calcul/rounding/rounding.js +49 -0
  40. package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.d.ts.map +1 -1
  41. package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.js +45 -0
  42. package/lib/exercises/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
  43. package/lib/exercises/calculLitteral/distributivity/firstIdentity.js +45 -0
  44. package/lib/exercises/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
  45. package/lib/exercises/calculLitteral/distributivity/secondIdentity.js +45 -0
  46. package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.d.ts.map +1 -1
  47. package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.js +45 -1
  48. package/lib/exercises/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
  49. package/lib/exercises/calculLitteral/distributivity/thirdIdentity.js +45 -0
  50. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
  51. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.js +106 -0
  52. package/lib/exercises/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
  53. package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +27 -0
  54. package/lib/exercises/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
  55. package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +27 -0
  56. package/lib/exercises/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
  57. package/lib/exercises/calculLitteral/equation/equationType3Exercise.js +27 -0
  58. package/lib/exercises/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
  59. package/lib/exercises/calculLitteral/equation/equationType4Exercise.js +27 -0
  60. package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts +4 -0
  61. package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts.map +1 -0
  62. package/lib/exercises/calculLitteral/equation/evaluateExpression.js +61 -0
  63. package/lib/exercises/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
  64. package/lib/exercises/calculLitteral/equation/firstDegreeEquation.js +25 -0
  65. package/lib/exercises/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
  66. package/lib/exercises/calculLitteral/equation/fractionEquation.js +32 -0
  67. package/lib/exercises/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  68. package/lib/exercises/calculLitteral/equation/multiplicationEquation.js +35 -0
  69. package/lib/exercises/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
  70. package/lib/exercises/calculLitteral/factorisation/factoIdRmq1.js +32 -0
  71. package/lib/exercises/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
  72. package/lib/exercises/calculLitteral/factorisation/factoIdRmq2.js +38 -0
  73. package/lib/exercises/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
  74. package/lib/exercises/calculLitteral/factorisation/factoIdRmq3.js +44 -0
  75. package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  76. package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.js +42 -0
  77. package/lib/exercises/calculLitteral/simplifying/reduceExpression.d.ts +4 -0
  78. package/lib/exercises/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -0
  79. package/lib/exercises/calculLitteral/simplifying/reduceExpression.js +118 -0
  80. package/lib/exercises/conversion/aeraConversion.d.ts.map +1 -1
  81. package/lib/exercises/conversion/aeraConversion.js +27 -0
  82. package/lib/exercises/conversion/capacityConversion.d.ts.map +1 -1
  83. package/lib/exercises/conversion/capacityConversion.js +27 -0
  84. package/lib/exercises/conversion/lengthConversion.d.ts.map +1 -1
  85. package/lib/exercises/conversion/lengthConversion.js +26 -0
  86. package/lib/exercises/conversion/massConversion.d.ts.map +1 -1
  87. package/lib/exercises/conversion/massConversion.js +26 -0
  88. package/lib/exercises/conversion/volumeCapacityConversion.d.ts.map +1 -1
  89. package/lib/exercises/conversion/volumeCapacityConversion.js +29 -3
  90. package/lib/exercises/conversion/volumeConversion.d.ts.map +1 -1
  91. package/lib/exercises/conversion/volumeConversion.js +26 -0
  92. package/lib/exercises/derivation/derivative/constanteDerivative.d.ts.map +1 -1
  93. package/lib/exercises/derivation/derivative/constanteDerivative.js +26 -0
  94. package/lib/exercises/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -1
  95. package/lib/exercises/derivation/derivative/firstDegreeDerivative.js +26 -0
  96. package/lib/exercises/derivation/derivative/inverseFunctionDerivative.d.ts.map +1 -1
  97. package/lib/exercises/derivation/derivative/inverseFunctionDerivative.js +26 -0
  98. package/lib/exercises/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -1
  99. package/lib/exercises/derivation/derivative/powerFunctionDerivative.js +26 -0
  100. package/lib/exercises/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  101. package/lib/exercises/derivation/derivative/rootFunctionDerivative.js +36 -0
  102. package/lib/exercises/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
  103. package/lib/exercises/derivation/derivative/secondDegreeDerivative.js +31 -0
  104. package/lib/exercises/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
  105. package/lib/exercises/derivation/derivative/thirdDegreeDerivative.js +30 -0
  106. package/lib/exercises/derivation/derivativeNumberReading.d.ts.map +1 -1
  107. package/lib/exercises/derivation/derivativeNumberReading.js +30 -0
  108. package/lib/exercises/exercise.d.ts +6 -0
  109. package/lib/exercises/exercise.d.ts.map +1 -1
  110. package/lib/exercises/exercises.d.ts.map +1 -1
  111. package/lib/exercises/exercises.js +8 -0
  112. package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.d.ts +4 -0
  113. package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -0
  114. package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.js +101 -0
  115. package/lib/exercises/geometry/cartesian/leadingCoefficient.d.ts.map +1 -1
  116. package/lib/exercises/geometry/cartesian/leadingCoefficient.js +30 -0
  117. package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.d.ts.map +1 -1
  118. package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.js +26 -0
  119. package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.d.ts.map +1 -1
  120. package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.js +26 -0
  121. package/lib/exercises/geometry/cartesian/midpoint.d.ts.map +1 -1
  122. package/lib/exercises/geometry/cartesian/midpoint.js +29 -0
  123. package/lib/exercises/geometry/euclidean/circleArea.d.ts.map +1 -1
  124. package/lib/exercises/geometry/euclidean/circleArea.js +28 -1
  125. package/lib/exercises/geometry/euclidean/circleCircumference.d.ts.map +1 -1
  126. package/lib/exercises/geometry/euclidean/circleCircumference.js +28 -1
  127. package/lib/exercises/geometry/euclidean/pythagore.d.ts.map +1 -1
  128. package/lib/exercises/geometry/euclidean/pythagore.js +47 -0
  129. package/lib/exercises/geometry/euclidean/pythagoreCalcul.d.ts.map +1 -1
  130. package/lib/exercises/geometry/euclidean/pythagoreCalcul.js +28 -0
  131. package/lib/exercises/geometry/euclidean/rectangleArea.d.ts.map +1 -1
  132. package/lib/exercises/geometry/euclidean/rectangleArea.js +25 -0
  133. package/lib/exercises/geometry/euclidean/rectanglePerimeter.d.ts.map +1 -1
  134. package/lib/exercises/geometry/euclidean/rectanglePerimeter.js +25 -0
  135. package/lib/exercises/geometry/euclidean/rightTriangleArea.d.ts.map +1 -1
  136. package/lib/exercises/geometry/euclidean/rightTriangleArea.js +25 -0
  137. package/lib/exercises/geometry/euclidean/squareArea.d.ts.map +1 -1
  138. package/lib/exercises/geometry/euclidean/squareArea.js +25 -0
  139. package/lib/exercises/geometry/euclidean/squarePerimeter.d.ts.map +1 -1
  140. package/lib/exercises/geometry/euclidean/squarePerimeter.js +25 -0
  141. package/lib/exercises/geometry/euclidean/thales.d.ts.map +1 -1
  142. package/lib/exercises/geometry/euclidean/thales.js +44 -1
  143. package/lib/exercises/geometry/euclidean/thalesCalcul.d.ts.map +1 -1
  144. package/lib/exercises/geometry/euclidean/thalesCalcul.js +25 -0
  145. package/lib/exercises/geometry/euclidean/triangleArea.d.ts.map +1 -0
  146. package/lib/exercises/geometry/euclidean/{TriangleArea.js → triangleArea.js} +24 -0
  147. package/lib/exercises/geometry/euclidean/triangleAreaV2.d.ts.map +1 -1
  148. package/lib/exercises/geometry/euclidean/triangleAreaV2.js +32 -1
  149. package/lib/exercises/geometry/euclidean/trianglePerimeter.d.ts.map +1 -1
  150. package/lib/exercises/geometry/euclidean/trianglePerimeter.js +26 -0
  151. package/lib/exercises/geometry/euclidean/trigonometry.d.ts.map +1 -1
  152. package/lib/exercises/geometry/euclidean/trigonometry.js +39 -0
  153. package/lib/exercises/geometry/euclidean/trigonometryAngleCalcul.d.ts.map +1 -1
  154. package/lib/exercises/geometry/euclidean/trigonometryAngleCalcul.js +24 -0
  155. package/lib/exercises/geometry/euclidean/trigonometrySideCalcul.d.ts.map +1 -1
  156. package/lib/exercises/geometry/euclidean/trigonometrySideCalcul.js +25 -0
  157. package/lib/exercises/geometry/vectors/scalarProductViaCoords.d.ts.map +1 -1
  158. package/lib/exercises/geometry/vectors/scalarProductViaCoords.js +28 -1
  159. package/lib/exercises/percent/applyPercent.d.ts.map +1 -1
  160. package/lib/exercises/percent/applyPercent.js +30 -0
  161. package/lib/exercises/percent/averageEvolutionRate.d.ts.map +1 -1
  162. package/lib/exercises/percent/averageEvolutionRate.js +32 -2
  163. package/lib/exercises/percent/globalPercent.d.ts.map +1 -1
  164. package/lib/exercises/percent/globalPercent.js +30 -0
  165. package/lib/exercises/percent/reciprocalPercentage.d.ts.map +1 -1
  166. package/lib/exercises/percent/reciprocalPercentage.js +30 -0
  167. package/lib/exercises/powers/powersDivision.d.ts.map +1 -1
  168. package/lib/exercises/powers/powersDivision.js +29 -1
  169. package/lib/exercises/powers/powersOfTenToDecimal.d.ts.map +1 -1
  170. package/lib/exercises/powers/powersOfTenToDecimal.js +28 -0
  171. package/lib/exercises/powers/powersPower.d.ts.map +1 -1
  172. package/lib/exercises/powers/powersPower.js +28 -0
  173. package/lib/exercises/powers/powersProduct.d.ts.map +1 -1
  174. package/lib/exercises/powers/powersProduct.js +29 -1
  175. package/lib/exercises/powers/scientificToDecimal.d.ts.map +1 -1
  176. package/lib/exercises/powers/scientificToDecimal.js +27 -0
  177. package/lib/exercises/proba/conditionalProbability.d.ts.map +1 -1
  178. package/lib/exercises/proba/conditionalProbability.js +25 -0
  179. package/lib/exercises/proba/marginalAndConditionalFrequency.d.ts.map +1 -1
  180. package/lib/exercises/proba/marginalAndConditionalFrequency.js +25 -0
  181. package/lib/exercises/proba/probabilityTree.d.ts.map +1 -1
  182. package/lib/exercises/proba/probabilityTree.js +33 -6
  183. package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
  184. package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +25 -0
  185. package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.d.ts.map +1 -1
  186. package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.js +25 -0
  187. package/lib/exercises/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
  188. package/lib/exercises/sequences/arithmetic/arithmeticFindReason.js +25 -0
  189. package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.d.ts.map +1 -1
  190. package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.js +25 -0
  191. package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.d.ts.map +1 -1
  192. package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.js +25 -0
  193. package/lib/exercises/sequences/arithmetic/arithmeticThresholdFind.d.ts.map +1 -1
  194. package/lib/exercises/sequences/arithmetic/arithmeticThresholdFind.js +25 -0
  195. package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
  196. package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.js +25 -0
  197. package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
  198. package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.js +31 -0
  199. package/lib/exercises/sequences/geometric/geometricFindReason.d.ts.map +1 -1
  200. package/lib/exercises/sequences/geometric/geometricFindReason.js +31 -0
  201. package/lib/exercises/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
  202. package/lib/exercises/sequences/geometric/geometricReasonUsage.js +31 -0
  203. package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.d.ts.map +1 -1
  204. package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.js +31 -0
  205. package/lib/exercises/squareRoots/simpifySquareRoot.d.ts.map +1 -1
  206. package/lib/exercises/squareRoots/simpifySquareRoot.js +29 -0
  207. package/lib/math/geometry/point.d.ts +1 -0
  208. package/lib/math/geometry/point.d.ts.map +1 -1
  209. package/lib/math/geometry/point.js +9 -0
  210. package/lib/math/polynomials/polynomial.d.ts +1 -0
  211. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  212. package/lib/math/polynomials/polynomial.js +8 -1
  213. package/lib/server.js +16 -20
  214. package/package.json +7 -6
  215. package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts +0 -4
  216. package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts.map +0 -1
  217. package/lib/exercises/geometry/cartesian/derivativeNumberReading.js +0 -51
  218. package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts +0 -1
  219. package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts.map +0 -1
  220. package/lib/exercises/geometry/cartesian/derivativeNumberReading2.js +0 -91
  221. package/lib/exercises/geometry/euclidean/TriangleArea.d.ts.map +0 -1
  222. /package/lib/exercises/geometry/euclidean/{TriangleArea.d.ts → triangleArea.d.ts} +0 -0
@@ -5,6 +5,8 @@ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQues
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
6
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
7
7
  const simplify_1 = require("../../../tree/parsers/simplify");
8
+ const shuffle_1 = require("../../../utils/shuffle");
9
+ const uuid_1 = require("uuid");
8
10
  exports.firstDegreeEquation = {
9
11
  id: 'firstDegreeEquation',
10
12
  connector: '=',
@@ -19,11 +21,34 @@ exports.firstDegreeEquation = {
19
21
  function getFirstDegreeEquation() {
20
22
  const a = (0, randint_1.randint)(-30, 30, [0]);
21
23
  const b = (0, randint_1.randint)(-30, 30, [0]);
24
+ const getPropositions = (n) => {
25
+ const res = [];
26
+ res.push({
27
+ id: (0, uuid_1.v4)() + '',
28
+ statement: (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(a / b)).toTex(),
29
+ isRightAnswer: true,
30
+ });
31
+ for (let i = 0; i < n - 1; i++) {
32
+ let isDuplicate;
33
+ let proposition;
34
+ do {
35
+ proposition = {
36
+ id: (0, uuid_1.v4)() + '',
37
+ statement: (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode((a + (0, randint_1.randint)(-7, 8, [-a])) / (b + (0, randint_1.randint)(-7, 8, [-b])))).toTex(),
38
+ isRightAnswer: false,
39
+ };
40
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
41
+ } while (isDuplicate);
42
+ res.push(proposition);
43
+ }
44
+ return (0, shuffle_1.shuffle)(res);
45
+ };
22
46
  const question = {
23
47
  instruction: `Résoudre l'équation suivante : $\\frac{${a}}{x} = ${b}$`,
24
48
  startStatement: `x`,
25
49
  answer: (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(a / b)).toTex(),
26
50
  keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
51
+ getPropositions,
27
52
  };
28
53
  return question;
29
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fractionEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/fractionEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAuB9C"}
1
+ {"version":3,"file":"fractionEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/fractionEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CA8D9C"}
@@ -7,6 +7,8 @@ const randint_1 = require("../../../math/utils/random/randint");
7
7
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
8
8
  const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
9
9
  const simplify_1 = require("../../../tree/parsers/simplify");
10
+ const shuffle_1 = require("../../../utils/shuffle");
11
+ const uuid_1 = require("uuid");
10
12
  exports.fractionEquation = {
11
13
  id: 'fractionEquation',
12
14
  connector: '\\iff',
@@ -29,10 +31,40 @@ function getFractionEquation() {
29
31
  const answer = -d / c === -b / a
30
32
  ? `S = \\emptyset`
31
33
  : `S = \\left\\{${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-b), new numberNode_1.NumberNode(a))).toTex()}\\right\\}`;
34
+ const getPropositions = (n) => {
35
+ const res = [];
36
+ res.push({
37
+ id: (0, uuid_1.v4)() + '',
38
+ statement: answer,
39
+ isRightAnswer: true,
40
+ });
41
+ for (let i = 0; i < n - 1; i++) {
42
+ let isDuplicate;
43
+ let proposition;
44
+ do {
45
+ const a = (0, randint_1.randint)(-9, 10, [0]);
46
+ const b = (0, randint_1.randint)(-9, 10, [0]);
47
+ const c = (0, randint_1.randint)(-9, 10, [0]);
48
+ const d = (0, randint_1.randint)(-9, 10, [0]);
49
+ const wrongAnswer = -d / c === -b / a
50
+ ? `S = \\emptyset`
51
+ : `S = \\left\\{${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-b), new numberNode_1.NumberNode(a))).toTex()}\\right\\}`;
52
+ proposition = {
53
+ id: (0, uuid_1.v4)() + '',
54
+ statement: wrongAnswer,
55
+ isRightAnswer: false,
56
+ };
57
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
58
+ } while (isDuplicate);
59
+ res.push(proposition);
60
+ }
61
+ return (0, shuffle_1.shuffle)(res);
62
+ };
32
63
  const question = {
33
64
  startStatement: `\\frac{${polynome1.toTex()}}{${polynome2.toTex()}} = 0`,
34
65
  answer,
35
66
  keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'ou', 'emptyset'],
67
+ getPropositions,
36
68
  };
37
69
  return question;
38
70
  }
@@ -1 +1 @@
1
- {"version":3,"file":"multiplicationEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/multiplicationEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,sBAAsB,EAAE,QAUpC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CAsBpD"}
1
+ {"version":3,"file":"multiplicationEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/multiplicationEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,sBAAsB,EAAE,QAUpC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CAsEpD"}
@@ -7,6 +7,8 @@ const randint_1 = require("../../../math/utils/random/randint");
7
7
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
8
8
  const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
9
9
  const simplify_1 = require("../../../tree/parsers/simplify");
10
+ const shuffle_1 = require("../../../utils/shuffle");
11
+ const uuid_1 = require("uuid");
10
12
  exports.multiplicationEquation = {
11
13
  id: 'multiplicationEquation',
12
14
  connector: '\\iff',
@@ -29,10 +31,43 @@ function getMultiplicationEquation() {
29
31
  } while (a / c === b / d);
30
32
  const polynome1 = new polynomial_1.Polynomial([b, a]);
31
33
  const polynome2 = new polynomial_1.Polynomial([d, c]);
34
+ const answer = `S = \\left\\{${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-b), new numberNode_1.NumberNode(a))).toTex()};${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-d), new numberNode_1.NumberNode(c))).toTex()}\\right\\}`;
35
+ const getPropositions = (n) => {
36
+ const res = [];
37
+ res.push({
38
+ id: (0, uuid_1.v4)() + '',
39
+ statement: answer,
40
+ isRightAnswer: true,
41
+ });
42
+ for (let i = 0; i < n - 1; i++) {
43
+ let isDuplicate;
44
+ let proposition;
45
+ do {
46
+ do {
47
+ a = (0, randint_1.randint)(-9, 10, [0]);
48
+ b = (0, randint_1.randint)(-9, 10, [0]);
49
+ c = (0, randint_1.randint)(-9, 10, [0]);
50
+ d = (0, randint_1.randint)(-9, 10, [0]);
51
+ } while (a / c === b / d);
52
+ const polynome1 = new polynomial_1.Polynomial([b, a]);
53
+ const polynome2 = new polynomial_1.Polynomial([d, c]);
54
+ const wrongAnswer = `S = \\left\\{${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-b), new numberNode_1.NumberNode(a))).toTex()};${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-d), new numberNode_1.NumberNode(c))).toTex()}\\right\\}`;
55
+ proposition = {
56
+ id: (0, uuid_1.v4)() + '',
57
+ statement: wrongAnswer,
58
+ isRightAnswer: false,
59
+ };
60
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
61
+ } while (isDuplicate);
62
+ res.push(proposition);
63
+ }
64
+ return (0, shuffle_1.shuffle)(res);
65
+ };
32
66
  const question = {
33
67
  startStatement: `(${polynome1.toTex()})(${polynome2.toTex()}) = 0`,
34
68
  answer: `S = \\left\\{${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-b), new numberNode_1.NumberNode(a))).toTex()};${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-d), new numberNode_1.NumberNode(c))).toTex()}\\right\\}`,
35
69
  keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'ou'],
70
+ getPropositions,
36
71
  };
37
72
  return question;
38
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factoIdRmq1.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/factorisation/factoIdRmq1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAc9D,eAAO,MAAM,WAAW,EAAE,QAUzB,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAWhD"}
1
+ {"version":3,"file":"factoIdRmq1.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/factorisation/factoIdRmq1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAgB3E,eAAO,MAAM,WAAW,EAAE,QAUzB,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAuDhD"}
@@ -6,8 +6,11 @@ const integer_1 = require("../../../math/numbers/integer/integer");
6
6
  const affine_1 = require("../../../math/polynomials/affine");
7
7
  const discreteSet_1 = require("../../../math/sets/discreteSet");
8
8
  const intervals_1 = require("../../../math/sets/intervals/intervals");
9
+ const randint_1 = require("../../../math/utils/random/randint");
9
10
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
10
11
  const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
12
+ const shuffle_1 = require("../../../utils/shuffle");
13
+ const uuid_1 = require("uuid");
11
14
  exports.factoIdRmq1 = {
12
15
  id: 'factoIdRmq1',
13
16
  connector: '=',
@@ -24,10 +27,39 @@ function getFactoType1Question() {
24
27
  const affine = affine_1.AffineConstructor.random(interval, interval);
25
28
  const statementTree = affine.multiply(affine).toTree();
26
29
  const answerTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
30
+ const getPropositions = (n) => {
31
+ const res = [];
32
+ res.push({
33
+ id: (0, uuid_1.v4)() + '',
34
+ statement: answerTree.toTex(),
35
+ isRightAnswer: true,
36
+ });
37
+ res.push({
38
+ id: (0, uuid_1.v4)() + '',
39
+ statement: new powerNode_1.PowerNode(new affine_1.Affine(affine.b, affine.a).toTree(), new numberNode_1.NumberNode(2)).toTex(),
40
+ isRightAnswer: false,
41
+ });
42
+ for (let i = 0; i < n - 2; i++) {
43
+ let isDuplicate;
44
+ let proposition;
45
+ do {
46
+ const wrongAnswer = new powerNode_1.PowerNode(new affine_1.Affine(affine.a + (0, randint_1.randint)(-affine.a + 1, 10 - affine.a), affine.b + (0, randint_1.randint)(-affine.b + 1, 10 - affine.b)).toTree(), new numberNode_1.NumberNode(2));
47
+ proposition = {
48
+ id: (0, uuid_1.v4)() + '',
49
+ statement: wrongAnswer.toTex(),
50
+ isRightAnswer: false,
51
+ };
52
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
53
+ } while (isDuplicate);
54
+ res.push(proposition);
55
+ }
56
+ return (0, shuffle_1.shuffle)(res);
57
+ };
27
58
  const question = {
28
59
  startStatement: statementTree.toTex(),
29
60
  answer: answerTree.toTex(),
30
61
  keys: ['x'],
62
+ getPropositions,
31
63
  };
32
64
  return question;
33
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factoIdRmq2.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/factorisation/factoIdRmq2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAc9D,eAAO,MAAM,WAAW,EAAE,QAUzB,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAahD"}
1
+ {"version":3,"file":"factoIdRmq2.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/factorisation/factoIdRmq2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAgB3E,eAAO,MAAM,WAAW,EAAE,QAUzB,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAgEhD"}
@@ -6,8 +6,11 @@ const integer_1 = require("../../../math/numbers/integer/integer");
6
6
  const affine_1 = require("../../../math/polynomials/affine");
7
7
  const discreteSet_1 = require("../../../math/sets/discreteSet");
8
8
  const intervals_1 = require("../../../math/sets/intervals/intervals");
9
+ const randint_1 = require("../../../math/utils/random/randint");
9
10
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
10
11
  const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
12
+ const shuffle_1 = require("../../../utils/shuffle");
13
+ const uuid_1 = require("uuid");
11
14
  exports.factoIdRmq2 = {
12
15
  id: 'factoIdRmq2',
13
16
  connector: '=',
@@ -25,10 +28,45 @@ function getFactoType1Question() {
25
28
  const affine = affine_1.AffineConstructor.random(intervalA, intervalB);
26
29
  const statementTree = affine.multiply(affine).toTree();
27
30
  const answerTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
31
+ const getPropositions = (n) => {
32
+ const res = [];
33
+ res.push({
34
+ id: (0, uuid_1.v4)() + '',
35
+ statement: answerTree.toTex(),
36
+ isRightAnswer: true,
37
+ });
38
+ res.push({
39
+ id: (0, uuid_1.v4)() + '',
40
+ statement: new powerNode_1.PowerNode(new affine_1.Affine(-affine.b, -affine.a).toTree(), new numberNode_1.NumberNode(2)).toTex(),
41
+ isRightAnswer: false,
42
+ });
43
+ if (n > 2)
44
+ res.push({
45
+ id: (0, uuid_1.v4)() + '',
46
+ statement: new powerNode_1.PowerNode(new affine_1.Affine(-affine.a, affine.b).toTree(), new numberNode_1.NumberNode(2)).toTex(),
47
+ isRightAnswer: false,
48
+ });
49
+ for (let i = 0; i < n - 3; i++) {
50
+ let isDuplicate;
51
+ let proposition;
52
+ do {
53
+ const wrongAnswer = new powerNode_1.PowerNode(new affine_1.Affine(affine.a + (0, randint_1.randint)(-affine.a + 1, 10 - affine.a), affine.b + (0, randint_1.randint)(-9 - affine.b, -affine.b)).toTree(), new numberNode_1.NumberNode(2));
54
+ proposition = {
55
+ id: (0, uuid_1.v4)() + '',
56
+ statement: wrongAnswer.toTex(),
57
+ isRightAnswer: false,
58
+ };
59
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
60
+ } while (isDuplicate);
61
+ res.push(proposition);
62
+ }
63
+ return (0, shuffle_1.shuffle)(res);
64
+ };
28
65
  const question = {
29
66
  startStatement: statementTree.toTex(),
30
67
  answer: answerTree.toTex(),
31
68
  keys: ['x'],
69
+ getPropositions,
32
70
  };
33
71
  return question;
34
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factoIdRmq3.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/factorisation/factoIdRmq3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAc9D,eAAO,MAAM,WAAW,EAAE,QAUzB,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAahD"}
1
+ {"version":3,"file":"factoIdRmq3.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/factorisation/factoIdRmq3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAa3E,eAAO,MAAM,WAAW,EAAE,QAUzB,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAqEhD"}
@@ -6,7 +6,10 @@ const integer_1 = require("../../../math/numbers/integer/integer");
6
6
  const affine_1 = require("../../../math/polynomials/affine");
7
7
  const discreteSet_1 = require("../../../math/sets/discreteSet");
8
8
  const intervals_1 = require("../../../math/sets/intervals/intervals");
9
+ const randint_1 = require("../../../math/utils/random/randint");
9
10
  const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
11
+ const shuffle_1 = require("../../../utils/shuffle");
12
+ const uuid_1 = require("uuid");
10
13
  exports.factoIdRmq3 = {
11
14
  id: 'factoIdRmq3',
12
15
  connector: '=',
@@ -24,10 +27,51 @@ function getFactoType1Question() {
24
27
  const affine2 = new affine_1.Affine(affine.a, -affine.b);
25
28
  const statementTree = affine.multiply(affine2).toTree();
26
29
  const answerTree = new multiplyNode_1.MultiplyNode(affine.toTree(), affine2.toTree());
30
+ const getPropositions = (n) => {
31
+ const res = [];
32
+ res.push({
33
+ id: (0, uuid_1.v4)() + '',
34
+ statement: answerTree.toTex(),
35
+ isRightAnswer: true,
36
+ });
37
+ res.push({
38
+ id: (0, uuid_1.v4)() + '',
39
+ statement: new multiplyNode_1.MultiplyNode(affine.toTree(), affine.toTree()).toTex(),
40
+ isRightAnswer: false,
41
+ });
42
+ if (n > 2)
43
+ res.push({
44
+ id: (0, uuid_1.v4)() + '',
45
+ statement: new multiplyNode_1.MultiplyNode(affine2.toTree(), affine2.toTree()).toTex(),
46
+ isRightAnswer: false,
47
+ });
48
+ if (n > 3)
49
+ res.push({
50
+ id: (0, uuid_1.v4)() + '',
51
+ statement: new multiplyNode_1.MultiplyNode(affine2.toTree(), new affine_1.Affine(-affine.b, affine.a).toTree()).toTex(),
52
+ isRightAnswer: false,
53
+ });
54
+ for (let i = 0; i < n - 4; i++) {
55
+ let isDuplicate;
56
+ let proposition;
57
+ do {
58
+ const wrongAnswer = new multiplyNode_1.MultiplyNode(new affine_1.Affine((0, randint_1.randint)(-9, 10, [0]), (0, randint_1.randint)(-9, 10, [0])).toTree(), new affine_1.Affine((0, randint_1.randint)(-9, 10, [0]), (0, randint_1.randint)(-9, 10, [0])).toTree());
59
+ proposition = {
60
+ id: (0, uuid_1.v4)() + '',
61
+ statement: wrongAnswer.toTex(),
62
+ isRightAnswer: false,
63
+ };
64
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
65
+ } while (isDuplicate);
66
+ res.push(proposition);
67
+ }
68
+ return (0, shuffle_1.shuffle)(res);
69
+ };
27
70
  const question = {
28
71
  startStatement: statementTree.toTex(),
29
72
  answer: answerTree.toTex(),
30
73
  keys: ['x'],
74
+ getPropositions,
31
75
  };
32
76
  return question;
33
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,kBAAkB,EAAE,QAUhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CA6BhD"}
1
+ {"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,kBAAkB,EAAE,QAUhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CA6FhD"}
@@ -11,6 +11,7 @@ const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
11
11
  const substractNode_1 = require("../../../tree/nodes/operators/substractNode");
12
12
  const random_1 = require("../../../utils/random");
13
13
  const shuffle_1 = require("../../../utils/shuffle");
14
+ const uuid_1 = require("uuid");
14
15
  exports.factoType1Exercise = {
15
16
  id: 'facto1',
16
17
  connector: '=',
@@ -30,10 +31,51 @@ function getFactoType1Question() {
30
31
  ? new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(permut[0][0].toTree(), permut[0][1].toTree()), new multiplyNode_1.MultiplyNode(permut[1][0].toTree(), permut[1][1].toTree()))
31
32
  : new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(permut[0][0].toTree(), permut[0][1].toTree()), new multiplyNode_1.MultiplyNode(permut[1][0].toTree(), permut[1][1].toTree()));
32
33
  const answerTree = new multiplyNode_1.MultiplyNode(affines[0].toTree(), affines[1].add(operation === 'add' ? affines[2] : affines[2].opposite()).toTree());
34
+ const getPropositions = (n) => {
35
+ const res = [];
36
+ res.push({
37
+ id: (0, uuid_1.v4)() + '',
38
+ statement: answerTree.toTex(),
39
+ isRightAnswer: true,
40
+ });
41
+ res.push({
42
+ id: (0, uuid_1.v4)() + '',
43
+ statement: new multiplyNode_1.MultiplyNode(affines[0].toTree(), affines[1].add(operation !== 'add' ? affines[2] : affines[2].opposite()).toTree()).toTex(),
44
+ isRightAnswer: false,
45
+ });
46
+ if (n > 2)
47
+ res.push({
48
+ id: (0, uuid_1.v4)() + '',
49
+ statement: new multiplyNode_1.MultiplyNode(affines[1].toTree(), affines[0].add(operation === 'add' ? affines[2] : affines[2].opposite()).toTree()).toTex(),
50
+ isRightAnswer: false,
51
+ });
52
+ if (n > 3)
53
+ res.push({
54
+ id: (0, uuid_1.v4)() + '',
55
+ statement: new multiplyNode_1.MultiplyNode(affines[2].toTree(), affines[0].add(operation === 'add' ? affines[2] : affines[2].opposite()).toTree()).toTex(),
56
+ isRightAnswer: false,
57
+ });
58
+ for (let i = 0; i < n - 4; i++) {
59
+ let isDuplicate;
60
+ let proposition;
61
+ do {
62
+ const wrongAnswer = new multiplyNode_1.MultiplyNode(affines[0].toTree(), affines[1].add(affine_1.AffineConstructor.differentRandoms(1)[0]).toTree());
63
+ proposition = {
64
+ id: (0, uuid_1.v4)() + '',
65
+ statement: wrongAnswer.toTex(),
66
+ isRightAnswer: false,
67
+ };
68
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
69
+ } while (isDuplicate);
70
+ res.push(proposition);
71
+ }
72
+ return (0, shuffle_1.shuffle)(res);
73
+ };
33
74
  const question = {
34
75
  startStatement: statementTree.toTex(),
35
76
  answer: answerTree.toTex(),
36
77
  keys: ['x'],
78
+ getPropositions,
37
79
  };
38
80
  return question;
39
81
  }
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const reduceExpression: Exercise;
3
+ export declare function getReduceExpression(): Question;
4
+ //# sourceMappingURL=reduceExpression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAgI9C"}
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getReduceExpression = exports.reduceExpression = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const polynomial_1 = require("../../../math/polynomials/polynomial");
6
+ const randint_1 = require("../../../math/utils/random/randint");
7
+ const addNode_1 = require("../../../tree/nodes/operators/addNode");
8
+ const shuffle_1 = require("../../../utils/shuffle");
9
+ const uuid_1 = require("uuid");
10
+ exports.reduceExpression = {
11
+ id: 'reduceExpression',
12
+ connector: '=',
13
+ instruction: "Réduire l'expression suivante :",
14
+ isSingleStep: false,
15
+ label: 'Réduire une expression',
16
+ levels: ['3', '2'],
17
+ section: 'Calcul littéral',
18
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getReduceExpression, nb),
19
+ keys: ['x'],
20
+ };
21
+ function getReduceExpression() {
22
+ const rand = (0, randint_1.randint)(0, 7);
23
+ let statement;
24
+ let polynome1;
25
+ let polynome2;
26
+ let answer;
27
+ switch (rand) {
28
+ case 0: // ax + b + cx + d
29
+ polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])]);
30
+ polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-5, 6), (0, randint_1.randint)(-5, 6, [0])]);
31
+ statement = new addNode_1.AddNode(polynome1.toTree(), polynome2.toTree());
32
+ statement.shuffle();
33
+ answer = polynome1.add(polynome2).toTree().toTex();
34
+ break;
35
+ case 1:
36
+ polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])]);
37
+ polynome2 = new polynomial_1.Polynomial([0, (0, randint_1.randint)(-5, 6, [0])]);
38
+ statement = new addNode_1.AddNode(polynome1.toTree(), polynome2.toTree());
39
+ statement.shuffle();
40
+ answer = polynome1.add(polynome2).toTree().toTex();
41
+ break;
42
+ case 2:
43
+ polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])]);
44
+ polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-5, 6, [0])]);
45
+ statement = new addNode_1.AddNode(polynome1.toTree(), polynome2.toTree());
46
+ statement.shuffle();
47
+ answer = polynome1.add(polynome2).toTree().toTex();
48
+ break;
49
+ case 3:
50
+ polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])]);
51
+ polynome2 = new polynomial_1.Polynomial([0, (0, randint_1.randint)(-5, 6), (0, randint_1.randint)(-5, 6, [0])]);
52
+ statement = new addNode_1.AddNode(polynome1.toTree(), polynome2.toTree());
53
+ statement.shuffle();
54
+ answer = polynome1.add(polynome2).toTree().toTex();
55
+ break;
56
+ case 4:
57
+ polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])]);
58
+ polynome2 = new polynomial_1.Polynomial([0, 0, (0, randint_1.randint)(-5, 6, [0])]);
59
+ statement = new addNode_1.AddNode(polynome1.toTree(), polynome2.toTree());
60
+ statement.shuffle();
61
+ answer = polynome1.add(polynome2).toTree().toTex();
62
+ break;
63
+ case 5:
64
+ polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])]);
65
+ polynome2 = new polynomial_1.Polynomial([0, (0, randint_1.randint)(-5, 6, [0])]);
66
+ statement = new addNode_1.AddNode(polynome1.toTree(), polynome2.toTree());
67
+ statement.shuffle();
68
+ answer = polynome1.add(polynome2).toTree().toTex();
69
+ break;
70
+ case 6:
71
+ polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])]);
72
+ polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-5, 6, [0])]);
73
+ statement = new addNode_1.AddNode(polynome1.toTree(), polynome2.toTree());
74
+ statement.shuffle();
75
+ answer = polynome1.add(polynome2).toTree().toTex();
76
+ break;
77
+ default:
78
+ polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])]);
79
+ polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-5, 6, [0])]);
80
+ statement = new addNode_1.AddNode(new polynomial_1.Polynomial([1, 2]).toTree(), new polynomial_1.Polynomial([3, 4]).toTree());
81
+ statement.shuffle();
82
+ answer = polynome1.add(polynome2).toTree().toTex();
83
+ break;
84
+ }
85
+ const getPropositions = (n) => {
86
+ const res = [];
87
+ res.push({
88
+ id: (0, uuid_1.v4)() + '',
89
+ statement: answer,
90
+ isRightAnswer: true,
91
+ });
92
+ for (let i = 0; i < n - 1; i++) {
93
+ let isDuplicate;
94
+ let proposition;
95
+ do {
96
+ polynome2 = new polynomial_1.Polynomial(rand < 3
97
+ ? [(0, randint_1.randint)(-5, 6, [0]), (0, randint_1.randint)(-5, 6, [0])]
98
+ : [(0, randint_1.randint)(-5, 6, [0]), (0, randint_1.randint)(-5, 6, [0]), (0, randint_1.randint)(-5, 6, [0])]);
99
+ proposition = {
100
+ id: (0, uuid_1.v4)() + '',
101
+ statement: polynome1.add(polynome2).toTree().toTex(),
102
+ isRightAnswer: false,
103
+ };
104
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
105
+ } while (isDuplicate);
106
+ res.push(proposition);
107
+ }
108
+ return (0, shuffle_1.shuffle)(res);
109
+ };
110
+ const question = {
111
+ startStatement: statement.toTex(),
112
+ answer,
113
+ keys: ['x'],
114
+ getPropositions,
115
+ };
116
+ return question;
117
+ }
118
+ exports.getReduceExpression = getReduceExpression;
@@ -1 +1 @@
1
- {"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/aeraConversion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGjD,eAAO,MAAM,cAAc,EAAE,QAU5B,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,QAAQ,CAmB5C"}
1
+ {"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/aeraConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,cAAc,EAAE,QAU5B,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,QAAQ,CAoD5C"}
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAeraConversion = exports.aeraConversion = void 0;
4
4
  const decimal_1 = require("../../math/numbers/decimals/decimal");
5
5
  const randint_1 = require("../../math/utils/random/randint");
6
+ const shuffle_1 = require("../../utils/shuffle");
6
7
  const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
8
+ const uuid_1 = require("uuid");
7
9
  exports.aeraConversion = {
8
10
  id: 'aeraConversion',
9
11
  connector: '=',
@@ -22,10 +24,35 @@ function getAeraConversion() {
22
24
  // cette manip a pour but d'éviter des conversion de type km² --> cm² ou le contraire (chiffre trop grand/petit)
23
25
  randomUnitIndex - 2 < 0 ? 0 : randomUnitIndex - 2, randomUnitIndex + 2 > 7 ? 7 : randomUnitIndex + 3, [randomUnitIndex]);
24
26
  const randomAera = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
27
+ const getPropositions = (n) => {
28
+ const res = [];
29
+ res.push({
30
+ id: (0, uuid_1.v4)() + '',
31
+ statement: randomAera.multiplyByPowerOfTen(2 * (randomUnitIndex - randomUnitInstructionIndex)).value + '',
32
+ isRightAnswer: true,
33
+ });
34
+ for (let i = 0; i < n - 1; i++) {
35
+ let isDuplicate;
36
+ let proposition;
37
+ do {
38
+ const wrongAnswer = randomAera.multiplyByPowerOfTen(2 * (0, randint_1.randint)(-2, 4, [randomUnitIndex - randomUnitInstructionIndex])).value +
39
+ '';
40
+ proposition = {
41
+ id: (0, uuid_1.v4)() + '',
42
+ statement: wrongAnswer,
43
+ isRightAnswer: false,
44
+ };
45
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
46
+ } while (isDuplicate);
47
+ res.push(proposition);
48
+ }
49
+ return (0, shuffle_1.shuffle)(res);
50
+ };
25
51
  const question = {
26
52
  instruction: `$${randomAera.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
27
53
  answer: randomAera.multiplyByPowerOfTen(2 * (randomUnitIndex - randomUnitInstructionIndex)).value + '',
28
54
  keys: [],
55
+ getPropositions,
29
56
  };
30
57
  return question;
31
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/capacityConversion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGjD,eAAO,MAAM,kBAAkB,EAAE,QAUhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAchD"}
1
+ {"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/capacityConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,kBAAkB,EAAE,QAUhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CA+ChD"}
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCapacityConversion = exports.capacityConversion = void 0;
4
4
  const decimal_1 = require("../../math/numbers/decimals/decimal");
5
5
  const randint_1 = require("../../math/utils/random/randint");
6
+ const shuffle_1 = require("../../utils/shuffle");
6
7
  const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
8
+ const uuid_1 = require("uuid");
7
9
  exports.capacityConversion = {
8
10
  id: 'capacityConversion',
9
11
  connector: '=',
@@ -20,10 +22,35 @@ function getCapacityConversion() {
20
22
  const randomUnitIndex = (0, randint_1.randint)(0, 7);
21
23
  const randomUnitInstructionIndex = (0, randint_1.randint)(0, 7, [randomUnitIndex]);
22
24
  const randomCapacity = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
25
+ const getPropositions = (n) => {
26
+ const res = [];
27
+ res.push({
28
+ id: (0, uuid_1.v4)() + '',
29
+ statement: randomCapacity.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '',
30
+ isRightAnswer: true,
31
+ });
32
+ for (let i = 0; i < n - 1; i++) {
33
+ let isDuplicate;
34
+ let proposition;
35
+ do {
36
+ const wrongAnswer = randomCapacity.multiplyByPowerOfTen((0, randint_1.randint)(-3, 4, [randomUnitIndex - randomUnitInstructionIndex])).value +
37
+ '';
38
+ proposition = {
39
+ id: (0, uuid_1.v4)() + '',
40
+ statement: wrongAnswer,
41
+ isRightAnswer: false,
42
+ };
43
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
44
+ } while (isDuplicate);
45
+ res.push(proposition);
46
+ }
47
+ return (0, shuffle_1.shuffle)(res);
48
+ };
23
49
  const question = {
24
50
  instruction: `$${randomCapacity.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
25
51
  answer: randomCapacity.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '',
26
52
  keys: [],
53
+ getPropositions,
27
54
  };
28
55
  return question;
29
56
  }