math-exercises 3.0.111 → 3.0.113

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 (31) hide show
  1. package/lib/exercises/math/calcul/mentalCaluls/mentalPercentage.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/mentalCaluls/mentalPercentage.js +5 -2
  3. package/lib/exercises/math/dataRepresentations/boxPlotReading.d.ts +9 -0
  4. package/lib/exercises/math/dataRepresentations/boxPlotReading.d.ts.map +1 -0
  5. package/lib/exercises/math/dataRepresentations/boxPlotReading.js +133 -0
  6. package/lib/exercises/math/dataRepresentations/boxPlotReadingPercentages.d.ts +11 -0
  7. package/lib/exercises/math/dataRepresentations/boxPlotReadingPercentages.d.ts.map +1 -0
  8. package/lib/exercises/math/dataRepresentations/boxPlotReadingPercentages.js +198 -0
  9. package/lib/exercises/math/dataRepresentations/index.d.ts +2 -0
  10. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  11. package/lib/exercises/math/dataRepresentations/index.js +2 -0
  12. package/lib/exercises/math/derivation/tangent/derivativeNumberReading.js +1 -0
  13. package/lib/exercises/math/functions/affines/drawAffineFrom2Points.d.ts +10 -0
  14. package/lib/exercises/math/functions/affines/drawAffineFrom2Points.d.ts.map +1 -0
  15. package/lib/exercises/math/functions/affines/drawAffineFrom2Points.js +151 -0
  16. package/lib/exercises/math/functions/affines/index.d.ts +1 -0
  17. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  18. package/lib/exercises/math/functions/affines/index.js +1 -0
  19. package/lib/exercises/math/index.d.ts +0 -1
  20. package/lib/exercises/math/index.d.ts.map +1 -1
  21. package/lib/exercises/math/index.js +1 -1
  22. package/lib/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.d.ts.map +1 -1
  23. package/lib/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.js +7 -7
  24. package/lib/index.d.ts +318 -643
  25. package/lib/index.d.ts.map +1 -1
  26. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  27. package/lib/math/polynomials/polynomial.js +4 -1
  28. package/lib/tree/nodes/equations/equalNode.d.ts +1 -1
  29. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  30. package/lib/tree/nodes/equations/equalNode.js +5 -5
  31. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"mentalPercentage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalPercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuJF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAYlD,CAAC"}
1
+ {"version":3,"file":"mentalPercentage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalPercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA0JF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAYlD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
- import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
3
+ import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
4
4
  import { randint } from "../../../../math/utils/random/randint.js";
5
5
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
6
6
  import { shuffle } from "../../../../utils/alea/shuffle.js";
@@ -119,7 +119,10 @@ const getPropositions = (n, { answer, rand }) => {
119
119
  return shuffle(propositions);
120
120
  };
121
121
  const isAnswerValid = (studentAns, { answer }) => {
122
- return numberVEA(studentAns, answer);
122
+ return rationalVEA(studentAns, answer, {
123
+ allowNonIrreductible: true,
124
+ allowDecimal: true,
125
+ });
123
126
  };
124
127
  export const mentalPercentage = {
125
128
  id: "mentalPercentage",
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type QuartileIndex = 0 | 1 | 2 | 3 | 4;
3
+ type Identifiers = {
4
+ quartileIndex: QuartileIndex;
5
+ quartiles: number[];
6
+ };
7
+ export declare const boxPlotReading: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=boxPlotReading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boxPlotReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/boxPlotReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AA0IF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAmBhD,CAAC"}
@@ -0,0 +1,133 @@
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
+ const getPropositions = (n, { answer, quartiles }) => {
7
+ const propositions = [];
8
+ addValidProp(propositions, answer);
9
+ [0, 1, 2, 3, 4].forEach((qIndex) => {
10
+ tryToAddWrongProp(propositions, quartiles[qIndex].frenchify());
11
+ });
12
+ return shuffleProps(propositions, n);
13
+ };
14
+ const getAnswer = (identifiers) => {
15
+ const { quartileIndex, quartiles } = identifiers;
16
+ return quartiles[quartileIndex].frenchify();
17
+ };
18
+ const getFrenchStringForOfQuartile = (quartileIndex) => {
19
+ switch (quartileIndex) {
20
+ case 0:
21
+ return "du minimum";
22
+ case 1:
23
+ return "du premier quartile";
24
+ case 2:
25
+ return "de la médiane";
26
+ case 3:
27
+ return "du troisième quartile";
28
+ case 4:
29
+ return "du maximum";
30
+ }
31
+ };
32
+ const getInstruction = (identifiers) => {
33
+ const { quartileIndex } = identifiers;
34
+ return `On a représenté une série statistique à une variable sous forme d'une boîte à moustaches.
35
+
36
+ Quelle est la valeur ${getFrenchStringForOfQuartile(quartileIndex)} ?
37
+ `;
38
+ };
39
+ const getHint = () => {
40
+ return `Une boîte à moustaches permet de lire les indicateurs statistiques d'une série. Chaque trait vertical représente un indicateur. Ces indicateurs sont rangés dans l'ordre : minimum, premier quartile, médiane, troisième quartile, maximum.`;
41
+ };
42
+ const getCorrection = (identifiers) => {
43
+ const { quartileIndex, quartiles } = identifiers;
44
+ //https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/mathliveV2/activities/quizzes/generator/boxplot.png
45
+ return `Une boîte à moustache permet de lire les indicateurs statistiques d'une série :
46
+
47
+ ![](https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/mathliveV2/activities/quizzes/generator/boxplot.png)
48
+
49
+ La valeur ${getFrenchStringForOfQuartile(quartileIndex)} est donc ici $ ${quartiles[quartileIndex]} $.`;
50
+ };
51
+ const getGGBOptions = (identifiers) => {
52
+ const { quartiles } = identifiers;
53
+ const [q0, q1, q2, q3, q4] = quartiles;
54
+ const yOffset = 2;
55
+ const yScale = 0.8;
56
+ const commands = [
57
+ `BM = BoxPlot(${yOffset}, ${yScale}, ${q0}, ${q1}, ${q2}, ${q3}, ${q4})`,
58
+ `ShowLabel(BM, false)`,
59
+ ];
60
+ const ggb = new GeogebraConstructor({
61
+ commands,
62
+ forbidShiftDragZoom: false,
63
+ lockedAxesRatio: false,
64
+ // gridDistance: [0.5, 1],
65
+ xAxis: {
66
+ hideNumbers: false,
67
+ steps: 1,
68
+ },
69
+ yAxis: {
70
+ hidden: true,
71
+ },
72
+ maxHeight: 100,
73
+ fontSize: 20,
74
+ });
75
+ return ggb.getOptions({
76
+ coords: ggb.getAdaptedCoords({
77
+ xMin: q0,
78
+ xMax: q4,
79
+ yMin: -2,
80
+ yMax: 5,
81
+ }),
82
+ });
83
+ };
84
+ const getKeys = () => {
85
+ return [];
86
+ };
87
+ const isAnswerValid = (ans, { answer }) => {
88
+ return numberVEA(ans, answer);
89
+ };
90
+ const getBoxPlotReadingQuestion = () => {
91
+ const [q0, q1] = [0, 1]
92
+ .map((_) => randint(0, 8))
93
+ .toSorted((i1, i2) => i1 - i2);
94
+ const [q3, q4] = [0, 1]
95
+ .map((_) => randint(12, 20))
96
+ .toSorted((i1, i2) => i1 - i2);
97
+ const q2 = randint(q1, q3, [q1]); //we prevent q2 from being equal to q1 or q3
98
+ const quartiles = [q0, q1, q2, q3, q4];
99
+ const quartileIndex = randint(0, 5);
100
+ const identifiers = { quartileIndex, quartiles };
101
+ return getQuestionFromIdentifiers(identifiers);
102
+ };
103
+ const getQuestionFromIdentifiers = (identifiers) => {
104
+ return {
105
+ answer: getAnswer(identifiers),
106
+ instruction: getInstruction(identifiers),
107
+ keys: getKeys(identifiers),
108
+ answerFormat: "tex",
109
+ identifiers,
110
+ hint: getHint(identifiers),
111
+ correction: getCorrection(identifiers),
112
+ ggbOptions: getGGBOptions(identifiers),
113
+ };
114
+ };
115
+ export const boxPlotReading = {
116
+ id: "boxPlotReading",
117
+ label: "Lire les indicateurs statistiques sur une boîte à moustaches",
118
+ isSingleStep: true,
119
+ generator: (nb, opts) => getDistinctQuestions(() => getBoxPlotReadingQuestion(opts), nb),
120
+ qcmTimer: 60,
121
+ freeTimer: 60,
122
+ getPropositions,
123
+ isAnswerValid,
124
+ subject: "Mathématiques",
125
+ getHint,
126
+ getCorrection,
127
+ getInstruction,
128
+ getAnswer,
129
+ getGGBOptions,
130
+ hasGeogebra: true,
131
+ getQuestionFromIdentifiers,
132
+ hasHintAndCorrection: true,
133
+ };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type QuartileIndex = 0 | 1 | 2 | 3 | 4;
3
+ type QuestionType = "below" | "between" | "above";
4
+ type Identifiers = {
5
+ quartiles: number[];
6
+ arrQuartileIndex: QuartileIndex[];
7
+ typeQ: QuestionType;
8
+ };
9
+ export declare const boxPlotReadingPercentages: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=boxPlotReadingPercentages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boxPlotReadingPercentages.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/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
+ };
@@ -2,4 +2,6 @@ export * from "./tableReading.js";
2
2
  export * from "./barChartReading.js";
3
3
  export * from "./functionGraphReading.js";
4
4
  export * from "./pieChartReading.js";
5
+ export * from "./boxPlotReadingPercentages.js";
6
+ export * from "./boxPlotReading.js";
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
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"}
@@ -2,6 +2,8 @@ export * from "./tableReading.js";
2
2
  export * from "./barChartReading.js";
3
3
  export * from "./functionGraphReading.js";
4
4
  export * from "./pieChartReading.js";
5
+ export * from "./boxPlotReadingPercentages.js";
6
+ export * from "./boxPlotReading.js";
5
7
  // export * from "./testGen.js";
6
8
  // export * from "./testGenGGB.js";
7
9
  // export * from "./testGenStudentGGB.js";
@@ -44,6 +44,7 @@ const getGGBOptions = (identifiers) => {
44
44
  const penteString = penteTree.toMathString();
45
45
  const originString = originTree.toMathString();
46
46
  const polynome = new Polynomial(identifiers.coeffs);
47
+ console.log(polynome.toMathString());
47
48
  const commands = [
48
49
  `f(x) = ${polynome.toMathString()}`,
49
50
  `SetColor(f, "${blueMain}")`,
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../math/geometry/point.js";
3
+ type Identifiers = {
4
+ pointIdsA: PointIdentifiers;
5
+ pointIdsB: PointIdentifiers;
6
+ funcName: string;
7
+ };
8
+ export declare const drawAffineFrom2Points: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=drawAffineFrom2Points.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawAffineFrom2Points.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/drawAffineFrom2Points.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAiKF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { isGGBLine } from "../../../../exercises/utils/geogebra/isGGBLine.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
4
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
5
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
6
+ import { random, randomMany } from "../../../../utils/alea/random.js";
7
+ import { Line } from "../../../../math/geometry/line.js";
8
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
9
+ const getHint = () => {
10
+ return `Si $f$ est une fonction telle que $f(x) = y$,
11
+ alors la courbe représentative de f passe par le point de coordonnées $(x;y)$.
12
+ Détermine deux points par lesquels passe la droite représentative de la fonction.`;
13
+ };
14
+ const getCorrection = (identifiers) => {
15
+ const { pointIdsA, pointIdsB, funcName } = identifiers;
16
+ const pointA = PointConstructor.fromIdentifiers(pointIdsA);
17
+ const pointB = PointConstructor.fromIdentifiers(pointIdsB);
18
+ return `La fonction $${funcName}$ est une fonction affine.
19
+ Sa représentation graphique est une droite, que l'on va nommer $d$.
20
+
21
+ On sait que $ ${funcName}(${pointA.x.toTex()}) = ${pointA.y.toTex()} $.
22
+ C'est-à-dire que le point de coordonnées $(${pointA.x.toTex()}; ${pointA.y.toTex()})$ appartient à $d$.
23
+
24
+ On sait que $ ${funcName}(${pointB.x.toTex()}) = ${pointB.y.toTex()} $.
25
+ C'est-à-dire que le point de coordonnées $(${pointB.x.toTex()}; ${pointB.y.toTex()})$ appartient également à $d$.
26
+
27
+ On place donc les deux points de coordonnées $(${pointA.x.toTex()}; ${pointA.y.toTex()})$ et $(${pointB.x.toTex()}; ${pointB.y.toTex()})$,
28
+ puis on trace la droite passant par ces deux points.`;
29
+ };
30
+ const getInstruction = (identifiers) => {
31
+ const { pointIdsA, pointIdsB, funcName } = identifiers;
32
+ const pointA = PointConstructor.fromIdentifiers(pointIdsA);
33
+ const pointB = PointConstructor.fromIdentifiers(pointIdsB);
34
+ return `La fonction $${funcName}$ est affine telle que :
35
+
36
+ $ ${funcName}(${pointA.x.toTex()}) = ${pointA.y.toTex()} $ et
37
+ $ ${funcName}(${pointB.x.toTex()}) = ${pointB.y.toTex()} $.
38
+
39
+ Dans le repère, tracer la représentation graphique de la fonction $${funcName}$.`;
40
+ };
41
+ const getStudentGGBOptions = (identifiers) => {
42
+ const { pointIdsA, pointIdsB } = identifiers;
43
+ const pointA = PointConstructor.fromIdentifiers(pointIdsA);
44
+ const pointB = PointConstructor.fromIdentifiers(pointIdsB);
45
+ const studentGGB = new GeogebraConstructor({
46
+ isGridSimple: true,
47
+ customToolBar: toolBarConstructor({
48
+ join: true,
49
+ }),
50
+ });
51
+ const [xA, xB, yA, yB] = [pointA.x, pointB.x, pointA.y, pointB.y].map((node) => node.evaluate());
52
+ const [xMin, xMax, yMin, yMax] = [
53
+ Math.min(xA, xB),
54
+ Math.max(xA, xB),
55
+ Math.min(yA, yB),
56
+ Math.max(yA, yB),
57
+ ];
58
+ return studentGGB.getOptions({
59
+ coords: studentGGB.getAdaptedCoords({
60
+ xMin,
61
+ xMax,
62
+ yMax,
63
+ yMin,
64
+ forceShowAxes: true,
65
+ }),
66
+ });
67
+ };
68
+ const getGGBAnswer = (identifiers) => {
69
+ const { pointIdsA, pointIdsB } = identifiers;
70
+ const pointA = PointConstructor.fromIdentifiers(pointIdsA);
71
+ const pointB = PointConstructor.fromIdentifiers(pointIdsB);
72
+ return [
73
+ `(${pointA.x.evaluate()},${pointA.y.evaluate()})`,
74
+ `(${pointB.x.evaluate()},${pointB.y.evaluate()})`,
75
+ `Line[A, B]`,
76
+ ];
77
+ };
78
+ const getDrawAffineFrom2PointsQuestion = () => {
79
+ const availableCoordValues = [...Array(21).keys()].map((i) => i - 10);
80
+ const [xA, xB] = randomMany(availableCoordValues, 2); //this prevents building vertical lines
81
+ const [yA, yB] = [0, 1].map((_) => random(availableCoordValues));
82
+ const pointA = new Point("A", xA, yA);
83
+ const pointB = new Point("B", xB, yB);
84
+ const funcName = random(["f", "g", "h"]);
85
+ const identifiers = {
86
+ pointIdsA: pointA.toIdentifiers(),
87
+ pointIdsB: pointB.toIdentifiers(),
88
+ funcName,
89
+ };
90
+ return getQuestionFromIdentifiers(identifiers);
91
+ };
92
+ const getQuestionFromIdentifiers = (identifiers) => {
93
+ const question = {
94
+ ggbAnswer: getGGBAnswer(identifiers),
95
+ instruction: getInstruction(identifiers),
96
+ keys: [],
97
+ answerFormat: "tex",
98
+ studentGgbOptions: getStudentGGBOptions(identifiers),
99
+ identifiers,
100
+ hint: getHint(identifiers),
101
+ correction: getCorrection(identifiers),
102
+ };
103
+ return question;
104
+ };
105
+ const isGGBAnswerValid = (ans, { pointIdsA, pointIdsB }) => {
106
+ try {
107
+ //parse la line (si +1, faux)
108
+ // parse le spoints de la line
109
+ //transformer en vrai droite
110
+ // checker si A et B sont sur la droite
111
+ const lines = ans.filter((s) => isGGBLine(s));
112
+ if (lines.length !== 1)
113
+ return false;
114
+ const pointNames = lines[0]
115
+ .split("Line")[1]
116
+ .replace("[", "")
117
+ .replace("]", "")
118
+ .replace(" ", "")
119
+ .split(",");
120
+ const pointCmds = ans.filter((s) => s.startsWith(pointNames[0] + "=") || s.startsWith(pointNames[1] + "="));
121
+ const pointsCoords = pointCmds.map((cmd) => cmd
122
+ .split("=")[1]
123
+ .replace("(", "")
124
+ .replace(")", "")
125
+ .split(",")
126
+ .map((n) => Number(n)));
127
+ const points = pointsCoords.map((coord) => new Point("A", coord[0], coord[1]));
128
+ const line = new Line(points[0], points[1]);
129
+ const A = PointConstructor.fromIdentifiers(pointIdsA);
130
+ const B = PointConstructor.fromIdentifiers(pointIdsB);
131
+ return line.includes(A, 0.5) && line.includes(B, 0.5);
132
+ }
133
+ catch (err) {
134
+ return handleVEAError(err);
135
+ }
136
+ };
137
+ export const drawAffineFrom2Points = {
138
+ id: "drawAffineFrom2Points",
139
+ label: "Tracer la représentation graphique d'une fonction affine à partir de deux images",
140
+ isSingleStep: true,
141
+ answerType: "GGB",
142
+ generator: (nb) => getDistinctQuestions(getDrawAffineFrom2PointsQuestion, nb),
143
+ ggbTimer: 60,
144
+ isGGBAnswerValid,
145
+ subject: "Mathématiques",
146
+ getGGBAnswer,
147
+ getInstruction,
148
+ getStudentGGBOptions,
149
+ getQuestionFromIdentifiers,
150
+ hasHintAndCorrection: true,
151
+ };
@@ -12,5 +12,6 @@ export * from "./affineAdjustmentComplete.js";
12
12
  export * from "./affineMeanValue.js";
13
13
  export * from "./affineExpressionFromTwoImages.js";
14
14
  export * from "./affineFromExercise.js";
15
+ export * from "./drawAffineFrom2Points.js";
15
16
  export * from "./drawAffineFromLitExp.js";
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC"}
@@ -12,4 +12,5 @@ export * from "./affineAdjustmentComplete.js";
12
12
  export * from "./affineMeanValue.js";
13
13
  export * from "./affineExpressionFromTwoImages.js";
14
14
  export * from "./affineFromExercise.js";
15
+ export * from "./drawAffineFrom2Points.js";
15
16
  export * from "./drawAffineFromLitExp.js";
@@ -23,5 +23,4 @@ export * from "./python/index.js";
23
23
  export * from "./sampling/index.js";
24
24
  export * from "./dataRepresentations/index.js";
25
25
  export * from "./tests/index.js";
26
- export * from "./pcExosInMath.js";
27
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC"}
@@ -23,4 +23,4 @@ export * from "./python/index.js";
23
23
  export * from "./sampling/index.js";
24
24
  export * from "./dataRepresentations/index.js";
25
25
  export * from "./tests/index.js";
26
- export * from "./pcExosInMath.js";
26
+ // export * from "./pcExosInMath.js";
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticFindAntecedent.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAqBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2HF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAiB1D,CAAC"}
1
+ {"version":3,"file":"arithmeticFindAntecedent.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2HF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAiB1D,CAAC"}