math-exercises 3.0.76 → 3.0.78

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 (108) hide show
  1. package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.d.ts +10 -0
  2. package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.d.ts.map +1 -0
  3. package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.js +112 -0
  4. package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.d.ts +8 -0
  5. package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.d.ts.map +1 -0
  6. package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.js +123 -0
  7. package/lib/exercises/math/calcul/arithmetics/compareInverseValues.d.ts +10 -0
  8. package/lib/exercises/math/calcul/arithmetics/compareInverseValues.d.ts.map +1 -0
  9. package/lib/exercises/math/calcul/arithmetics/compareInverseValues.js +136 -0
  10. package/lib/exercises/math/calcul/arithmetics/compareSquaredValues.d.ts +9 -0
  11. package/lib/exercises/math/calcul/arithmetics/compareSquaredValues.d.ts.map +1 -0
  12. package/lib/exercises/math/calcul/arithmetics/compareSquaredValues.js +143 -0
  13. package/lib/exercises/math/calcul/arithmetics/index.d.ts +5 -0
  14. package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
  15. package/lib/exercises/math/calcul/arithmetics/index.js +5 -0
  16. package/lib/exercises/math/calcul/arithmetics/sqrtInequality.d.ts +10 -0
  17. package/lib/exercises/math/calcul/arithmetics/sqrtInequality.d.ts.map +1 -0
  18. package/lib/exercises/math/calcul/arithmetics/sqrtInequality.js +160 -0
  19. package/lib/exercises/math/calcul/sign/absoluteNumber.js +1 -1
  20. package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
  21. package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +5 -1
  22. package/lib/exercises/math/functions/basics/graphicEquation.d.ts.map +1 -1
  23. package/lib/exercises/math/functions/basics/graphicEquation.js +33 -1
  24. package/lib/exercises/math/functions/basics/twoFunctionsEquation.d.ts.map +1 -1
  25. package/lib/exercises/math/functions/basics/twoFunctionsEquation.js +27 -0
  26. package/lib/exercises/math/functions/cube/compareCubeValues.d.ts +8 -0
  27. package/lib/exercises/math/functions/cube/compareCubeValues.d.ts.map +1 -0
  28. package/lib/exercises/math/functions/cube/compareCubeValues.js +113 -0
  29. package/lib/exercises/math/functions/cube/index.d.ts +1 -0
  30. package/lib/exercises/math/functions/cube/index.d.ts.map +1 -1
  31. package/lib/exercises/math/functions/cube/index.js +1 -0
  32. package/lib/exercises/math/functions/index.d.ts +1 -0
  33. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/index.js +1 -0
  35. package/lib/exercises/math/functions/sqrt/compareSqrtValues.d.ts +8 -0
  36. package/lib/exercises/math/functions/sqrt/compareSqrtValues.d.ts.map +1 -0
  37. package/lib/exercises/math/functions/sqrt/compareSqrtValues.js +83 -0
  38. package/lib/exercises/math/functions/sqrt/index.d.ts +2 -0
  39. package/lib/exercises/math/functions/sqrt/index.d.ts.map +1 -0
  40. package/lib/exercises/math/functions/sqrt/index.js +1 -0
  41. package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/variations/varTableExtremaReading.js +23 -8
  43. package/lib/exercises/math/geometry/angles/index.d.ts +1 -0
  44. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
  45. package/lib/exercises/math/geometry/angles/index.js +1 -0
  46. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts +8 -0
  47. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts.map +1 -0
  48. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.js +92 -0
  49. package/lib/exercises/math/geometry/cartesian/placeAbscissOnLine.d.ts.map +1 -1
  50. package/lib/exercises/math/geometry/cartesian/placeAbscissOnLine.js +26 -1
  51. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
  52. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +47 -13
  53. package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
  54. package/lib/exercises/math/geometry/lines/linesRelativePositions.js +29 -5
  55. package/lib/exercises/math/probaStat/calculateMeanFromFrequencies.d.ts +8 -0
  56. package/lib/exercises/math/probaStat/calculateMeanFromFrequencies.d.ts.map +1 -0
  57. package/lib/exercises/math/probaStat/calculateMeanFromFrequencies.js +108 -0
  58. package/lib/exercises/math/probaStat/checkEquiprobability.d.ts +9 -0
  59. package/lib/exercises/math/probaStat/checkEquiprobability.d.ts.map +1 -0
  60. package/lib/exercises/math/probaStat/checkEquiprobability.js +129 -0
  61. package/lib/exercises/math/probaStat/getComplementaryProbability.d.ts +7 -0
  62. package/lib/exercises/math/probaStat/getComplementaryProbability.d.ts.map +1 -0
  63. package/lib/exercises/math/probaStat/getComplementaryProbability.js +90 -0
  64. package/lib/exercises/math/probaStat/getMissingProbabilityValue.d.ts +9 -0
  65. package/lib/exercises/math/probaStat/getMissingProbabilityValue.d.ts.map +1 -0
  66. package/lib/exercises/math/probaStat/getMissingProbabilityValue.js +109 -0
  67. package/lib/exercises/math/probaStat/index.d.ts +6 -0
  68. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  69. package/lib/exercises/math/probaStat/index.js +6 -0
  70. package/lib/exercises/math/probaStat/mostLeastProbable.d.ts +8 -0
  71. package/lib/exercises/math/probaStat/mostLeastProbable.d.ts.map +1 -0
  72. package/lib/exercises/math/probaStat/mostLeastProbable.js +114 -0
  73. package/lib/exercises/math/probaStat/unionIntersectionProba.d.ts +11 -0
  74. package/lib/exercises/math/probaStat/unionIntersectionProba.d.ts.map +1 -0
  75. package/lib/exercises/math/probaStat/unionIntersectionProba.js +164 -0
  76. package/lib/exercises/math/python/conditionIfElifElse.d.ts +9 -0
  77. package/lib/exercises/math/python/conditionIfElifElse.d.ts.map +1 -0
  78. package/lib/exercises/math/python/conditionIfElifElse.js +121 -0
  79. package/lib/exercises/math/python/index.d.ts +1 -0
  80. package/lib/exercises/math/python/index.d.ts.map +1 -1
  81. package/lib/exercises/math/python/index.js +1 -0
  82. package/lib/exercises/math/python/pyNestedForLoopExercise.d.ts.map +1 -1
  83. package/lib/exercises/math/python/pyNestedForLoopExercise.js +26 -10
  84. package/lib/exercises/math/python/pyWhileLoop1Exercise.d.ts +0 -1
  85. package/lib/exercises/math/python/pyWhileLoop1Exercise.d.ts.map +1 -1
  86. package/lib/exercises/math/python/pyWhileLoop1Exercise.js +54 -31
  87. package/lib/exercises/math/python/pythonFunctionTrinom.d.ts.map +1 -1
  88. package/lib/exercises/math/python/pythonFunctionTrinom.js +23 -1
  89. package/lib/exercises/math/python/whileLoop.js +2 -2
  90. package/lib/exercises/math/python/whileLoopCount.js +1 -1
  91. package/lib/exercises/math/sequences/explicitFormulaUsage.js +3 -3
  92. package/lib/exercises/math/sequences/genericSequenceVariations.js +2 -2
  93. package/lib/exercises/math/sets/index.d.ts +2 -0
  94. package/lib/exercises/math/sets/index.d.ts.map +1 -1
  95. package/lib/exercises/math/sets/index.js +2 -0
  96. package/lib/exercises/math/sets/nameOfNumberSets.d.ts +8 -0
  97. package/lib/exercises/math/sets/nameOfNumberSets.d.ts.map +1 -0
  98. package/lib/exercises/math/sets/nameOfNumberSets.js +125 -0
  99. package/lib/exercises/math/sets/subsetsOfKnownSets.d.ts +8 -0
  100. package/lib/exercises/math/sets/subsetsOfKnownSets.d.ts.map +1 -0
  101. package/lib/exercises/math/sets/subsetsOfKnownSets.js +99 -0
  102. package/lib/index.d.ts +61 -6
  103. package/lib/index.d.ts.map +1 -1
  104. package/lib/latexTester.d.ts.map +1 -1
  105. package/lib/latexTester.js +25 -7
  106. package/lib/tests/pdfExo.test.d.ts.map +1 -1
  107. package/lib/tests/pdfExo.test.js +2 -2
  108. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ doubleAngle: number;
4
+ singleAngle: number;
5
+ };
6
+ export declare const parallelogramFourthAngle: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=parallelogramFourthAngle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelogramFourthAngle.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/parallelogramFourthAngle.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA4FF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAkB1D,CAAC"}
@@ -0,0 +1,92 @@
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 { degreeParser } from "../../../../tree/parsers/degreeParser.js";
5
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
+ const getPropositions = (n, { answer, singleAngle, doubleAngle }) => {
7
+ const propositions = [];
8
+ addValidProp(propositions, answer);
9
+ tryToAddWrongProp(propositions, `${singleAngle}^{\\circ}`);
10
+ tryToAddWrongProp(propositions, `${doubleAngle}^{\\circ}`);
11
+ tryToAddWrongProp(propositions, `${360 - singleAngle}^{\\circ}`);
12
+ tryToAddWrongProp(propositions, `${360 - doubleAngle}^{\\circ}`);
13
+ tryToAddWrongProp(propositions, `${360 - singleAngle - doubleAngle}^{\\circ}`);
14
+ tryToAddWrongProp(propositions, `${Math.abs(180 - 2 * singleAngle - doubleAngle)}^{\\circ}`);
15
+ return shuffleProps(propositions, n);
16
+ };
17
+ const getAnswer = (identifiers) => {
18
+ const { singleAngle, doubleAngle } = identifiers;
19
+ const fourthAngle = 360 - singleAngle - 2 * doubleAngle;
20
+ return `${fourthAngle}^{\\circ}`;
21
+ };
22
+ const getInstruction = (identifiers) => {
23
+ return `Un parallélogramme a deux angles de mesure $${identifiers.doubleAngle}^{\\circ}$ et un angle de mesure $${identifiers.singleAngle}^{\\circ}$.
24
+
25
+ Quelle est la mesure de son quatrième angle ?`;
26
+ };
27
+ const getHint = (identifiers) => {
28
+ return `La somme des angles d'un parallélogramme est égale à $360°$.`;
29
+ };
30
+ const getCorrection = (identifiers) => {
31
+ const { singleAngle, doubleAngle } = identifiers;
32
+ const sum = singleAngle + 2 * doubleAngle;
33
+ return `La somme des angles d'un parallélogramme est égale à $360°$. Ici, la somme des trois angles connus vaut :
34
+
35
+ $$
36
+ ${singleAngle}^{\\circ} + 2\\times ${doubleAngle}^{\\circ} = ${sum}^{\\circ}
37
+ $$
38
+
39
+ Le quatrième angle vaut donc :
40
+
41
+ $$
42
+ 360^{\\circ} - ${sum}^{\\circ} = ${singleAngle} ^{\\circ}
43
+ $$`;
44
+ };
45
+ const isAnswerValid = (ans, { answer }) => {
46
+ try {
47
+ return degreeParser(ans) === answer;
48
+ }
49
+ catch (err) {
50
+ return handleVEAError(err);
51
+ }
52
+ };
53
+ const getParallelogramFourthAngleQuestion = (ops) => {
54
+ const doubleAngle = randint(10, 170);
55
+ const singleAngle = 180 - doubleAngle;
56
+ const identifiers = {
57
+ singleAngle,
58
+ doubleAngle,
59
+ };
60
+ return getQuestionFromIdentifiers(identifiers);
61
+ };
62
+ const getKeys = (identifiers) => {
63
+ return ["degree"];
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 parallelogramFourthAngle = {
77
+ id: "parallelogramFourthAngle",
78
+ label: "Déterminer le $4$ème angle d'un parallélogramme en connaissant les $3$ autres",
79
+ isSingleStep: true,
80
+ generator: (nb, opts) => getDistinctQuestions(() => getParallelogramFourthAngleQuestion(opts), nb),
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
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"placeAbscissOnLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/placeAbscissOnLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAQ1D,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAyIF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
1
+ {"version":3,"file":"placeAbscissOnLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/placeAbscissOnLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAa1D,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAsKF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAgBpD,CAAC"}
@@ -9,8 +9,10 @@ import { randfloat } from "../../../../math/utils/random/randfloat.js";
9
9
  import { randint } from "../../../../math/utils/random/randint.js";
10
10
  import { round } from "../../../../math/utils/round.js";
11
11
  import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
12
- import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
12
+ import { multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
13
14
  import { random } from "../../../../utils/alea/random.js";
15
+ import { pluralize } from "../../../../utils/strings/pluralize.js";
14
16
  const getInstruction = ({ abscissTex }) => {
15
17
  return `Placer le point d'abscisse $${abscissTex}$ sur la droite graduée ci-dessous :`;
16
18
  };
@@ -108,6 +110,28 @@ const getPlaceAbscissOnLineQuestion = () => {
108
110
  };
109
111
  return getQuestionFromIdentifiers(identifiers);
110
112
  };
113
+ const getHint = (identifiers) => {
114
+ const { absciss, axisUnit, oneUnitTex, abscissType, abscissTex, coeff } = identifiers;
115
+ return `Il faut compter le nombre de graduations entre les points $O$ et $A$. Puis on utilise le fait qu'une graduation vaut $${oneUnitTex}$.
116
+
117
+ D'autre part, si $A$ est placé à gauche de $O$, alors son abscisse est négative.`;
118
+ };
119
+ const getCorrection = (identifiers) => {
120
+ const { absciss, axisUnit, oneUnitTex, abscissType, abscissTex, coeff } = identifiers;
121
+ const absCoeff = Math.abs(coeff);
122
+ const oneUnitNode = parseAlgebraic(oneUnitTex);
123
+ return `Il y a $${absCoeff}$ ${pluralize("graduation", absCoeff)} entre $O$ et $A$. Puisqu'une graduation vaut $${oneUnitTex}$, cela représente un écart de :
124
+
125
+ $$
126
+ ${multiply(absCoeff, oneUnitNode).toTex({
127
+ forceNoSimplification: true,
128
+ })} = ${multiply(absCoeff, oneUnitNode).simplify().toTex()}
129
+ $$
130
+
131
+ ${coeff < 0
132
+ ? `Puisque $A$ est placé à gauche du point $O$, son abscisse est négative. L'abscisse du point $A$ est donc $${abscissTex}$.`
133
+ : `L'abscisse du point $A$ est donc $${abscissTex}$.`}`;
134
+ };
111
135
  const getQuestionFromIdentifiers = (identifiers) => {
112
136
  const question = {
113
137
  ggbAnswer: getGGBAnswer(identifiers),
@@ -133,4 +157,5 @@ export const placeAbscissOnLine = {
133
157
  getStudentGGBOptions,
134
158
  answerType: "GGB",
135
159
  getQuestionFromIdentifiers,
160
+ // hasHintAndCorrection: true,
136
161
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pythagoreOrThales.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/pythagoreOrThales.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAkBtC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IAEzB,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;CAQnB,CAAC;AAqPF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAuBnD,CAAC"}
1
+ {"version":3,"file":"pythagoreOrThales.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/pythagoreOrThales.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAkBtC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IAEzB,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;CAQnB,CAAC;AA4RF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAuBnD,CAAC"}
@@ -30,9 +30,26 @@ const getAnswer = (identifiers) => {
30
30
  : "La réciproque du théorème de Thalès";
31
31
  };
32
32
  const getInstruction = (identifiers) => {
33
- const { isAskingLength, pointsIdentifiers, isSegmentHeight } = identifiers;
33
+ const { isAskingLength, pointsIdentifiers, lengths, isSegmentHeight } = identifiers;
34
34
  const points = pointsIdentifiers.map((p) => PointConstructor.fromIdentifiers(p));
35
35
  let instruction = ``;
36
+ let segments;
37
+ if (isSegmentHeight) {
38
+ const withoutA = points.slice(1);
39
+ segments = withoutA.map((p, i) => new Segment(p, withoutA[(i + 1) % 3], {
40
+ lengthNode: new NumberNode(lengths[i]),
41
+ }));
42
+ segments.push(new Segment(points[3], points[0], {
43
+ lengthNode: new NumberNode(lengths[3]),
44
+ }));
45
+ segments.push(new Segment(points[0], points[1]));
46
+ }
47
+ else {
48
+ segments = points.map((p, i) => new Segment(p, points[(i + 1) % points.length], {
49
+ lengthNode: new NumberNode(lengths[i]),
50
+ }));
51
+ segments.push(new Segment(points[1], points[3]));
52
+ }
36
53
  if (isSegmentHeight) {
37
54
  if (isAskingLength) {
38
55
  instruction = `calculer la longueur $${points[0].name}${points[1].name}$`;
@@ -53,6 +70,11 @@ const getInstruction = (identifiers) => {
53
70
  ? `, où les droites $\\left(${points[1].name}${points[3].name}\\right)$ et $\\left(${points[0].name}${points[4].name}\\right)$ sont parallèles.`
54
71
  : "."}
55
72
 
73
+ On connaît les longueurs suivantes : $${segments
74
+ .slice(0, segments.length - 1)
75
+ .map((e) => e.toLengthTex())
76
+ .join("\\ ; \\ ")}$.
77
+
56
78
  Pour ${instruction}, il faut utiliser... `;
57
79
  };
58
80
  const getHint = (identifiers) => {
@@ -69,22 +91,32 @@ $$
69
91
  };
70
92
  const getCorrection = (identifiers) => {
71
93
  const { isAskingLength, pointsIdentifiers, isSegmentHeight } = identifiers;
72
- const points = pointsIdentifiers.map((p) => PointConstructor.fromIdentifiers(p));
73
94
  if (isSegmentHeight) {
74
95
  if (isAskingLength) {
75
- // ("Pythagore");
76
- return ``;
96
+ return `Il faut utiliser le théorème de Pythagore : das un triangle rectangle, le carré de l'hypoténuse est égal à la somme des carrés des deux autres côtés.
97
+
98
+ On applique ce théorème dans le triangle $ABD$ rectangle en $D$. En effet, d'après le théorème de Pythagore, on a $AB^2 = AD^2 + DB^2$. Puisqu'on connaît les longueurs $AD$ et $DB$, on peut en déduire la longueur $AB$.`;
77
99
  }
78
100
  else {
79
- // ("Recip pythagore");
101
+ return `Il faut utiliser la réciproque du théorème de Pythagore : si dans un triangle, le carré de l'hypoténuse est égal à la somme des carrés des deux autres côtés, alors le triangle est rectangle.
102
+
103
+ On applique cette réciproque dans le triangle $BCD$. En effet, on connaît les longueurs des trois côtés. Il suffit donc de montrer que $BC^2 = BD^2 + CD^2$.`;
80
104
  }
81
105
  }
82
106
  else {
83
107
  if (isAskingLength) {
84
- // ("Thales");
108
+ return `Il faut utiliser le théorème de Thalès : dans le triangle $ABC$, si les droites $(DE)$ et $(BC)$ sont parallèles, alors :
109
+
110
+ $$
111
+ \\frac{AD}{AB}=\\frac{AE}{AC}=\\frac{DE}{BC}
112
+ $$
113
+
114
+ On peut donc calculer $DE$ en remplaçant les longueurs par les valeurs données dans l'énoncé.`;
85
115
  }
86
116
  else {
87
- // ("Recip thales");
117
+ return `Il faut utiliser la réciproque du théorème de Thalès : dans le triangle $ABC$, si $\\frac{DB}{AB}=\\frac{EB}{CB}$, alors les droites $(DE)$ et $(AC)$ sont parallèles.
118
+
119
+ Il suffit donc de prouver que $\\frac{DB}{AB} = \\frac{EB}{CB}$, en remplaçant les longueurs par les valeurs données dans l'énoncé.`;
88
120
  }
89
121
  }
90
122
  return ``;
@@ -112,9 +144,11 @@ const getGGBOptions = (identifiers) => {
112
144
  const commands = [
113
145
  ...points.flatMap((p) => p.toGGBCommand()),
114
146
  ...segments.flatMap((s, i) => s.toGGBCommands(false, { color: "grey", thickness: 3 })),
115
- ...segments
116
- .slice(0, segments.length - 1)
117
- .flatMap((s, i) => s.getFitCaptionCommands({ size: "scriptsize", color: "red" })),
147
+ // ...segments
148
+ // .slice(0, segments.length - 1)
149
+ // .flatMap((s, i) =>
150
+ // s.getFitCaptionCommands({ size: "scriptsize", color: "red" }),
151
+ // ),
118
152
  ...(isAskingLength && isSegmentHeight
119
153
  ? new Angle([points[1], points[3], points[0]]).toCommands()
120
154
  : []),
@@ -203,8 +237,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
203
237
  keys: getKeys(identifiers),
204
238
  answerFormat: "raw",
205
239
  identifiers,
206
- // hint: getHint(identifiers),
207
- // correction: getCorrection(identifiers),
240
+ hint: getHint(identifiers),
241
+ correction: getCorrection(identifiers),
208
242
  ggbOptions: getGGBOptions(identifiers),
209
243
  };
210
244
  return question;
@@ -230,7 +264,7 @@ export const pythagoreOrThales = {
230
264
  shouldSpreadPropositions: true,
231
265
  },
232
266
  getQuestionFromIdentifiers,
233
- // hasHintAndCorrection: true,
267
+ hasHintAndCorrection: true,
234
268
  };
235
269
  const getSubTriangle = ({ triangle, insidePointsNames, ratio, isPapillon, }) => {
236
270
  const [A, B, C] = triangle.points;
@@ -1 +1 @@
1
- {"version":3,"file":"linesRelativePositions.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/lines/linesRelativePositions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAE/D,WAAW,EAAE,MAAM,CAAC;CAKrB,CAAC;AAkJF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAoBxD,CAAC"}
1
+ {"version":3,"file":"linesRelativePositions.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/lines/linesRelativePositions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAE/D,WAAW,EAAE,MAAM,CAAC;CAKrB,CAAC;AAyKF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAqBxD,CAAC"}
@@ -25,6 +25,31 @@ const getAnswer = (identifiers) => {
25
25
  return "sécantes mais non perpendiculaires";
26
26
  }
27
27
  };
28
+ const getHint = (identifiers) => {
29
+ return `Deux droites sont :
30
+
31
+ - perpendiculaires si leur intersection forme un angle droit ;
32
+ - sécantes mais non perpendiculaires si elles s'intersectent mais sans angle droit ;
33
+ - parallèles si elles n'ont pas de point d'intersection.`;
34
+ };
35
+ const getCorrection = (identifiers) => {
36
+ const { coupleAsked, lines } = identifiers;
37
+ const askedLines = coupleAsked === 0
38
+ ? [lines[0], lines[4]]
39
+ : coupleAsked === 3
40
+ ? [lines[2], lines[4]]
41
+ : [lines[coupleAsked], lines[coupleAsked + 1]];
42
+ const answer = getAnswer(identifiers);
43
+ if (answer === "parallèles")
44
+ return `Les droites $${askedLines[0].label}$ et $${askedLines[1].label}$ ne semblent pas avoir de point d'intersection : elles semblent donc parallèles.`;
45
+ if (answer === "perpendiculaires") {
46
+ `Les droites $${askedLines[0].label}$ et $${askedLines[1].label}$ ont un point d'intersection : elles sont donc sécantes. De plus, leur intersection semble former un angle droit : elles semblent donc perpendiculaires.`;
47
+ }
48
+ if (askedLines[1].label === "d_4") {
49
+ `Les droites $${askedLines[0].label}$ et $${askedLines[1].label}$ ont un point d'intersection : elles sont donc sécantes. De plus, elles ne semble pas perpendiculaires, car leur intersection ne semble pas former un angle droit.`;
50
+ }
51
+ return `Les droites $${askedLines[0].label}$ et $${askedLines[1].label}$ sont sécantes. En effet, même si on ne voit pas leur point d'intersection sur le graphique, on voit qu'elles ne sont pas parallèles, et qu'en poursuivant le tracé, elles finiront par s'intersecter.`;
52
+ };
28
53
  const getInstruction = (identifiers) => {
29
54
  const { coupleAsked, lines } = identifiers;
30
55
  const askedLines = coupleAsked === 0
@@ -34,10 +59,8 @@ const getInstruction = (identifiers) => {
34
59
  : [lines[coupleAsked], lines[coupleAsked + 1]];
35
60
  return `On donne la figure ci-dessous.
36
61
 
37
- $${askedLines[0].label}$ et $${askedLines[1].label}$ semblent...`;
62
+ Les droites $${askedLines[0].label}$ et $${askedLines[1].label}$ semblent...`;
38
63
  };
39
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
40
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
41
64
  const getGGBOptions = (identifiers) => {
42
65
  const lines = identifiers.lines.map((d, i) => new Line(new Point(`A_${d.label}`, d.pointA[0], d.pointA[1]), new Point(`B_${d.label}`, d.pointB[0], d.pointB[1]), d.label));
43
66
  const ggb = new GeogebraConstructor({
@@ -114,8 +137,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
114
137
  keys: getKeys(identifiers),
115
138
  answerFormat: "raw",
116
139
  identifiers,
117
- // hint: getHint(identifiers),
118
- // correction: getCorrection(identifiers),
140
+ hint: getHint(identifiers),
141
+ correction: getCorrection(identifiers),
119
142
  ggbOptions: getGGBOptions(identifiers),
120
143
  };
121
144
  return question;
@@ -139,4 +162,5 @@ export const linesRelativePositions = {
139
162
  maxAllowedQuestions: 4,
140
163
  answerType: "QCU",
141
164
  getQuestionFromIdentifiers,
165
+ hasHintAndCorrection: true,
142
166
  };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ xValues: number[];
4
+ yValues: number[];
5
+ };
6
+ export declare const calculateMeanFromFrequencies: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=calculateMeanFromFrequencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateMeanFromFrequencies.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/calculateMeanFromFrequencies.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAwGF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAoB9D,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
4
+ import { dollarize } from "../../../utils/latex/dollarize.js";
5
+ import { mdTable } from "../../../utils/markdown/mdTable.js";
6
+ import { round } from "../../../math/utils/round.js";
7
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
8
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
9
+ const getPropositions = (n, { answer }) => {
10
+ const propositions = [];
11
+ addValidProp(propositions, answer);
12
+ while (propositions.length < n) {
13
+ const offset = randfloat(0.1, 1, 2);
14
+ tryToAddWrongProp(propositions, round(answer.unfrenchify() + offset, 2).frenchify());
15
+ }
16
+ return shuffleProps(propositions, n);
17
+ };
18
+ const getAnswer = (identifiers) => {
19
+ const { xValues, yValues } = identifiers;
20
+ const sum = xValues.reduce((sum, v, i) => sum + v * yValues[i], 0);
21
+ const mean = round(sum, 2);
22
+ return mean.frenchify();
23
+ };
24
+ const getInstruction = (identifiers) => {
25
+ const { xValues, yValues } = identifiers;
26
+ return `Un film a été noté par les spectateurs :
27
+
28
+
29
+ ${mdTable([
30
+ ["Note", ...xValues.map((v) => dollarize(v))],
31
+ ["Fréquence", ...yValues.map((v) => dollarize(`${round(v * 100, 2)} \\%`))],
32
+ ])}
33
+
34
+ Quelle est la note moyenne du film ?`;
35
+ };
36
+ const getHint = (identifiers) => {
37
+ return `Pour calculer la moyenne, multiplie chaque valeur $x_i$ par sa fréquence correspondante $f_i$, puis additionne ces produits.`;
38
+ };
39
+ const getCorrection = (identifiers) => {
40
+ const { xValues, yValues } = identifiers;
41
+ const products = xValues.map((v, i) => round(v * yValues[i], 2));
42
+ const total = getAnswer(identifiers);
43
+ return `On calcule les produits des notes par leur fréquence : \n\n
44
+
45
+ ${xValues
46
+ .map((v, i) => `$$
47
+ ${v} \\times ${yValues[i].frenchify()} = ${products[i].frenchify()}
48
+ $$`)
49
+ .join("\n\n")}
50
+
51
+ En additionnant ces produits, on obtient la moyenne $\\overline{x}$ :
52
+
53
+ $$
54
+ \\overline x = ${total}
55
+ $$`;
56
+ };
57
+ const getKeys = (identifiers) => {
58
+ return [];
59
+ };
60
+ const isAnswerValid = (ans, { answer }) => {
61
+ try {
62
+ const ansNode = parseAlgebraic(ans);
63
+ const answerNode = parseAlgebraic(answer);
64
+ return ansNode.simplify().equals(answerNode.simplify());
65
+ }
66
+ catch (err) {
67
+ return handleVEAError(err);
68
+ }
69
+ };
70
+ const getCalculateMeanFromFrequenciesQuestion = (ops) => {
71
+ const xValues = [0, 1, 2, 3, 4];
72
+ const raw = xValues.map(() => Math.random());
73
+ const total = raw.reduce((sum, v) => sum + v, 0);
74
+ const yValues = raw.map((v) => round(v / total, 2));
75
+ const sumRounded = yValues.reduce((sum, v) => sum + v, 0);
76
+ const diff = round(1 - sumRounded, 2);
77
+ yValues[yValues.length - 1] = round(yValues[yValues.length - 1] + diff, 2);
78
+ const identifiers = { xValues, yValues };
79
+ return getQuestionFromIdentifiers(identifiers);
80
+ };
81
+ const getQuestionFromIdentifiers = (identifiers) => {
82
+ return {
83
+ answer: getAnswer(identifiers),
84
+ instruction: getInstruction(identifiers),
85
+ keys: getKeys(identifiers),
86
+ answerFormat: "tex",
87
+ identifiers,
88
+ hint: getHint(identifiers),
89
+ correction: getCorrection(identifiers),
90
+ };
91
+ };
92
+ export const calculateMeanFromFrequencies = {
93
+ id: "calculateMeanFromFrequencies",
94
+ label: "Calculer une moyenne à partir de fréquences",
95
+ isSingleStep: true,
96
+ generator: (nb, opts) => getDistinctQuestions(() => getCalculateMeanFromFrequenciesQuestion(opts), nb),
97
+ qcmTimer: 60,
98
+ freeTimer: 60,
99
+ getPropositions,
100
+ isAnswerValid,
101
+ subject: "Mathématiques",
102
+ getInstruction,
103
+ getHint,
104
+ getCorrection,
105
+ getAnswer,
106
+ getQuestionFromIdentifiers,
107
+ hasHintAndCorrection: true,
108
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ total: number;
4
+ distribution: number[];
5
+ observe: boolean;
6
+ };
7
+ export declare const checkEquiprobability: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=checkEquiprobability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkEquiprobability.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/checkEquiprobability.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAsIF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
@@ -0,0 +1,129 @@
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 { frac } from "../../../tree/nodes/operators/fractionNode.js";
5
+ import { coinFlip } from "../../../utils/alea/coinFlip.js";
6
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
7
+ const getPropositions = (n, { answer }) => {
8
+ const propositions = [];
9
+ addValidProp(propositions, answer, "raw");
10
+ const wrong = answer === "Oui" ? "Non" : "Oui";
11
+ tryToAddWrongProp(propositions, wrong, "raw");
12
+ tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
13
+ return shuffleProps(propositions, n);
14
+ };
15
+ const getAnswer = (identifiers) => {
16
+ const { observe, distribution } = identifiers;
17
+ if (observe) {
18
+ return "Oui";
19
+ }
20
+ else {
21
+ return distribution.every((v) => v === distribution[0]) ? "Oui" : "Non";
22
+ }
23
+ };
24
+ const getInstruction = ({ total, distribution, observe, }) => {
25
+ const colors = ["rouges", "vertes", "bleues", "jaunes"];
26
+ const colorLines = distribution
27
+ .map((count, i) => `$${count}$ cartes sont ${colors[i]}`)
28
+ .join(", ");
29
+ return `Un jeu est constitué de $${total}$ cartes numérotées de $1$ à $${total}$.
30
+
31
+ ${colorLines}.
32
+
33
+ On tire une carte au hasard.
34
+
35
+ On observe ${observe ? "le numéro" : "la couleur"} de la carte tirée.
36
+
37
+ Les issues sont-elles équiprobables ?`;
38
+ };
39
+ const getHint = ({ observe }) => {
40
+ if (observe) {
41
+ return `Pense à combien de cartes portent chaque numéro.
42
+ Y a-t-il autant de cartes pour chaque numéro possible ?`;
43
+ }
44
+ else {
45
+ return `Regarde le nombre de cartes de chaque couleur.
46
+ A-t-on autant de chances d'obtenir toutes les couleurs ?`;
47
+ }
48
+ };
49
+ const getCorrection = ({ total, distribution, observe, }) => {
50
+ const colors = ["rouge", "vert", "bleu", "jaune"];
51
+ const probs = distribution
52
+ .map((count, i) => `$$
53
+ P(\\text{${colors[i]}}) = ${frac(count, total).toTex()}
54
+ $$`)
55
+ .join("\n \n");
56
+ const explanation = observe
57
+ ? `Chaque carte a un numéro distinct entre $1$ et $${total}$, donc chaque numéro a une probabilité d'être tiré égale à $${frac(1, total).toTex()}$.
58
+ Toutes les issues sont donc équiprobables.`
59
+ : `Les probabilités associées à chaque couleur sont : \n\n ${probs} \n\n
60
+ ${distribution.every((v) => v === distribution[0])
61
+ ? "Puisqu'il y autant de cartes de chaque couleur, les issues sont équiprobables."
62
+ : "Les couleurs n'ont pas toutes le même nombre de cartes, donc les issues ne sont pas équiprobables."}`;
63
+ return `${explanation}`;
64
+ };
65
+ const getKeys = (identifiers) => {
66
+ return [];
67
+ };
68
+ const isAnswerValid = (ans, { answer }) => {
69
+ try {
70
+ return ans === answer;
71
+ }
72
+ catch (err) {
73
+ return handleVEAError(err);
74
+ }
75
+ };
76
+ const getCheckEquiprobabilityQuestion = (ops) => {
77
+ let total;
78
+ let distribution;
79
+ const isEquiprobable = coinFlip();
80
+ const observe = coinFlip();
81
+ if (isEquiprobable) {
82
+ total = 4 * randint(10, 30);
83
+ const value = total / 4;
84
+ distribution = [value, value, value, value];
85
+ }
86
+ else {
87
+ total = randint(30, 61);
88
+ const a = randint(2, total - 6);
89
+ const b = randint(2, total - a - 4);
90
+ const c = randint(2, total - a - b - 2);
91
+ const d = total - a - b - c;
92
+ distribution = [a, b, c, d];
93
+ }
94
+ const identifiers = {
95
+ total,
96
+ distribution,
97
+ observe,
98
+ };
99
+ return getQuestionFromIdentifiers(identifiers);
100
+ };
101
+ const getQuestionFromIdentifiers = (identifiers) => {
102
+ return {
103
+ answer: getAnswer(identifiers),
104
+ instruction: getInstruction(identifiers),
105
+ keys: getKeys(identifiers),
106
+ answerFormat: "tex",
107
+ identifiers,
108
+ hint: getHint(identifiers),
109
+ correction: getCorrection(identifiers),
110
+ };
111
+ };
112
+ export const checkEquiprobability = {
113
+ id: "checkEquiprobability",
114
+ label: "Reconnaître une situation équiprobable",
115
+ isSingleStep: true,
116
+ generator: (nb, opts) => getDistinctQuestions(() => getCheckEquiprobabilityQuestion(opts), nb),
117
+ qcmTimer: 60,
118
+ freeTimer: 60,
119
+ getPropositions,
120
+ isAnswerValid,
121
+ subject: "Mathématiques",
122
+ getInstruction,
123
+ getHint,
124
+ getCorrection,
125
+ getAnswer,
126
+ getQuestionFromIdentifiers,
127
+ hasHintAndCorrection: true,
128
+ answerType: "QCU",
129
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ pA: number;
4
+ };
5
+ export declare const getComplementaryProbability: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=getComplementaryProbability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getComplementaryProbability.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/getComplementaryProbability.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAiFF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAoB7D,CAAC"}