math-exercises 3.0.72 → 3.0.74

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 (239) hide show
  1. package/lib/exercises/exercise.d.ts +3 -1
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/arithmetics/divisorsList.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/arithmetics/divisorsList.js +37 -2
  5. package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts +9 -0
  6. package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts.map +1 -0
  7. package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.js +114 -0
  8. package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts +8 -0
  9. package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts.map +1 -0
  10. package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.js +152 -0
  11. package/lib/exercises/math/calcul/arithmetics/index.d.ts +11 -0
  12. package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
  13. package/lib/exercises/math/calcul/arithmetics/index.js +11 -0
  14. package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts +15 -0
  15. package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts.map +1 -0
  16. package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.js +143 -0
  17. package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.d.ts +9 -0
  18. package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.d.ts.map +1 -0
  19. package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.js +123 -0
  20. package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts +9 -0
  21. package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts.map +1 -0
  22. package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.js +111 -0
  23. package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts +10 -0
  24. package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts.map +1 -0
  25. package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.js +133 -0
  26. package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts +9 -0
  27. package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts.map +1 -0
  28. package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.js +117 -0
  29. package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts +13 -0
  30. package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts.map +1 -0
  31. package/lib/exercises/math/calcul/arithmetics/minNumberInequality.js +192 -0
  32. package/lib/exercises/math/calcul/arithmetics/paritySumsAndProducts.d.ts.map +1 -1
  33. package/lib/exercises/math/calcul/arithmetics/paritySumsAndProducts.js +114 -0
  34. package/lib/exercises/math/calcul/arithmetics/pgcdCalcul.d.ts.map +1 -1
  35. package/lib/exercises/math/calcul/arithmetics/pgcdCalcul.js +28 -1
  36. package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts.map +1 -1
  37. package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.js +1 -0
  38. package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts +7 -0
  39. package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts.map +1 -0
  40. package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.js +84 -0
  41. package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
  42. package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +37 -2
  43. package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts +8 -0
  44. package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts.map +1 -0
  45. package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.js +107 -0
  46. package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.d.ts +9 -0
  47. package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.d.ts.map +1 -0
  48. package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.js +131 -0
  49. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
  50. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +37 -0
  51. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
  52. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +57 -6
  53. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
  54. package/lib/exercises/math/calcul/fractions/fractionsOperations.js +64 -22
  55. package/lib/exercises/math/calcul/fractions/fractionsSubstraction.d.ts.map +1 -1
  56. package/lib/exercises/math/calcul/fractions/fractionsSubstraction.js +143 -4
  57. package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
  58. package/lib/exercises/math/calcul/fractions/fractionsSum.js +141 -3
  59. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  60. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  61. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  62. package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +3 -3
  63. package/lib/exercises/math/calcul/fractions/powerNotation.d.ts +9 -0
  64. package/lib/exercises/math/calcul/fractions/powerNotation.d.ts.map +1 -0
  65. package/lib/exercises/math/calcul/fractions/powerNotation.js +125 -0
  66. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  67. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +29 -5
  68. package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts +7 -0
  69. package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts.map +1 -0
  70. package/lib/exercises/math/calcul/sign/absoluteNumber.js +80 -0
  71. package/lib/exercises/math/calcul/sign/index.d.ts +1 -0
  72. package/lib/exercises/math/calcul/sign/index.d.ts.map +1 -1
  73. package/lib/exercises/math/calcul/sign/index.js +1 -0
  74. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts.map +1 -1
  75. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.js +52 -4
  76. package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts.map +1 -1
  77. package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +109 -4
  78. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
  79. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +67 -21
  80. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
  81. package/lib/exercises/math/calculLitteral/equation/equa3.js +0 -2
  82. package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.d.ts.map +1 -1
  83. package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.js +53 -9
  84. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts +9 -0
  85. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -0
  86. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +145 -0
  87. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
  88. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  89. package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
  90. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
  91. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +32 -4
  92. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  93. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +30 -2
  94. package/lib/exercises/math/calculLitteral/inequations/index.d.ts +1 -0
  95. package/lib/exercises/math/calculLitteral/inequations/index.d.ts.map +1 -1
  96. package/lib/exercises/math/calculLitteral/inequations/index.js +1 -0
  97. package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts +9 -0
  98. package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts.map +1 -0
  99. package/lib/exercises/math/calculLitteral/inequations/inequationsSign.js +75 -0
  100. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts +9 -0
  101. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts.map +1 -0
  102. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.js +120 -0
  103. package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
  104. package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +43 -1
  105. package/lib/exercises/math/curve/index.d.ts +3 -0
  106. package/lib/exercises/math/curve/index.d.ts.map +1 -0
  107. package/lib/exercises/math/curve/index.js +2 -0
  108. package/lib/exercises/math/curve/sqrtCurvePoint.d.ts +8 -0
  109. package/lib/exercises/math/curve/sqrtCurvePoint.d.ts.map +1 -0
  110. package/lib/exercises/math/curve/sqrtCurvePoint.js +132 -0
  111. package/lib/exercises/math/curve/squareCurvePoint.d.ts +8 -0
  112. package/lib/exercises/math/curve/squareCurvePoint.d.ts.map +1 -0
  113. package/lib/exercises/math/curve/squareCurvePoint.js +133 -0
  114. package/lib/exercises/math/functions/absolute/index.d.ts +2 -0
  115. package/lib/exercises/math/functions/absolute/index.d.ts.map +1 -1
  116. package/lib/exercises/math/functions/absolute/index.js +2 -0
  117. package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts +8 -0
  118. package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts.map +1 -0
  119. package/lib/exercises/math/functions/absolute/removeAbsNotation.js +105 -0
  120. package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts +8 -0
  121. package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts.map +1 -0
  122. package/lib/exercises/math/functions/absolute/removeAbsNotationSign.js +108 -0
  123. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  124. package/lib/exercises/math/functions/affines/affineExpressionReading.js +36 -0
  125. package/lib/exercises/math/functions/basics/index.js +1 -0
  126. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
  127. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +19 -0
  128. package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts +7 -0
  129. package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts.map +1 -0
  130. package/lib/exercises/math/functions/basics/valueTableCompletion.js +78 -0
  131. package/lib/exercises/math/functions/cube/cubicEquation.d.ts.map +1 -1
  132. package/lib/exercises/math/functions/cube/cubicEquation.js +16 -8
  133. package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts +8 -0
  134. package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts.map +1 -0
  135. package/lib/exercises/math/functions/cube/imageOfCubeFunction.js +142 -0
  136. package/lib/exercises/math/functions/cube/index.d.ts +1 -0
  137. package/lib/exercises/math/functions/cube/index.d.ts.map +1 -1
  138. package/lib/exercises/math/functions/cube/index.js +1 -0
  139. package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts +8 -0
  140. package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts.map +1 -0
  141. package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.js +128 -0
  142. package/lib/exercises/math/functions/square/index.d.ts +1 -0
  143. package/lib/exercises/math/functions/square/index.d.ts.map +1 -1
  144. package/lib/exercises/math/functions/square/index.js +1 -0
  145. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
  146. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +32 -2
  147. package/lib/exercises/math/index.d.ts +1 -0
  148. package/lib/exercises/math/index.d.ts.map +1 -1
  149. package/lib/exercises/math/index.js +1 -0
  150. package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.d.ts.map +1 -1
  151. package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.js +39 -8
  152. package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
  153. package/lib/exercises/math/powers/decimalToScientific.js +0 -1
  154. package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
  155. package/lib/exercises/math/powers/powersMixOperations.js +0 -1
  156. package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
  157. package/lib/exercises/math/probaStat/ballsBasicProbas.js +1 -3
  158. package/lib/exercises/math/probaStat/cardBasicProbas.d.ts.map +1 -1
  159. package/lib/exercises/math/probaStat/cardBasicProbas.js +37 -0
  160. package/lib/exercises/math/probaStat/issuesCountingForCards.d.ts.map +1 -1
  161. package/lib/exercises/math/probaStat/issuesCountingForCards.js +27 -0
  162. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts +3 -1
  163. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  164. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +126 -7
  165. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  166. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +131 -3
  167. package/lib/exercises/math/python/index.d.ts +3 -0
  168. package/lib/exercises/math/python/index.d.ts.map +1 -1
  169. package/lib/exercises/math/python/index.js +3 -0
  170. package/lib/exercises/math/python/pyIfElseCondition.d.ts +8 -0
  171. package/lib/exercises/math/python/pyIfElseCondition.d.ts.map +1 -0
  172. package/lib/exercises/math/python/pyIfElseCondition.js +133 -0
  173. package/lib/exercises/math/python/variableType.d.ts +8 -0
  174. package/lib/exercises/math/python/variableType.d.ts.map +1 -0
  175. package/lib/exercises/math/python/variableType.js +118 -0
  176. package/lib/exercises/math/python/whileLoop.js +1 -1
  177. package/lib/exercises/math/python/whileLoopCount.d.ts +8 -0
  178. package/lib/exercises/math/python/whileLoopCount.d.ts.map +1 -0
  179. package/lib/exercises/math/python/whileLoopCount.js +94 -0
  180. package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
  181. package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +1 -0
  182. package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
  183. package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.js +2 -1
  184. package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  185. package/lib/exercises/math/sets/intervals/inequalityToInterval.js +21 -0
  186. package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts.map +1 -1
  187. package/lib/exercises/math/sets/intervals/intervalToInequality.js +20 -0
  188. package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
  189. package/lib/exercises/math/sets/intervals/intervalsUnion.js +19 -0
  190. package/lib/exercises/math/sets/setBelonging.d.ts.map +1 -1
  191. package/lib/exercises/math/sets/setBelonging.js +24 -0
  192. package/lib/exercises/math/squareRoots/simpifySquareRoot.d.ts.map +1 -1
  193. package/lib/exercises/math/squareRoots/simpifySquareRoot.js +41 -0
  194. package/lib/exercises/math/squareRoots/squareRootEquation.d.ts.map +1 -1
  195. package/lib/exercises/math/squareRoots/squareRootEquation.js +25 -0
  196. package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
  197. package/lib/exercises/math/squareRoots/squareRootIdentities.js +106 -5
  198. package/lib/exercises/math/squareRoots/squareRootsDistributivity.d.ts.map +1 -1
  199. package/lib/exercises/math/squareRoots/squareRootsDistributivity.js +29 -2
  200. package/lib/exercises/math/squareRoots/squareRootsFractions.d.ts.map +1 -1
  201. package/lib/exercises/math/squareRoots/squareRootsFractions.js +33 -4
  202. package/lib/exercises/math/squareRoots/squareRootsProducts.d.ts.map +1 -1
  203. package/lib/exercises/math/squareRoots/squareRootsProducts.js +27 -4
  204. package/lib/exercises/math/squareRoots/squareRootsSum.d.ts.map +1 -1
  205. package/lib/exercises/math/squareRoots/squareRootsSum.js +33 -1
  206. package/lib/exercises/math/squareRoots/squareRootsToSquare.d.ts.map +1 -1
  207. package/lib/exercises/math/squareRoots/squareRootsToSquare.js +46 -4
  208. package/lib/exercises/pc/chemicalElements/weightPercent.d.ts.map +1 -1
  209. package/lib/exercises/pc/chemicalElements/weightPercent.js +0 -1
  210. package/lib/exercises/utils/getDistinctQuestions.d.ts.map +1 -1
  211. package/lib/exercises/utils/getDistinctQuestions.js +6 -0
  212. package/lib/index.d.ts +82 -1
  213. package/lib/index.d.ts.map +1 -1
  214. package/lib/latexTester.d.ts.map +1 -1
  215. package/lib/latexTester.js +5 -2
  216. package/lib/math/numbers/decimals/decimal.d.ts +1 -1
  217. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  218. package/lib/math/numbers/decimals/decimal.js +5 -2
  219. package/lib/playground.d.ts.map +1 -1
  220. package/lib/playground.js +9 -7
  221. package/lib/tests/pdfExo.test.d.ts.map +1 -1
  222. package/lib/tests/pdfExo.test.js +2 -2
  223. package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -1
  224. package/lib/tests/pdfs/mdCodeToLatex.js +10 -0
  225. package/lib/tests/pdfs/quizPdfPreambule.js +1 -1
  226. package/lib/tree/nodes/algebraicNode.d.ts +2 -0
  227. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  228. package/lib/tree/nodes/functions/absNode.d.ts +2 -2
  229. package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
  230. package/lib/tree/nodes/functions/absNode.js +5 -2
  231. package/lib/tree/nodes/nodeConstructor.js +1 -1
  232. package/lib/tree/nodes/numbers/numberNode.js +2 -2
  233. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  234. package/lib/tree/nodes/operators/fractionNode.js +10 -4
  235. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  236. package/lib/tree/nodes/operators/multiplyNode.js +15 -6
  237. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  238. package/lib/tree/nodes/operators/powerNode.js +4 -0
  239. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ v: string | number;
4
+ vType: string;
5
+ };
6
+ export declare const variableType: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=variableType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variableType.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/variableType.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAuGF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAkB9C,CAAC"}
@@ -0,0 +1,118 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../math/utils/random/randint.js";
4
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
5
+ const getPropositions = (n, { answer }) => {
6
+ const propositions = [];
7
+ addValidProp(propositions, answer, "raw");
8
+ tryToAddWrongProp(propositions, "Nombre entier", "raw");
9
+ tryToAddWrongProp(propositions, "Nombre flottant", "raw");
10
+ tryToAddWrongProp(propositions, "Chaine de caractères", "raw");
11
+ return shuffleProps(propositions, n);
12
+ };
13
+ const getAnswer = (identifiers) => {
14
+ const { v, vType } = identifiers;
15
+ if (vType === "int") {
16
+ return "Nombre entier";
17
+ }
18
+ else if (vType === "float") {
19
+ return "Nombre flottant";
20
+ }
21
+ else if (vType === "str") {
22
+ return "Chaine de caractères";
23
+ }
24
+ else {
25
+ throw new Error(`Unknown type: ${vType}`);
26
+ }
27
+ };
28
+ const getInstruction = (identifiers) => {
29
+ const { v, vType } = identifiers;
30
+ return `On exécute le script en Python ci-dessous :\n
31
+ \`\`\`python
32
+ v = ${vType === "str" ? `"${v}"` : v}
33
+ \`\`\`
34
+ \n
35
+ Quel est le type de la variable var ?
36
+ `;
37
+ };
38
+ const getHint = (identifiers) => {
39
+ return "En Python, le type d'une variable peut être : un nombre entier, un nombre flottant (c'est à dire avec une virgule), ou une chaîne de caractère (c'est à dire un texte).";
40
+ };
41
+ const getCorrection = (identifiers) => {
42
+ const { v, vType } = identifiers;
43
+ let explanationType = "";
44
+ if (vType === "int") {
45
+ explanationType = "Nombre entier";
46
+ }
47
+ else if (vType === "float") {
48
+ explanationType = "Nombre flottant";
49
+ }
50
+ else if (vType === "str") {
51
+ explanationType = "Chaine de caractères";
52
+ }
53
+ return `En Python, le type d'une variable peut être : un nombre entier, un nombre flottant (c'est à dire avec une virgule), ou une chaîne de caractère (c'est à dire un texte).
54
+
55
+ Ici, la variable \`v\` est de type ${explanationType.toLocaleLowerCase()}.`;
56
+ };
57
+ const getKeys = (identifiers) => {
58
+ return [];
59
+ };
60
+ const isAnswerValid = (ans, { answer }) => {
61
+ try {
62
+ throw Error("VEA not implemented");
63
+ }
64
+ catch (err) {
65
+ return handleVEAError(err);
66
+ }
67
+ };
68
+ const getVariableTypeQuestion = (ops) => {
69
+ const vTypes = ["int", "float", "str"];
70
+ const vType = vTypes[randint(0, vTypes.length)];
71
+ let v;
72
+ if (vType === "int") {
73
+ v = randint(0, 100);
74
+ }
75
+ else if (vType === "float") {
76
+ v = randint(0, 100) + Math.random().toFixed(2);
77
+ }
78
+ else {
79
+ const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
80
+ const length = randint(3, 8);
81
+ let result = "";
82
+ for (let i = 0; i < length; i++) {
83
+ result += chars.charAt(randint(0, chars.length));
84
+ }
85
+ v = result;
86
+ }
87
+ const identifiers = { v, vType };
88
+ return getQuestionFromIdentifiers(identifiers);
89
+ };
90
+ const getQuestionFromIdentifiers = (identifiers) => {
91
+ return {
92
+ answer: getAnswer(identifiers),
93
+ instruction: getInstruction(identifiers),
94
+ keys: getKeys(identifiers),
95
+ answerFormat: "raw",
96
+ identifiers,
97
+ hint: getHint(identifiers),
98
+ correction: getCorrection(identifiers),
99
+ };
100
+ };
101
+ export const variableType = {
102
+ id: "variableType",
103
+ label: "Déterminer le type d’une variable en Python",
104
+ isSingleStep: true,
105
+ generator: (nb, opts) => getDistinctQuestions(() => getVariableTypeQuestion(opts), nb),
106
+ qcmTimer: 60,
107
+ freeTimer: 60,
108
+ getPropositions,
109
+ isAnswerValid,
110
+ subject: "Mathématiques",
111
+ getInstruction,
112
+ getHint,
113
+ getCorrection,
114
+ getAnswer,
115
+ getQuestionFromIdentifiers,
116
+ hasHintAndCorrection: true,
117
+ answerType: "QCU",
118
+ };
@@ -17,7 +17,7 @@ const getAnswer = (identifiers) => {
17
17
  const getInstruction = (identifiers) => {
18
18
  const { a, initialValue, iterations, opIndex, step, x } = identifiers;
19
19
  const op = operations[opIndex];
20
- return `Qu'affichera le programme suivant ?
20
+ return `Qu'affichera le programme suivant \`var\` ?
21
21
  \`\`\`
22
22
  a = ${a}
23
23
  n = ${initialValue}
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ inputValue: number;
4
+ threshold: number;
5
+ };
6
+ export declare const pyWhileLoopCount: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=whileLoopCount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whileLoopCount.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/whileLoopCount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAqGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}
@@ -0,0 +1,94 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../math/utils/random/randint.js";
4
+ const getInstruction = ({ inputValue, threshold, }) => {
5
+ return `On définit la fonction en Python boucle.
6
+
7
+ \`\`\`python
8
+ def boucle(x):
9
+ while x > ${threshold}:
10
+ x = x / 2
11
+ return x
12
+ \`\`\`
13
+
14
+ Si l'on saisit la commande boucle($${inputValue}$), combien de fois la boucle s'exécute-t-elle ?`;
15
+ };
16
+ const getAnswer = ({ inputValue, threshold }) => {
17
+ let x = inputValue;
18
+ let count = 0;
19
+ while (x > threshold) {
20
+ x = x / 2;
21
+ count++;
22
+ }
23
+ return count.frenchify();
24
+ };
25
+ const getHint = ({ inputValue, threshold }) => {
26
+ return `La boucle s'exécute tant que la condition $x > ${threshold}$ est vraie. À chaque tour, $x$ est divisé par $2$. Compte combien de fois on peut diviser $${inputValue}$ par $2$ avant d'obtenir un résultat inférieur ou égal à $${threshold}$.`;
27
+ };
28
+ const getCorrection = ({ inputValue, threshold, }) => {
29
+ let x = inputValue;
30
+ let count = 0;
31
+ let allValues = [];
32
+ while (x > threshold) {
33
+ allValues.push(x.frenchify());
34
+ x = x / 2;
35
+ count++;
36
+ }
37
+ allValues.push(x.frenchify());
38
+ return `On commence avec $x = ${inputValue}$ et à chaque itération on divise $x$ par $2$. La boucle while $x > ${threshold}$ s'exécute tant que $x$ est strictement supérieur à $${threshold}$.
39
+
40
+ $x$ prend donc les valeurs successives suivantes :
41
+
42
+ $$
43
+ ${allValues.join("\\rightarrow ")}
44
+ $$
45
+
46
+ La boucle s'arrêtte alors car $${allValues[allValues.length - 1]} < ${threshold}$.
47
+
48
+ La boucle s'exécute donc $${count}$ fois.`;
49
+ };
50
+ const getQuestionFromIdentifiers = (identifiers) => ({
51
+ instruction: getInstruction(identifiers),
52
+ answer: getAnswer(identifiers),
53
+ hint: getHint(identifiers),
54
+ correction: getCorrection(identifiers),
55
+ keys: [],
56
+ answerFormat: "raw",
57
+ identifiers,
58
+ });
59
+ const getPyWhileLoopCountQuestion = () => {
60
+ const threshold = randint(2, 20);
61
+ const inputValue = randint(threshold + 1, 100);
62
+ return getQuestionFromIdentifiers({ inputValue, threshold });
63
+ };
64
+ const getPropositions = (n, { answer, inputValue, threshold }) => {
65
+ const propositions = [];
66
+ const correctAnswer = parseInt(answer);
67
+ addValidProp(propositions, correctAnswer.frenchify());
68
+ tryToAddWrongProp(propositions, (correctAnswer - 1).frenchify());
69
+ tryToAddWrongProp(propositions, (correctAnswer + 1).frenchify());
70
+ tryToAddWrongProp(propositions, Math.floor(inputValue / 2).frenchify());
71
+ tryToAddWrongProp(propositions, "0");
72
+ while (propositions.length < n) {
73
+ const rand = randint(0, 6);
74
+ tryToAddWrongProp(propositions, rand.frenchify());
75
+ }
76
+ return shuffleProps(propositions, n);
77
+ };
78
+ const isAnswerValid = (ans, { answer }) => ans === answer;
79
+ export const pyWhileLoopCount = {
80
+ id: "whileLoopCount",
81
+ label: "Nombre d’itérations d’une boucle while",
82
+ isSingleStep: true,
83
+ generator: (nb) => getDistinctQuestions(getPyWhileLoopCountQuestion, nb),
84
+ qcmTimer: 60,
85
+ freeTimer: 60,
86
+ getPropositions,
87
+ isAnswerValid,
88
+ getInstruction,
89
+ getHint,
90
+ getCorrection,
91
+ subject: "Mathématiques",
92
+ getQuestionFromIdentifiers,
93
+ hasHintAndCorrection: true,
94
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2FF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAchE,CAAC"}
1
+ {"version":3,"file":"arithmeticExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA4FF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAchE,CAAC"}
@@ -71,6 +71,7 @@ const getPropositions = (n, { answer, firstValue, askedRank, reason }) => {
71
71
  const isAnswerValid = (ans, { answer, askedRank }) => {
72
72
  return [
73
73
  answer,
74
+ `u${askedRank}=${answer}`,
74
75
  `u_${askedRank}=${answer}`,
75
76
  `u_{${askedRank}}=${answer}`,
76
77
  ].includes(ans);
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticFindReason.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFindReason.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA0EF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC"}
1
+ {"version":3,"file":"arithmeticFindReason.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFindReason.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA0EF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
3
4
  import { randint } from "../../../../math/utils/random/randint.js";
4
5
  import { substract } from "../../../../tree/nodes/operators/substractNode.js";
5
6
  import { shuffle } from "../../../../utils/alea/shuffle.js";
@@ -63,7 +64,7 @@ const getPropositions = (n, { answer }) => {
63
64
  return shuffle(propositions);
64
65
  };
65
66
  const isAnswerValid = (ans, { answer }) => {
66
- return ans === answer;
67
+ return numberVEA(ans, answer);
67
68
  };
68
69
  export const arithmeticFindReason = {
69
70
  id: "arithmeticFindReason",
@@ -1 +1 @@
1
- {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAK/C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AA6GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
1
+ {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAK/C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AAwIF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
@@ -41,6 +41,24 @@ const getInequalityToIntervalQuestion = () => {
41
41
  };
42
42
  return getQuestionFromIdentifiers(identifiers);
43
43
  };
44
+ const getHint = (identifiers) => {
45
+ return `
46
+ - L'intervalle $[a;b]$ représente l'ensemble des nombres $x$ compris entre $a$ et $b$ inclus.
47
+ - L'intervalle $]a;b[$ représente l'ensemble des nombres $x$ compris entre $a$ et $b$ exclus.
48
+ - L'intervalle $[a;b[$ représente l'ensemble des nombres $x$ compris entre $a$ inclus et $b$ exclus.
49
+ - L'intervalle $]a;b]$ représente l'ensemble des nombres $x$ compris entre $a$ exclus et $b$ inclus.
50
+ - L'intervalle $]-\\infty; b]$ représente l'ensemble des nombres inférieurs ou égaux à $b$.
51
+ - L'intervalle $[a; +\\infty[$ représente l'ensemble des nombres supérieurs ou égaux à $a$.
52
+ `;
53
+ };
54
+ const getCorrection = (identifiers) => {
55
+ const { intervalIdentifiers } = identifiers;
56
+ const interval = IntervalNodeConstructor.fromIdentifiers(identifiers.intervalIdentifiers);
57
+ const inequality = interval.toInequality();
58
+ return `Si $${inequality.toTex()}$, alors $x$ est ${interval.toText(true, false)}.
59
+
60
+ On a donc $${inequality.toTex()} \\iff ${getAnswer(identifiers)}$.`;
61
+ };
44
62
  const getQuestionFromIdentifiers = (identifiers) => {
45
63
  const question = {
46
64
  answer: getAnswer(identifiers),
@@ -59,6 +77,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
59
77
  ],
60
78
  answerFormat: "tex",
61
79
  identifiers,
80
+ hint: getHint(identifiers),
81
+ correction: getCorrection(identifiers),
62
82
  };
63
83
  return question;
64
84
  };
@@ -96,4 +116,5 @@ export const inequalityToInterval = {
96
116
  subject: "Mathématiques",
97
117
  rebuildIdentifiers,
98
118
  getQuestionFromIdentifiers,
119
+ hasHintAndCorrection: true,
99
120
  };
@@ -1 +1 @@
1
- {"version":3,"file":"intervalToInequality.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/intervalToInequality.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EAGL,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAK/C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AA2FF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
1
+ {"version":3,"file":"intervalToInequality.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/intervalToInequality.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EAGL,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAM/C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AAqHF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
@@ -39,6 +39,23 @@ const getIntervalToInequalityQuestion = () => {
39
39
  };
40
40
  return getQuestionFromIdentifiers(identifiers);
41
41
  };
42
+ const getHint = (identifiers) => {
43
+ return `
44
+ - L'intervalle $[a;b]$ représente l'ensemble des nombres $x$ compris entre $a$ et $b$ inclus.
45
+ - L'intervalle $]a;b[$ représente l'ensemble des nombres $x$ compris entre $a$ et $b$ exclus.
46
+ - L'intervalle $[a;b[$ représente l'ensemble des nombres $x$ compris entre $a$ inclus et $b$ exclus.
47
+ - L'intervalle $]a;b]$ représente l'ensemble des nombres $x$ compris entre $a$ exclus et $b$ inclus.
48
+ - L'intervalle $]-\\infty; b]$ représente l'ensemble des nombres inférieurs ou égaux à $b$.
49
+ - L'intervalle $[a; +\\infty[$ représente l'ensemble des nombres supérieurs ou égaux à $a$.
50
+ `;
51
+ };
52
+ const getCorrection = (identifiers) => {
53
+ const { intervalIdentifiers } = identifiers;
54
+ const interval = IntervalNodeConstructor.fromIdentifiers(identifiers.intervalIdentifiers);
55
+ return `L'intervalle $${interval.toTex()}$ représente tous les nombres ${interval.toText(true, false)}.
56
+
57
+ On a donc $x\\in ${interval.toTex()} \\iff ${getAnswer(identifiers)}$.`;
58
+ };
42
59
  const getQuestionFromIdentifiers = (identifiers) => {
43
60
  const question = {
44
61
  answer: getAnswer(identifiers),
@@ -46,6 +63,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
46
63
  keys: ["x", "inf", "sup", "geq", "leq", "infty"],
47
64
  answerFormat: "tex",
48
65
  identifiers,
66
+ hint: getHint(identifiers),
67
+ correction: getCorrection(identifiers),
49
68
  };
50
69
  return question;
51
70
  };
@@ -78,4 +97,5 @@ export const intervalToInequality = {
78
97
  subject: "Mathématiques",
79
98
  rebuildIdentifiers,
80
99
  getQuestionFromIdentifiers,
100
+ hasHintAndCorrection: true,
81
101
  };
@@ -1 +1 @@
1
- {"version":3,"file":"intervalsUnion.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/intervalsUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAK/C,KAAK,WAAW,GAAG;IAOjB,eAAe,EAAE,uBAAuB,CAAC;IACzC,eAAe,EAAE,uBAAuB,CAAC;CAC1C,CAAC;AAoHF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAchD,CAAC"}
1
+ {"version":3,"file":"intervalsUnion.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/intervalsUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAK/C,KAAK,WAAW,GAAG;IAOjB,eAAe,EAAE,uBAAuB,CAAC;IACzC,eAAe,EAAE,uBAAuB,CAAC;CAC1C,CAAC;AAwIF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAehD,CAAC"}
@@ -73,6 +73,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
73
73
  keys: ["infty", "lbracket", "rbracket", "semicolon", "cup", "cap"],
74
74
  answerFormat: "tex",
75
75
  identifiers,
76
+ hint: getHint(identifiers),
77
+ correction: getCorrection(identifiers),
76
78
  };
77
79
  return question;
78
80
  };
@@ -101,6 +103,22 @@ const isAnswerValid = (ans, { answer }) => {
101
103
  return handleVEAError(err);
102
104
  }
103
105
  };
106
+ const getCorrection = (identifiers) => {
107
+ const [int1, int2] = [
108
+ IntervalNodeConstructor.fromIdentifiers(identifiers.int1Identifiers),
109
+ IntervalNodeConstructor.fromIdentifiers(identifiers.int2Identifiers),
110
+ ];
111
+ const union = int1.union(int2);
112
+ const answer = union.toTex();
113
+ return `$I$ contient les nombres ${int1.toText(true, false)}.
114
+
115
+ $J$ contient les nombres ${int2.toText(false, false)}.
116
+
117
+ $I\\cup J$ contient donc l'ensemble de ces nombres : c'est à dire $I\\cup J = ${answer}$.`;
118
+ };
119
+ const getHint = (identifiers) => {
120
+ return `Détermine l'ensemble des nombres qui appartiennent à $I$ et/ou à $J$.`;
121
+ };
104
122
  export const intervalsUnion = {
105
123
  id: "intervalsUnion",
106
124
  connector: "=",
@@ -114,4 +132,5 @@ export const intervalsUnion = {
114
132
  subject: "Mathématiques",
115
133
  rebuildIdentifiers,
116
134
  getQuestionFromIdentifiers,
135
+ hasHintAndCorrection: true,
117
136
  };
@@ -1 +1 @@
1
- {"version":3,"file":"setBelonging.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/setBelonging.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA6FF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAgB9C,CAAC"}
1
+ {"version":3,"file":"setBelonging.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/setBelonging.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAuHF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAiB9C,CAAC"}
@@ -25,6 +25,27 @@ const getAnswer = (identifiers) => {
25
25
  }
26
26
  return "";
27
27
  };
28
+ const getHint = (identifiers) => {
29
+ return `
30
+ - $\\mathbb{N}$ est l'ensemble des nombres naturels (c'est à dire les nombres entiers positifs) ;
31
+ - $\\mathbb{Z}$ est l'ensemble des nombres relatifs (c'est à dire les nombres entiers positifs et négatifs) ;
32
+ - $\\mathbb{D}$ est l'ensemble des nombres décimaux (c'est à dire les nombres à virgule avec un nombre fini de chiffres après la virgule)
33
+ - $\\mathbb{Q}$ est l'ensemble des nombres rationnels (c'est à dire les fractions de numérateur et dénominateur entiers)
34
+ - $\\mathbb{R}$ est l'ensemble des nombres réels (c'est à dire l'ensemble des nombres qu'on peut placer sur une droite graduée)
35
+ `;
36
+ };
37
+ const getCorrection = (identifiers) => {
38
+ const { nb, type } = identifiers;
39
+ const sets = ["N", "Z", "D", "Q", "R"];
40
+ const labels = [
41
+ "nombre entier positif",
42
+ "nombre entier négatif",
43
+ "nombre décimal",
44
+ "nombre rationnel",
45
+ "nombre réel",
46
+ ];
47
+ return `$${nb}$ est un ${labels[type]}. On a donc $x \\in ${getAnswer(identifiers)}$.`;
48
+ };
28
49
  const getIdentifiers = (prevIdentifiers) => {
29
50
  //N Z D Q R (racine2, pi)
30
51
  //fraction simplifiable en décimal/entier
@@ -68,6 +89,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
68
89
  keys: getKeys(identifiers),
69
90
  answerFormat: "tex",
70
91
  identifiers,
92
+ hint: getHint(identifiers),
93
+ correction: getCorrection(identifiers),
71
94
  };
72
95
  };
73
96
  const getSetBelongingQuestion = () => {
@@ -105,4 +128,5 @@ export const setBelonging = {
105
128
  getAnswer,
106
129
  getQuestionFromIdentifiers,
107
130
  hotFix,
131
+ hasHintAndCorrection: true,
108
132
  };
@@ -1 +1 @@
1
- {"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAYT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAiEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAYpD,CAAC"}
1
+ {"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,QAAQ,EAcT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAwGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
@@ -1,5 +1,8 @@
1
1
  import { SquareRoot, SquareRootConstructor, } from "../../../math/numbers/reals/real.js";
2
+ import { sqrt } from "../../../tree/nodes/functions/sqrtNode.js";
3
+ import { multiply, } from "../../../tree/nodes/operators/multiplyNode.js";
2
4
  import { shuffle } from "../../../utils/alea/shuffle.js";
5
+ import { alignTex } from "../../../utils/latex/alignTex.js";
3
6
  import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
4
7
  import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
5
8
  const getStatementNode = (identifiers) => {
@@ -16,6 +19,41 @@ $$
16
19
  ${getStartStatement(identifiers)}
17
20
  $$`;
18
21
  };
22
+ const getHint = (identifiers) => {
23
+ const { sqrtOperand } = identifiers;
24
+ return `Cherche à écrire $${sqrtOperand}$ sous la forme $a^2\\times b$, puis utilise la propriété :
25
+
26
+ $$
27
+ \\sqrt{ab} = \\sqrt{a} \\times \\sqrt{b}
28
+ $$`;
29
+ };
30
+ const getCorrection = (identifiers) => {
31
+ const { sqrtOperand } = identifiers;
32
+ let biggestSquare = 0;
33
+ const ints = Array.from({ length: 16 }, (_, i) => i + 1).reverse();
34
+ for (const k of ints) {
35
+ const square = k ** 2;
36
+ if (sqrtOperand % square === 0) {
37
+ biggestSquare = square;
38
+ break;
39
+ }
40
+ }
41
+ return `
42
+
43
+ ${alignTex([
44
+ [
45
+ sqrt(sqrtOperand).toTex(),
46
+ "=",
47
+ sqrt(multiply(biggestSquare, sqrtOperand / biggestSquare)).toTex(),
48
+ ],
49
+ [
50
+ "",
51
+ "=",
52
+ multiply(sqrt(biggestSquare), sqrt(sqrtOperand / biggestSquare)).toTex(),
53
+ ],
54
+ ["", "=", getAnswer(identifiers)],
55
+ ])}`;
56
+ };
19
57
  const getAnswer = (identifiers) => {
20
58
  const squareRoot = new SquareRoot(identifiers.sqrtOperand);
21
59
  const answer = squareRoot.simplify().toTree().toTex();
@@ -37,6 +75,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
37
75
  keys: [],
38
76
  answerFormat: "tex",
39
77
  identifiers,
78
+ hint: getHint(identifiers),
79
+ correction: getCorrection(identifiers),
40
80
  };
41
81
  return question;
42
82
  };
@@ -69,4 +109,5 @@ export const simplifySquareRoot = {
69
109
  isAnswerValid,
70
110
  subject: "Mathématiques",
71
111
  getQuestionFromIdentifiers,
112
+ hasHintAndCorrection: true,
72
113
  };
@@ -1 +1 @@
1
- {"version":3,"file":"squareRootEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8DF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
1
+ {"version":3,"file":"squareRootEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
@@ -3,6 +3,7 @@ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuesti
3
3
  import { randint } from "../../../math/utils/random/randint.js";
4
4
  import { EquationSolutionNode } from "../../../tree/nodes/equations/equationSolutionNode.js";
5
5
  import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
6
+ import { square } from "../../../tree/nodes/operators/powerNode.js";
6
7
  import { DiscreteSetNode, EmptySet, } from "../../../tree/nodes/sets/discreteSetNode.js";
7
8
  import { shuffle } from "../../../utils/alea/shuffle.js";
8
9
  const getInstruction = (identifiers) => {
@@ -23,6 +24,27 @@ const getSquareRootEquationQuestion = () => {
23
24
  const identifiers = { k };
24
25
  return getQuestionFromIdentifiers(identifiers);
25
26
  };
27
+ const getHint = (identifiers) => {
28
+ const { k } = identifiers;
29
+ return `Si $k>=0$, alors $\\sqrt{x} = k$ si et seulement si $x = k^2$.`;
30
+ };
31
+ const getCorrection = (identifiers) => {
32
+ const { k } = identifiers;
33
+ if (k < 0) {
34
+ return `La racine carrée d'un nombre est un nombre positif. Il n'y a donc pas de solution à cette équation :
35
+
36
+ $$
37
+ ${getAnswer(identifiers)}
38
+ $$`;
39
+ }
40
+ return `Puisque $${k}>0$, alors $\\sqrt{x} = ${k}$ si et seulement si $x = ${square(k).toTex()}$.
41
+
42
+ La solution de cette équation est donc :
43
+
44
+ $$
45
+ ${getAnswer(identifiers)}
46
+ $$`;
47
+ };
26
48
  const getQuestionFromIdentifiers = (identifiers) => {
27
49
  const question = {
28
50
  answer: getAnswer(identifiers),
@@ -30,6 +52,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
30
52
  keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
31
53
  answerFormat: "tex",
32
54
  identifiers,
55
+ hint: getHint(identifiers),
56
+ correction: getCorrection(identifiers),
33
57
  };
34
58
  return question;
35
59
  };
@@ -64,4 +88,5 @@ export const squareRootEquation = {
64
88
  isAnswerValid,
65
89
  subject: "Mathématiques",
66
90
  getQuestionFromIdentifiers,
91
+ hasHintAndCorrection: true,
67
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"squareRootIdentities.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootIdentities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAqBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AA0MF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
1
+ {"version":3,"file":"squareRootIdentities.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootIdentities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAyBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAsUF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}