math-exercises 3.0.190 → 3.0.192

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 (125) hide show
  1. package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.d.ts +53 -0
  2. package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.d.ts.map +1 -0
  3. package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.js +543 -0
  4. package/lib/exercises/math/dataRepresentations/barChart/barChartReading.d.ts +94 -0
  5. package/lib/exercises/math/dataRepresentations/barChart/barChartReading.d.ts.map +1 -0
  6. package/lib/exercises/math/dataRepresentations/barChart/barChartReading.js +280 -0
  7. package/lib/exercises/math/dataRepresentations/barChart/index.d.ts +3 -0
  8. package/lib/exercises/math/dataRepresentations/barChart/index.d.ts.map +1 -0
  9. package/lib/exercises/math/dataRepresentations/barChart/index.js +2 -0
  10. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.d.ts +7 -0
  11. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.d.ts.map +1 -0
  12. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.js +223 -0
  13. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.d.ts +9 -0
  14. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.d.ts.map +1 -0
  15. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.js +133 -0
  16. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.d.ts +11 -0
  17. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.d.ts.map +1 -0
  18. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.js +198 -0
  19. package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.d.ts +13 -0
  20. package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.d.ts.map +1 -0
  21. package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.js +192 -0
  22. package/lib/exercises/math/dataRepresentations/boxPlot/index.d.ts +5 -0
  23. package/lib/exercises/math/dataRepresentations/boxPlot/index.d.ts.map +1 -0
  24. package/lib/exercises/math/dataRepresentations/boxPlot/index.js +4 -0
  25. package/lib/exercises/math/dataRepresentations/index.d.ts +4 -7
  26. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  27. package/lib/exercises/math/dataRepresentations/index.js +4 -11
  28. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts +6 -0
  29. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts.map +1 -0
  30. package/lib/exercises/math/dataRepresentations/scatterPlot/index.js +5 -0
  31. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts +12 -0
  32. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts.map +1 -0
  33. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.js +206 -0
  34. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts +9 -0
  35. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts.map +1 -0
  36. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.js +210 -0
  37. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts +10 -0
  38. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts.map +1 -0
  39. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.js +252 -0
  40. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts +12 -0
  41. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts.map +1 -0
  42. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.js +352 -0
  43. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts +11 -0
  44. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts.map +1 -0
  45. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.js +403 -0
  46. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts +7 -0
  47. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts.map +1 -0
  48. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.js +222 -0
  49. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts +7 -0
  50. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts.map +1 -0
  51. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.js +187 -0
  52. package/lib/exercises/math/dataRepresentations/tables/index.d.ts +4 -0
  53. package/lib/exercises/math/dataRepresentations/tables/index.d.ts.map +1 -0
  54. package/lib/exercises/math/dataRepresentations/tables/index.js +3 -0
  55. package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts +8 -0
  56. package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts.map +1 -0
  57. package/lib/exercises/math/dataRepresentations/tables/tableReading.js +109 -0
  58. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts +8 -0
  59. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts.map +1 -0
  60. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.js +145 -0
  61. package/lib/exercises/math/derivation/applications/index.d.ts +1 -0
  62. package/lib/exercises/math/derivation/applications/index.d.ts.map +1 -1
  63. package/lib/exercises/math/derivation/applications/index.js +1 -0
  64. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +1 -1
  65. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -1
  66. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +4 -1
  67. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts +13 -0
  68. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts.map +1 -0
  69. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.js +205 -0
  70. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts +9 -0
  71. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts.map +1 -0
  72. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.js +157 -0
  73. package/lib/exercises/math/functions/affines/affineVariations.d.ts +12 -0
  74. package/lib/exercises/math/functions/affines/affineVariations.d.ts.map +1 -0
  75. package/lib/exercises/math/functions/affines/affineVariations.js +176 -0
  76. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts +8 -0
  77. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts.map +1 -0
  78. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.js +203 -0
  79. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts +12 -0
  80. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts.map +1 -0
  81. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.js +259 -0
  82. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts +9 -0
  83. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts.map +1 -0
  84. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.js +99 -0
  85. package/lib/exercises/math/functions/exponentials/index.d.ts +5 -0
  86. package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
  87. package/lib/exercises/math/functions/exponentials/index.js +5 -0
  88. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts +10 -0
  89. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts.map +1 -0
  90. package/lib/exercises/math/functions/exponentials/realPowersFraction.js +125 -0
  91. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts +12 -0
  92. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts.map +1 -0
  93. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.js +148 -0
  94. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts +10 -0
  95. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts.map +1 -0
  96. package/lib/exercises/math/functions/exponentials/realPowersPower.js +128 -0
  97. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts +10 -0
  98. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts.map +1 -0
  99. package/lib/exercises/math/functions/exponentials/realPowersProduct.js +128 -0
  100. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -1
  101. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +7 -2
  102. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  103. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +131 -61
  104. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts +12 -0
  105. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map +1 -0
  106. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.js +217 -0
  107. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts +10 -0
  108. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts.map +1 -0
  109. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.js +186 -0
  110. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts +14 -0
  111. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts.map +1 -0
  112. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.js +189 -0
  113. package/lib/exercises/math/sequences/geometric/graph/index.d.ts +2 -0
  114. package/lib/exercises/math/sequences/geometric/graph/index.d.ts.map +1 -0
  115. package/lib/exercises/math/sequences/geometric/graph/index.js +1 -0
  116. package/lib/index.d.ts +53 -25
  117. package/lib/index.d.ts.map +1 -1
  118. package/lib/tree/nodes/algebraicNode.d.ts +3 -0
  119. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  120. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  121. package/lib/tree/nodes/operators/fractionNode.js +5 -3
  122. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  123. package/lib/tree/nodes/operators/multiplyNode.js +5 -3
  124. package/lib/tree/nodes/operators/powerNode.js +1 -1
  125. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boxPlotReadingPercentages.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvC,KAAK,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAElD,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gBAAgB,EAAE,aAAa,EAAE,CAAC;IAClC,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AA0NF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAmB3D,CAAC"}
@@ -0,0 +1,198 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
8
+ import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
9
+ import { random, randomMany } from "../../../../utils/alea/random.js";
10
+ const getPropositions = (n, { answer }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer);
13
+ [0, 25, 50, 75, 100].forEach((percentage) => {
14
+ tryToAddWrongProp(propositions, percentage.frenchify());
15
+ });
16
+ return shuffleProps(propositions, n);
17
+ };
18
+ const getAnswer = (identifiers) => {
19
+ const { arrQuartileIndex } = identifiers;
20
+ return multiply(substract(arrQuartileIndex[1], arrQuartileIndex[0]), 25)
21
+ .simplify()
22
+ .toTex();
23
+ };
24
+ const getFrenchStringForDuQuartile = (quartileIndex) => {
25
+ switch (quartileIndex) {
26
+ case 0:
27
+ return "du minimum";
28
+ case 1:
29
+ return "du premier quartile";
30
+ case 2:
31
+ return "de la médiane";
32
+ case 3:
33
+ return "du troisième quartile";
34
+ case 4:
35
+ return "du maximum";
36
+ }
37
+ };
38
+ const getInstruction = (identifiers) => {
39
+ const { quartiles, arrQuartileIndex, typeQ } = identifiers;
40
+ const vMin = quartiles[arrQuartileIndex[0]];
41
+ const vMax = quartiles[arrQuartileIndex[1]];
42
+ return `On a représenté une série statistique à une variable sous forme d'une boîte à moustaches.
43
+ ${(() => {
44
+ switch (typeQ) {
45
+ case "below":
46
+ return `Quelle est la proportion de valeurs (en pourcentage) qui sont inférieures ou égales à $${vMax}$ ?`;
47
+ case "between":
48
+ return `Quelle est la proportion de valeurs (en pourcentage) qui sont comprises entre $${vMin}$ et $${vMax}$ ?`;
49
+ case "above":
50
+ return `Quelle est la proportion de valeurs (en pourcentage) qui sont supérieures ou égales à $${vMin}$ ?`;
51
+ }
52
+ })()}
53
+ `;
54
+ };
55
+ const getHint = () => {
56
+ return `$25\\%$ des données sont inférieures ou égales au premier quartile ($Q_1$).
57
+
58
+ $50\\%$ des données sont inférieures ou égales à la médiane ($Q_2$).
59
+
60
+ $75\\%$ des données sont inférieures ou égales au troisième quartile ($Q_3$).`;
61
+ };
62
+ const getCorrection = (identifiers) => {
63
+ const { quartiles, arrQuartileIndex, typeQ } = identifiers;
64
+ const texPercentage = getAnswer(identifiers);
65
+ switch (typeQ) {
66
+ case "below":
67
+ return `D'après la boîte à moustaches, $ ${quartiles[arrQuartileIndex[1]]} $ est la valeur ${getFrenchStringForDuQuartile(arrQuartileIndex[1])}.
68
+
69
+ La proportion de valeurs inférieures ou égales à $ ${quartiles[arrQuartileIndex[1]]} $ est donc $${texPercentage}\\%$.`;
70
+ case "between":
71
+ return `D'après la boîte à moustaches, $ ${quartiles[arrQuartileIndex[0]]} $ est la valeur ${getFrenchStringForDuQuartile(arrQuartileIndex[0])} , et $ ${quartiles[arrQuartileIndex[1]]} $ est la valeur ${getFrenchStringForDuQuartile(arrQuartileIndex[1])}.
72
+
73
+ La proportion de valeurs comprises entre $ ${quartiles[arrQuartileIndex[0]]} $ et $ ${quartiles[arrQuartileIndex[1]]} $ est donc $${texPercentage}\\%$.`;
74
+ case "above":
75
+ return `D'après la boîte à moustaches, $ ${quartiles[arrQuartileIndex[0]]} $ est la valeur ${getFrenchStringForDuQuartile(arrQuartileIndex[0])}.
76
+
77
+
78
+ La proportion de valeurs supérieures ou égales à $ ${quartiles[arrQuartileIndex[0]]} $ est donc $${texPercentage}\\%$.`;
79
+ }
80
+ };
81
+ const getGGBOptions = (identifiers) => {
82
+ const { quartiles } = identifiers;
83
+ const [q0, q1, q2, q3, q4] = quartiles;
84
+ const yOffset = 2;
85
+ const yScale = 0.8;
86
+ const commands = [
87
+ `BM = BoxPlot(${yOffset}, ${yScale}, ${q0}, ${q1}, ${q2}, ${q3}, ${q4})`,
88
+ `ShowLabel(BM, false)`,
89
+ ];
90
+ const ggb = new GeogebraConstructor({
91
+ commands,
92
+ forbidShiftDragZoom: false,
93
+ lockedAxesRatio: false,
94
+ // gridDistance: [0.5, 1],
95
+ xAxis: {
96
+ hideNumbers: false,
97
+ steps: 1,
98
+ },
99
+ yAxis: {
100
+ hidden: true,
101
+ },
102
+ maxHeight: 100,
103
+ fontSize: 20,
104
+ });
105
+ return ggb.getOptions({
106
+ coords: ggb.getAdaptedCoords({
107
+ xMin: q0,
108
+ xMax: q4,
109
+ yMin: -2,
110
+ yMax: 5,
111
+ }),
112
+ });
113
+ };
114
+ const getKeys = () => {
115
+ return [];
116
+ };
117
+ const isAnswerValid = (ans, { answer }) => {
118
+ return numberVEA(ans, answer);
119
+ };
120
+ const getBoxPlotReadingPercentagesQuestion = () => {
121
+ const arrBounds = probaLawFlip([
122
+ [
123
+ [
124
+ { min: 0, max: 8 },
125
+ { min: 12, max: 20 },
126
+ ],
127
+ 0.6,
128
+ ],
129
+ [
130
+ [
131
+ { min: -8, max: 0 },
132
+ { min: 20, max: 28 },
133
+ ],
134
+ 0.2,
135
+ ],
136
+ [
137
+ [
138
+ { min: -20, max: -12 },
139
+ { min: 0, max: 8 },
140
+ ],
141
+ 0.2,
142
+ ],
143
+ ]);
144
+ const [q0, q1] = [0, 1]
145
+ .map((_) => randint(arrBounds[0].min, arrBounds[0].max))
146
+ .toSorted((i1, i2) => i1 - i2);
147
+ const [q3, q4] = [0, 1]
148
+ .map((_) => randint(arrBounds[1].min, arrBounds[1].max))
149
+ .toSorted((i1, i2) => i1 - i2);
150
+ const q2 = randint(q1, q3, [q1]); //we prevent q2 from being equal to q1 or q3
151
+ const quartiles = [q0, q1, q2, q3, q4];
152
+ const arrQuartileIndexAvailable = [
153
+ 0,
154
+ ...(q0 !== q1 ? [1] : []),
155
+ 2,
156
+ ...(q3 !== q4 ? [3] : []),
157
+ 4,
158
+ ];
159
+ const arrQuartileIndex = randomMany(arrQuartileIndexAvailable, 2).toSorted((i1, i2) => i1 - i2);
160
+ const typeQ = random([
161
+ ...(arrQuartileIndex[0] === 0 ? ["below"] : []),
162
+ "between",
163
+ ...(arrQuartileIndex[1] === 4 ? ["above"] : []),
164
+ ]);
165
+ const identifiers = { quartiles, arrQuartileIndex, typeQ };
166
+ return getQuestionFromIdentifiers(identifiers);
167
+ };
168
+ const getQuestionFromIdentifiers = (identifiers) => {
169
+ return {
170
+ answer: getAnswer(identifiers),
171
+ instruction: getInstruction(identifiers),
172
+ keys: getKeys(identifiers),
173
+ answerFormat: "tex",
174
+ identifiers,
175
+ hint: getHint(identifiers),
176
+ correction: getCorrection(identifiers),
177
+ ggbOptions: getGGBOptions(identifiers),
178
+ };
179
+ };
180
+ export const boxPlotReadingPercentages = {
181
+ id: "boxPlotReadingPercentages",
182
+ label: "Lire des proportions sur une boîte à moustaches",
183
+ isSingleStep: true,
184
+ generator: (nb, opts) => getDistinctQuestions(() => getBoxPlotReadingPercentagesQuestion(opts), nb),
185
+ qcmTimer: 60,
186
+ freeTimer: 60,
187
+ getPropositions,
188
+ isAnswerValid,
189
+ subject: "Mathématiques",
190
+ getHint,
191
+ getCorrection,
192
+ getInstruction,
193
+ getAnswer,
194
+ getGGBOptions,
195
+ hasGeogebra: true,
196
+ getQuestionFromIdentifiers,
197
+ hasHintAndCorrection: true,
198
+ };
@@ -0,0 +1,13 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ indexTopic: number;
4
+ isLess: boolean;
5
+ arrDistrib: Distrib[];
6
+ };
7
+ type Distrib = {
8
+ name: string;
9
+ indicators: number[];
10
+ };
11
+ export declare const compareBoxPlot: Exercise<Identifiers>;
12
+ export {};
13
+ //# sourceMappingURL=compareBoxPlot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compareBoxPlot.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,EAAE,CAAC;CACvB,CAAC;AAKF,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA8PF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAmBhD,CAAC"}
@@ -0,0 +1,192 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueDark, red } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
7
+ import { randomMany } from "../../../../utils/alea/random.js";
8
+ const distribNames = ["A", "B"];
9
+ const colors = [blueDark, red];
10
+ class Topic {
11
+ type;
12
+ questions1;
13
+ funcIndicator;
14
+ constructor(type, questions1, funcIndicator) {
15
+ this.type = type;
16
+ this.questions1 = questions1;
17
+ this.funcIndicator = funcIndicator;
18
+ }
19
+ getQuestion(isLess) {
20
+ return `Quelle série a ${this.getFrenchStringForTheMoreOrLessIndicator(isLess)} ?`;
21
+ }
22
+ getFrenchStringForTheMoreOrLessIndicator(isLess) {
23
+ return this.questions1[isLess ? 0 : 1];
24
+ }
25
+ compare(d1, d2) {
26
+ return this.funcIndicator(d1) - this.funcIndicator(d2);
27
+ }
28
+ isCompatibleWithArrDistrib(arrDistrib) {
29
+ const arrIndicator = arrDistrib.map((d) => this.funcIndicator(d));
30
+ return arrIndicator[1] !== arrIndicator[0];
31
+ }
32
+ }
33
+ const arrTopic = [
34
+ new Topic("l'étendue", ["la plus petite étendue", "la plus grande étendue"], (d) => d.indicators[4] - d.indicators[0]),
35
+ new Topic("l'écart interquartile", ["le plus petit écart interquartile", "le plus grand écart interquartile"], (d) => d.indicators[3] - d.indicators[1]),
36
+ new Topic("le minimum", ["le minimum le plus petit", "le minimum le plus grand"], (d) => d.indicators[0]),
37
+ new Topic("la médiane", ["la plus petite médiane", "la plus grande médiane"], (d) => d.indicators[2]),
38
+ new Topic("le maximum", ["le maximum le plus petit", "le maximum le plus grand"], (d) => d.indicators[4]),
39
+ ];
40
+ const createRandomDistrib = (name, min = 5, max = 20) => {
41
+ const indicators = randomMany([...Array(max - min + 1).keys()].map((i) => i + min), 5).toSorted((i1, i2) => i1 - i2);
42
+ const d = {
43
+ name,
44
+ indicators: indicators,
45
+ };
46
+ return d;
47
+ };
48
+ const getPropositions = (n, { answer, arrDistrib }) => {
49
+ const propositions = [];
50
+ addValidProp(propositions, answer);
51
+ arrDistrib.forEach((d) => {
52
+ tryToAddWrongProp(propositions, d.name);
53
+ });
54
+ return shuffleProps(propositions, n);
55
+ };
56
+ const getAnswer = (identifiers) => {
57
+ const { indexTopic, isLess: isLess, arrDistrib } = identifiers;
58
+ const topic = arrTopic[indexTopic];
59
+ const funcCompare = (d1, d2) => isLess ? topic.compare(d1, d2) : topic.compare(d2, d1);
60
+ const arrDistribSorted = arrDistrib.toSorted(funcCompare);
61
+ const distribAnswer = arrDistribSorted[0];
62
+ return distribAnswer.name;
63
+ };
64
+ const getInstruction = (identifiers) => {
65
+ const { indexTopic, isLess: isLess, arrDistrib } = identifiers;
66
+ return `Voici $${arrDistrib.length}$ boîtes à moustaches, chacune représentant une série statistique spécifique.
67
+
68
+ ${arrTopic[indexTopic].getQuestion(isLess)}`;
69
+ };
70
+ const getHint = () => {
71
+ return `Une boite à moustaches permet de lire les indicateurs statistiques d'une série :
72
+
73
+ ![](https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/mathliveV2/activities/quizzes/generator/boxplot.png)
74
+ `;
75
+ };
76
+ const getCorrection = (identifiers) => {
77
+ const { indexTopic, isLess: isLess, arrDistrib } = identifiers;
78
+ const topic = arrTopic[indexTopic];
79
+ return `${arrDistrib.map((d) => `Pour la série $${d.name}$, ${topic.type} vaut $${topic
80
+ .funcIndicator(d)
81
+ .frenchify()}$.`).join(`
82
+
83
+ `)}
84
+
85
+
86
+ C'est donc la série $${getAnswer(identifiers)}$ qui a ${topic.getFrenchStringForTheMoreOrLessIndicator(isLess)}.`;
87
+ };
88
+ const getGGBOptions = (identifiers) => {
89
+ const { arrDistrib } = identifiers;
90
+ const yPaddingPure = 3;
91
+ const yAltitude0Pure = 5;
92
+ const yScale = 4;
93
+ const yPadding = yPaddingPure + yScale;
94
+ const yAltitude0 = yAltitude0Pure + yScale / 2;
95
+ const xMin = Math.min(...arrDistrib.map((d) => d.indicators[0]));
96
+ const xMax = Math.max(...arrDistrib.map((d) => d.indicators[4]));
97
+ const yMin = -yAltitude0;
98
+ const yMax = yAltitude0 + arrDistrib.length * yPadding;
99
+ const xLabel = xMin - 2;
100
+ function createBoxPlotCommands(d, color, yOffset, yScale, xLabel) {
101
+ const [q0, q1, q2, q3, q4] = d.indicators;
102
+ const commands = [
103
+ `B_${d.name} = BoxPlot(${yOffset}, ${yScale}, ${q0}, ${q1}, ${q2}, ${q3}, ${q4})`,
104
+ `SetColor(B_${d.name}, "${color}")`,
105
+ `ShowLabel(B_${d.name}, false)`,
106
+ `T_${d.name} = Text("\\footnotesize ${d.name}", (${xLabel},${yOffset + 4}), true, true)`,
107
+ `SetColor(T_${d.name}, "${color}")`,
108
+ ];
109
+ return commands;
110
+ }
111
+ const commands = arrDistrib.flatMap((d, i) => createBoxPlotCommands(d, colors[i], yAltitude0 + (yPadding + yScale) * i, yScale, xLabel));
112
+ const ggb = new GeogebraConstructor({
113
+ commands,
114
+ forbidShiftDragZoom: false,
115
+ lockedAxesRatio: false,
116
+ hideGrid: true,
117
+ xAxis: {
118
+ hideNumbers: false,
119
+ steps: 1,
120
+ },
121
+ yAxis: {
122
+ hidden: true,
123
+ },
124
+ maxHeight: 100,
125
+ fontSize: 20,
126
+ });
127
+ return ggb.getOptions({
128
+ coords: [xMin - 5, xMax + 5, yMin - 5, yMax + 5],
129
+ });
130
+ };
131
+ const getBoxPlotReadingQuestion = () => {
132
+ const nbDistri = 2;
133
+ const nbInAnswer = 1;
134
+ const genParams = {
135
+ min: 0,
136
+ max: 20,
137
+ nbUniqueValues: 7,
138
+ minCount: 1,
139
+ maxCount: 5,
140
+ };
141
+ const isLess = coinFlip();
142
+ let indexTopic;
143
+ let isQuestionOk = false;
144
+ let counter = 0;
145
+ let arrDistrib;
146
+ do {
147
+ counter++;
148
+ if (counter > 1000)
149
+ throw new Error("Too many iterations in compareBoxPlot");
150
+ arrDistrib = [...Array(nbDistri).keys()].map((i) => {
151
+ const name = distribNames[i];
152
+ const d = createRandomDistrib(name, genParams.min, genParams.max);
153
+ return d;
154
+ });
155
+ indexTopic = randint(0, arrTopic.length);
156
+ const topic = arrTopic[indexTopic];
157
+ isQuestionOk = topic.isCompatibleWithArrDistrib(arrDistrib);
158
+ } while (!isQuestionOk);
159
+ const identifiers = { nbInAnswer, indexTopic, isLess, arrDistrib };
160
+ return getQuestionFromIdentifiers(identifiers);
161
+ };
162
+ const getQuestionFromIdentifiers = (identifiers) => {
163
+ return {
164
+ answer: getAnswer(identifiers),
165
+ instruction: getInstruction(identifiers),
166
+ keys: [],
167
+ answerFormat: "tex",
168
+ identifiers,
169
+ hint: getHint(identifiers),
170
+ correction: getCorrection(identifiers),
171
+ ggbOptions: getGGBOptions(identifiers),
172
+ };
173
+ };
174
+ export const compareBoxPlot = {
175
+ id: "compareBoxPlot",
176
+ label: "Comparer des séries à l'aide de boîtes à moustaches",
177
+ isSingleStep: true,
178
+ generator: (nb) => getDistinctQuestions(() => getBoxPlotReadingQuestion(), nb),
179
+ qcmTimer: 60,
180
+ freeTimer: 60,
181
+ getPropositions,
182
+ subject: "Mathématiques",
183
+ getHint,
184
+ getCorrection,
185
+ getInstruction,
186
+ getAnswer,
187
+ getGGBOptions,
188
+ hasGeogebra: true,
189
+ getQuestionFromIdentifiers,
190
+ hasHintAndCorrection: true,
191
+ answerType: "QCU",
192
+ };
@@ -0,0 +1,5 @@
1
+ export * from "./boxPlotInterpreting.js";
2
+ export * from "./boxPlotReading.js";
3
+ export * from "./boxPlotReadingPercentages.js";
4
+ export * from "./compareBoxPlot.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/boxPlot/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./boxPlotInterpreting.js";
2
+ export * from "./boxPlotReading.js";
3
+ export * from "./boxPlotReadingPercentages.js";
4
+ export * from "./compareBoxPlot.js";
@@ -1,15 +1,12 @@
1
- export * from "./tableReading.js";
2
- export * from "./barChartReading.js";
1
+ export * from "./tables/index.js";
2
+ export * from "./barChart/index.js";
3
3
  export * from "./functionGraphReading.js";
4
4
  export * from "./pieChartReading.js";
5
- export * from "./boxPlotReadingPercentages.js";
6
- export * from "./boxPlotReading.js";
7
- export * from "./compareBoxPlot.js";
8
- export * from "./barChartInterpreting.js";
5
+ export * from "./barChart/barChartInterpreting.js";
9
6
  export * from "./dataToGraphGraphToData.js";
10
7
  export * from "./cartesianGraphExtremaReading.js";
11
8
  export * from "./scatterPlotCommenting.js";
12
- export * from "./boxPlotInterpreting.js";
9
+ export * from "./boxPlot/index.js";
13
10
  export * from "./graphReading.js";
14
11
  export * from "./plausibleGraph.js";
15
12
  export * from "./halfPieChartReading.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC"}
@@ -1,22 +1,15 @@
1
- export * from "./tableReading.js";
2
- export * from "./barChartReading.js";
1
+ export * from "./tables/index.js";
2
+ export * from "./barChart/index.js";
3
3
  export * from "./functionGraphReading.js";
4
4
  export * from "./pieChartReading.js";
5
- export * from "./boxPlotReadingPercentages.js";
6
- export * from "./boxPlotReading.js";
7
- export * from "./compareBoxPlot.js";
8
- export * from "./barChartInterpreting.js";
5
+ export * from "./barChart/barChartInterpreting.js";
9
6
  export * from "./dataToGraphGraphToData.js";
10
7
  export * from "./cartesianGraphExtremaReading.js";
11
8
  export * from "./scatterPlotCommenting.js";
12
- export * from "./boxPlotInterpreting.js";
9
+ export * from "./boxPlot/index.js";
13
10
  export * from "./graphReading.js";
14
11
  export * from "./plausibleGraph.js";
15
12
  export * from "./halfPieChartReading.js";
16
13
  export * from "./halfPieChartCommenting.js";
17
14
  export * from "./histogram/index.js";
18
15
  // export * from "./placePointsFromDataTable.js";
19
- // export * from "./testGen.js";
20
- // export * from "./testGenGGB.js";
21
- // export * from "./testGenStudentGGB.js";
22
- // export * from "./testGGB.js";
@@ -0,0 +1,6 @@
1
+ export * from "./scatterPlotCommenting.js";
2
+ export * from "./scatterPlotFillDataTableFromScatterPlotData.js";
3
+ export * from "./scatterPlotFillDataTableWithDataClassesFromScatterPlotData.js";
4
+ export * from "./scatterPlotInterpreting.js";
5
+ export * from "./scatterPlotBuildScatterPlotFromDataTable.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/scatterPlot/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kDAAkD,CAAC;AACjE,cAAc,iEAAiE,CAAC;AAChF,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+CAA+C,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./scatterPlotCommenting.js";
2
+ export * from "./scatterPlotFillDataTableFromScatterPlotData.js";
3
+ export * from "./scatterPlotFillDataTableWithDataClassesFromScatterPlotData.js";
4
+ export * from "./scatterPlotInterpreting.js";
5
+ export * from "./scatterPlotBuildScatterPlotFromDataTable.js";
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ isRowBased: boolean;
5
+ rowBasedDataTable: string[][];
6
+ indexX: number;
7
+ indexY: number;
8
+ arrCoordsAsNodeIds: NodeIdentifiers[][];
9
+ };
10
+ export declare const scatterPlotBuildScatterPlotFromDataTable: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=scatterPlotBuildScatterPlotFromDataTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scatterPlotBuildScatterPlotFromDataTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,eAAe,EAAE,EAAE,CAAC;CACzC,CAAC;AA0QF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAoB1E,CAAC"}