math-exercises 3.0.198 → 3.0.200

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 (152) hide show
  1. package/lib/exercises/exercise.d.ts +14 -1
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/_debug/debugReorder1.d.ts +8 -0
  4. package/lib/exercises/math/_debug/debugReorder1.d.ts.map +1 -0
  5. package/lib/exercises/math/_debug/debugReorder1.js +81 -0
  6. package/lib/exercises/math/_debug/debugReorder2.d.ts +10 -0
  7. package/lib/exercises/math/_debug/debugReorder2.d.ts.map +1 -0
  8. package/lib/exercises/math/_debug/debugReorder2.js +88 -0
  9. package/lib/exercises/math/_debug/debugReorder3.d.ts +10 -0
  10. package/lib/exercises/math/_debug/debugReorder3.d.ts.map +1 -0
  11. package/lib/exercises/math/_debug/debugReorder3.js +81 -0
  12. package/lib/exercises/math/_debug/index.d.ts +3 -1
  13. package/lib/exercises/math/_debug/index.d.ts.map +1 -1
  14. package/lib/exercises/math/_debug/index.js +3 -1
  15. package/lib/exercises/math/calcul/factorial/index.d.ts +2 -0
  16. package/lib/exercises/math/calcul/factorial/index.d.ts.map +1 -0
  17. package/lib/exercises/math/calcul/factorial/index.js +1 -0
  18. package/lib/exercises/math/calcul/factorial/simplifyQuotientOfFactorialToProduct.d.ts +8 -0
  19. package/lib/exercises/math/calcul/factorial/simplifyQuotientOfFactorialToProduct.d.ts.map +1 -0
  20. package/lib/exercises/math/calcul/factorial/simplifyQuotientOfFactorialToProduct.js +199 -0
  21. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.d.ts.map +1 -1
  22. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.js +3 -0
  23. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  24. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +58 -30
  25. package/lib/exercises/math/combinatory/combination/index.d.ts +3 -0
  26. package/lib/exercises/math/combinatory/combination/index.d.ts.map +1 -0
  27. package/lib/exercises/math/combinatory/combination/index.js +2 -0
  28. package/lib/exercises/math/combinatory/combination/mentalCalculateCombination.d.ts +11 -0
  29. package/lib/exercises/math/combinatory/combination/mentalCalculateCombination.d.ts.map +1 -0
  30. package/lib/exercises/math/combinatory/combination/mentalCalculateCombination.js +225 -0
  31. package/lib/exercises/math/combinatory/combination/writeCombinationFormulaUsingFactorial.d.ts +13 -0
  32. package/lib/exercises/math/combinatory/combination/writeCombinationFormulaUsingFactorial.d.ts.map +1 -0
  33. package/lib/exercises/math/combinatory/combination/writeCombinationFormulaUsingFactorial.js +285 -0
  34. package/lib/exercises/math/complex/addComplex.d.ts.map +1 -1
  35. package/lib/exercises/math/complex/addComplex.js +53 -7
  36. package/lib/exercises/math/complex/conjugateComplex.d.ts.map +1 -1
  37. package/lib/exercises/math/complex/conjugateComplex.js +48 -7
  38. package/lib/exercises/math/complex/mutiplyComplex.d.ts.map +1 -1
  39. package/lib/exercises/math/complex/mutiplyComplex.js +51 -18
  40. package/lib/exercises/math/complex/reAndIm.d.ts.map +1 -1
  41. package/lib/exercises/math/complex/reAndIm.js +35 -4
  42. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts.map +1 -1
  43. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.js +1 -1
  44. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.d.ts.map +1 -1
  45. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.js +47 -3
  46. package/lib/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.d.ts +9 -0
  47. package/lib/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.d.ts.map +1 -0
  48. package/lib/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.js +209 -0
  49. package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.d.ts +9 -0
  50. package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.d.ts.map +1 -0
  51. package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.js +359 -0
  52. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts +11 -0
  53. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts.map +1 -0
  54. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.js +445 -0
  55. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts.map +1 -1
  56. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.js +2 -3
  57. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts.map +1 -1
  58. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.js +3 -0
  59. package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
  60. package/lib/exercises/math/functions/sign/affineProductSign.js +0 -4
  61. package/lib/exercises/math/index.d.ts +1 -0
  62. package/lib/exercises/math/index.d.ts.map +1 -1
  63. package/lib/exercises/math/index.js +1 -1
  64. package/lib/exercises/math/limits/sequenceGeometricLimit.d.ts.map +1 -1
  65. package/lib/exercises/math/limits/sequenceGeometricLimit.js +9 -0
  66. package/lib/exercises/math/primitive/constantPrimitive.d.ts +8 -5
  67. package/lib/exercises/math/primitive/constantPrimitive.d.ts.map +1 -1
  68. package/lib/exercises/math/primitive/constantPrimitive.js +40 -21
  69. package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
  70. package/lib/exercises/math/probaStat/stats2var/averagePoint.js +34 -2
  71. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdFromGraph.d.ts +15 -0
  72. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdFromGraph.d.ts.map +1 -0
  73. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdFromGraph.js +255 -0
  74. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdUsingCalculator.d.ts +15 -0
  75. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdUsingCalculator.d.ts.map +1 -0
  76. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdUsingCalculator.js +242 -0
  77. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.js +4 -4
  78. package/lib/exercises/math/sequences/geometric/graph/geometricSignOfReasonFromGraph.d.ts +12 -0
  79. package/lib/exercises/math/sequences/geometric/graph/geometricSignOfReasonFromGraph.d.ts.map +1 -0
  80. package/lib/exercises/math/sequences/geometric/graph/geometricSignOfReasonFromGraph.js +161 -0
  81. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSets.d.ts +10 -0
  82. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSets.d.ts.map +1 -0
  83. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSets.js +224 -0
  84. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSetsFromSituation.d.ts +18 -0
  85. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSetsFromSituation.d.ts.map +1 -0
  86. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSetsFromSituation.js +198 -0
  87. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfPowEK.d.ts +10 -0
  88. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfPowEK.d.ts.map +1 -0
  89. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfPowEK.js +231 -0
  90. package/lib/exercises/math/sets/cartesianProduct/findNumberOfPasswordsWithLettersAndNumbers.d.ts +19 -0
  91. package/lib/exercises/math/sets/cartesianProduct/findNumberOfPasswordsWithLettersAndNumbers.d.ts.map +1 -0
  92. package/lib/exercises/math/sets/cartesianProduct/findNumberOfPasswordsWithLettersAndNumbers.js +187 -0
  93. package/lib/exercises/math/sets/cartesianProduct/index.d.ts +7 -0
  94. package/lib/exercises/math/sets/cartesianProduct/index.d.ts.map +1 -0
  95. package/lib/exercises/math/sets/cartesianProduct/index.js +6 -0
  96. package/lib/exercises/math/sets/cartesianProduct/proposeElementInCartesianProductOfFiniteSets.d.ts +15 -0
  97. package/lib/exercises/math/sets/cartesianProduct/proposeElementInCartesianProductOfFiniteSets.d.ts.map +1 -0
  98. package/lib/exercises/math/sets/cartesianProduct/proposeElementInCartesianProductOfFiniteSets.js +291 -0
  99. package/lib/exercises/math/sets/cartesianProduct/proposeElementInPowEK.d.ts +15 -0
  100. package/lib/exercises/math/sets/cartesianProduct/proposeElementInPowEK.d.ts.map +1 -0
  101. package/lib/exercises/math/sets/cartesianProduct/proposeElementInPowEK.js +274 -0
  102. package/lib/exercises/math/sets/combinations/findNumberOfCombinationsFromSituation.d.ts +17 -0
  103. package/lib/exercises/math/sets/combinations/findNumberOfCombinationsFromSituation.d.ts.map +1 -0
  104. package/lib/exercises/math/sets/combinations/findNumberOfCombinationsFromSituation.js +228 -0
  105. package/lib/exercises/math/sets/combinations/findNumberOfProductsOfCombinationsFromSituation.d.ts +17 -0
  106. package/lib/exercises/math/sets/combinations/findNumberOfProductsOfCombinationsFromSituation.d.ts.map +1 -0
  107. package/lib/exercises/math/sets/combinations/findNumberOfProductsOfCombinationsFromSituation.js +388 -0
  108. package/lib/exercises/math/sets/combinations/index.d.ts +4 -0
  109. package/lib/exercises/math/sets/combinations/index.d.ts.map +1 -0
  110. package/lib/exercises/math/sets/combinations/index.js +3 -0
  111. package/lib/exercises/math/sets/combinations/proposeCombination.d.ts +15 -0
  112. package/lib/exercises/math/sets/combinations/proposeCombination.d.ts.map +1 -0
  113. package/lib/exercises/math/sets/combinations/proposeCombination.js +347 -0
  114. package/lib/exercises/math/sets/partialPermutations/findNumberOfPartialPermutationsFromSituation.d.ts +16 -0
  115. package/lib/exercises/math/sets/partialPermutations/findNumberOfPartialPermutationsFromSituation.d.ts.map +1 -0
  116. package/lib/exercises/math/sets/partialPermutations/findNumberOfPartialPermutationsFromSituation.js +186 -0
  117. package/lib/exercises/math/sets/partialPermutations/findNumberOfPermutationsFromSituation.d.ts +17 -0
  118. package/lib/exercises/math/sets/partialPermutations/findNumberOfPermutationsFromSituation.d.ts.map +1 -0
  119. package/lib/exercises/math/sets/partialPermutations/findNumberOfPermutationsFromSituation.js +232 -0
  120. package/lib/exercises/math/sets/partialPermutations/index.d.ts +4 -0
  121. package/lib/exercises/math/sets/partialPermutations/index.d.ts.map +1 -0
  122. package/lib/exercises/math/sets/partialPermutations/index.js +3 -0
  123. package/lib/exercises/math/sets/partialPermutations/proposePartialPermutation.d.ts +15 -0
  124. package/lib/exercises/math/sets/partialPermutations/proposePartialPermutation.d.ts.map +1 -0
  125. package/lib/exercises/math/sets/partialPermutations/proposePartialPermutation.js +343 -0
  126. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts.map +1 -1
  127. package/lib/exercises/math/trigonometry/functions/parityOfCosAXTimesSinBX.d.ts +8 -0
  128. package/lib/exercises/math/trigonometry/functions/parityOfCosAXTimesSinBX.d.ts.map +1 -0
  129. package/lib/exercises/math/trigonometry/functions/parityOfCosAXTimesSinBX.js +193 -0
  130. package/lib/index.d.ts +15 -1
  131. package/lib/index.d.ts.map +1 -1
  132. package/lib/math/sets/setOperations.d.ts +9 -0
  133. package/lib/math/sets/setOperations.d.ts.map +1 -0
  134. package/lib/math/sets/setOperations.js +84 -0
  135. package/lib/math/sets/tuple.d.ts +12 -0
  136. package/lib/math/sets/tuple.d.ts.map +1 -0
  137. package/lib/math/sets/tuple.js +17 -0
  138. package/lib/server.js +28 -2
  139. package/lib/tests/pdfExo.test.js +2 -2
  140. package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -1
  141. package/lib/tests/pdfs/buildPDFForExercise.js +6 -0
  142. package/lib/tests/pdfs/quizPdfPreambule.d.ts.map +1 -1
  143. package/lib/tests/pdfs/quizPdfPreambule.js +1 -0
  144. package/lib/tests/pdfs/treeDiagramToLatex.d.ts +15 -0
  145. package/lib/tests/pdfs/treeDiagramToLatex.d.ts.map +1 -0
  146. package/lib/tests/pdfs/treeDiagramToLatex.js +49 -0
  147. package/lib/tests/questionTest.d.ts.map +1 -1
  148. package/lib/tests/questionTest.js +19 -0
  149. package/lib/tree/utilities/nodePrinter.d.ts +7 -0
  150. package/lib/tree/utilities/nodePrinter.d.ts.map +1 -0
  151. package/lib/tree/utilities/nodePrinter.js +36 -0
  152. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"addComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/addComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA4EF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAY5C,CAAC"}
1
+ {"version":3,"file":"addComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/addComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwHF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAa5C,CAAC"}
@@ -1,7 +1,11 @@
1
1
  import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Complex, ComplexConstructor } from "../../../math/complex/complex.js";
4
+ import { add } from "../../../tree/nodes/operators/addNode.js";
5
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
6
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
4
7
  import { shuffle } from "../../../utils/alea/shuffle.js";
8
+ import { alignTex } from "../../../utils/latex/alignTex.js";
5
9
  const getInstruction = (identifiers) => {
6
10
  const z1 = new Complex(identifiers.z1Re, identifiers.z1Im);
7
11
  const z2 = new Complex(identifiers.z2Re, identifiers.z2Im);
@@ -15,14 +19,47 @@ const getAnswer = (identifiers) => {
15
19
  const answer = z1.add(z2).toTree().toTex();
16
20
  return answer;
17
21
  };
22
+ const getHint = () => {
23
+ return `Soient deux nombres complexes $z = a+ib$ et $z' = a'+ib'$. Alors :
24
+
25
+ $$
26
+ z+z' = (a+a') + i(b+b')
27
+ $$`;
28
+ };
29
+ const getCorrection = (identifiers) => {
30
+ const { z1Re, z1Im, z2Re, z2Im } = identifiers;
31
+ const z1 = add(z1Re, multiply(z1Im, "i")).simplify({
32
+ forbidFactorize: true,
33
+ noAddOrder: true,
34
+ });
35
+ const z2 = add(z2Re, multiply(z2Im, "i")).simplify({
36
+ forbidFactorize: true,
37
+ noAddOrder: true,
38
+ });
39
+ return `Soient deux nombres complexes $z = a+ib$ et $z' = a'+ib'$. Alors :
40
+
41
+ $$
42
+ z+z' = (a+a') + i(b+b')
43
+ $$
44
+
45
+ Ici, on a donc :
46
+
47
+ ${alignTex([
48
+ ["z+ z'", "=", add(z1, z2).toTex()],
49
+ ["", "=", add(add(z1Re, z2Re), multiply("i", add(z1Im, z2Im))).toTex()],
50
+ ["", "=", getAnswer(identifiers)],
51
+ ])}`;
52
+ };
18
53
  const getQuestionFromIdentifiers = (identifiers) => {
19
54
  const question = {
20
55
  answer: getAnswer(identifiers),
21
56
  instruction: getInstruction(identifiers),
22
- keys: ["i", "z", "quote"],
57
+ keys: ["i"],
23
58
  answerFormat: "tex",
24
59
  startStatement: "z+z'",
25
60
  identifiers,
61
+ hint: getHint(identifiers),
62
+ correction: getCorrection(identifiers),
26
63
  };
27
64
  return question;
28
65
  };
@@ -57,12 +94,20 @@ const getPropositions = (n, { answer, z1Re, z1Im, z2Re, z2Im }) => {
57
94
  });
58
95
  return shuffle(propositions);
59
96
  };
60
- const isAnswerValid = (ans, { z1Im, z1Re, z2Im, z2Re }) => {
61
- const z1 = new Complex(z1Re, z1Im);
62
- const z2 = new Complex(z2Re, z2Im);
63
- const answer = z1.add(z2).toTree();
64
- const texs = answer.toAllValidTexs();
65
- return texs.includes(ans);
97
+ const isAnswerValid = (ans, { answer }) => {
98
+ const parsed = parseAlgebraic(ans);
99
+ if (!parsed)
100
+ return false;
101
+ return (parsed
102
+ .simplify({
103
+ forbidFactorize: true,
104
+ })
105
+ .toTex() ===
106
+ parseAlgebraic(answer)
107
+ .simplify({
108
+ forbidFactorize: true,
109
+ })
110
+ .toTex());
66
111
  };
67
112
  export const addComplex = {
68
113
  id: "addComplex",
@@ -76,4 +121,5 @@ export const addComplex = {
76
121
  isAnswerValid,
77
122
  subject: "Mathématiques",
78
123
  getQuestionFromIdentifiers,
124
+ hasHintAndCorrection: true,
79
125
  };
@@ -1 +1 @@
1
- {"version":3,"file":"conjugateComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/conjugateComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA4DF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
1
+ {"version":3,"file":"conjugateComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/conjugateComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAqGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
@@ -1,11 +1,16 @@
1
1
  import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Complex, ComplexConstructor } from "../../../math/complex/complex.js";
4
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
4
5
  import { shuffle } from "../../../utils/alea/shuffle.js";
5
6
  const getInstruction = (identifiers) => {
6
7
  const { re, im } = identifiers;
7
8
  const complex = new Complex(re, im);
8
- return `Déterminer le conjugué de $z=${complex.toTree().toTex()}$.`;
9
+ return `Déterminer le conjugué $\\overline{z}$ de :
10
+
11
+ $$
12
+ z=${complex.toTree().toTex()}
13
+ $$`;
9
14
  };
10
15
  const getAnswer = (identifiers) => {
11
16
  const { re, im } = identifiers;
@@ -13,14 +18,40 @@ const getAnswer = (identifiers) => {
13
18
  const answer = complex.conjugate().toTree().toTex();
14
19
  return answer;
15
20
  };
21
+ const getHint = () => {
22
+ return `Soit $z = a+ib$ un nombre complexe.
23
+
24
+ Le conjugué $\\overline{z}$ de $z$ est le nombre :
25
+
26
+ $$
27
+ \\overline{z} = a-ib
28
+ $$`;
29
+ };
30
+ const getCorrection = (identifiers) => {
31
+ return `Soit $z = a+ib$ un nombre complexe.
32
+
33
+ Le conjugué $\\overline{z}$ de $z$ est le nombre :
34
+
35
+ $$
36
+ \\overline{z} = a-ib
37
+ $$
38
+
39
+ Ici, on a donc :
40
+
41
+ $$
42
+ \\overline{z} = ${getAnswer(identifiers)}
43
+ $$`;
44
+ };
16
45
  const getQuestionFromIdentifiers = (identifiers) => {
17
46
  const question = {
18
47
  answer: getAnswer(identifiers),
19
48
  instruction: getInstruction(identifiers),
20
- keys: ["i", "overline"],
49
+ keys: ["i"],
21
50
  answerFormat: "tex",
22
51
  startStatement: "\\overline z",
23
52
  identifiers,
53
+ hint: getHint(identifiers),
54
+ correction: getCorrection(identifiers),
24
55
  };
25
56
  return question;
26
57
  };
@@ -43,11 +74,20 @@ const getPropositions = (n, { answer, re, im }) => {
43
74
  });
44
75
  return shuffle(propositions);
45
76
  };
46
- const isAnswerValid = (ans, { im, re }) => {
47
- const complex = new Complex(re, im);
48
- const answer = complex.conjugate().toTree();
49
- const texs = answer.toAllValidTexs();
50
- return texs.includes(ans);
77
+ const isAnswerValid = (ans, { answer }) => {
78
+ const parsed = parseAlgebraic(ans);
79
+ if (!parsed)
80
+ return false;
81
+ return (parsed
82
+ .simplify({
83
+ forbidFactorize: true,
84
+ })
85
+ .toTex() ===
86
+ parseAlgebraic(answer)
87
+ .simplify({
88
+ forbidFactorize: true,
89
+ })
90
+ .toTex());
51
91
  };
52
92
  export const conjugateComplex = {
53
93
  id: "conjugateComplex",
@@ -61,4 +101,5 @@ export const conjugateComplex = {
61
101
  isAnswerValid,
62
102
  subject: "Mathématiques",
63
103
  getQuestionFromIdentifiers,
104
+ hasHintAndCorrection: true,
64
105
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mutiplyComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/mutiplyComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;CACd,CAAC;AAmEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
1
+ {"version":3,"file":"mutiplyComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/mutiplyComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;CACd,CAAC;AA2GF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAchD,CAAC"}
@@ -1,7 +1,12 @@
1
1
  import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Complex, ComplexConstructor } from "../../../math/complex/complex.js";
4
+ import { randTupleInt } from "../../../math/utils/random/randTupleInt.js";
5
+ import { add } from "../../../tree/nodes/operators/addNode.js";
6
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
7
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
4
8
  import { shuffle } from "../../../utils/alea/shuffle.js";
9
+ import { alignTex } from "../../../utils/latex/alignTex.js";
5
10
  const getInstruction = (identifiers) => {
6
11
  const z1 = new Complex(identifiers.z1[0], identifiers.z1[1]);
7
12
  const z2 = new Complex(identifiers.z2[0], identifiers.z2[1]);
@@ -15,29 +20,48 @@ const getAnswer = (identifiers) => {
15
20
  const answer = z1.multiply(z2).toTree().toTex();
16
21
  return answer;
17
22
  };
23
+ const getHint = () => {
24
+ return `Pour multiplier deux nombres complexes, on utilise la distributivité double, ainsi que le fait que $i^2 = -1$.`;
25
+ };
26
+ const getCorrection = (identifiers) => {
27
+ const { z1, z2 } = identifiers;
28
+ const [a, b] = z1;
29
+ const [c, d] = z2;
30
+ const zA = add(a, multiply(b, "i"));
31
+ const zB = add(c, multiply(d, "i"));
32
+ return `On distribue comme pour des nombres réels, puis on utilise le fait que $i^2=-1$ :
33
+
34
+ ${alignTex([
35
+ ["z\\times z'", "=", multiply(zA, zB).toTex()],
36
+ [
37
+ "",
38
+ "=",
39
+ add(add(multiply(a, c), multiply(a, multiply(d, "i"))), add(multiply(multiply(b, "i"), c), multiply(multiply(b, "i"), multiply(d, "i")))).toTex(),
40
+ ],
41
+ [
42
+ "",
43
+ "=",
44
+ add(add(multiply(a, c).simplify(), multiply(a * d + b * c, "i")), multiply(multiply(b, d).simplify(), -1)).toTex(),
45
+ ],
46
+ ["", "=", getAnswer(identifiers)],
47
+ ])}`;
48
+ };
18
49
  const getQuestionFromIdentifiers = (identifiers) => {
19
50
  const question = {
20
51
  answer: getAnswer(identifiers),
21
52
  instruction: getInstruction(identifiers),
22
- keys: ["i", "z", "quote"],
53
+ keys: ["i"],
23
54
  answerFormat: "tex",
24
55
  startStatement: "z\\times z'",
25
56
  identifiers,
57
+ hint: getHint(identifiers),
58
+ correction: getCorrection(identifiers),
26
59
  };
27
60
  return question;
28
61
  };
29
62
  const getMutiplyComplexQuestion = () => {
30
- const z1 = ComplexConstructor.random();
31
- let z2;
32
- let counter = 0;
33
- do {
34
- counter++;
35
- if (counter > 1000) {
36
- throw new Error("multiply complex too many iterations");
37
- }
38
- z2 = ComplexConstructor.random();
39
- } while (z1.im === 0 && z2.im === 0);
40
- const identifiers = { z1: [z1.re, z1.im], z2: [z2.re, z2.im] };
63
+ const [a, b, c, d] = randTupleInt(4, { from: -9, to: 10, elExcludes: [0] });
64
+ const identifiers = { z1: [a, b], z2: [c, d] };
41
65
  return getQuestionFromIdentifiers(identifiers);
42
66
  };
43
67
  const getPropositions = (n, { answer, z1, z2 }) => {
@@ -51,12 +75,20 @@ const getPropositions = (n, { answer, z1, z2 }) => {
51
75
  });
52
76
  return shuffle(propositions);
53
77
  };
54
- const isAnswerValid = (ans, { z1, z2 }) => {
55
- const complex1 = new Complex(z1[0], z1[1]);
56
- const complex2 = new Complex(z2[0], z2[1]);
57
- const answer = complex1.multiply(complex2).toTree();
58
- const texs = answer.toAllValidTexs();
59
- return texs.includes(ans);
78
+ const isAnswerValid = (ans, { answer }) => {
79
+ const parsed = parseAlgebraic(ans);
80
+ if (!parsed)
81
+ return false;
82
+ return (parsed
83
+ .simplify({
84
+ forbidFactorize: true,
85
+ })
86
+ .toTex() ===
87
+ parseAlgebraic(answer)
88
+ .simplify({
89
+ forbidFactorize: true,
90
+ })
91
+ .toTex());
60
92
  };
61
93
  export const mutiplyComplex = {
62
94
  id: "mutiplyComplex",
@@ -70,4 +102,5 @@ export const mutiplyComplex = {
70
102
  isAnswerValid,
71
103
  subject: "Mathématiques",
72
104
  getQuestionFromIdentifiers,
105
+ hasHintAndCorrection: true,
73
106
  };
@@ -1 +1 @@
1
- {"version":3,"file":"reAndIm.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/reAndIm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AA6DF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,WAAW,CAYzC,CAAC"}
1
+ {"version":3,"file":"reAndIm.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/reAndIm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AA2FF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,WAAW,CAazC,CAAC"}
@@ -1,13 +1,17 @@
1
1
  import { addValidProp, propWhile, 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 { Complex, ComplexConstructor } from "../../../math/complex/complex.js";
4
5
  import { randint } from "../../../math/utils/random/randint.js";
5
6
  import { coinFlip } from "../../../utils/alea/coinFlip.js";
6
7
  import { shuffle } from "../../../utils/alea/shuffle.js";
8
+ import { doWhile } from "../../../utils/doWhile.js";
7
9
  const getInstruction = (identifiers) => {
8
10
  const { re, im, isRe } = identifiers;
9
11
  const z1 = new Complex(re, im);
10
- return `Soit $z=${z1.toTree().toTex()}$. Quelle est la partie ${isRe ? "réelle" : "imaginaire"} de $z$ ?`;
12
+ return `Soit $z=${z1.toTree().toTex()}$.
13
+
14
+ Quelle est la partie ${isRe ? "réelle" : "imaginaire"} de $z$ ?`;
11
15
  };
12
16
  const getAnswer = (identifiers) => {
13
17
  const { re, im, isRe } = identifiers;
@@ -15,6 +19,30 @@ const getAnswer = (identifiers) => {
15
19
  const answer = (isRe ? z1.re : z1.im) + "";
16
20
  return answer;
17
21
  };
22
+ const getHint = () => {
23
+ return `Si $z$ est un nombre complexe tel que :
24
+
25
+ $$
26
+ z = a+ib
27
+ $$
28
+
29
+ alors $a$ est la partie réelle de $z$, et $b$ et sa partie imaginaire.`;
30
+ };
31
+ const getCorrection = (identifiers) => {
32
+ const { re, im } = identifiers;
33
+ const z1 = new Complex(re, im);
34
+ return `Si $z$ est un nombre complexe tel que :
35
+
36
+ $$
37
+ z = a+ib
38
+ $$
39
+
40
+ alors $a$ est la partie réelle de $z$, et $b$ et sa partie imaginaire.
41
+
42
+ Ici, on a $z = ${z1
43
+ .toTree()
44
+ .toTex()}$, donc la partie réelle de $z$ est $${re}$ et sa partie imaginaire est $${im}$. `;
45
+ };
18
46
  const getQuestionFromIdentifiers = (identifiers) => {
19
47
  const question = {
20
48
  answer: getAnswer(identifiers),
@@ -22,11 +50,13 @@ const getQuestionFromIdentifiers = (identifiers) => {
22
50
  keys: ["i", "z"],
23
51
  answerFormat: "tex",
24
52
  identifiers,
53
+ hint: getHint(identifiers),
54
+ correction: getCorrection(identifiers),
25
55
  };
26
56
  return question;
27
57
  };
28
58
  const getReAndImQuestion = () => {
29
- const z1 = ComplexConstructor.random();
59
+ const z1 = doWhile(() => ComplexConstructor.random(), (z) => z.re === z.im);
30
60
  const isRe = coinFlip();
31
61
  const identifiers = { re: z1.re, im: z1.im, isRe };
32
62
  return getQuestionFromIdentifiers(identifiers);
@@ -44,13 +74,13 @@ const getPropositions = (n, { answer, re, im, isRe }) => {
44
74
  return shuffle(propositions);
45
75
  };
46
76
  const isAnswerValid = (ans, { answer }) => {
47
- return ans === answer;
77
+ return numberVEA(ans, answer);
48
78
  };
49
79
  export const reAndIm = {
50
80
  id: "getReAndImQuestion",
51
81
  connector: "=",
52
82
  getPropositions,
53
- label: "Identifier partie réelle et partie imaginaire",
83
+ label: "Identifier partie réelle et partie imaginaire d'un nombre complexe",
54
84
  isSingleStep: true,
55
85
  generator: (nb) => getDistinctQuestions(getReAndImQuestion, nb),
56
86
  qcmTimer: 60,
@@ -58,4 +88,5 @@ export const reAndIm = {
58
88
  isAnswerValid,
59
89
  subject: "Mathématiques",
60
90
  getQuestionFromIdentifiers,
91
+ hasHintAndCorrection: true,
61
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"scatterPlotInterpreting.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAwC7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,eAAe,CAAC;CACnC,CAAC;AA2aF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAmBzD,CAAC"}
1
+ {"version":3,"file":"scatterPlotInterpreting.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAwC7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,eAAe,CAAC;CACnC,CAAC;AA2aF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAoBzD,CAAC"}
@@ -384,7 +384,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
384
384
  };
385
385
  export const scatterPlotInterpreting = {
386
386
  id: "scatterPlotInterpreting",
387
- label: "Interpréter un nuage de points",
387
+ label: "Compter le nombre de points dans un nuage de points vérifiant une condition",
388
388
  isSingleStep: true,
389
389
  generator: (nb, opts) => getDistinctQuestions(() => getScatterPlotInterpretingQuestion(opts), nb),
390
390
  qcmTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"cosSecondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAqIF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
1
+ {"version":3,"file":"cosSecondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAmLF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAe3D,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { AffineConstructor } from "../../../../../math/polynomials/affine.js";
4
- import { CosNode } from "../../../../../tree/nodes/functions/cosNode.js";
5
- import { SinNode } from "../../../../../tree/nodes/functions/sinNode.js";
4
+ import { cos, CosNode } from "../../../../../tree/nodes/functions/cosNode.js";
5
+ import { sin, SinNode } from "../../../../../tree/nodes/functions/sinNode.js";
6
6
  import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
7
7
  import { AddNode } from "../../../../../tree/nodes/operators/addNode.js";
8
- import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
9
9
  import { PowerNode } from "../../../../../tree/nodes/operators/powerNode.js";
10
10
  import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
11
11
  import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
@@ -28,6 +28,47 @@ const getAnswer = (identifiers) => {
28
28
  .toTex();
29
29
  return ans;
30
30
  };
31
+ const getHint = () => {
32
+ return `Pour toute fonction dérivable $u$, on a :
33
+
34
+ $$
35
+ \\left(\\cos(u)\\right)' = -u'\\times \\sin(u)
36
+ $$
37
+
38
+ et
39
+
40
+ $$
41
+ \\left(\\sin(u)\\right)' = u'\\times \\cos(u)
42
+ $$`;
43
+ };
44
+ const getCorrection = (identifiers) => {
45
+ const { affinecoeffs } = identifiers;
46
+ const affTree = AffineConstructor.fromCoeffs(affinecoeffs).toTree();
47
+ const a = affinecoeffs[1];
48
+ return `On utilise la propriété suivante : pour toute fonction dérivable $u$,
49
+
50
+ $$
51
+ \\left(\\cos(u)\\right)' = -u'\\times \\sin(u)
52
+ $$
53
+
54
+ et
55
+
56
+ $$
57
+ \\left(\\sin(u)\\right)' = u'\\times \\cos(u)
58
+ $$
59
+
60
+ Ici, on dérive la fonction $f$ deux fois. On a, pour tout $x\\in \\mathbb{R}$ :
61
+
62
+ $$
63
+ f'(x) = ${multiply(-a, sin(affTree)).toTex()}
64
+ $$
65
+
66
+ Donc
67
+
68
+ $$
69
+ f''(x)= ${multiply(multiply(-a, a).simplify(), cos(affTree)).toTex()}
70
+ $$`;
71
+ };
31
72
  const getCosSecondDegreeDerivativeQuestion = () => {
32
73
  const affine = AffineConstructor.random();
33
74
  const affinecoeffs = affine.coefficients;
@@ -41,6 +82,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
41
82
  keys: ["x", "sin", "cos", "tan"],
42
83
  answerFormat: "tex",
43
84
  identifiers,
85
+ hint: getHint(identifiers),
86
+ correction: getCorrection(identifiers),
44
87
  };
45
88
  return question;
46
89
  };
@@ -104,4 +147,5 @@ export const cosSecondDegreeDerivative = {
104
147
  getAnswer,
105
148
  getInstruction,
106
149
  getQuestionFromIdentifiers,
150
+ hasHintAndCorrection: true,
107
151
  };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ nodeIdsU: NodeIdentifiers;
5
+ nodeIdsV: NodeIdentifiers;
6
+ };
7
+ export declare const productOfSinAXPlusBCosCXPlusDDerivative: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=productOfSinAXPlusBCosCXPlusDDerivative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"productOfSinAXPlusBCosCXPlusDDerivative.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAiRF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAAC,WAAW,CAmBzE,CAAC"}