math-exercises 3.0.189 → 3.0.191

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 (138) hide show
  1. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.js +5 -4
  3. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +9 -8
  5. package/lib/exercises/math/calculLitteral/equation/isEqualityTrue.d.ts.map +1 -1
  6. package/lib/exercises/math/calculLitteral/equation/isEqualityTrue.js +7 -6
  7. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
  8. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +5 -4
  9. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts +6 -0
  10. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts.map +1 -0
  11. package/lib/exercises/math/dataRepresentations/scatterPlot/index.js +5 -0
  12. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts +12 -0
  13. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts.map +1 -0
  14. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.js +206 -0
  15. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts +9 -0
  16. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts.map +1 -0
  17. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.js +210 -0
  18. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts +10 -0
  19. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts.map +1 -0
  20. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.js +252 -0
  21. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts +12 -0
  22. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts.map +1 -0
  23. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.js +352 -0
  24. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts +11 -0
  25. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts.map +1 -0
  26. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.js +403 -0
  27. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.d.ts.map +1 -1
  28. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.js +3 -2
  29. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts.map +1 -1
  30. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.js +3 -2
  31. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -1
  32. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +3 -2
  33. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
  34. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +3 -2
  35. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
  36. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +3 -2
  37. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
  38. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +4 -3
  39. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
  40. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +4 -3
  41. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
  42. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +4 -3
  43. package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts.map +1 -1
  44. package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.js +3 -2
  45. package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts.map +1 -1
  46. package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.js +3 -2
  47. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -1
  48. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +8 -4
  49. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts +13 -0
  50. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts.map +1 -0
  51. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.js +205 -0
  52. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts +9 -0
  53. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts.map +1 -0
  54. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.js +157 -0
  55. package/lib/exercises/math/functions/affines/affineVariations.d.ts +12 -0
  56. package/lib/exercises/math/functions/affines/affineVariations.d.ts.map +1 -0
  57. package/lib/exercises/math/functions/affines/affineVariations.js +176 -0
  58. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts +8 -0
  59. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts.map +1 -0
  60. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.js +203 -0
  61. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts +12 -0
  62. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts.map +1 -0
  63. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.js +259 -0
  64. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -1
  65. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +8 -6
  66. package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.d.ts +2 -0
  67. package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.d.ts.map +1 -0
  68. package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.js +155 -0
  69. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts +9 -0
  70. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts.map +1 -0
  71. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.js +99 -0
  72. package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.d.ts +8 -0
  73. package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.d.ts.map +1 -0
  74. package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.js +99 -0
  75. package/lib/exercises/math/functions/exponentials/index.d.ts +8 -0
  76. package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
  77. package/lib/exercises/math/functions/exponentials/index.js +9 -0
  78. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.d.ts +12 -0
  79. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.d.ts.map +1 -0
  80. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.js +138 -0
  81. package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.d.ts +8 -0
  82. package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.d.ts.map +1 -0
  83. package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.js +142 -0
  84. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts +10 -0
  85. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts.map +1 -0
  86. package/lib/exercises/math/functions/exponentials/realPowersFraction.js +125 -0
  87. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts +12 -0
  88. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts.map +1 -0
  89. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.js +148 -0
  90. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts +10 -0
  91. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts.map +1 -0
  92. package/lib/exercises/math/functions/exponentials/realPowersPower.js +128 -0
  93. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts +10 -0
  94. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts.map +1 -0
  95. package/lib/exercises/math/functions/exponentials/realPowersProduct.js +128 -0
  96. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -1
  97. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +7 -6
  98. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts.map +1 -1
  99. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.js +3 -2
  100. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts.map +1 -1
  101. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.js +7 -6
  102. package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
  103. package/lib/exercises/math/percent/percentToDecimal.js +5 -4
  104. package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
  105. package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +5 -4
  106. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  107. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -8
  108. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
  109. package/lib/exercises/math/probaStat/stats1var/medianWithList.js +5 -4
  110. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
  111. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +9 -9
  112. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts +12 -0
  113. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map +1 -0
  114. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.js +217 -0
  115. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts +10 -0
  116. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts.map +1 -0
  117. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.js +186 -0
  118. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts +14 -0
  119. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts.map +1 -0
  120. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.js +189 -0
  121. package/lib/exercises/math/sequences/geometric/graph/index.d.ts +2 -0
  122. package/lib/exercises/math/sequences/geometric/graph/index.d.ts.map +1 -0
  123. package/lib/exercises/math/sequences/geometric/graph/index.js +1 -0
  124. package/lib/exercises/utils/options/arrayedOptions.d.ts +2 -0
  125. package/lib/exercises/utils/options/arrayedOptions.d.ts.map +1 -0
  126. package/lib/exercises/utils/options/arrayedOptions.js +16 -0
  127. package/lib/index.d.ts +33 -0
  128. package/lib/index.d.ts.map +1 -1
  129. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  130. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +20 -20
  131. package/lib/tree/nodes/algebraicNode.d.ts +3 -0
  132. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  133. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  134. package/lib/tree/nodes/operators/fractionNode.js +5 -3
  135. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  136. package/lib/tree/nodes/operators/multiplyNode.js +5 -3
  137. package/lib/tree/nodes/operators/powerNode.js +1 -1
  138. package/package.json +1 -1
@@ -0,0 +1,352 @@
1
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
2
+ import { greenDark, greenLight, orange } from "../../../../geogebra/colors.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
5
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
6
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
7
+ import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
8
+ import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
9
+ import { numberParser } from "../../../../tree/parsers/numberParser.js";
10
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
11
+ import { probaFlip } from "../../../../utils/alea/probaFlip.js";
12
+ import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
13
+ import { random } from "../../../../utils/alea/random.js";
14
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
15
+ import { zip } from "../../../../utils/arrays/arrayZip.js";
16
+ import { getCartesiansProducts } from "../../../../utils/arrays/cartesianProducts.js";
17
+ import { transpose } from "../../../../utils/arrays/transpose.js";
18
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
19
+ const getComponentOfPointForStrGroupBy = (point, strGroupBy) => {
20
+ switch (strGroupBy) {
21
+ case "x":
22
+ return point.x;
23
+ case "y":
24
+ return point.y;
25
+ default:
26
+ throw new Error("Unsupported strGroupBy: " + strGroupBy);
27
+ }
28
+ };
29
+ const getInstruction = () => {
30
+ return `Remplir le tableau avec les données issues du nuage de points ci-dessous
31
+ (les classes sont déjà inscrites dans le tableau).`;
32
+ };
33
+ const getInitTable = (identifiers) => {
34
+ const { strGroupBy, isTransposed, nodeIdsDataClasses } = identifiers;
35
+ const arrDataClass = nodeIdsDataClasses.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
36
+ const tableRaw = [
37
+ [`$${strGroupBy}$`, ...arrDataClass.map(() => `\\ `)],
38
+ [
39
+ "\\text{classe}",
40
+ ...arrDataClass.map((intervalNode) => intervalNode.toTex()),
41
+ ],
42
+ ["\\text{effectif}", ...arrDataClass.map(() => "")],
43
+ ];
44
+ return isTransposed ? transpose(tableRaw) : tableRaw;
45
+ };
46
+ const getAnswerTable = (identifiers) => {
47
+ const { pointIds, strGroupBy, isTransposed, nodeIdsDataClasses } = identifiers;
48
+ const arrPoint = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
49
+ const arrDataClass = nodeIdsDataClasses.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
50
+ const arrCount = arrDataClass.map((intervalNode) => {
51
+ return arrPoint.filter((point) => {
52
+ const nodeComponent = getComponentOfPointForStrGroupBy(point, strGroupBy);
53
+ return intervalNode.includes(nodeComponent);
54
+ }).length;
55
+ });
56
+ const tableRaw = [
57
+ [`$${strGroupBy}$`, ...arrDataClass.map(() => `\\ `)],
58
+ [
59
+ "\\text{classe}",
60
+ ...arrDataClass.map((intervalNode) => intervalNode.toTex()),
61
+ ],
62
+ ["\\text{effectif}", ...arrCount.map((v) => v.frenchify())],
63
+ ];
64
+ return isTransposed ? transpose(tableRaw) : tableRaw;
65
+ };
66
+ const getHint = (identifiers) => {
67
+ const { strGroupBy } = identifiers;
68
+ return `Pour chaque classe de $${strGroupBy}$, on compte le nombre de points qui ont $${strGroupBy}$ qui appartient à la classe.`;
69
+ };
70
+ const getCorrection = (identifiers) => {
71
+ const { pointIds, strGroupBy, nodeIdsDataClasses } = identifiers;
72
+ const arrPoint = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
73
+ const arrDataClass = nodeIdsDataClasses.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
74
+ const arrCount = arrDataClass.map((intervalNode) => {
75
+ return arrPoint.filter((point) => {
76
+ const nodeComponent = getComponentOfPointForStrGroupBy(point, strGroupBy);
77
+ return intervalNode.includes(nodeComponent);
78
+ }).length;
79
+ });
80
+ return `Pour chaque classe de $${strGroupBy}$, on compte le nombre de points qui ont $${strGroupBy}$ qui appartient à la classe.
81
+
82
+ ${zip(arrDataClass, arrCount).map(([intervalNode, count]) => `Il y a $${count}$ point${count === 1 ? "" : "s"} qui ${count === 1 ? "a" : "ont"} $${strGroupBy}$ dans $${intervalNode.toTex()}$.`).join(`
83
+
84
+ `)}`;
85
+ };
86
+ const getCorrectionGGBOptions = (identifiers) => {
87
+ const { pointIds, strGroupBy, nodeIdsDataClasses } = identifiers;
88
+ const arrPoint = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
89
+ const arrDataClass = nodeIdsDataClasses.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
90
+ const arrArrPoint = arrDataClass.map((intervalNode) => {
91
+ return arrPoint.filter((point) => {
92
+ const nodeComponent = getComponentOfPointForStrGroupBy(point, strGroupBy);
93
+ return intervalNode.includes(nodeComponent);
94
+ });
95
+ });
96
+ const commands = [
97
+ ...arrArrPoint.flatMap((arrPoint, i) => arrPoint.flatMap((point) => point.toGGBCommand({
98
+ isFixed: true,
99
+ isSelectionnable: true,
100
+ showLabel: false,
101
+ size: 6,
102
+ style: 3,
103
+ color: i % 2 === 0 ? greenDark : greenLight,
104
+ }))),
105
+ ...(() => {
106
+ switch (strGroupBy) {
107
+ case "x":
108
+ return arrDataClass.flatMap((nodeInterval, i) => {
109
+ return [
110
+ ...(() => {
111
+ if (nodeInterval.closure === ClosureType.FF ||
112
+ nodeInterval.closure === ClosureType.FO) {
113
+ const value = nodeInterval.a.evaluate();
114
+ return [
115
+ `l${i}l = Line((${value}, 0),(${value}, 1))`,
116
+ `SetColor(l${i}l, "${orange}")`,
117
+ ];
118
+ }
119
+ else {
120
+ return [];
121
+ }
122
+ })(),
123
+ ...(() => {
124
+ if (nodeInterval.closure === ClosureType.FF ||
125
+ nodeInterval.closure === ClosureType.OF) {
126
+ const value = nodeInterval.b.evaluate();
127
+ return [
128
+ `l${i}h = Line((${value}, 0),(${value}, 1))`,
129
+ `SetColor(l${i}h, "${orange}")`,
130
+ ];
131
+ }
132
+ else {
133
+ return [];
134
+ }
135
+ })(),
136
+ ];
137
+ });
138
+ case "y":
139
+ return arrDataClass.flatMap((nodeInterval, i) => {
140
+ return [
141
+ ...(() => {
142
+ if (nodeInterval.closure === ClosureType.FF ||
143
+ nodeInterval.closure === ClosureType.FO) {
144
+ const value = nodeInterval.a.evaluate();
145
+ return [
146
+ `l${i}l = Line((0, ${value}),(1,${value}))`,
147
+ `SetColor(l${i}l, "${orange}")`,
148
+ ];
149
+ }
150
+ else {
151
+ return [];
152
+ }
153
+ })(),
154
+ ...(() => {
155
+ if (nodeInterval.closure === ClosureType.FF ||
156
+ nodeInterval.closure === ClosureType.OF) {
157
+ const value = nodeInterval.b.evaluate();
158
+ return [
159
+ `l${i}h = Line((0, ${value}),(1,${value}))`,
160
+ `SetColor(l${i}h, "${orange}")`,
161
+ ];
162
+ }
163
+ else {
164
+ return [];
165
+ }
166
+ })(),
167
+ ];
168
+ });
169
+ default:
170
+ throw new Error("Unsupported strGroupBy: " + strGroupBy);
171
+ }
172
+ })(),
173
+ ];
174
+ const ggb = new GeogebraConstructor({
175
+ commands,
176
+ hideGrid: true,
177
+ fontSize: 16,
178
+ xAxis: {
179
+ showPositive: true,
180
+ label: "x",
181
+ steps: 1,
182
+ },
183
+ yAxis: {
184
+ showPositive: true,
185
+ label: "y",
186
+ steps: 1,
187
+ },
188
+ });
189
+ return ggb.getOptions({
190
+ coords: ggb.getAdaptedCoords({
191
+ xMin: -1,
192
+ xMax: 6,
193
+ yMin: -1,
194
+ yMax: 6,
195
+ }),
196
+ });
197
+ };
198
+ const getGGBOptions = (identifiers) => {
199
+ const { pointIds } = identifiers;
200
+ const arrPoint = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
201
+ const commands = [
202
+ ...arrPoint.flatMap((point) => point.toGGBCommand({
203
+ isFixed: true,
204
+ isSelectionnable: true,
205
+ showLabel: false,
206
+ size: 5,
207
+ style: 3,
208
+ })),
209
+ ];
210
+ const ggb = new GeogebraConstructor({
211
+ commands,
212
+ hideGrid: false,
213
+ fontSize: 16,
214
+ xAxis: {
215
+ showPositive: true,
216
+ label: "x",
217
+ steps: 1,
218
+ },
219
+ yAxis: {
220
+ showPositive: true,
221
+ label: "y",
222
+ steps: 1,
223
+ },
224
+ });
225
+ return ggb.getOptions({
226
+ coords: ggb.getAdaptedCoords({
227
+ xMin: -1,
228
+ xMax: 6,
229
+ yMin: -1,
230
+ yMax: 6,
231
+ }),
232
+ });
233
+ };
234
+ const getKeys = () => {
235
+ return [];
236
+ };
237
+ const isAnswerTableValid = (ans, { answerTable }) => {
238
+ try {
239
+ return answerTable[2].every((answer, i) => {
240
+ const ansParsed = numberParser(ans[2][i]);
241
+ const answerParsed = numberParser(answer);
242
+ return ansParsed === answerParsed;
243
+ });
244
+ }
245
+ catch (err) {
246
+ return handleVEAError(err);
247
+ }
248
+ };
249
+ const getScatterPlotFillDataTableWithDataClassesFromScatterPlotDataQuestion = () => {
250
+ const length = 6;
251
+ const height = 6;
252
+ const arrArrDict1 = getCartesiansProducts([
253
+ [...Array(length).keys()].map((i) => i + 1),
254
+ [...Array(height).keys()].map((i) => i + 1),
255
+ ]).map(([x, y]) => {
256
+ return {
257
+ x,
258
+ y,
259
+ isActivated: probaFlip(0.14),
260
+ };
261
+ });
262
+ const arrArrDict2 = getCartesiansProducts([
263
+ [...Array(length - 1).keys()].map((i) => i + 1),
264
+ [...Array(height - 1).keys()].map((i) => i + 1),
265
+ ]).map(([x, y]) => {
266
+ return {
267
+ x: x + 0.333,
268
+ y: y + 0.333,
269
+ isActivated: probaFlip(0.14),
270
+ };
271
+ });
272
+ const arrArrDict3 = getCartesiansProducts([
273
+ [...Array(length - 1).keys()].map((i) => i + 1),
274
+ [...Array(height - 1).keys()].map((i) => i + 1),
275
+ ]).map(([x, y]) => {
276
+ return {
277
+ x: x + 0.666,
278
+ y: y + 0.666,
279
+ isActivated: probaFlip(0.14),
280
+ };
281
+ });
282
+ //at least one point should be activated
283
+ {
284
+ const dictRandom = random(arrArrDict1);
285
+ dictRandom.isActivated = true;
286
+ }
287
+ const arrPoint = [...arrArrDict1, ...arrArrDict2, ...arrArrDict3]
288
+ .filter(({ isActivated }) => isActivated)
289
+ .map(({ x, y }, i) => new Point(`P${i}`, x, y));
290
+ const strGroupBy = coinFlip() ? "x" : "y";
291
+ const isTransposed = coinFlip();
292
+ const templateArrLengthDataClass = probaLawFlip([
293
+ [[1, 1, 1, 2], 0.2],
294
+ [[1, 2, 2], 0.4],
295
+ [[1, 1, 3], 0.3],
296
+ [[2, 3], 0.1],
297
+ ]);
298
+ const arrLengthDataClass = shuffle(templateArrLengthDataClass);
299
+ const arrDataClass = arrLengthDataClass.reduce((acc, lengthDataClass, i, arr) => {
300
+ const nodeBoundLow = acc.nodeBoundLowWork;
301
+ const nodeBoundHigh = add(nodeBoundLow, lengthDataClass).simplify({
302
+ towardsDistribute: true,
303
+ });
304
+ const nodeDataClass = new IntervalNode(nodeBoundLow, nodeBoundHigh, i === arr.length - 1 ? ClosureType.FF : ClosureType.FO);
305
+ acc.dataClasses.push(nodeDataClass);
306
+ acc.nodeBoundLowWork = nodeBoundHigh;
307
+ return acc;
308
+ }, {
309
+ nodeBoundLowWork: (1).toTree(),
310
+ dataClasses: [],
311
+ }).dataClasses;
312
+ const identifiers = {
313
+ pointIds: arrPoint.map((point) => point.toIdentifiers()),
314
+ strGroupBy,
315
+ isTransposed,
316
+ nodeIdsDataClasses: arrDataClass.map((node) => node.toIdentifiers()),
317
+ };
318
+ return getQuestionFromIdentifiers(identifiers);
319
+ };
320
+ const getQuestionFromIdentifiers = (identifiers) => {
321
+ return {
322
+ instruction: getInstruction(identifiers),
323
+ initTable: getInitTable(identifiers),
324
+ answerTable: getAnswerTable(identifiers),
325
+ answerFormat: "tex",
326
+ keys: getKeys(identifiers),
327
+ identifiers,
328
+ hint: getHint(identifiers),
329
+ correction: getCorrection(identifiers),
330
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers),
331
+ ggbOptions: getGGBOptions(identifiers),
332
+ };
333
+ };
334
+ export const scatterPlotFillDataTableWithDataClassesFromScatterPlotData = {
335
+ id: "scatterPlotFillDataTableWithDataClassesFromScatterPlotData",
336
+ label: "Remplir un tableau avec les données issues d'un nuage de points (avec des classes)",
337
+ isSingleStep: true,
338
+ generator: (nb, opts) => getDistinctQuestions(() => getScatterPlotFillDataTableWithDataClassesFromScatterPlotDataQuestion(opts), nb),
339
+ qcmTimer: 60,
340
+ freeTimer: 60,
341
+ subject: "Mathématiques",
342
+ isAnswerTableValid,
343
+ getAnswerTable,
344
+ getInstruction,
345
+ getGGBOptions,
346
+ hasGeogebra: true,
347
+ getQuestionFromIdentifiers,
348
+ getHint,
349
+ getCorrection,
350
+ hasHintAndCorrection: true,
351
+ answerType: "valueTable",
352
+ };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../math/geometry/point.js";
3
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
4
+ type Identifiers = {
5
+ pointIds: PointIdentifiers[];
6
+ strGroupBy: string;
7
+ nodeIdsDataClass: NodeIdentifiers;
8
+ };
9
+ export declare const scatterPlotInterpreting: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=scatterPlotInterpreting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scatterPlotInterpreting.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAwC7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,eAAe,CAAC;CACnC,CAAC;AA2aF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAmBzD,CAAC"}