math-exercises 3.0.101 → 3.0.103

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 (124) hide show
  1. package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.js +1 -1
  2. package/lib/exercises/math/curve/sqrtCurvePoint.d.ts.map +1 -1
  3. package/lib/exercises/math/curve/sqrtCurvePoint.js +7 -5
  4. package/lib/exercises/math/curve/squareCurvePoint.d.ts.map +1 -1
  5. package/lib/exercises/math/curve/squareCurvePoint.js +4 -2
  6. package/lib/exercises/math/dataRepresentations/barChartReading.d.ts +1 -1
  7. package/lib/exercises/math/dataRepresentations/barChartReading.js +1 -1
  8. package/lib/exercises/math/functions/basics/imageFunction.d.ts.map +1 -1
  9. package/lib/exercises/math/functions/basics/imageFunction.js +8 -8
  10. package/lib/exercises/math/functions/sign/equationFromSignTable.js +1 -1
  11. package/lib/exercises/math/functions/sqrt/compareSqrtValues.js +1 -1
  12. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.d.ts.map +1 -1
  13. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.js +10 -2
  14. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
  15. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +3 -2
  16. package/lib/exercises/math/geometry/index.d.ts +1 -0
  17. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  18. package/lib/exercises/math/geometry/index.js +1 -0
  19. package/lib/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.d.ts +8 -0
  20. package/lib/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.d.ts.map +1 -0
  21. package/lib/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.js +145 -0
  22. package/lib/exercises/math/geometry/optimisation/index.d.ts +4 -0
  23. package/lib/exercises/math/geometry/optimisation/index.d.ts.map +1 -0
  24. package/lib/exercises/math/geometry/optimisation/index.js +3 -0
  25. package/lib/exercises/math/geometry/optimisation/lengthIntervalOnPicture.d.ts +8 -0
  26. package/lib/exercises/math/geometry/optimisation/lengthIntervalOnPicture.d.ts.map +1 -0
  27. package/lib/exercises/math/geometry/optimisation/lengthIntervalOnPicture.js +93 -0
  28. package/lib/exercises/math/geometry/optimisation/lengthWithXOnPicture.d.ts +8 -0
  29. package/lib/exercises/math/geometry/optimisation/lengthWithXOnPicture.d.ts.map +1 -0
  30. package/lib/exercises/math/geometry/optimisation/lengthWithXOnPicture.js +99 -0
  31. package/lib/exercises/math/geometry/pythagore/index.d.ts +1 -0
  32. package/lib/exercises/math/geometry/pythagore/index.d.ts.map +1 -1
  33. package/lib/exercises/math/geometry/pythagore/index.js +1 -1
  34. package/lib/exercises/math/geometry/pythagore/triangleHeight.d.ts.map +1 -1
  35. package/lib/exercises/math/geometry/pythagore/triangleHeight.js +78 -32
  36. package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.d.ts.map +1 -1
  37. package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.js +8 -1
  38. package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.js +6 -7
  39. package/lib/exercises/math/geometry/vectors/parallelogram/parallelogramCriterion.js +1 -1
  40. package/lib/exercises/math/geometry/vectors/vectorCoordinatesFromTwoPoints.d.ts.map +1 -1
  41. package/lib/exercises/math/geometry/vectors/vectorCoordinatesFromTwoPoints.js +33 -10
  42. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.d.ts.map +1 -1
  43. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +39 -9
  44. package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +1 -1
  45. package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +1 -1
  46. package/lib/exercises/math/probaStat/basicProbas/ballsBasicProbas.js +1 -1
  47. package/lib/exercises/math/probaStat/basicProbas/cardBasicProbas.d.ts.map +1 -1
  48. package/lib/exercises/math/probaStat/basicProbas/cardBasicProbas.js +1 -3
  49. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.d.ts.map +1 -1
  50. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.js +5 -3
  51. package/lib/exercises/math/probaStat/events/describeEvent.d.ts.map +1 -1
  52. package/lib/exercises/math/probaStat/events/describeEvent.js +5 -11
  53. package/lib/exercises/math/probaStat/events/eventNotation.d.ts.map +1 -1
  54. package/lib/exercises/math/probaStat/events/eventNotation.js +5 -11
  55. package/lib/exercises/math/probaStat/issuesCountingForCards.js +1 -1
  56. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  57. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +5 -3
  58. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  59. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +10 -2
  60. package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.js +4 -4
  61. package/lib/exercises/math/probaStat/stats1var/averageLinearity.d.ts.map +1 -1
  62. package/lib/exercises/math/probaStat/stats1var/averageLinearity.js +5 -4
  63. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.d.ts.map +1 -1
  64. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.js +14 -32
  65. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +1 -1
  66. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +1 -1
  67. package/lib/exercises/math/probaStat/stats1var/interquartilesList.d.ts.map +1 -1
  68. package/lib/exercises/math/probaStat/stats1var/interquartilesList.js +4 -3
  69. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
  70. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +23 -7
  71. package/lib/exercises/math/probaStat/stats1var/median.js +1 -1
  72. package/lib/exercises/math/probaStat/stats1var/medianList.js +1 -1
  73. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  74. package/lib/exercises/math/probaStat/stats1var/quartiles.js +1 -0
  75. package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
  76. package/lib/exercises/math/probaStat/stats1var/quartilesList.js +1 -0
  77. package/lib/exercises/math/probaStat/stats1var/standardDeviationList.js +4 -4
  78. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +4 -4
  79. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
  80. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +1 -1
  81. package/lib/exercises/math/probaStat/unionIntersectionProba.js +1 -1
  82. package/lib/exercises/math/python/inOutCalcul.js +1 -1
  83. package/lib/exercises/math/python/index.d.ts +6 -0
  84. package/lib/exercises/math/python/index.d.ts.map +1 -1
  85. package/lib/exercises/math/python/index.js +6 -0
  86. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts +9 -0
  87. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts.map +1 -0
  88. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.js +129 -0
  89. package/lib/exercises/math/python/pythonIfStatementCompletion.d.ts +8 -0
  90. package/lib/exercises/math/python/pythonIfStatementCompletion.d.ts.map +1 -0
  91. package/lib/exercises/math/python/pythonIfStatementCompletion.js +114 -0
  92. package/lib/exercises/math/python/pythonRangeCompletion.d.ts +9 -0
  93. package/lib/exercises/math/python/pythonRangeCompletion.d.ts.map +1 -0
  94. package/lib/exercises/math/python/pythonRangeCompletion.js +105 -0
  95. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.d.ts +8 -0
  96. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.d.ts.map +1 -0
  97. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.js +89 -0
  98. package/lib/exercises/math/python/pythonWhileStatementCompletion.d.ts +7 -0
  99. package/lib/exercises/math/python/pythonWhileStatementCompletion.d.ts.map +1 -0
  100. package/lib/exercises/math/python/pythonWhileStatementCompletion.js +87 -0
  101. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts +8 -0
  102. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts.map +1 -0
  103. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.js +120 -0
  104. package/lib/exercises/math/python/variableType.js +1 -1
  105. package/lib/exercises/math/python/whileLoop.d.ts.map +1 -1
  106. package/lib/exercises/math/python/whileLoop.js +1 -0
  107. package/lib/exercises/math/python/whileLoopCount.js +2 -2
  108. package/lib/exercises/math/sampling/samplingFrequency.d.ts.map +1 -1
  109. package/lib/exercises/math/sampling/samplingFrequency.js +2 -4
  110. package/lib/exercises/math/sequences/genericSequenceVariations.js +3 -3
  111. package/lib/exercises/math/sequences/sequencePlot.js +1 -1
  112. package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.js +1 -1
  113. package/lib/index.d.ts +32 -0
  114. package/lib/index.d.ts.map +1 -1
  115. package/lib/math/probability/binomial.d.ts +1 -0
  116. package/lib/math/probability/binomial.d.ts.map +1 -1
  117. package/lib/math/probability/binomial.js +20 -0
  118. package/lib/math/utils/stats/gaussianWithNoise.d.ts +3 -0
  119. package/lib/math/utils/stats/gaussianWithNoise.d.ts.map +1 -0
  120. package/lib/math/utils/stats/gaussianWithNoise.js +9 -0
  121. package/lib/playground.d.ts +5 -0
  122. package/lib/playground.d.ts.map +1 -1
  123. package/lib/playground.js +8 -1
  124. package/package.json +1 -1
@@ -114,7 +114,7 @@ const getQuestionFromIdentifiers = (identifiers) => ({
114
114
  });
115
115
  export const whichMultipleAmI = {
116
116
  id: "whichMultipleAmI",
117
- label: "Trouver le multiple dun nombre vérifiant des conditions",
117
+ label: "Trouver le multiple d'un nombre vérifiant des conditions",
118
118
  isSingleStep: true,
119
119
  generator: (nb, opts) => getDistinctQuestions(() => getWhichMultipleAmIQuestion(opts), nb),
120
120
  qcmTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"sqrtCurvePoint.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/curve/sqrtCurvePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAatC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAuHF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}
1
+ {"version":3,"file":"sqrtCurvePoint.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/curve/sqrtCurvePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAatC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAyHF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}
@@ -38,7 +38,7 @@ const getAnswer = (identifiers) => {
38
38
  };
39
39
  const getInstruction = (identifiers) => {
40
40
  const { point } = identifiers;
41
- return `Le point $${PointConstructor.fromIdentifiers(point).toTexWithCoords()}$ appartient-il à la courbe de la fonction racine carré ?`;
41
+ return `Le point $${PointConstructor.fromIdentifiers(point).toTexWithCoords()}$ appartient-il à la courbe de la fonction racine carrée ?`;
42
42
  };
43
43
  const getHint = (identifiers) => {
44
44
  return "Un point $A(x; y)$ appartient à la courbe de la fonction $f$ si et seulement si $f(x) = y$.";
@@ -50,9 +50,11 @@ const getCorrection = (identifiers) => {
50
50
  const y = point.y;
51
51
  const isValidPoint = isPointOnCurve(identifiers);
52
52
  const conclusion = isValidPoint
53
- ? "Le point est donc sur la courbe."
54
- : "Le point n'est donc pas sur la courbe.";
55
- return `$${point.toTexWithCoords()}$ appartient à la courbe de la fonction racine carré si et seulement si :
53
+ ? `Le point est donc bien sur la courbe.`
54
+ : `Puisque $f\\left(${x.toTex()}\\right) = ${sqrt(x)
55
+ .simplify()
56
+ .toTex()}\\neq ${y.toTex()}$, le point n'est donc pas sur la courbe.`;
57
+ return `$${point.toTexWithCoords()}$ appartient à la courbe de la fonction racine carrée si et seulement si :
56
58
 
57
59
  ${alignTex(sqrt(x).simplify().toTex() != sqrt(x).toTex()
58
60
  ? [
@@ -115,7 +117,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
115
117
  };
116
118
  export const sqrtCurvePoint = {
117
119
  id: "sqrtCurvePoint",
118
- label: "Déterminer si un point appartient à la courbe de la fonction racine carré",
120
+ label: "Déterminer si un point appartient à la courbe de la fonction racine carrée",
119
121
  answerType: "QCU",
120
122
  isSingleStep: true,
121
123
  generator: (nb, opts) => getDistinctQuestions(() => getSqrtCurvePointQuestion(opts), nb),
@@ -1 +1 @@
1
- {"version":3,"file":"squareCurvePoint.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/curve/squareCurvePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AActC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAyHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAiBlD,CAAC"}
1
+ {"version":3,"file":"squareCurvePoint.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/curve/squareCurvePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AActC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AA2HF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAiBlD,CAAC"}
@@ -49,8 +49,10 @@ const getCorrection = (identifiers) => {
49
49
  const point = PointConstructor.fromIdentifiers(pointId);
50
50
  const isValidPoint = isPointOnCurve(identifiers);
51
51
  const conclusion = isValidPoint
52
- ? "Le point est donc sur la courbe."
53
- : "Le point n'est donc pas sur la courbe.";
52
+ ? `Le point est donc bien sur la courbe.`
53
+ : `Puisque $f(${point.x.toTex()}) = ${square(point.x)
54
+ .simplify()
55
+ .toTex()}\\neq ${point.y.toTex()}$, le point n'est donc pas sur la courbe.`;
54
56
  return `$${point.toTexWithCoords()}$ appartient à la courbe de la fonction carré si et seulement si :
55
57
 
56
58
  ${alignTex([
@@ -67,7 +67,7 @@ export {};
67
67
  .attr("text-anchor", "start")
68
68
  .style("font-size", "14px")
69
69
  .style("font-weight", "bold")
70
- .text("Nombre dexemplaires vendus");
70
+ .text("Nombre d'exemplaires vendus");
71
71
 
72
72
  svg
73
73
  .selectAll(".bar")
@@ -245,7 +245,7 @@ export const barChartReading = {
245
245
  .attr("text-anchor", "start")
246
246
  .style("font-size", "14px")
247
247
  .style("font-weight", "bold")
248
- .text("Nombre dexemplaires vendus");
248
+ .text("Nombre d'exemplaires vendus");
249
249
 
250
250
  svg
251
251
  .selectAll(".bar")
@@ -1 +1 @@
1
- {"version":3,"file":"imageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IAOjB,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AA+LF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AA4BF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBxD,CAAC"}
1
+ {"version":3,"file":"imageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IAOjB,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AA8LF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AA4BF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBxD,CAAC"}
@@ -70,16 +70,16 @@ const getCorrection = (identifiers, opts) => {
70
70
  const coeffsNode = polynomeCoeffs.map((coeff) => reifyAlgebraic(coeff));
71
71
  const polynome = new GeneralPolynomial(coeffsNode).toTree();
72
72
  const answer = getAnswer(identifiers);
73
+ const detailed = polynome.toDetailedEvaluation({ x: xValueNode });
74
+ const detailedStep = detailed.simplify({ forbidAdditions: true });
75
+ const steps = [[`f\\left(${xValueTex}\\right)`, "=", detailed.toTex()]];
76
+ if (detailed.toTex() !== detailedStep.toTex()) {
77
+ steps.push(["", "=", detailedStep.toTex()]);
78
+ }
79
+ steps.push(["", "=", answer]);
73
80
  return `On remplace $x$ par $${xValueTex}$ dans l'expression de $f$ :
74
81
 
75
- ${alignTex([
76
- [
77
- `f\\left(${xValueTex}\\right)`,
78
- "=",
79
- polynome.toDetailedEvaluation({ x: xValueNode }).toTex(),
80
- ],
81
- ["", "=", answer],
82
- ])}`;
82
+ ${alignTex(steps)}`;
83
83
  };
84
84
  const getStartStatement = (identifiers) => {
85
85
  const { xValue, polynomeCoeffs, imageSyntaxText } = identifiers;
@@ -210,7 +210,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
210
210
  return {
211
211
  answer: getAnswer(identifiers, opts),
212
212
  instruction: getInstruction(identifiers, opts),
213
- answerFormat: "raw",
213
+ answerFormat: "tex",
214
214
  identifiers,
215
215
  hint: getHint(identifiers, opts),
216
216
  correction: getCorrection(identifiers, opts),
@@ -26,7 +26,7 @@ ${sqrt(a).toTex()} \\ \\ldots \\ ${sqrt(b).toTex()}
26
26
  $$`;
27
27
  };
28
28
  const getHint = (identifiers) => {
29
- return `La racine carré conserve l'ordre : pour tous $a$ et $b$ positifs,
29
+ return `La racine carrée conserve l'ordre : pour tous $a$ et $b$ positifs,
30
30
 
31
31
  - $a > b \\iff ${sqrt("a").toTex()} > ${sqrt("b").toTex()}$
32
32
  - $a < b \\iff ${sqrt("a").toTex()} < ${sqrt("b").toTex()}$
@@ -1 +1 @@
1
- {"version":3,"file":"squareImageIntervalWithGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/squareImageIntervalWithGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAW,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAMxE,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAoNF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAc9D,CAAC"}
1
+ {"version":3,"file":"squareImageIntervalWithGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/squareImageIntervalWithGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAW,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAMxE,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA2NF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAc9D,CAAC"}
@@ -163,12 +163,20 @@ const getPropositions = (n, { answer, a, b, type, closure }) => {
163
163
  }
164
164
  return shuffleProps(propositions, n);
165
165
  };
166
- const isAnswerValid = (ans, { answer, a, b, closure, type }) => {
166
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
167
167
  try {
168
+ const intervalSolution = getAnswerNode(identifiers);
168
169
  const parsed = intervalParser(ans);
169
170
  if (!parsed)
170
171
  return false;
171
- return parsed.simplify().toTex() === answer;
172
+ if (parsed.closure !== intervalSolution.closure)
173
+ return false;
174
+ const a = parsed.a.evaluate();
175
+ const b = parsed.b.evaluate();
176
+ return (Math.abs(a - intervalSolution.a.evaluate()) < 3 &&
177
+ Math.abs(b - intervalSolution.b.evaluate()) < 3);
178
+ // return;
179
+ // return parsed.simplify().toTex() === answer;
172
180
  }
173
181
  catch (err) {
174
182
  return handleVEAError(err);
@@ -1 +1 @@
1
- {"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAqKF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
1
+ {"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAyKF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
@@ -73,8 +73,9 @@ const getStudentGGBOptions = (identifiers) => {
73
73
  coords: ggb.getCoordsForPoints([...points, endPoint]),
74
74
  });
75
75
  };
76
- const isGGBAnswerValid = (ans, { ggbAnswer }) => {
77
- const studentAns = ans.filter((c) => !["A", "B", "C", "D"].includes(c[0]));
76
+ const isGGBAnswerValid = (ans, { ggbAnswer, points, startPoint, translationPoints }) => {
77
+ const pointsUsed = points.map((p) => p.name);
78
+ const studentAns = ans.filter((c) => !pointsUsed.includes(c[0]));
78
79
  if (studentAns.length !== 1)
79
80
  return false;
80
81
  const studentPoint = studentAns[0].split("=")[1];
@@ -14,4 +14,5 @@ export * from "./quadrilaterals/index.js";
14
14
  export * from "./angles/index.js";
15
15
  export * from "./lines/index.js";
16
16
  export * from "./triangles/index.js";
17
+ export * from "./optimisation/index.js";
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
@@ -14,3 +14,4 @@ export * from "./quadrilaterals/index.js";
14
14
  export * from "./angles/index.js";
15
15
  export * from "./lines/index.js";
16
16
  export * from "./triangles/index.js";
17
+ export * from "./optimisation/index.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ perimeter: number;
4
+ askingX: boolean;
5
+ };
6
+ export declare const geometryExtremaReadingOnGraph: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=geometryExtremaReadingOnGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometryExtremaReadingOnGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAoJF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAuB/D,CAAC"}
@@ -0,0 +1,145 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueDark } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { round } from "../../../../math/utils/round.js";
7
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
8
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
9
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
10
+ const getPropositions = (n, { answer, askingX, perimeter }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer);
13
+ tryToAddWrongProp(propositions, getAnswer({ askingX: !askingX, perimeter }));
14
+ const answerNb = answer.unfrenchify();
15
+ while (propositions.length < n) {
16
+ tryToAddWrongProp(propositions, (answerNb + randint(-20, 20, [0])).frenchify());
17
+ }
18
+ return shuffleProps(propositions, n);
19
+ };
20
+ const getAnswer = (identifiers) => {
21
+ const { perimeter, askingX } = identifiers;
22
+ return askingX
23
+ ? round(perimeter / 4, 4).frenchify()
24
+ : round(perimeter ** 2 / 16, 4).frenchify();
25
+ };
26
+ const getInstruction = (identifiers) => {
27
+ const { perimeter, askingX } = identifiers;
28
+ return `On cherche à construire un rectangle de périmètre $${perimeter}$ et de surface la plus grande possible.
29
+
30
+ On appelle $x$ la largeur du rectangle. Son aire s'obtient alors par la formule :
31
+
32
+ $$
33
+ A(x) = x(${round(perimeter / 2, 2)}-x)
34
+ $$
35
+
36
+ On a tracé ci-dessous la courbe de la fonction A.
37
+
38
+ ${askingX
39
+ ? `Quelle doit être la largeur du rectangle pour avoir la surface maximale ?`
40
+ : `Quelle est la surface maximale de ce rectangle ?`}
41
+
42
+ *On pourra zoomer et se déplacer sur le graphique.*`;
43
+ };
44
+ const getHint = (identifiers) => {
45
+ const { perimeter, askingX } = identifiers;
46
+ return `La courbe représentative de $A$ donne l'aire du rectangle en fonction de sa largeur $x$.
47
+
48
+ ${askingX
49
+ ? `Repère donc pour quelle valeur de $x$ on obtient la plus grande valeur de $A(x)$. `
50
+ : `Repère donc la plus grande valeur de $A(x)$.`}
51
+ `;
52
+ };
53
+ const getCorrection = (identifiers) => {
54
+ const { perimeter, askingX } = identifiers;
55
+ const x = round(perimeter / 4, 4).frenchify();
56
+ const y = round(perimeter ** 2 / 16, 4).frenchify();
57
+ return `La courbe représentative de $A$ donne l'aire du rectangle en fonction de sa largeur $x$.
58
+
59
+ ${askingX
60
+ ? `On cherche donc pour quelle valeur de $x$ on obtient la plus grande valeur de $A(x)$. `
61
+ : `On cherche donc la plus grande valeur de $A(x)$.`}
62
+
63
+ On voit que le maximum de $A$ est $${y}$, atteint pour $x=${x}$.
64
+
65
+ ${askingX
66
+ ? `Le rectangle atteint donc sa surface maximale pour une largeur de $${x}$.`
67
+ : `La surface maximale du rectangle est donc $${y}$.`}`;
68
+ };
69
+ const getGGBOptions = (identifiers) => {
70
+ const { perimeter } = identifiers;
71
+ const ggb = new GeogebraConstructor({
72
+ commands: [
73
+ `A = Function(x(${round(perimeter / 2, 2)}-x), 0, ${perimeter / 2})`,
74
+ `SetFixed(A, true)`,
75
+ `SetColor(A, "${blueDark}")`,
76
+ `SetCaption(A, "A(x)")`,
77
+ `ShowLabel(A, true)`,
78
+ ],
79
+ lockedAxesRatio: false,
80
+ // gridDistance: false,
81
+ });
82
+ const xMax = perimeter / 2;
83
+ const yMax = perimeter ** 2 / 16;
84
+ return ggb.getOptions({
85
+ coords: ggb.getAdaptedCoords({
86
+ xMin: 0,
87
+ xMax,
88
+ yMin: 0,
89
+ yMax,
90
+ forceShowAxes: true,
91
+ }),
92
+ });
93
+ };
94
+ const getKeys = (identifiers) => {
95
+ return [];
96
+ };
97
+ const isAnswerValid = (ans, { answer }) => {
98
+ try {
99
+ const parsed = parseAlgebraic(ans);
100
+ const value = parsed.evaluate();
101
+ const answerValue = parseAlgebraic(answer).evaluate();
102
+ return Math.abs(value - answerValue) < 0.1 * answerValue;
103
+ }
104
+ catch (err) {
105
+ return handleVEAError(err);
106
+ }
107
+ };
108
+ const getGeometryExtremaReadingOnGraphQuestion = (opts) => {
109
+ const identifiers = {
110
+ askingX: coinFlip(),
111
+ perimeter: 4 * randint(1, 20),
112
+ };
113
+ return getQuestionFromIdentifiers(identifiers);
114
+ };
115
+ const getQuestionFromIdentifiers = (identifiers) => {
116
+ return {
117
+ answer: getAnswer(identifiers),
118
+ instruction: getInstruction(identifiers),
119
+ keys: getKeys(identifiers),
120
+ answerFormat: "tex",
121
+ identifiers,
122
+ hint: getHint(identifiers),
123
+ correction: getCorrection(identifiers),
124
+ ggbOptions: getGGBOptions(identifiers),
125
+ };
126
+ };
127
+ export const geometryExtremaReadingOnGraph = {
128
+ id: "geometryExtremaReadingOnGraph",
129
+ label: "Répondre à un problème d'optimisation géométrique à partir d'une courbe représentative",
130
+ isSingleStep: true,
131
+ generator: (nb, opts) => getDistinctQuestions(() => getGeometryExtremaReadingOnGraphQuestion(opts), nb),
132
+ qcmTimer: 60,
133
+ freeTimer: 60,
134
+ getPropositions,
135
+ isAnswerValid,
136
+ subject: "Mathématiques",
137
+ getHint,
138
+ getCorrection,
139
+ getInstruction,
140
+ getAnswer,
141
+ getGGBOptions,
142
+ hasGeogebra: true,
143
+ getQuestionFromIdentifiers,
144
+ hasHintAndCorrection: true,
145
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./geometryExtremaReadingOnGraph.js";
2
+ export * from "./lengthIntervalOnPicture.js";
3
+ export * from "./lengthWithXOnPicture.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/optimisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./geometryExtremaReadingOnGraph.js";
2
+ export * from "./lengthIntervalOnPicture.js";
3
+ export * from "./lengthWithXOnPicture.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ shape: number;
4
+ side: number;
5
+ };
6
+ export declare const lengthIntervalOnPicture: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=lengthIntervalOnPicture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lengthIntervalOnPicture.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/optimisation/lengthIntervalOnPicture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA2FF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAuBzD,CAAC"}
@@ -0,0 +1,93 @@
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 { ClosureType } from "../../../../tree/nodes/sets/closure.js";
5
+ import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
6
+ import { intervalParser } from "../../../../tree/parsers/intervalParser.js";
7
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
8
+ const getPropositions = (n, { answer }) => {
9
+ const propositions = [];
10
+ addValidProp(propositions, answer);
11
+ tryToAddWrongProp(propositions, "[AB]");
12
+ tryToAddWrongProp(propositions, "[A;B]");
13
+ while (propositions.length < n) {
14
+ tryToAddWrongProp(propositions, new IntervalNode((0).toTree(), randint(1, 20).toTree(), ClosureType.FF).toTex());
15
+ }
16
+ return shuffleProps(propositions, n);
17
+ };
18
+ const getAnswer = (identifiers) => {
19
+ return new IntervalNode((0).toTree(), identifiers.side.toTree(), ClosureType.FF).toTex();
20
+ };
21
+ const getInstruction = (identifiers) => {
22
+ const { shape, side } = identifiers;
23
+ return `On considère un carré $ABCD$ de côté $${side}$. On place un point $M$ sur le segment $[AB]$, et on note $x$ la longueur $AM$.
24
+
25
+ Dans quel intervalle $x$ peut-il varier ?
26
+
27
+ ![](https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/mathliveV2/activities/quizzes/generator/squareWithX.png)`;
28
+ };
29
+ const getHint = (identifiers) => {
30
+ return `Le point $M$ peut être situé n'importe où sur le segment $[AB]$. Quelle peut être la plus petit valeur de $AM$ ? et sa plus grande valeur ?`;
31
+ };
32
+ const getCorrection = (identifiers) => {
33
+ const { shape, side } = identifiers;
34
+ return `Si le point $M$ est confondu avec le point $A$, alors $AM = 0$, donc $x = 0$.
35
+
36
+ Si le point $M$ est confondu avec le point $B$, alors $AM = ${side}$, donc $x = ${side}$.
37
+
38
+ Ainsi, $x$ appartient à l'intervalle $${getAnswer(identifiers)}$`;
39
+ };
40
+ const getKeys = (identifiers) => {
41
+ return ["lbracket", "semicolon", "rbracket"];
42
+ };
43
+ const isAnswerValid = (ans, { answer }) => {
44
+ try {
45
+ const parsed = intervalParser(ans, {
46
+ allowCommaInsteadOfSemicolon: true,
47
+ allowNoBrackets: true,
48
+ expectedClosure: ClosureType.FF,
49
+ });
50
+ if (!parsed)
51
+ return false;
52
+ return parsed.simplify().toTex() === answer;
53
+ }
54
+ catch (err) {
55
+ return handleVEAError(err);
56
+ }
57
+ };
58
+ const getLengthIntervalOnPictureQuestion = (ops) => {
59
+ const identifiers = {
60
+ shape: 1,
61
+ side: randint(1, 20),
62
+ };
63
+ return getQuestionFromIdentifiers(identifiers);
64
+ };
65
+ const getQuestionFromIdentifiers = (identifiers) => {
66
+ return {
67
+ answer: getAnswer(identifiers),
68
+ instruction: getInstruction(identifiers),
69
+ keys: getKeys(identifiers),
70
+ answerFormat: "tex",
71
+ identifiers,
72
+ hint: getHint(identifiers),
73
+ correction: getCorrection(identifiers),
74
+ };
75
+ };
76
+ export const lengthIntervalOnPicture = {
77
+ id: "lengthIntervalOnPicture",
78
+ label: "Déterminer l'intervalle dans lequel varie une longueur avec point mobile",
79
+ isSingleStep: true,
80
+ generator: (nb, opts) => getDistinctQuestions(() => getLengthIntervalOnPictureQuestion(opts), nb, 15),
81
+ qcmTimer: 60,
82
+ freeTimer: 60,
83
+ getPropositions,
84
+ isAnswerValid,
85
+ subject: "Mathématiques",
86
+ getInstruction,
87
+ getHint,
88
+ getCorrection,
89
+ getAnswer,
90
+ getQuestionFromIdentifiers,
91
+ hasHintAndCorrection: true,
92
+ maxAllowedQuestions: 15,
93
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ shape: number;
4
+ side: number;
5
+ };
6
+ export declare const lengthWithXOnPicture: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=lengthWithXOnPicture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lengthWithXOnPicture.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/optimisation/lengthWithXOnPicture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAyFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAuBtD,CAAC"}
@@ -0,0 +1,99 @@
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 { round } from "../../../../math/utils/round.js";
5
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
7
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
8
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
9
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
10
+ const getPropositions = (n, { answer, shape, side }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer);
13
+ tryToAddWrongProp(propositions, side.frenchify());
14
+ tryToAddWrongProp(propositions, round(side / 4, 2).frenchify());
15
+ tryToAddWrongProp(propositions, add("x", side).toTex());
16
+ tryToAddWrongProp(propositions, substract("x", side).toTex());
17
+ return shuffleProps(propositions, n);
18
+ };
19
+ const getAnswer = (identifiers) => {
20
+ return substract(identifiers.side.toTree(), "x").toTex();
21
+ };
22
+ const getInstruction = (identifiers) => {
23
+ const { shape, side } = identifiers;
24
+ return `On considère un carré $ABCD$ de côté $${side}$. On place un point $M$ sur le segment $[AB]$, et on note $x$ la longueur $AM$.
25
+
26
+ Exprimer la longueur $BM$ en fonction de $x$.
27
+
28
+ ![](https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/mathliveV2/activities/quizzes/generator/squareWithX.png)`;
29
+ };
30
+ const getHint = (identifiers) => {
31
+ return `La longueur $BM$ est égale à $AB$ moins $AM$.`;
32
+ };
33
+ const getCorrection = (identifiers) => {
34
+ const { shape, side } = identifiers;
35
+ return `La longueur $BM$ est égale à $AB$ moins $AM$.
36
+
37
+ Or, $AB = ${side}$ et $AM = x$.
38
+
39
+ Donc :
40
+
41
+ ${alignTex([
42
+ ["BM", "=", "AB-BM"],
43
+ ["", "=", substract(side, "x").toTex()],
44
+ ])}`;
45
+ };
46
+ const getKeys = (identifiers) => {
47
+ return ["x"];
48
+ };
49
+ const isAnswerValid = (ans, { answer }) => {
50
+ try {
51
+ const parsed = parseAlgebraic(ans);
52
+ const answerParsed = parseAlgebraic(answer);
53
+ return (parsed
54
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
55
+ .toTex() ===
56
+ answerParsed
57
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
58
+ .toTex());
59
+ }
60
+ catch (err) {
61
+ return handleVEAError(err);
62
+ }
63
+ };
64
+ const getLengthIntervalOnPictureQuestion = (ops) => {
65
+ const identifiers = {
66
+ shape: 1,
67
+ side: randint(1, 20),
68
+ };
69
+ return getQuestionFromIdentifiers(identifiers);
70
+ };
71
+ const getQuestionFromIdentifiers = (identifiers) => {
72
+ return {
73
+ answer: getAnswer(identifiers),
74
+ instruction: getInstruction(identifiers),
75
+ keys: getKeys(identifiers),
76
+ answerFormat: "tex",
77
+ identifiers,
78
+ hint: getHint(identifiers),
79
+ correction: getCorrection(identifiers),
80
+ };
81
+ };
82
+ export const lengthWithXOnPicture = {
83
+ id: "lengthWithXOnPicture",
84
+ label: "Déterminer l'expression d'une longueur en fonction de $x$ à partir d'une figure",
85
+ isSingleStep: true,
86
+ generator: (nb, opts) => getDistinctQuestions(() => getLengthIntervalOnPictureQuestion(opts), nb, 15),
87
+ qcmTimer: 60,
88
+ freeTimer: 60,
89
+ getPropositions,
90
+ isAnswerValid,
91
+ subject: "Mathématiques",
92
+ getInstruction,
93
+ getHint,
94
+ getCorrection,
95
+ getAnswer,
96
+ getQuestionFromIdentifiers,
97
+ hasHintAndCorrection: true,
98
+ maxAllowedQuestions: 15,
99
+ };
@@ -2,4 +2,5 @@ export * from "./pythagore.js";
2
2
  export * from "./pythagoreCalcul.js";
3
3
  export * from "./isTriangleRight.js";
4
4
  export * from "./calculateDiagonalFromSides.js";
5
+ export * from "./triangleHeight.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC"}
@@ -2,4 +2,4 @@ export * from "./pythagore.js";
2
2
  export * from "./pythagoreCalcul.js";
3
3
  export * from "./isTriangleRight.js";
4
4
  export * from "./calculateDiagonalFromSides.js";
5
- // export * from "./triangleHeight.js";
5
+ export * from "./triangleHeight.js";
@@ -1 +1 @@
1
- {"version":3,"file":"triangleHeight.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/triangleHeight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAyFF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}
1
+ {"version":3,"file":"triangleHeight.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/triangleHeight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AA8IF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}