math-exercises 3.0.191 → 3.0.193

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 (94) 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/dataToGraphGraphToData.d.ts.map +1 -1
  26. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.js +1 -1
  27. package/lib/exercises/math/dataRepresentations/index.d.ts +4 -7
  28. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  29. package/lib/exercises/math/dataRepresentations/index.js +4 -11
  30. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts +7 -0
  31. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts.map +1 -0
  32. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.js +222 -0
  33. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts +7 -0
  34. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts.map +1 -0
  35. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.js +187 -0
  36. package/lib/exercises/math/dataRepresentations/tables/index.d.ts +4 -0
  37. package/lib/exercises/math/dataRepresentations/tables/index.d.ts.map +1 -0
  38. package/lib/exercises/math/dataRepresentations/tables/index.js +3 -0
  39. package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts +8 -0
  40. package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts.map +1 -0
  41. package/lib/exercises/math/dataRepresentations/tables/tableReading.js +109 -0
  42. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts +8 -0
  43. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts.map +1 -0
  44. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.js +145 -0
  45. package/lib/exercises/math/derivation/applications/index.d.ts +1 -0
  46. package/lib/exercises/math/derivation/applications/index.d.ts.map +1 -1
  47. package/lib/exercises/math/derivation/applications/index.js +1 -0
  48. package/lib/exercises/math/functions/exponentials/computeImageByExponentialFunctionInSituation.d.ts +10 -0
  49. package/lib/exercises/math/functions/exponentials/computeImageByExponentialFunctionInSituation.d.ts.map +1 -0
  50. package/lib/exercises/math/functions/exponentials/computeImageByExponentialFunctionInSituation.js +96 -0
  51. package/lib/exercises/math/functions/exponentials/computeImageByExponentialFunctionWithUnitChange.d.ts +11 -0
  52. package/lib/exercises/math/functions/exponentials/computeImageByExponentialFunctionWithUnitChange.d.ts.map +1 -0
  53. package/lib/exercises/math/functions/exponentials/computeImageByExponentialFunctionWithUnitChange.js +116 -0
  54. package/lib/exercises/math/functions/exponentials/index.d.ts +3 -0
  55. package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
  56. package/lib/exercises/math/functions/exponentials/index.js +3 -0
  57. package/lib/exercises/math/functions/exponentials/modelizeSituationByExponentialFunction.d.ts +9 -0
  58. package/lib/exercises/math/functions/exponentials/modelizeSituationByExponentialFunction.d.ts.map +1 -0
  59. package/lib/exercises/math/functions/exponentials/modelizeSituationByExponentialFunction.js +105 -0
  60. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.js +2 -2
  61. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -1
  62. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +7 -2
  63. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  64. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +131 -61
  65. package/lib/exercises/math/probaStat/stats2var/buildDataTableFromScatterplot.d.ts +8 -0
  66. package/lib/exercises/math/probaStat/stats2var/buildDataTableFromScatterplot.d.ts.map +1 -0
  67. package/lib/exercises/math/probaStat/stats2var/buildDataTableFromScatterplot.js +114 -0
  68. package/lib/exercises/math/probaStat/stats2var/buildScatterPlotFromDataTable.d.ts +8 -0
  69. package/lib/exercises/math/probaStat/stats2var/buildScatterPlotFromDataTable.d.ts.map +1 -0
  70. package/lib/exercises/math/probaStat/stats2var/buildScatterPlotFromDataTable.js +110 -0
  71. package/lib/exercises/math/probaStat/stats2var/index.d.ts +2 -0
  72. package/lib/exercises/math/probaStat/stats2var/index.d.ts.map +1 -1
  73. package/lib/exercises/math/probaStat/stats2var/index.js +2 -0
  74. package/lib/exercises/math/sequences/geometric/graph/compareGeometricReasonWithOneFromGraph.d.ts +8 -0
  75. package/lib/exercises/math/sequences/geometric/graph/compareGeometricReasonWithOneFromGraph.d.ts.map +1 -0
  76. package/lib/exercises/math/sequences/geometric/graph/compareGeometricReasonWithOneFromGraph.js +87 -0
  77. package/lib/exercises/math/sequences/geometric/graph/index.d.ts +4 -1
  78. package/lib/exercises/math/sequences/geometric/graph/index.d.ts.map +1 -1
  79. package/lib/exercises/math/sequences/geometric/graph/index.js +4 -1
  80. package/lib/exercises/math/sequences/geometric/graph/plausibleGeometricSequenceExpressionFromGraph.d.ts +12 -0
  81. package/lib/exercises/math/sequences/geometric/graph/plausibleGeometricSequenceExpressionFromGraph.d.ts.map +1 -0
  82. package/lib/exercises/math/sequences/geometric/graph/plausibleGeometricSequenceExpressionFromGraph.js +133 -0
  83. package/lib/exercises/math/sequences/geometric/graph/readGeometricExpressionFromGraph.d.ts +8 -0
  84. package/lib/exercises/math/sequences/geometric/graph/readGeometricExpressionFromGraph.d.ts.map +1 -0
  85. package/lib/exercises/math/sequences/geometric/graph/readGeometricExpressionFromGraph.js +132 -0
  86. package/lib/exercises/math/sequences/geometric/graph/recognizeGeometricFromGraph.d.ts +11 -0
  87. package/lib/exercises/math/sequences/geometric/graph/recognizeGeometricFromGraph.d.ts.map +1 -0
  88. package/lib/exercises/math/sequences/geometric/graph/recognizeGeometricFromGraph.js +137 -0
  89. package/lib/exercises/math/sequences/geometric/index.d.ts +1 -0
  90. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  91. package/lib/exercises/math/sequences/geometric/index.js +1 -0
  92. package/lib/index.d.ts +71 -25
  93. package/lib/index.d.ts.map +1 -1
  94. package/package.json +1 -1
@@ -1,131 +1,194 @@
1
- import { Rational } from "../../../../math/numbers/rationals/rational.js";
1
+ import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
2
2
  import { randint } from "../../../../math/utils/random/randint.js";
3
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
3
4
  import { random } from "../../../../utils/alea/random.js";
4
5
  import { shuffle } from "../../../../utils/alea/shuffle.js";
5
6
  import { dollarize } from "../../../../utils/latex/dollarize.js";
6
7
  import { mdTable } from "../../../../utils/markdown/mdTable.js";
7
8
  import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercise.js";
8
9
  import { getDistinctQuestions } from "../../../utils/getDistinctQuestions.js";
9
- const getFreqStrings = (rand) => {
10
+ const getFreqStrings = (identifiers) => {
11
+ const { rand, x1, x2, x3, x4 } = identifiers;
12
+ const total = x1 + x2 + x3 + x4;
10
13
  let freqString = "";
11
14
  let frequence = "";
15
+ let mainEvent = "";
16
+ let subEvent = "";
17
+ let num = 0;
18
+ let denum = 0;
12
19
  switch (rand) {
13
20
  case 0:
14
21
  freqString = "marginale de $A$";
15
22
  frequence = "f(A)";
23
+ mainEvent = "A";
24
+ num = x1 + x3;
25
+ denum = total;
16
26
  break;
17
27
  case 1:
18
28
  freqString = "marginale de $B$";
19
29
  frequence = "f(B)";
30
+ mainEvent = "B";
31
+ num = x2 + x4;
32
+ denum = total;
20
33
  break;
21
34
  case 2:
22
35
  freqString = "marginale de $C$";
23
36
  frequence = "f(C)";
37
+ mainEvent = "C";
38
+ num = x1 + x2;
39
+ denum = total;
24
40
  break;
25
41
  case 3:
26
42
  freqString = "marginale de $D$";
27
43
  frequence = "f(D)";
44
+ mainEvent = "D";
45
+ num = x3 + x4;
46
+ denum = total;
28
47
  break;
29
48
  case 4:
30
49
  freqString = "conditionnelle de $A$ parmi $C$";
31
50
  frequence = "f_C(A)";
51
+ mainEvent = "A";
52
+ subEvent = "C";
53
+ num = x1;
54
+ denum = x1 + x2;
32
55
  break;
33
56
  case 5:
34
57
  freqString = "conditionnelle de $A$ parmi $D$";
35
58
  frequence = "f_D(A)";
59
+ mainEvent = "A";
60
+ subEvent = "D";
61
+ num = x3;
62
+ denum = x3 + x4;
36
63
  break;
37
64
  case 6:
38
65
  freqString = "conditionnelle de $B$ parmi $C$";
39
66
  frequence = "f_C(B)";
67
+ mainEvent = "B";
68
+ subEvent = "C";
69
+ num = x2;
70
+ denum = x1 + x2;
40
71
  break;
41
72
  case 7:
42
73
  freqString = "conditionnelle de $B$ parmi $D$";
43
74
  frequence = "f_D(B)";
75
+ mainEvent = "B";
76
+ subEvent = "D";
77
+ num = x4;
78
+ denum = x3 + x4;
44
79
  break;
45
80
  case 8:
46
81
  freqString = "conditionnelle de $C$ parmi $A$";
47
82
  frequence = "f_A(C)";
83
+ mainEvent = "C";
84
+ subEvent = "A";
85
+ num = x1;
86
+ denum = x1 + x3;
48
87
  break;
49
88
  case 9:
50
89
  freqString = "conditionnelle de $C$ parmi $B$";
51
90
  frequence = "f_B(C)";
91
+ mainEvent = "C";
92
+ subEvent = "B";
93
+ num = x2;
94
+ denum = x2 + x4;
52
95
  break;
53
96
  case 10:
54
97
  freqString = "conditionnelle de $D$ parmi $A$";
55
98
  frequence = "f_A(D)";
99
+ mainEvent = "D";
100
+ subEvent = "A";
101
+ num = x3;
102
+ denum = x1 + x3;
56
103
  break;
57
104
  case 11:
58
105
  freqString = "conditionnelle de $D$ parmi $B$";
59
106
  frequence = "f_B(D)";
107
+ mainEvent = "D";
108
+ subEvent = "B";
109
+ num = x4;
110
+ denum = x2 + x4;
60
111
  break;
61
112
  default:
62
113
  throw Error("error");
63
114
  }
64
- return { freqString, frequence };
115
+ return { freqString, frequence, mainEvent, subEvent, num, denum };
65
116
  };
66
- const getInstruction = ({ x1, x2, x3, x4, rand, }) => {
67
- const { freqString } = getFreqStrings(rand);
117
+ const getInstruction = (identifiers) => {
118
+ const { x1, x2, x3, x4 } = identifiers;
119
+ const { freqString } = getFreqStrings(identifiers);
68
120
  return `On considère le tableau d'effectifs suivant :
69
121
 
70
122
  ${mdTable([
71
- [" ", "$A$", "$B$"],
72
- ["$C$", dollarize(x1), dollarize(x2)],
73
- ["$D$", dollarize(x3), dollarize(x4)],
123
+ [" ", "$A$", "$B$", "Total"],
124
+ ["$C$", dollarize(x1), dollarize(x2), dollarize(x1 + x2)],
125
+ ["$D$", dollarize(x3), dollarize(x4), dollarize(x3 + x4)],
126
+ [
127
+ "Total",
128
+ dollarize(x1 + x3),
129
+ dollarize(x2 + x4),
130
+ dollarize(x1 + x2 + x3 + x4),
131
+ ],
74
132
  ])}
75
133
 
76
- Calculer la fréquence ${freqString}.`;
134
+ Calculer la fréquence ${freqString} (donner la valeur exacte ou une valeur arrondie au centième).`;
77
135
  };
78
- const getAnswerNode = (rand, x1, x2, x3, x4) => {
79
- const x = x1 + x2 + x3 + x4;
80
- let answer;
81
- switch (rand) {
82
- case 0:
83
- answer = new Rational(x1 + x3, x).simplify().toTree();
84
- break;
85
- case 1:
86
- answer = new Rational(x2 + x4, x).simplify().toTree();
87
- break;
88
- case 2:
89
- answer = new Rational(x1 + x2, x).simplify().toTree();
90
- break;
91
- case 3:
92
- answer = new Rational(x3 + x4, x).simplify().toTree();
93
- break;
94
- case 4:
95
- answer = new Rational(x1, x1 + x2).simplify().toTree();
96
- break;
97
- case 5:
98
- answer = new Rational(x3, x3 + x4).simplify().toTree();
99
- break;
100
- case 6:
101
- answer = new Rational(x2, x1 + x2).simplify().toTree();
102
- break;
103
- case 7:
104
- answer = new Rational(x4, x3 + x4).simplify().toTree();
105
- break;
106
- case 8:
107
- answer = new Rational(x1, x1 + x3).simplify().toTree();
108
- break;
109
- case 9:
110
- answer = new Rational(x2, x2 + x4).simplify().toTree();
111
- break;
112
- case 10:
113
- answer = new Rational(x3, x1 + x3).simplify().toTree();
114
- break;
115
- case 11:
116
- answer = new Rational(x4, x2 + x4).simplify().toTree();
117
- break;
118
- default:
119
- throw Error("error");
120
- }
121
- return answer;
136
+ const getAnswerNode = (identifiers) => {
137
+ const { num, denum } = getFreqStrings(identifiers);
138
+ return frac(num, denum).simplify();
122
139
  };
123
140
  const getAnswer = (identifiers) => {
124
- const { rand, x1, x2, x3, x4 } = identifiers;
125
- const answerNode = getAnswerNode(rand, x1, x2, x3, x4);
141
+ const answerNode = getAnswerNode(identifiers);
126
142
  const answer = answerNode.toTex();
127
143
  return answer;
128
144
  };
145
+ const getHint = (identifiers) => {
146
+ const { rand } = identifiers;
147
+ if (rand < 4) {
148
+ return `La fréquence marginale de $M$ s'obtient par le calcul :
149
+
150
+ $$
151
+ f(M) = \\frac{\\text{effectif total de } M}{\\text{effectif total}}
152
+ $$`;
153
+ }
154
+ return `La fréquence conditionnelle de $M$ parmi $N$ s'obtient par le calcul :
155
+
156
+ $$
157
+ f_N(M) = \\frac{\\text{effectif vérifiant à la fois } M \\text{ et } N}{\\text{effectif marginal de } N}
158
+ $$`;
159
+ };
160
+ const getCorrection = (identifiers) => {
161
+ const { rand } = identifiers;
162
+ const { freqString, frequence, mainEvent, subEvent, num, denum } = getFreqStrings(identifiers);
163
+ if (rand < 4) {
164
+ return `La fréquence ${freqString} s'obtient par le calcul :
165
+
166
+ $$
167
+ ${frequence} = \\frac{\\text{effectif total de } ${mainEvent}}{\\text{effectif total}}
168
+ $$
169
+
170
+ Ici, l'effectif total est $${denum.frenchify()}$, et l'effectif total de $${mainEvent}$ est $${num}$.
171
+
172
+ On a donc :
173
+
174
+ $$
175
+ ${frequence} = ${frac(num, denum).toSimplificationTex()}
176
+ $$`;
177
+ }
178
+ return `La fréquence ${freqString} s'obtient par le calcul :
179
+
180
+ $$
181
+ ${frequence} = \\frac{\\text{effectif vérifiant à la fois } ${mainEvent} \\text{ et } ${subEvent}}{\\text{effectif marginal de } ${subEvent}}
182
+ $$
183
+
184
+ Ici, l'effectif vérifiant à la fois $${mainEvent}$ et $${subEvent}$ est $${num}$, et l'effectif marginal de $${subEvent}$ est $${denum}$.
185
+
186
+ On a donc :
187
+
188
+ $$
189
+ ${frequence} = ${frac(num, denum).toSimplificationTex()}
190
+ $$`;
191
+ };
129
192
  const getMarginalAndConditionalFrequency = () => {
130
193
  const [x1, x2, x3, x4] = [1, 2, 3, 4].map((_el) => randint(1, 100));
131
194
  const rand = randint(0, 12);
@@ -135,7 +198,7 @@ const getMarginalAndConditionalFrequency = () => {
135
198
  const getQuestionFromIdentifiers = (identifiers) => {
136
199
  const question = {
137
200
  instruction: getInstruction(identifiers),
138
- startStatement: `${getFreqStrings(identifiers.rand).frequence}`,
201
+ startStatement: `${getFreqStrings(identifiers).frequence}`,
139
202
  answer: getAnswer(identifiers),
140
203
  keys: ["f", "cap", "underscore"],
141
204
  answerFormat: "tex",
@@ -147,6 +210,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
147
210
  firstRowIsHeader: true,
148
211
  },
149
212
  },
213
+ hint: getHint(identifiers),
214
+ correction: getCorrection(identifiers),
150
215
  };
151
216
  return question;
152
217
  };
@@ -155,15 +220,19 @@ const getPropositions = (n, { answer, x1, x2, x3, x4 }) => {
155
220
  addValidProp(propositions, answer);
156
221
  propWhile(propositions, n, () => {
157
222
  const fakeRand = randint(0, 12);
158
- const answerTree = getAnswerNode(fakeRand, x1 + random([0, 1]), x2 + random([0, 1]), x3 + random([0, 1]), x4 + random([0, 1]));
223
+ const answerTree = getAnswerNode({
224
+ rand: fakeRand,
225
+ x1: x1 + random([0, 1]),
226
+ x2: x2 + random([0, 1]),
227
+ x3: x3 + random([0, 1]),
228
+ x4: x4 + random([0, 1]),
229
+ });
159
230
  tryToAddWrongProp(propositions, answerTree.toTex());
160
231
  });
161
232
  return shuffle(propositions);
162
233
  };
163
- const isAnswerValid = (ans, { rand, x1, x2, x3, x4 }) => {
164
- const answerTree = getAnswerNode(rand, x1, x2, x3, x4);
165
- const texs = answerTree.toAllValidTexs({ allowFractionToDecimal: true });
166
- return texs.includes(ans);
234
+ const isAnswerValid = (ans, { answer }) => {
235
+ return rationalVEA(ans, answer);
167
236
  };
168
237
  export const marginalAndConditionalFrequency = {
169
238
  id: "marginalAndConditionalFrequency",
@@ -177,4 +246,5 @@ export const marginalAndConditionalFrequency = {
177
246
  isAnswerValid,
178
247
  subject: "Mathématiques",
179
248
  getQuestionFromIdentifiers,
249
+ hasHintAndCorrection: true,
180
250
  };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ xs: number[];
4
+ ys: number[];
5
+ };
6
+ export declare const buildDataTableFromScatterplot: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=buildDataTableFromScatterplot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildDataTableFromScatterplot.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/buildDataTableFromScatterplot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;CACd,CAAC;AA6GF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAsB/D,CAAC"}
@@ -0,0 +1,114 @@
1
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
2
+ import { valueTableVEA } from "../../../../exercises/vea/valueTableVEA.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { PointConstructor } from "../../../../math/geometry/point.js";
5
+ import { randTupleInt } from "../../../../math/utils/random/randTupleInt.js";
6
+ import { dollarize } from "../../../../utils/latex/dollarize.js";
7
+ import { mdTable } from "../../../../utils/markdown/mdTable.js";
8
+ const getAnswerTable = (identifiers) => {
9
+ const { xs, ys } = identifiers;
10
+ return [
11
+ ["\\text{Temps de révision}", ...xs.map((e) => e.frenchify())],
12
+ ["\\text{Note}", ...ys.map((e) => e.frenchify())],
13
+ ];
14
+ };
15
+ const getInstruction = () => {
16
+ return `Le graphique ci-dessous donne les résultats d'une classe à un contrôle : le temps de révision (en heures) est en abscisse, et la note obtenue (sur $10$) est en ordonnée.
17
+
18
+ Compléter le tableau de données associé à ce nuage de points.`;
19
+ };
20
+ const getHint = () => {
21
+ return `Lis l'abscisse et l'ordonnée de chaque point. Dans le tableau, chaque colonne correspond à un point. Classe ces points dans l'ordre croissant de leur abscisse.`;
22
+ };
23
+ const getCorrection = (identifiers) => {
24
+ const { xs, ys } = identifiers;
25
+ const points = xs.map((x, i) => PointConstructor.fromCoords([x, ys[i]], `P_${i}`));
26
+ return `On lit les coordonnées de chaque point, on trouve :
27
+
28
+ - $${points.map((p) => p.toCoords()).join("$ \n - $")}$
29
+
30
+ On entre les abscisses dans la première ligne, et les ordonnées correspondantes dans la deuxième.
31
+
32
+ On obtient donc le tableau suivant :
33
+
34
+ ${mdTable([
35
+ ["Temps de révision", ...xs.map((e) => dollarize(e.frenchify()))],
36
+ ["Note", ...ys.map((e) => dollarize(e.frenchify()))],
37
+ ])}`;
38
+ };
39
+ const getGGBOptions = (identifiers) => {
40
+ const { xs, ys } = identifiers;
41
+ const points = xs.map((x, i) => PointConstructor.fromCoords([x, ys[i]], `P_${i}`));
42
+ const ggb = new GeogebraConstructor({
43
+ commands: [
44
+ ...points.flatMap((p) => p.toGGBCommand({
45
+ isFixed: true,
46
+ isSelectionnable: false,
47
+ showLabel: false,
48
+ })),
49
+ ],
50
+ });
51
+ return ggb.getOptions({
52
+ coords: [-1, 11, -1, 11],
53
+ });
54
+ };
55
+ const getKeys = () => {
56
+ return [];
57
+ };
58
+ const isAnswerTableValid = (ans, { answerTable }) => {
59
+ return valueTableVEA(ans, answerTable);
60
+ };
61
+ const getBuildDataTableFromScatterplotQuestion = () => {
62
+ const xs = randTupleInt(4, {
63
+ from: 0,
64
+ to: 10,
65
+ allDifferent: true,
66
+ sorted: true,
67
+ });
68
+ const ys = randTupleInt(4, {
69
+ from: 0,
70
+ to: 10,
71
+ allDifferent: true,
72
+ sorted: true,
73
+ });
74
+ const identifiers = {
75
+ xs,
76
+ ys,
77
+ };
78
+ return getQuestionFromIdentifiers(identifiers);
79
+ };
80
+ const getQuestionFromIdentifiers = (identifiers) => {
81
+ return {
82
+ answerTable: getAnswerTable(identifiers),
83
+ instruction: getInstruction(identifiers),
84
+ keys: getKeys(identifiers),
85
+ answerFormat: "tex",
86
+ identifiers,
87
+ hint: getHint(identifiers),
88
+ correction: getCorrection(identifiers),
89
+ ggbOptions: getGGBOptions(identifiers),
90
+ initTable: [
91
+ ["\\text{Temps de révision}", "", "", "", ""],
92
+ ["\\text{Note}", "", "", "", ""],
93
+ ],
94
+ };
95
+ };
96
+ export const buildDataTableFromScatterplot = {
97
+ id: "buildDataTableFromScatterplot",
98
+ label: "Construire le tableau de valeurs associé à un nuage de points",
99
+ isSingleStep: true,
100
+ generator: (nb, opts) => getDistinctQuestions(() => getBuildDataTableFromScatterplotQuestion(opts), nb),
101
+ qcmTimer: 60,
102
+ freeTimer: 60,
103
+ isAnswerTableValid,
104
+ subject: "Mathématiques",
105
+ getHint,
106
+ getCorrection,
107
+ getInstruction,
108
+ getAnswerTable,
109
+ getGGBOptions,
110
+ hasGeogebra: true,
111
+ getQuestionFromIdentifiers,
112
+ answerType: "valueTable",
113
+ hasHintAndCorrection: true,
114
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ xs: number[];
4
+ ys: number[];
5
+ };
6
+ export declare const buildScatterPlotFromDataTable: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=buildScatterPlotFromDataTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildScatterPlotFromDataTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/buildScatterPlotFromDataTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;CACd,CAAC;AA8GF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAoB/D,CAAC"}
@@ -0,0 +1,110 @@
1
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
5
+ import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
6
+ import { PointConstructor } from "../../../../math/geometry/point.js";
7
+ import { randTupleInt } from "../../../../math/utils/random/randTupleInt.js";
8
+ import { dollarize } from "../../../../utils/latex/dollarize.js";
9
+ import { mdTable } from "../../../../utils/markdown/mdTable.js";
10
+ const getInstruction = (identifiers) => {
11
+ return `On s'intéresse à l'évolution de la population de loups dans une zone protégée à partir de l'année $2000$ (année $0$). Le tableau suivant donne le nombre d'individus pour chaque année étudiée.
12
+
13
+ ${mdTable([
14
+ ["Année", ...identifiers.xs.map((e) => dollarize(e.frenchify()))],
15
+ [
16
+ "Nombre d'individus",
17
+ ...identifiers.ys.map((e) => dollarize(e.frenchify())),
18
+ ],
19
+ ])}
20
+
21
+ Construire le nuage de points associé au tableau ci-dessus.`;
22
+ };
23
+ const getHint = () => {
24
+ return `Chaque colonne du tableau représente un point du nuage de points. La première ligne donne son abscisse, et la deuxième son ordonnée.`;
25
+ };
26
+ const getCorrection = (identifiers) => {
27
+ const { xs, ys } = identifiers;
28
+ const points = xs.map((x, i) => PointConstructor.fromCoords([x, ys[i]], `P_${i}`));
29
+ return `Le tableau nous donne les points suivants :
30
+
31
+ - $${points.map((p) => p.toCoords()).join("$ \n - $")}$
32
+
33
+ Il suffit ensuite de placer ces points dans la figure.
34
+ `;
35
+ };
36
+ const getGGBAnswer = (identifiers) => {
37
+ const { xs, ys } = identifiers;
38
+ const points = xs.map((x, i) => PointConstructor.fromCoords([x, ys[i]], `P_${i}`));
39
+ return [
40
+ ...points.flatMap((p) => p.toGGBCommand({
41
+ isFixed: true,
42
+ isSelectionnable: false,
43
+ showLabel: false,
44
+ })),
45
+ ];
46
+ };
47
+ const getStudentGGBOptions = () => {
48
+ const ggb = new GeogebraConstructor({
49
+ commands: [],
50
+ customToolBar: toolBarConstructor({ point: true }),
51
+ });
52
+ return ggb.getOptions({
53
+ coords: [-1, 11, -1, 11],
54
+ });
55
+ };
56
+ const isGGBAnswerValid = (ans, { ggbAnswer, ...identifiers }) => {
57
+ const { xs, ys } = identifiers;
58
+ const points = xs.map((x, i) => PointConstructor.fromCoords([x, ys[i]], `P_${i}`));
59
+ const studentPoints = parseGGBPoints(ans)
60
+ .map((p) => ggbPointToCoords(p))
61
+ .sort((a, b) => a.x - b.x);
62
+ return studentPoints.every((p, i) => Math.abs(p.x - points[i].x.evaluate()) < 0.4 &&
63
+ Math.abs(p.y - points[i].y.evaluate()) < 0.4);
64
+ };
65
+ const getBuildScatterPlotFromDataTableQuestion = () => {
66
+ const xs = randTupleInt(4, {
67
+ from: 0,
68
+ to: 10,
69
+ allDifferent: true,
70
+ sorted: true,
71
+ });
72
+ const ys = randTupleInt(4, {
73
+ from: 0,
74
+ to: 10,
75
+ allDifferent: true,
76
+ sorted: true,
77
+ });
78
+ const identifiers = {
79
+ xs,
80
+ ys,
81
+ };
82
+ return getQuestionFromIdentifiers(identifiers);
83
+ };
84
+ const getQuestionFromIdentifiers = (identifiers) => {
85
+ return {
86
+ ggbAnswer: getGGBAnswer(identifiers),
87
+ instruction: getInstruction(identifiers),
88
+ studentGgbOptions: getStudentGGBOptions(identifiers),
89
+ identifiers,
90
+ hint: getHint(identifiers),
91
+ correction: getCorrection(identifiers),
92
+ };
93
+ };
94
+ export const buildScatterPlotFromDataTable = {
95
+ id: "buildScatterPlotFromDataTable",
96
+ label: "Construire le nuage de points associé à un tableau de données",
97
+ isSingleStep: true,
98
+ generator: (nb, opts) => getDistinctQuestions(() => getBuildScatterPlotFromDataTableQuestion(opts), nb),
99
+ ggbTimer: 60,
100
+ isGGBAnswerValid,
101
+ subject: "Mathématiques",
102
+ getHint,
103
+ getInstruction,
104
+ getCorrection,
105
+ getGGBAnswer,
106
+ getStudentGGBOptions,
107
+ answerType: "GGB",
108
+ getQuestionFromIdentifiers,
109
+ hasHintAndCorrection: true,
110
+ };
@@ -1,3 +1,5 @@
1
1
  export * from "./averagePoint.js";
2
2
  export * from "./fineAdjustementExercise.js";
3
+ export * from "./buildDataTableFromScatterplot.js";
4
+ export * from "./buildScatterPlotFromDataTable.js";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export * from "./averagePoint.js";
2
2
  export * from "./fineAdjustementExercise.js";
3
+ export * from "./buildDataTableFromScatterplot.js";
4
+ export * from "./buildScatterPlotFromDataTable.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ q: number;
4
+ start: number;
5
+ };
6
+ export declare const compareGeometricReasonWithOneFromGraph: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=compareGeometricReasonWithOneFromGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compareGeometricReasonWithOneFromGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/graph/compareGeometricReasonWithOneFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAiFF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,WAAW,CAuBxE,CAAC"}
@@ -0,0 +1,87 @@
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 { randfloat } from "../../../../../math/utils/random/randfloat.js";
5
+ import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
6
+ const getPropositions = (n, { answer }) => {
7
+ const propositions = [];
8
+ addValidProp(propositions, answer);
9
+ tryToAddWrongProp(propositions, "q>1");
10
+ tryToAddWrongProp(propositions, "q=1");
11
+ tryToAddWrongProp(propositions, "0<q<1");
12
+ tryToAddWrongProp(propositions, "q<0");
13
+ return shuffleProps(propositions, n);
14
+ };
15
+ const getAnswer = (identifiers) => {
16
+ const { q } = identifiers;
17
+ return q > 1 ? "q>1" : "0<q<1";
18
+ };
19
+ const getInstruction = () => {
20
+ return `On donne ci-dessous le nuage de points représentant une suite géométrique $u$.
21
+
22
+ Que peut-on dire sur la raison $q$ de cette suite ?`;
23
+ };
24
+ const getHint = () => {
25
+ return `La raison d'une suite géométrique est le nombre par lequel on multiplie un terme pour passer au suivant.
26
+
27
+ Ici, le sens de variations de la suite te donne une indication sur ce nombre : les termes de la suite augmentent-ils en fonction du rang, ou bien diminuent-ils ?`;
28
+ };
29
+ const getCorrection = (identifiers) => {
30
+ const { q } = identifiers;
31
+ return `Le nuage de points de la suite $u$ montre qu'elle est ${q > 1 ? "croissante" : "décroissante"}.
32
+
33
+ Or, une suite géométrique est :
34
+ - croissante si et seulement si $q>1$;
35
+ - décroissante si et seulement si $0<q<1$.
36
+
37
+ Ici, on peut donc affirmer que $${getAnswer(identifiers)}$.`;
38
+ };
39
+ const getGGBOptions = (identifiers) => {
40
+ const { q, start } = identifiers;
41
+ const ggb = new GeogebraConstructor({
42
+ commands: [`Sequence((n, ${start}*${q}^n), n, 0, 50)`],
43
+ lockedAxesRatio: false,
44
+ gridDistance: false,
45
+ });
46
+ const max = Math.max(start, q ** 4 * start);
47
+ return ggb.getOptions({
48
+ coords: [-1, 5, Math.min(-1, -max * 0.1), 1.2 * max],
49
+ });
50
+ };
51
+ const getCompareGeometricReasonWithOneFromGraphQuestion = () => {
52
+ const start = randfloat(0.5, 4, 2);
53
+ const q = coinFlip() ? randfloat(0.1, 1, 2, [1]) : randfloat(1.1, 5, 2);
54
+ const identifiers = { q, start };
55
+ return getQuestionFromIdentifiers(identifiers);
56
+ };
57
+ const getQuestionFromIdentifiers = (identifiers) => {
58
+ return {
59
+ answer: getAnswer(identifiers),
60
+ instruction: getInstruction(identifiers),
61
+ keys: [],
62
+ answerFormat: "tex",
63
+ identifiers,
64
+ hint: getHint(identifiers),
65
+ correction: getCorrection(identifiers),
66
+ ggbOptions: getGGBOptions(identifiers),
67
+ };
68
+ };
69
+ export const compareGeometricReasonWithOneFromGraph = {
70
+ id: "compareGeometricReasonWithOneFromGraph",
71
+ label: "Comparer la raison d'une suite géométrique avec $1$ à partir de son nuage de points",
72
+ isSingleStep: true,
73
+ generator: (nb, opts) => getDistinctQuestions(() => getCompareGeometricReasonWithOneFromGraphQuestion(opts), nb),
74
+ qcmTimer: 60,
75
+ freeTimer: 60,
76
+ getPropositions,
77
+ subject: "Mathématiques",
78
+ getHint,
79
+ getCorrection,
80
+ getInstruction,
81
+ getAnswer,
82
+ getGGBOptions,
83
+ hasGeogebra: true,
84
+ getQuestionFromIdentifiers,
85
+ answerType: "QCU",
86
+ hasHintAndCorrection: true,
87
+ };
@@ -1,2 +1,5 @@
1
- export * from "./geometricPlaceFirstPoints.js";
1
+ export * from "./recognizeGeometricFromGraph.js";
2
+ export * from "./plausibleGeometricSequenceExpressionFromGraph.js";
3
+ export * from "./readGeometricExpressionFromGraph.js";
4
+ export * from "./compareGeometricReasonWithOneFromGraph.js";
2
5
  //# sourceMappingURL=index.d.ts.map