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
@@ -4,7 +4,9 @@ exports.getMarginalAndConditionalFrequency = exports.marginalAndConditionalFrequ
4
4
  const randint_1 = require("../../math/utils/random/randint");
5
5
  const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
6
6
  const simplify_1 = require("../../tree/parsers/simplify");
7
+ const shuffle_1 = require("../../utils/shuffle");
7
8
  const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
9
+ const uuid_1 = require("uuid");
8
10
  exports.marginalAndConditionalFrequency = {
9
11
  id: 'marginalAndConditionalFrequency',
10
12
  connector: '=',
@@ -63,6 +65,28 @@ function getMarginalAndConditionalFrequency() {
63
65
  x4 / (x2 + x4),
64
66
  ];
65
67
  const calculsNodes = Calculs.map((el) => (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(el)));
68
+ const getPropositions = (n) => {
69
+ const res = [];
70
+ res.push({
71
+ id: (0, uuid_1.v4)() + '',
72
+ statement: calculsNodes[rand].toTex(),
73
+ isRightAnswer: true,
74
+ });
75
+ for (let i = 0; i < n - 1; i++) {
76
+ let isDuplicate;
77
+ let proposition;
78
+ do {
79
+ proposition = {
80
+ id: (0, uuid_1.v4)() + '',
81
+ statement: calculsNodes[(0, randint_1.randint)(0, 12, [rand])].toTex(),
82
+ isRightAnswer: false,
83
+ };
84
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
85
+ } while (isDuplicate);
86
+ res.push(proposition);
87
+ }
88
+ return (0, shuffle_1.shuffle)(res);
89
+ };
66
90
  const question = {
67
91
  instruction: `On considère le tableau d'effectifs suivant :
68
92
 
@@ -75,6 +99,7 @@ Calculer la fréquence ${freqString[rand]}.`,
75
99
  startStatement: `${frequences[rand]}`,
76
100
  answer: calculsNodes[rand].toTex(),
77
101
  keys: ['f', 'cap', 'underscore'],
102
+ getPropositions,
78
103
  };
79
104
  return question;
80
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"probabilityTree.d.ts","sourceRoot":"","sources":["../../../src/exercises/proba/probabilityTree.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGjD,eAAO,MAAM,eAAe,EAAE,QAS7B,CAAC;AAOF,wBAAgB,kBAAkB,IAAI,QAAQ,CAwF7C"}
1
+ {"version":3,"file":"probabilityTree.d.ts","sourceRoot":"","sources":["../../../src/exercises/proba/probabilityTree.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,eAAe,EAAE,QAS7B,CAAC;AAOF,wBAAgB,kBAAkB,IAAI,QAAQ,CAwH7C"}
@@ -5,7 +5,9 @@ const randint_1 = require("../../math/utils/random/randint");
5
5
  const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
6
6
  const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
7
7
  const simplify_1 = require("../../tree/parsers/simplify");
8
+ const shuffle_1 = require("../../utils/shuffle");
8
9
  const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
10
+ const uuid_1 = require("uuid");
9
11
  exports.probabilityTree = {
10
12
  id: 'probabilityTree',
11
13
  connector: '=',
@@ -36,33 +38,35 @@ function getProbabilityTree() {
36
38
  const pB_D = (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(BD / (BC + BD)));
37
39
  let instruction = `En utilisant l'arbre de probabilité suivant, `;
38
40
  let startStatement = '';
39
- let answer = '';
41
+ let answer;
40
42
  const rand = (0, randint_1.randint)(1, 5);
41
43
  switch (rand) {
42
44
  case 1: {
43
45
  instruction += `$\\\\$ Calculer $P(A \\cap C)$`;
44
46
  startStatement = `P(A \\cap C)`;
45
- answer = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(pA, pA_C)).toTex();
47
+ answer = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(pA, pA_C));
46
48
  break;
47
49
  }
48
50
  case 2: {
49
51
  instruction += `$\\\\$ Calculer $P(A \\cap D)$`;
50
52
  startStatement = `P(A \\cap D)`;
51
- answer = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(pA, pA_D)).toTex();
53
+ answer = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(pA, pA_D));
52
54
  break;
53
55
  }
54
56
  case 3: {
55
57
  instruction += `$\\\\$ Calculer $P(B \\cap C)$`;
56
58
  startStatement = `P(B \\cap C)`;
57
- answer = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(pB, pB_C)).toTex();
59
+ answer = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(pB, pB_C));
58
60
  break;
59
61
  }
60
62
  case 4: {
61
63
  instruction += `$\\\\$ Calculer $P(B \\cap D)$`;
62
64
  startStatement = `P(B \\cap D)`;
63
- answer = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(pB, pB_D)).toTex();
65
+ answer = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(pB, pB_D));
64
66
  break;
65
67
  }
68
+ default:
69
+ answer = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(pB, pB_D)); // juste pour éviter l'erreur
66
70
  }
67
71
  let commands = [
68
72
  'A = Point({2,2})',
@@ -92,13 +96,36 @@ function getProbabilityTree() {
92
96
  'Text("C", (5.5 , -1.1))',
93
97
  'Text("D", (5.5 , -3.1))',
94
98
  ];
99
+ const getPropositions = (n) => {
100
+ const res = [];
101
+ res.push({
102
+ id: (0, uuid_1.v4)() + '',
103
+ statement: answer.toTex(),
104
+ isRightAnswer: true,
105
+ });
106
+ for (let i = 0; i < n - 1; i++) {
107
+ let isDuplicate;
108
+ let proposition;
109
+ do {
110
+ proposition = {
111
+ id: (0, uuid_1.v4)() + '',
112
+ statement: (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(answer, new numberNode_1.NumberNode((0, randint_1.randint)(2, 11)))).toTex(),
113
+ isRightAnswer: false,
114
+ };
115
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
116
+ } while (isDuplicate);
117
+ res.push(proposition);
118
+ }
119
+ return (0, shuffle_1.shuffle)(res);
120
+ };
95
121
  const question = {
96
122
  instruction,
97
123
  startStatement,
98
- answer,
124
+ answer: answer.toTex(),
99
125
  keys: [],
100
126
  commands,
101
127
  coords: [-2, 8, -5, 5],
128
+ getPropositions,
102
129
  };
103
130
  return question;
104
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAY9D,eAAO,MAAM,8BAA8B,EAAE,QAU5C,CAAC;AAEF,wBAAgB,iCAAiC,IAAI,QAAQ,CAe5D"}
1
+ {"version":3,"file":"arithmeticExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,8BAA8B,EAAE,QAU5C,CAAC;AAEF,wBAAgB,iCAAiC,IAAI,QAAQ,CA6C5D"}
@@ -4,6 +4,8 @@ exports.getArithmeticExplicitFormulaUsage = exports.arithmeticExplicitFormulaUsa
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
5
  const polynomial_1 = require("../../../math/polynomials/polynomial");
6
6
  const randint_1 = require("../../../math/utils/random/randint");
7
+ const shuffle_1 = require("../../../utils/shuffle");
8
+ const uuid_1 = require("uuid");
7
9
  exports.arithmeticExplicitFormulaUsage = {
8
10
  id: 'arithmeticExplicitFormulaUsage',
9
11
  connector: '=',
@@ -20,11 +22,34 @@ function getArithmeticExplicitFormulaUsage() {
20
22
  const firstValue = (0, randint_1.randint)(-10, 10);
21
23
  const reason = (0, randint_1.randint)(-10, 10, [0]);
22
24
  const polynomial = new polynomial_1.Polynomial([firstValue, reason], 'n');
25
+ const getPropositions = (n) => {
26
+ const res = [];
27
+ res.push({
28
+ id: (0, uuid_1.v4)() + '',
29
+ statement: (firstValue + askedRank * reason).toString(),
30
+ isRightAnswer: true,
31
+ });
32
+ for (let i = 0; i < n - 1; i++) {
33
+ let isDuplicate;
34
+ let proposition;
35
+ do {
36
+ proposition = {
37
+ id: (0, uuid_1.v4)() + '',
38
+ statement: ((0, randint_1.randint)(-5, 6, [firstValue]) + askedRank * reason).toString(),
39
+ isRightAnswer: false,
40
+ };
41
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
42
+ } while (isDuplicate);
43
+ res.push(proposition);
44
+ }
45
+ return (0, shuffle_1.shuffle)(res);
46
+ };
23
47
  const question = {
24
48
  instruction: `$(u_n)$ est une suite arithmétique définie par $u_n = ${polynomial.toString()}$. Calculer :`,
25
49
  startStatement: `u_{${askedRank}}`,
26
50
  answer: (firstValue + askedRank * reason).toString(),
27
51
  keys: ['r', 'n', 'u', 'underscore'],
52
+ getPropositions,
28
53
  };
29
54
  return question;
30
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAY9D,eAAO,MAAM,6BAA6B,EAAE,QAU3C,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CAe3D"}
1
+ {"version":3,"file":"arithmeticFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,6BAA6B,EAAE,QAU3C,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CA6C3D"}
@@ -4,6 +4,8 @@ exports.getArithmeticFindExplicitFormula = exports.arithmeticFindExplicitFormula
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
5
  const polynomial_1 = require("../../../math/polynomials/polynomial");
6
6
  const randint_1 = require("../../../math/utils/random/randint");
7
+ const shuffle_1 = require("../../../utils/shuffle");
8
+ const uuid_1 = require("uuid");
7
9
  exports.arithmeticFindExplicitFormula = {
8
10
  id: 'arithmeticFindExplicitFormula',
9
11
  connector: '=',
@@ -20,11 +22,34 @@ function getArithmeticFindExplicitFormula() {
20
22
  const firstValue = (0, randint_1.randint)(-10, 10);
21
23
  const reason = (0, randint_1.randint)(-10, 10, [0]);
22
24
  const formula = new polynomial_1.Polynomial([firstValue, reason], 'n');
25
+ const getPropositions = (n) => {
26
+ const res = [];
27
+ res.push({
28
+ id: (0, uuid_1.v4)() + '',
29
+ statement: formula.toString(),
30
+ isRightAnswer: true,
31
+ });
32
+ for (let i = 0; i < n - 1; i++) {
33
+ let isDuplicate;
34
+ let proposition;
35
+ do {
36
+ proposition = {
37
+ id: (0, uuid_1.v4)() + '',
38
+ statement: new polynomial_1.Polynomial([firstValue + (0, randint_1.randint)(-3, 4), reason + (0, randint_1.randint)(-3, 4)], 'n').toString(),
39
+ isRightAnswer: false,
40
+ };
41
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
42
+ } while (isDuplicate);
43
+ res.push(proposition);
44
+ }
45
+ return (0, shuffle_1.shuffle)(res);
46
+ };
23
47
  const question = {
24
48
  instruction: `$(u_n)$ est une suite arithmétique de premier terme $u_{${firstRank}} = ${firstValue}$ et de raison $r = ${reason}$. $\\\\$ Donner l'expression de $u_n$ en fonction de $n$.`,
25
49
  startStatement: 'u_n',
26
50
  answer: formula.toString(),
27
51
  keys: ['r', 'n', 'u', 'underscore'],
52
+ getPropositions,
28
53
  };
29
54
  return question;
30
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticFindReason.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticFindReason.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,oBAAoB,EAAE,QAWlC,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAclD"}
1
+ {"version":3,"file":"arithmeticFindReason.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticFindReason.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,oBAAoB,EAAE,QAWlC,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CA4ClD"}
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getArithmeticFindReason = exports.arithmeticFindReason = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
+ const shuffle_1 = require("../../../utils/shuffle");
7
+ const uuid_1 = require("uuid");
6
8
  exports.arithmeticFindReason = {
7
9
  id: 'arithmeticFindReason',
8
10
  connector: '=',
@@ -20,11 +22,34 @@ function getArithmeticFindReason() {
20
22
  const reason = (0, randint_1.randint)(-10, 10, [0]);
21
23
  const value1 = (0, randint_1.randint)(-10, 10);
22
24
  const value2 = reason + value1;
25
+ const getPropositions = (n) => {
26
+ const res = [];
27
+ res.push({
28
+ id: (0, uuid_1.v4)() + '',
29
+ statement: reason + '',
30
+ isRightAnswer: true,
31
+ });
32
+ for (let i = 0; i < n - 1; i++) {
33
+ let isDuplicate;
34
+ let proposition;
35
+ do {
36
+ proposition = {
37
+ id: (0, uuid_1.v4)() + '',
38
+ statement: reason + (0, randint_1.randint)(-5, 6, [0]) + '',
39
+ isRightAnswer: false,
40
+ };
41
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
42
+ } while (isDuplicate);
43
+ res.push(proposition);
44
+ }
45
+ return (0, shuffle_1.shuffle)(res);
46
+ };
23
47
  const question = {
24
48
  instruction: `$(u_n)$ est une suite arithmétique. On sait que $u_{${rank1}} = ${value1}$ et $u_{${rank2}} = ${value2}$. Quelle est la raison de la suite $(u_n)$ ?`,
25
49
  startStatement: 'r',
26
50
  answer: reason.toString(),
27
51
  keys: ['r', 'n', 'u', 'underscore'],
52
+ getPropositions,
28
53
  };
29
54
  return question;
30
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticReasonUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAI9D,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAYnD"}
1
+ {"version":3,"file":"arithmeticReasonUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CA2CnD"}
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getArithmeticReasonUsage = exports.arithmeticReasonUsage = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
+ const shuffle_1 = require("../../../utils/shuffle");
7
+ const uuid_1 = require("uuid");
6
8
  exports.arithmeticReasonUsage = {
7
9
  id: 'arithmeticReasonUsage',
8
10
  connector: '=',
@@ -19,11 +21,34 @@ function getArithmeticReasonUsage() {
19
21
  const startRank = (0, randint_1.randint)(0, 20);
20
22
  const askedRank = startRank + 1;
21
23
  const startValue = (0, randint_1.randint)(-10, 10);
24
+ const getPropositions = (n) => {
25
+ const res = [];
26
+ res.push({
27
+ id: (0, uuid_1.v4)() + '',
28
+ statement: (startValue + reason).toString(),
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: startValue + reason + (0, randint_1.randint)(-5, 6, [0]) + '',
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: `$(u_n)$ est une suite arithmétique de raison $r = ${reason}$ et on sait que $u_{${startRank}} = ${startValue}$. Calculer : `,
24
48
  startStatement: `u_{${askedRank}}`,
25
49
  answer: (startValue + reason).toString(),
26
50
  keys: ['r', 'n', 'u', 'underscore'],
51
+ getPropositions,
27
52
  };
28
53
  return question;
29
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIhF,eAAO,MAAM,gCAAgC,EAAE,QAU9C,CAAC;AAEF,wBAAgB,mCAAmC,IAAI,QAAQ,CAa9D"}
1
+ {"version":3,"file":"arithmeticRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiC,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM7F,eAAO,MAAM,gCAAgC,EAAE,QAU9C,CAAC;AAEF,wBAAgB,mCAAmC,IAAI,QAAQ,CA2C9D"}
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getArithmeticRecurrenceFormulaUsage = exports.arithmeticRecurrenceFormulaUsage = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
+ const shuffle_1 = require("../../../utils/shuffle");
7
+ const uuid_1 = require("uuid");
6
8
  exports.arithmeticRecurrenceFormulaUsage = {
7
9
  id: 'arithmeticRecurrenceFormulaUsage',
8
10
  connector: '=',
@@ -19,11 +21,34 @@ function getArithmeticRecurrenceFormulaUsage() {
19
21
  const firstValue = (0, randint_1.randint)(-10, 10);
20
22
  const reason = (0, randint_1.randint)(-10, 10, [0]);
21
23
  const askedRank = firstRank + 1;
24
+ const getPropositions = (n) => {
25
+ const res = [];
26
+ res.push({
27
+ id: (0, uuid_1.v4)() + '',
28
+ statement: (firstValue + reason).toString(),
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: firstValue + reason + (0, randint_1.randint)(-5, 6, [0]) + '',
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: `$(u_n)$ est une suite définie par $u_{n+1} = ${reason} + u_n$ et $u_{${firstRank}} = ${firstValue}$. Calculer :`,
24
48
  startStatement: `u_{${askedRank}}`,
25
49
  answer: (firstValue + reason).toString(),
26
50
  keys: ['r', 'n', 'u', 'underscore'],
51
+ getPropositions,
27
52
  };
28
53
  return question;
29
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticThresholdFind.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticThresholdFind.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAGpD,eAAO,MAAM,uBAAuB,EAAE,QAUrC,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CAyBrD"}
1
+ {"version":3,"file":"arithmeticThresholdFind.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticThresholdFind.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAIjE,eAAO,MAAM,uBAAuB,EAAE,QAUrC,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CAuDrD"}
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getArithmeticThresholdFind = exports.arithmeticThresholdFind = void 0;
4
4
  const polynomial_1 = require("../../../math/polynomials/polynomial");
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.arithmeticThresholdFind = {
8
10
  id: 'arithmeticThresholdFind',
9
11
  connector: '=',
@@ -29,11 +31,34 @@ function getArithmeticThresholdFind() {
29
31
  randValue += (0, randint_1.randint)(-100, reason);
30
32
  instruction += `À partir de quel rang a-t-on $u_n < ${randValue}$ ?`;
31
33
  }
34
+ const getPropositions = (n) => {
35
+ const res = [];
36
+ res.push({
37
+ id: (0, uuid_1.v4)() + '',
38
+ statement: (Math.floor((randValue - firstValue) / reason) + 1).toString(),
39
+ isRightAnswer: true,
40
+ });
41
+ for (let i = 0; i < n - 1; i++) {
42
+ let isDuplicate;
43
+ let proposition;
44
+ do {
45
+ proposition = {
46
+ id: (0, uuid_1.v4)() + '',
47
+ statement: (Math.floor((randValue - firstValue) / reason) + (0, randint_1.randint)(-5, 6, [1])).toString(),
48
+ isRightAnswer: false,
49
+ };
50
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
51
+ } while (isDuplicate);
52
+ res.push(proposition);
53
+ }
54
+ return (0, shuffle_1.shuffle)(res);
55
+ };
32
56
  const question = {
33
57
  instruction,
34
58
  startStatement: `n`,
35
59
  answer: (Math.floor((randValue - firstValue) / reason) + 1).toString(),
36
60
  keys: ['r', 'n', 'u', 'underscore', 'inf', 'sup', 'approx'],
61
+ getPropositions,
37
62
  };
38
63
  return question;
39
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"geometricExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,6BAA6B,EAAE,QAU3C,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CAiB3D"}
1
+ {"version":3,"file":"geometricExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E,eAAO,MAAM,6BAA6B,EAAE,QAU3C,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CAgD3D"}
@@ -8,6 +8,8 @@ const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
8
8
  const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
9
9
  const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
10
10
  const simplify_1 = require("../../../tree/parsers/simplify");
11
+ const shuffle_1 = require("../../../utils/shuffle");
12
+ const uuid_1 = require("uuid");
11
13
  exports.geometricExplicitFormulaUsage = {
12
14
  id: 'geometricExplicitFormulaUsage',
13
15
  connector: '=',
@@ -25,11 +27,34 @@ function getGeometricExplicitFormulaUsage() {
25
27
  const reason = (0, randint_1.randint)(2, 10);
26
28
  const formula = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(firstValue), new powerNode_1.PowerNode(new numberNode_1.NumberNode(reason), new variableNode_1.VariableNode('n')));
27
29
  const formulaTex = (0, simplify_1.simplifyNode)(formula).toTex();
30
+ const getPropositions = (n) => {
31
+ const res = [];
32
+ res.push({
33
+ id: (0, uuid_1.v4)() + '',
34
+ statement: (firstValue * Math.pow(reason, askedRank)).toString(),
35
+ isRightAnswer: true,
36
+ });
37
+ for (let i = 0; i < n - 1; i++) {
38
+ let isDuplicate;
39
+ let proposition;
40
+ do {
41
+ proposition = {
42
+ id: (0, uuid_1.v4)() + '',
43
+ statement: (firstValue * Math.pow(reason, (0, randint_1.randint)(0, 9, [askedRank]))).toString(),
44
+ isRightAnswer: false,
45
+ };
46
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
47
+ } while (isDuplicate);
48
+ res.push(proposition);
49
+ }
50
+ return (0, shuffle_1.shuffle)(res);
51
+ };
28
52
  const question = {
29
53
  instruction: `$(u_n)$ est une suite géométrique définie par $u_n = ${formulaTex}$. Calculer :`,
30
54
  startStatement: `u_{${askedRank}}`,
31
55
  answer: (firstValue * Math.pow(reason, askedRank)).toString(),
32
56
  keys: ['n', 'u', 'underscore'],
57
+ getPropositions,
33
58
  };
34
59
  return question;
35
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"geometricFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,4BAA4B,EAAE,QAU1C,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAgB1D"}
1
+ {"version":3,"file":"geometricFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E,eAAO,MAAM,4BAA4B,EAAE,QAU1C,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CA2D1D"}
@@ -8,6 +8,8 @@ const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
8
8
  const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
9
9
  const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
10
10
  const simplify_1 = require("../../../tree/parsers/simplify");
11
+ const shuffle_1 = require("../../../utils/shuffle");
12
+ const uuid_1 = require("uuid");
11
13
  exports.geometricFindExplicitFormula = {
12
14
  id: 'geometricFindExplicitFormula',
13
15
  connector: '=',
@@ -24,11 +26,40 @@ function getGeometricFindExplicitFormula() {
24
26
  const firstValue = (0, randint_1.randint)(1, 10);
25
27
  const reason = (0, randint_1.randint)(2, 10);
26
28
  const formula = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(firstValue), new powerNode_1.PowerNode(new numberNode_1.NumberNode(reason), new variableNode_1.VariableNode('n')));
29
+ const getPropositions = (n) => {
30
+ const res = [];
31
+ res.push({
32
+ id: (0, uuid_1.v4)() + '',
33
+ statement: (0, simplify_1.simplifyNode)(formula).toTex(),
34
+ isRightAnswer: true,
35
+ });
36
+ res.push({
37
+ id: (0, uuid_1.v4)() + '',
38
+ statement: (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(reason), new powerNode_1.PowerNode(new numberNode_1.NumberNode(firstValue), new variableNode_1.VariableNode('n')))).toTex(),
39
+ isRightAnswer: false,
40
+ });
41
+ for (let i = 0; i < n - 2; i++) {
42
+ let isDuplicate;
43
+ let proposition;
44
+ do {
45
+ const wrongAnswer = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(firstValue + (0, randint_1.randint)(-firstValue, 2 * firstValue + 1)), new powerNode_1.PowerNode(new numberNode_1.NumberNode(reason + +(0, randint_1.randint)(-reason + 1, 2 * reason + 1)), new variableNode_1.VariableNode('n')));
46
+ proposition = {
47
+ id: (0, uuid_1.v4)() + '',
48
+ statement: (0, simplify_1.simplifyNode)(wrongAnswer).toTex(),
49
+ isRightAnswer: false,
50
+ };
51
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
52
+ } while (isDuplicate);
53
+ res.push(proposition);
54
+ }
55
+ return (0, shuffle_1.shuffle)(res);
56
+ };
27
57
  const question = {
28
58
  instruction: `$(u_n)$ est une suite géométrique de premier terme $u_{${firstRank}} = ${firstValue}$ et de raison $q = ${reason}$. $\\\\$ Donner l'expression de $u_n$ en fonction de $n$.`,
29
59
  startStatement: 'u_n',
30
60
  answer: (0, simplify_1.simplifyNode)(formula).toTex(),
31
61
  keys: ['q', 'n', 'u', 'underscore'],
62
+ getPropositions,
32
63
  };
33
64
  return question;
34
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"geometricFindReason.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricFindReason.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAI9D,eAAO,MAAM,mBAAmB,EAAE,QAUjC,CAAC;AAEF,wBAAgB,sBAAsB,IAAI,QAAQ,CAajD"}
1
+ {"version":3,"file":"geometricFindReason.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricFindReason.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,mBAAmB,EAAE,QAUjC,CAAC;AAEF,wBAAgB,sBAAsB,IAAI,QAAQ,CAmDjD"}
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getGeometricFindReason = exports.geometricFindReason = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
+ const shuffle_1 = require("../../../utils/shuffle");
7
+ const uuid_1 = require("uuid");
6
8
  exports.geometricFindReason = {
7
9
  id: 'geometricFindReason',
8
10
  connector: '=',
@@ -20,11 +22,40 @@ function getGeometricFindReason() {
20
22
  const reason = (0, randint_1.randint)(2, 10);
21
23
  const value1 = (0, randint_1.randint)(1, 10);
22
24
  const value2 = reason * value1;
25
+ const getPropositions = (n) => {
26
+ const res = [];
27
+ res.push({
28
+ id: (0, uuid_1.v4)() + '',
29
+ statement: reason + '',
30
+ isRightAnswer: true,
31
+ });
32
+ if (value2 - value1 !== 2)
33
+ res.push({
34
+ id: (0, uuid_1.v4)() + '',
35
+ statement: value2 - value1 + '',
36
+ isRightAnswer: false,
37
+ });
38
+ for (let i = 0; i < (value2 - value1 === 2 ? n - 1 : n - 2); i++) {
39
+ let isDuplicate;
40
+ let proposition;
41
+ do {
42
+ proposition = {
43
+ id: (0, uuid_1.v4)() + '',
44
+ statement: reason + (0, randint_1.randint)(1, 10) + '',
45
+ isRightAnswer: false,
46
+ };
47
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
48
+ } while (isDuplicate);
49
+ res.push(proposition);
50
+ }
51
+ return (0, shuffle_1.shuffle)(res);
52
+ };
23
53
  const question = {
24
54
  instruction: `$(u_n)$ est une suite géométrique. On sait que $u_{${rank1}} = ${value1}$ et $u_{${rank2}} = ${value2}$. Quelle est la raison de la suite $(u_n)$ ?`,
25
55
  startStatement: 'q',
26
56
  answer: reason.toString(),
27
57
  keys: ['q', 'n', 'u', 'underscore'],
58
+ getPropositions,
28
59
  };
29
60
  return question;
30
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAI9D,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAYlD"}
1
+ {"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAkDlD"}