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.
- package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.d.ts +53 -0
- package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.js +543 -0
- package/lib/exercises/math/dataRepresentations/barChart/barChartReading.d.ts +94 -0
- package/lib/exercises/math/dataRepresentations/barChart/barChartReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/barChart/barChartReading.js +280 -0
- package/lib/exercises/math/dataRepresentations/barChart/index.d.ts +3 -0
- package/lib/exercises/math/dataRepresentations/barChart/index.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/barChart/index.js +2 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.d.ts +7 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.js +223 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.js +133 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.d.ts +11 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.js +198 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.d.ts +13 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.js +192 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/index.d.ts +5 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/index.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/boxPlot/index.js +4 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts +4 -7
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +4 -11
- package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts +6 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/index.js +5 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts +12 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.js +206 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.js +210 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts +10 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.js +252 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts +12 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.js +352 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts +11 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.js +403 -0
- package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts +7 -0
- package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.js +222 -0
- package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts +7 -0
- package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.js +187 -0
- package/lib/exercises/math/dataRepresentations/tables/index.d.ts +4 -0
- package/lib/exercises/math/dataRepresentations/tables/index.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/tables/index.js +3 -0
- package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/tables/tableReading.js +109 -0
- package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts +8 -0
- package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts.map +1 -0
- package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.js +145 -0
- package/lib/exercises/math/derivation/applications/index.d.ts +1 -0
- package/lib/exercises/math/derivation/applications/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/applications/index.js +1 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +4 -1
- package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts +13 -0
- package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.js +205 -0
- package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts +9 -0
- package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.js +157 -0
- package/lib/exercises/math/functions/affines/affineVariations.d.ts +12 -0
- package/lib/exercises/math/functions/affines/affineVariations.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineVariations.js +176 -0
- package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts +8 -0
- package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineVariationsFromGraph.js +203 -0
- package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts +12 -0
- package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.js +259 -0
- package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts +9 -0
- package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.js +99 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts +5 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponentials/index.js +5 -0
- package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts +10 -0
- package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/realPowersFraction.js +125 -0
- package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts +12 -0
- package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/realPowersMixOperations.js +148 -0
- package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts +10 -0
- package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/realPowersPower.js +128 -0
- package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts +10 -0
- package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/realPowersProduct.js +128 -0
- package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +7 -2
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +131 -61
- package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts +12 -0
- package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.js +217 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts +10 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.js +186 -0
- package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.js +189 -0
- package/lib/exercises/math/sequences/geometric/graph/index.d.ts +2 -0
- package/lib/exercises/math/sequences/geometric/graph/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/graph/index.js +1 -0
- package/lib/index.d.ts +53 -25
- package/lib/index.d.ts.map +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +3 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +5 -3
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +5 -3
- package/lib/tree/nodes/operators/powerNode.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { randomDataTable } from "../../../../exercises/utils/data/randomDataTable.js";
|
|
2
|
+
import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
|
|
3
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
4
|
+
import { greenMain } from "../../../../geogebra/colors.js";
|
|
5
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
6
|
+
import { GeogebraParser } from "../../../../geogebra/parsers/geogebraParser.js";
|
|
7
|
+
import { Point } from "../../../../math/geometry/point.js";
|
|
8
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
9
|
+
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
10
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
12
|
+
import { randomMany } from "../../../../utils/alea/random.js";
|
|
13
|
+
import { transpose } from "../../../../utils/arrays/transpose.js";
|
|
14
|
+
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
15
|
+
import { joinanded } from "../../../../utils/strings/joinanded.js";
|
|
16
|
+
const getStrGraphName = (identifiers) => {
|
|
17
|
+
const { rowBasedDataTable, indexX, indexY } = identifiers;
|
|
18
|
+
const [nameTexX, nameTexY] = [indexX, indexY].map((i) => rowBasedDataTable[i][0]);
|
|
19
|
+
const graphName = `${nameTexY} en fonction de ${nameTexX}`;
|
|
20
|
+
return graphName;
|
|
21
|
+
};
|
|
22
|
+
const getDataTable = (identifiers) => {
|
|
23
|
+
const { isRowBased, rowBasedDataTable } = identifiers;
|
|
24
|
+
return isRowBased ? rowBasedDataTable : transpose(rowBasedDataTable);
|
|
25
|
+
};
|
|
26
|
+
const getInstruction = (identifiers) => {
|
|
27
|
+
return `À partir du tableau de données ci-dessous, construire le nuage de points "${getStrGraphName(identifiers)}".
|
|
28
|
+
|
|
29
|
+
${mdTable(getDataTable(identifiers))}
|
|
30
|
+
|
|
31
|
+
`;
|
|
32
|
+
};
|
|
33
|
+
const getHint = () => {
|
|
34
|
+
return `Quand on construit un nuage de points "$u$ en fonction de $v$", $u$ se lira sur l'axe des ordonnées et $v$ sur l'axe des abscisses.`;
|
|
35
|
+
};
|
|
36
|
+
const getCorrection = (identifiers) => {
|
|
37
|
+
const { rowBasedDataTable, indexX, indexY } = identifiers;
|
|
38
|
+
const [nameTexX, nameTexY] = [indexX, indexY].map((i) => rowBasedDataTable[i][0]);
|
|
39
|
+
const solutionPoints = getSolutionPoints(identifiers);
|
|
40
|
+
return `On place chaque point de coordonnées (${nameTexX};${nameTexY}).
|
|
41
|
+
|
|
42
|
+
On place donc les points de coordonnées ${joinanded(solutionPoints.map((p) => `$(${p.x.toTex()};${p.y.toTex()})$`), ", ", " et ")}.`;
|
|
43
|
+
};
|
|
44
|
+
const getSolutionPoints = (identifiers) => {
|
|
45
|
+
const { arrCoordsAsNodeIds } = identifiers;
|
|
46
|
+
const arrCoordsAsNodes = arrCoordsAsNodeIds.map(([nodeIdsX, nodeIdsY]) => [nodeIdsX, nodeIdsY].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
|
|
47
|
+
return arrCoordsAsNodes.map(([nodeX, nodeY], i) => {
|
|
48
|
+
return new Point(`S_${i}`, nodeX, nodeY);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const getGGBAnswer = (identifiers) => {
|
|
52
|
+
const solutionPoints = getSolutionPoints(identifiers);
|
|
53
|
+
return [
|
|
54
|
+
...solutionPoints.flatMap((point) => point.toGGBCommand({ color: `${greenMain}`, showLabel: false })),
|
|
55
|
+
];
|
|
56
|
+
};
|
|
57
|
+
const getStudentGGBOptions = (identifiers) => {
|
|
58
|
+
const { indexX, indexY, rowBasedDataTable } = identifiers;
|
|
59
|
+
const [nameTexX, nameTexY] = [indexX, indexY].map((i) => rowBasedDataTable[i][0]);
|
|
60
|
+
const ggb = new GeogebraConstructor({
|
|
61
|
+
commands: [],
|
|
62
|
+
customToolBar: toolBarConstructor({
|
|
63
|
+
point: true,
|
|
64
|
+
}),
|
|
65
|
+
forbidShiftDragZoom: true,
|
|
66
|
+
xAxis: {
|
|
67
|
+
label: nameTexX,
|
|
68
|
+
steps: 1,
|
|
69
|
+
},
|
|
70
|
+
yAxis: {
|
|
71
|
+
label: nameTexY,
|
|
72
|
+
steps: 1,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
return ggb.getOptions({
|
|
76
|
+
coords: [-1, 7, -1, 7],
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const isGGBAnswerValid = (ans, { ggbAnswer, ...identifiers }) => {
|
|
80
|
+
const commands = ans;
|
|
81
|
+
const ggbParser = new GeogebraParser(commands);
|
|
82
|
+
const objectDict = ggbParser.objectDict();
|
|
83
|
+
const pointsCoords = Object.keys(objectDict).map((name) => ggbParser.pointCoords(name));
|
|
84
|
+
const pointsCoordsSortedByAscXSortedByAscY = pointsCoords
|
|
85
|
+
.toSorted(([x1], [x2]) => {
|
|
86
|
+
return x1 - x2;
|
|
87
|
+
})
|
|
88
|
+
.toSorted(([_x1, y1], [_x2, y2]) => {
|
|
89
|
+
return y1 - y2;
|
|
90
|
+
});
|
|
91
|
+
const solutionPointsSortedByAscXSortedByAscY = getSolutionPoints(identifiers)
|
|
92
|
+
.toSorted((p1, p2) => {
|
|
93
|
+
return p1.x.evaluate() - p2.x.evaluate();
|
|
94
|
+
})
|
|
95
|
+
.toSorted((p1, p2) => {
|
|
96
|
+
return p1.y.evaluate() - p2.y.evaluate();
|
|
97
|
+
});
|
|
98
|
+
return (pointsCoordsSortedByAscXSortedByAscY.length ===
|
|
99
|
+
solutionPointsSortedByAscXSortedByAscY.length &&
|
|
100
|
+
pointsCoordsSortedByAscXSortedByAscY.every(([x, y], i) => {
|
|
101
|
+
const studentPoint = new Point("StudentPoint", x, y);
|
|
102
|
+
const solutionPoint = solutionPointsSortedByAscXSortedByAscY[i];
|
|
103
|
+
const distance = studentPoint.distanceTo(solutionPoint);
|
|
104
|
+
return distance < 1;
|
|
105
|
+
}));
|
|
106
|
+
};
|
|
107
|
+
const getScatterPlotBuildScatterPlotFromDataTableQuestion = () => {
|
|
108
|
+
function createArrCoordsAsNodes(rowBasedDataTable, indexX, indexY) {
|
|
109
|
+
const [nodesX, nodesY] = [indexX, indexY].map((i) => rowBasedDataTable[i]
|
|
110
|
+
.slice(1)
|
|
111
|
+
.map((strValue) => parseAlgebraic(strValue)));
|
|
112
|
+
const arrCoordsAsNodes = nodesX.map((nodeX, i) => {
|
|
113
|
+
const nodeY = nodesY[i];
|
|
114
|
+
return [nodeX, nodeY];
|
|
115
|
+
});
|
|
116
|
+
return arrCoordsAsNodes;
|
|
117
|
+
}
|
|
118
|
+
const isRowBased = coinFlip();
|
|
119
|
+
const nbValues = 4;
|
|
120
|
+
const dictCateg = {
|
|
121
|
+
a: {
|
|
122
|
+
nameTex: "a",
|
|
123
|
+
gen: (min = 1, max = 6) => Math.max(min, Math.min(max, randint(min, max + 1))),
|
|
124
|
+
},
|
|
125
|
+
b: {
|
|
126
|
+
nameTex: "b",
|
|
127
|
+
gen: (min = 1, max = 6) => Math.max(min, Math.min(max, randint(min, max + 1))),
|
|
128
|
+
},
|
|
129
|
+
c: {
|
|
130
|
+
nameTex: "c",
|
|
131
|
+
gen: (min = 1, max = 6) => Math.max(min, Math.min(max, randint(min, max + 1))),
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
let rowBasedDataTable = [];
|
|
135
|
+
let indexX = -1;
|
|
136
|
+
let indexY = -1;
|
|
137
|
+
let arrCoordsAsNodes = [];
|
|
138
|
+
let counter = -1;
|
|
139
|
+
let isValidTable = false;
|
|
140
|
+
while (!isValidTable && counter < 100) {
|
|
141
|
+
counter++;
|
|
142
|
+
const arrCategAndValues = Object.values(dictCateg).map((categ) => {
|
|
143
|
+
return {
|
|
144
|
+
categ,
|
|
145
|
+
values: [...Array(nbValues).keys()].map(() => categ.gen()),
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
rowBasedDataTable = randomDataTable(arrCategAndValues, true);
|
|
149
|
+
[indexX, indexY] = randomMany([...Array(rowBasedDataTable.length).keys()], 2);
|
|
150
|
+
arrCoordsAsNodes = createArrCoordsAsNodes(rowBasedDataTable, indexX, indexY);
|
|
151
|
+
const arrXY = arrCoordsAsNodes.map(([nodeX, nodeY]) => [nodeX, nodeY].map((node) => node.evaluate()));
|
|
152
|
+
const isDuplicateData = () => [...new Set(arrXY.map(([x, y]) => `${x};${y}`))].length < arrXY.length;
|
|
153
|
+
isValidTable = !isDuplicateData();
|
|
154
|
+
}
|
|
155
|
+
if (!isValidTable) {
|
|
156
|
+
rowBasedDataTable = [
|
|
157
|
+
["a", "3", "2", "3"],
|
|
158
|
+
["b", "1", "2", "3"],
|
|
159
|
+
["c", "1", "1", "2"],
|
|
160
|
+
];
|
|
161
|
+
[indexX, indexY] = [0, 1];
|
|
162
|
+
arrCoordsAsNodes = createArrCoordsAsNodes(rowBasedDataTable, indexX, indexY);
|
|
163
|
+
}
|
|
164
|
+
const identifiers = {
|
|
165
|
+
isRowBased,
|
|
166
|
+
rowBasedDataTable,
|
|
167
|
+
indexX,
|
|
168
|
+
indexY,
|
|
169
|
+
arrCoordsAsNodeIds: arrCoordsAsNodes.map(([nodeX, nodeY]) => [nodeX, nodeY].map((node) => node.toIdentifiers())),
|
|
170
|
+
};
|
|
171
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
172
|
+
};
|
|
173
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
174
|
+
return {
|
|
175
|
+
ggbAnswer: getGGBAnswer(identifiers),
|
|
176
|
+
instruction: getInstruction(identifiers),
|
|
177
|
+
studentGgbOptions: getStudentGGBOptions(identifiers),
|
|
178
|
+
identifiers,
|
|
179
|
+
hint: getHint(identifiers),
|
|
180
|
+
correction: getCorrection(identifiers),
|
|
181
|
+
style: {
|
|
182
|
+
tableOptions: {
|
|
183
|
+
firstCellIsDivided: false,
|
|
184
|
+
firstColumnIsHeader: identifiers.isRowBased,
|
|
185
|
+
firstRowIsHeader: !identifiers.isRowBased,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
export const scatterPlotBuildScatterPlotFromDataTable = {
|
|
191
|
+
id: "scatterPlotBuildScatterPlotFromDataTable",
|
|
192
|
+
label: "Construire un nuage de points à partir d'un tableau de données",
|
|
193
|
+
isSingleStep: true,
|
|
194
|
+
generator: (nb, opts) => getDistinctQuestions(() => getScatterPlotBuildScatterPlotFromDataTableQuestion(opts), nb),
|
|
195
|
+
ggbTimer: 60,
|
|
196
|
+
isGGBAnswerValid,
|
|
197
|
+
subject: "Mathématiques",
|
|
198
|
+
getHint,
|
|
199
|
+
getInstruction,
|
|
200
|
+
getCorrection,
|
|
201
|
+
getGGBAnswer,
|
|
202
|
+
getStudentGGBOptions,
|
|
203
|
+
answerType: "GGB",
|
|
204
|
+
getQuestionFromIdentifiers,
|
|
205
|
+
hasHintAndCorrection: true,
|
|
206
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { CloudPointsIdentifiers } from "../../../../math/geometry/CloudPoints.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
cloudPointsIdentifiers: CloudPointsIdentifiers;
|
|
5
|
+
evolutionType: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const scatterPlotCommenting: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=scatterPlotCommenting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scatterPlotCommenting.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAK5C,KAAK,WAAW,GAAG;IACjB,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAmQF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
4
|
+
import { CloudPoints, CloudPointsConstructor, } from "../../../../math/geometry/CloudPoints.js";
|
|
5
|
+
import { Point, PointConstructor } from "../../../../math/geometry/point.js";
|
|
6
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
+
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
8
|
+
const countries = [
|
|
9
|
+
"Lusitalie",
|
|
10
|
+
"Franemagne",
|
|
11
|
+
"Esprèce",
|
|
12
|
+
"Belgarie",
|
|
13
|
+
"Slovégal",
|
|
14
|
+
"Finlange",
|
|
15
|
+
"Suénemark",
|
|
16
|
+
"Cromanie",
|
|
17
|
+
"Polgique",
|
|
18
|
+
"Maltonie",
|
|
19
|
+
];
|
|
20
|
+
const getInstruction = () => {
|
|
21
|
+
return `Observe ce nuage de points.
|
|
22
|
+
|
|
23
|
+
Parmi les propositions suivantes, lesquelles sont vraies ?`;
|
|
24
|
+
};
|
|
25
|
+
const getHint = () => {
|
|
26
|
+
return `Regarde si les points semblent respecter une règle ou bien pas du tout.`;
|
|
27
|
+
};
|
|
28
|
+
const getCorrection = (identifiers) => {
|
|
29
|
+
const { evolutionType, cloudPointsIdentifiers } = identifiers;
|
|
30
|
+
const allValidProps = propsForEvolutionType[evolutionType];
|
|
31
|
+
const cloudPoints = CloudPointsConstructor.fromIdentifiers(cloudPointsIdentifiers);
|
|
32
|
+
return `Voici tout ce que l'on peut dire sur ce nuage de points :
|
|
33
|
+
|
|
34
|
+
${allValidProps.join(`
|
|
35
|
+
|
|
36
|
+
`)}
|
|
37
|
+
|
|
38
|
+
${(() => {
|
|
39
|
+
switch (evolutionType) {
|
|
40
|
+
case "increasing": {
|
|
41
|
+
const [pointLowX, pointHighX] = cloudPoints.points.toSorted((p1, p2) => p1.x.evaluate() - p2.x.evaluate());
|
|
42
|
+
return `En particulier :
|
|
43
|
+
|
|
44
|
+
Le pays ${pointLowX.name} a un faible taux de chômage et une faible croissance du PIB.
|
|
45
|
+
|
|
46
|
+
Le pays ${pointHighX.name} a un fort taux de chômage et une forte croissance du PIB.`;
|
|
47
|
+
}
|
|
48
|
+
case "decreasing": {
|
|
49
|
+
const [pointLowX, pointHighX] = cloudPoints.points.toSorted((p1, p2) => p1.x.evaluate() - p2.x.evaluate());
|
|
50
|
+
return `En particulier :
|
|
51
|
+
|
|
52
|
+
Le pays ${pointLowX.name} a un faible taux de chômage et une forte croissance du PIB.
|
|
53
|
+
|
|
54
|
+
Le pays ${pointHighX.name} a un fort taux de chômage et une faible croissance du PIB.`;
|
|
55
|
+
}
|
|
56
|
+
case "unpredictible": {
|
|
57
|
+
return `En effet,
|
|
58
|
+
il y a des pays avec un taux de chômage faible et une croissance faible,
|
|
59
|
+
il y a des pays avec un taux de chômage faible et une croissance forte,
|
|
60
|
+
il y a des pays avec un taux de chômage fort et une croissance faible,
|
|
61
|
+
il y a des pays avec un taux de chômage fort et une croissance forte.
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
default:
|
|
65
|
+
return ``;
|
|
66
|
+
}
|
|
67
|
+
})()}`;
|
|
68
|
+
};
|
|
69
|
+
const propsForEvolutionType = {
|
|
70
|
+
increasing: [
|
|
71
|
+
`Plus le taux de chômage est élevé et plus la croissance du PIB est élevée.`,
|
|
72
|
+
],
|
|
73
|
+
decreasing: [
|
|
74
|
+
`Plus le taux de chômage est élevé et plus la croissance du PIB est faible.`,
|
|
75
|
+
],
|
|
76
|
+
unpredictible: [
|
|
77
|
+
`Il n'y a aucun lien entre le taux de chômage et la croissance du PIB.`,
|
|
78
|
+
],
|
|
79
|
+
increasingThenDecreasing: [],
|
|
80
|
+
decreasingThenIncreasing: [],
|
|
81
|
+
};
|
|
82
|
+
const getPropositions = (n, { evolutionType }) => {
|
|
83
|
+
const propositions = [];
|
|
84
|
+
const allValidProps = propsForEvolutionType[evolutionType];
|
|
85
|
+
const validPropsPicked = randomMany(propsForEvolutionType[evolutionType], randint(1, propsForEvolutionType[evolutionType].length + 1));
|
|
86
|
+
validPropsPicked.forEach((str) => {
|
|
87
|
+
addValidProp(propositions, str, "raw");
|
|
88
|
+
});
|
|
89
|
+
const invalidProps = [
|
|
90
|
+
...Object.values(propsForEvolutionType).flatMap((props) => props),
|
|
91
|
+
].filter((prop) => !allValidProps.includes(prop));
|
|
92
|
+
invalidProps.forEach((str) => {
|
|
93
|
+
tryToAddWrongProp(propositions, str, "raw");
|
|
94
|
+
});
|
|
95
|
+
return shuffleProps(propositions, n);
|
|
96
|
+
};
|
|
97
|
+
const getGGBOptions = (identifiers) => {
|
|
98
|
+
const { cloudPointsIdentifiers } = identifiers;
|
|
99
|
+
const cloudPoints = new CloudPoints(cloudPointsIdentifiers.pointsIdentifiers.map((i) => PointConstructor.fromIdentifiers(i)));
|
|
100
|
+
const commands = cloudPoints.points.flatMap((point, i) => {
|
|
101
|
+
return [
|
|
102
|
+
`${point.name}=Point({${point.getXnumber()},${point.getYnumber()}})`,
|
|
103
|
+
`SetFixed(${point.name},true, false)`,
|
|
104
|
+
`Lbl_{${i}} = Text("\\tiny ${point.name}", (${point.x.toMathString()},${point.y.evaluate() + 0.7}), true, true, 0, 0)`,
|
|
105
|
+
`SetFixed(Lbl_{${i}},true, false)`,
|
|
106
|
+
];
|
|
107
|
+
});
|
|
108
|
+
const ggb = new GeogebraConstructor({
|
|
109
|
+
commands,
|
|
110
|
+
hideAxes: false,
|
|
111
|
+
hideGrid: false,
|
|
112
|
+
xAxis: {
|
|
113
|
+
steps: 1,
|
|
114
|
+
label: "Chômage (%)",
|
|
115
|
+
},
|
|
116
|
+
yAxis: {
|
|
117
|
+
steps: 0.5,
|
|
118
|
+
label: "Croissance du PIB (%)",
|
|
119
|
+
},
|
|
120
|
+
fontSize: 15,
|
|
121
|
+
});
|
|
122
|
+
const xValues = cloudPoints.points.map((element) => {
|
|
123
|
+
return element.getXnumber();
|
|
124
|
+
});
|
|
125
|
+
const yValues = cloudPoints.points.map((element) => {
|
|
126
|
+
return element.getYnumber();
|
|
127
|
+
});
|
|
128
|
+
const xMin = Math.min(...xValues);
|
|
129
|
+
const xMax = Math.max(...xValues);
|
|
130
|
+
const yMin = Math.min(...yValues);
|
|
131
|
+
const yMax = Math.max(...yValues);
|
|
132
|
+
return ggb.getOptions({
|
|
133
|
+
coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
const getScatterPlotCommentingQuestion = () => {
|
|
137
|
+
const nbCountries = 6;
|
|
138
|
+
const countriesPicked = randomMany(countries, nbCountries);
|
|
139
|
+
const boxFull = { xMin: 3, xMax: 13, yMin: 0, yMax: 4 };
|
|
140
|
+
const evolutionType = random(["increasing", "decreasing", "unpredictible"]);
|
|
141
|
+
let cloudPointsWithEvoBoxed;
|
|
142
|
+
switch (evolutionType) {
|
|
143
|
+
case "increasing":
|
|
144
|
+
case "decreasing":
|
|
145
|
+
{
|
|
146
|
+
cloudPointsWithEvoBoxed =
|
|
147
|
+
CloudPointsConstructor.cloudPointsByReboxingCloudPoints(CloudPointsConstructor.randomWithEvolutionType(nbCountries, evolutionType), boxFull);
|
|
148
|
+
}
|
|
149
|
+
break;
|
|
150
|
+
case "unpredictible":
|
|
151
|
+
default:
|
|
152
|
+
{
|
|
153
|
+
const nbCountriesTop = Math.floor(nbCountries / 2);
|
|
154
|
+
const nbCountriesBottom = nbCountries - nbCountriesTop;
|
|
155
|
+
const cloudPointsTop = CloudPointsConstructor.cloudPointsByReboxingCloudPoints(CloudPointsConstructor.randomWithEvolutionType(nbCountriesTop, "scatter"), {
|
|
156
|
+
xMin: 0,
|
|
157
|
+
xMax: 1,
|
|
158
|
+
yMin: 0.7,
|
|
159
|
+
yMax: 1,
|
|
160
|
+
});
|
|
161
|
+
const cloudPointsBottom = CloudPointsConstructor.cloudPointsByReboxingCloudPoints(CloudPointsConstructor.randomWithEvolutionType(nbCountriesBottom, "scatter"), {
|
|
162
|
+
xMin: 0,
|
|
163
|
+
xMax: 1,
|
|
164
|
+
yMin: 0,
|
|
165
|
+
yMax: 0.3,
|
|
166
|
+
});
|
|
167
|
+
cloudPointsWithEvoBoxed =
|
|
168
|
+
CloudPointsConstructor.cloudPointsByReboxingCloudPoints(new CloudPoints([
|
|
169
|
+
...cloudPointsTop.points,
|
|
170
|
+
...cloudPointsBottom.points,
|
|
171
|
+
]), boxFull);
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
const namedPoints = cloudPointsWithEvoBoxed.points.map((point, i) => new Point(countriesPicked[i], point.x, point.y));
|
|
176
|
+
const cloudPointsNamed = new CloudPoints(namedPoints);
|
|
177
|
+
const identifiers = {
|
|
178
|
+
cloudPointsIdentifiers: cloudPointsNamed.toIdentifiers(),
|
|
179
|
+
evolutionType,
|
|
180
|
+
};
|
|
181
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
182
|
+
};
|
|
183
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
184
|
+
const question = {
|
|
185
|
+
instruction: getInstruction(identifiers),
|
|
186
|
+
hint: getHint(identifiers),
|
|
187
|
+
correction: getCorrection(identifiers),
|
|
188
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
189
|
+
keys: [],
|
|
190
|
+
answerFormat: "raw",
|
|
191
|
+
identifiers,
|
|
192
|
+
};
|
|
193
|
+
return question;
|
|
194
|
+
};
|
|
195
|
+
export const scatterPlotCommenting = {
|
|
196
|
+
id: "scatterPlotCommenting",
|
|
197
|
+
label: "Commenter un nuage de points",
|
|
198
|
+
isSingleStep: true,
|
|
199
|
+
hasGeogebra: true,
|
|
200
|
+
generator: (nb) => getDistinctQuestions(getScatterPlotCommentingQuestion, nb),
|
|
201
|
+
qcmTimer: 60,
|
|
202
|
+
freeTimer: 60,
|
|
203
|
+
getPropositions,
|
|
204
|
+
getHint,
|
|
205
|
+
getCorrection,
|
|
206
|
+
subject: "Mathématiques",
|
|
207
|
+
getQuestionFromIdentifiers,
|
|
208
|
+
hasHintAndCorrection: true,
|
|
209
|
+
answerType: "QCU",
|
|
210
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { PointIdentifiers } from "../../../../math/geometry/point.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
pointIds: PointIdentifiers[];
|
|
5
|
+
strGroupBy: string;
|
|
6
|
+
isTransposed: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const scatterPlotFillDataTableFromScatterPlotData: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=scatterPlotFillDataTableFromScatterPlotData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scatterPlotFillDataTableFromScatterPlotData.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AA+CtC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AA4PF,eAAO,MAAM,2CAA2C,EAAE,QAAQ,CAAC,WAAW,CAuB3E,CAAC"}
|