math-exercises 3.0.101 → 3.0.102

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 (66) hide show
  1. package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.js +1 -1
  2. package/lib/exercises/math/curve/sqrtCurvePoint.js +3 -3
  3. package/lib/exercises/math/dataRepresentations/barChartReading.d.ts +1 -1
  4. package/lib/exercises/math/dataRepresentations/barChartReading.js +1 -1
  5. package/lib/exercises/math/functions/basics/imageFunction.d.ts.map +1 -1
  6. package/lib/exercises/math/functions/basics/imageFunction.js +8 -8
  7. package/lib/exercises/math/functions/sqrt/compareSqrtValues.js +1 -1
  8. package/lib/exercises/math/geometry/index.d.ts +1 -0
  9. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  10. package/lib/exercises/math/geometry/index.js +1 -0
  11. package/lib/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.d.ts +8 -0
  12. package/lib/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.d.ts.map +1 -0
  13. package/lib/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.js +145 -0
  14. package/lib/exercises/math/geometry/optimisation/index.d.ts +4 -0
  15. package/lib/exercises/math/geometry/optimisation/index.d.ts.map +1 -0
  16. package/lib/exercises/math/geometry/optimisation/index.js +3 -0
  17. package/lib/exercises/math/geometry/optimisation/lengthIntervalOnPicture.d.ts +8 -0
  18. package/lib/exercises/math/geometry/optimisation/lengthIntervalOnPicture.d.ts.map +1 -0
  19. package/lib/exercises/math/geometry/optimisation/lengthIntervalOnPicture.js +93 -0
  20. package/lib/exercises/math/geometry/optimisation/lengthWithXOnPicture.d.ts +8 -0
  21. package/lib/exercises/math/geometry/optimisation/lengthWithXOnPicture.d.ts.map +1 -0
  22. package/lib/exercises/math/geometry/optimisation/lengthWithXOnPicture.js +99 -0
  23. package/lib/exercises/math/geometry/pythagore/index.d.ts +1 -0
  24. package/lib/exercises/math/geometry/pythagore/index.d.ts.map +1 -1
  25. package/lib/exercises/math/geometry/pythagore/index.js +1 -1
  26. package/lib/exercises/math/geometry/pythagore/triangleHeight.d.ts.map +1 -1
  27. package/lib/exercises/math/geometry/pythagore/triangleHeight.js +78 -32
  28. package/lib/exercises/math/probaStat/events/describeEvent.js +1 -1
  29. package/lib/exercises/math/probaStat/events/eventNotation.js +1 -1
  30. package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.js +4 -4
  31. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +1 -1
  32. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +1 -1
  33. package/lib/exercises/math/probaStat/stats1var/interquartilesList.js +3 -3
  34. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
  35. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +22 -7
  36. package/lib/exercises/math/probaStat/stats1var/median.js +1 -1
  37. package/lib/exercises/math/probaStat/stats1var/medianList.js +1 -1
  38. package/lib/exercises/math/probaStat/stats1var/standardDeviationList.js +4 -4
  39. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +4 -4
  40. package/lib/exercises/math/probaStat/unionIntersectionProba.js +1 -1
  41. package/lib/exercises/math/python/inOutCalcul.js +1 -1
  42. package/lib/exercises/math/python/index.d.ts +6 -0
  43. package/lib/exercises/math/python/index.d.ts.map +1 -1
  44. package/lib/exercises/math/python/index.js +6 -0
  45. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts +9 -0
  46. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts.map +1 -0
  47. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.js +129 -0
  48. package/lib/exercises/math/python/pythonIfStatementCompletion.d.ts +8 -0
  49. package/lib/exercises/math/python/pythonIfStatementCompletion.d.ts.map +1 -0
  50. package/lib/exercises/math/python/pythonIfStatementCompletion.js +114 -0
  51. package/lib/exercises/math/python/pythonRangeCompletion.d.ts +9 -0
  52. package/lib/exercises/math/python/pythonRangeCompletion.d.ts.map +1 -0
  53. package/lib/exercises/math/python/pythonRangeCompletion.js +105 -0
  54. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.d.ts +8 -0
  55. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.d.ts.map +1 -0
  56. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.js +89 -0
  57. package/lib/exercises/math/python/pythonWhileStatementCompletion.d.ts +7 -0
  58. package/lib/exercises/math/python/pythonWhileStatementCompletion.d.ts.map +1 -0
  59. package/lib/exercises/math/python/pythonWhileStatementCompletion.js +87 -0
  60. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts +8 -0
  61. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts.map +1 -0
  62. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.js +120 -0
  63. package/lib/exercises/math/sampling/samplingFrequency.js +1 -1
  64. package/lib/index.d.ts +32 -0
  65. package/lib/index.d.ts.map +1 -1
  66. 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,
@@ -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$.";
@@ -52,7 +52,7 @@ const getCorrection = (identifiers) => {
52
52
  const conclusion = isValidPoint
53
53
  ? "Le point est donc sur la courbe."
54
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 :
55
+ return `$${point.toTexWithCoords()}$ appartient à la courbe de la fonction racine carrée si et seulement si :
56
56
 
57
57
  ${alignTex(sqrt(x).simplify().toTex() != sqrt(x).toTex()
58
58
  ? [
@@ -115,7 +115,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
115
115
  };
116
116
  export const sqrtCurvePoint = {
117
117
  id: "sqrtCurvePoint",
118
- label: "Déterminer si un point appartient à la courbe de la fonction racine carré",
118
+ label: "Déterminer si un point appartient à la courbe de la fonction racine carrée",
119
119
  answerType: "QCU",
120
120
  isSingleStep: true,
121
121
  generator: (nb, opts) => getDistinctQuestions(() => getSqrtCurvePointQuestion(opts), nb),
@@ -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;
@@ -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()}$
@@ -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"}