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
|
@@ -1,131 +1,194 @@
|
|
|
1
|
-
import {
|
|
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 = (
|
|
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 = (
|
|
67
|
-
const {
|
|
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 = (
|
|
79
|
-
const
|
|
80
|
-
|
|
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
|
|
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
|
|
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(
|
|
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, {
|
|
164
|
-
|
|
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
|
};
|
package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
rank1: number;
|
|
4
|
+
value1: number;
|
|
5
|
+
rank2: number;
|
|
6
|
+
value2: number;
|
|
7
|
+
precisionInitial: number;
|
|
8
|
+
precisionReason: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const geometricFindNextTermFromTwoConsecutiveTerms: Exercise<Identifiers>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map
|
package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricFindNextTermFromTwoConsecutiveTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AA2OF,eAAO,MAAM,4CAA4C,EAAE,QAAQ,CAAC,WAAW,CAmB5E,CAAC"}
|
package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../../math/utils/round.js";
|
|
7
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
10
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
11
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
12
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
13
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
14
|
+
const getInstruction = (identifiers) => {
|
|
15
|
+
const { rank1, value1, rank2, value2 } = identifiers;
|
|
16
|
+
const rankAsked = round(rank2 + 1, 0);
|
|
17
|
+
return `Soit $u$ une suite géométrique telle que $u_{${rank1.frenchify()}} = ${value1.frenchify()}$ et $u_{${rank2.frenchify()}} = ${value2.frenchify()}$.
|
|
18
|
+
|
|
19
|
+
Que vaut $u_{${rankAsked.frenchify()}}$ ?`;
|
|
20
|
+
};
|
|
21
|
+
const getAnswerStuff = (identifiers) => {
|
|
22
|
+
const { value1, value2 } = identifiers;
|
|
23
|
+
const nodeReason = frac(value2, value1).simplify({ towardsDistribute: true });
|
|
24
|
+
const nodeAnswer = multiply(value2, nodeReason);
|
|
25
|
+
return {
|
|
26
|
+
nodeReason,
|
|
27
|
+
nodeAnswer,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
return getAnswerStuff(identifiers)
|
|
32
|
+
.nodeAnswer.simplify({ towardsDistribute: true })
|
|
33
|
+
.toTex();
|
|
34
|
+
};
|
|
35
|
+
const getHint = (identifiers, _optsIn) => {
|
|
36
|
+
const { rank2 } = identifiers;
|
|
37
|
+
const rankAsked = round(rank2 + 1, 0);
|
|
38
|
+
return `Commence par déterminer la raison $q$ de la suite $u$.
|
|
39
|
+
|
|
40
|
+
Puis, utilise cette raison et un des termes connus de la suite pour déterminer $u_{${rankAsked.frenchify()}}$.`;
|
|
41
|
+
};
|
|
42
|
+
const getCorrection = (identifiers) => {
|
|
43
|
+
const { rank1, value1, rank2, value2 } = identifiers;
|
|
44
|
+
const rankAsked = round(rank2 + 1, 0);
|
|
45
|
+
const { nodeReason, nodeAnswer } = getAnswerStuff(identifiers);
|
|
46
|
+
return `On commence par déterminer la raison $q$ de la suite $u$.
|
|
47
|
+
|
|
48
|
+
On a :
|
|
49
|
+
|
|
50
|
+
${alignTex([
|
|
51
|
+
["q", "=", `\\frac{u_{${rank2}}}{u_{${rank1}}}`],
|
|
52
|
+
["", "=", `\\frac{${value2.frenchify()}}{${value1.frenchify()}}`],
|
|
53
|
+
["", "=", `${nodeReason.toTex()}`],
|
|
54
|
+
])}
|
|
55
|
+
|
|
56
|
+
On peut alors déterminer $u_{${rankAsked.frenchify()}}$ en utilisant $u_{${rank2.frenchify()}}$ et $q$. En effet, on a :
|
|
57
|
+
|
|
58
|
+
${alignTex([
|
|
59
|
+
[
|
|
60
|
+
`u_{${rankAsked.frenchify()}}`,
|
|
61
|
+
"=",
|
|
62
|
+
`u_{${rank2.frenchify()}} \\ \\times \\ q`,
|
|
63
|
+
],
|
|
64
|
+
["", "=", nodeAnswer.toTex()],
|
|
65
|
+
["", "=", nodeAnswer.simplify({ towardsDistribute: true }).toTex()],
|
|
66
|
+
])}
|
|
67
|
+
|
|
68
|
+
`;
|
|
69
|
+
};
|
|
70
|
+
const getPropositions = (n, { answer, ..._identifiers }) => {
|
|
71
|
+
const propositions = [];
|
|
72
|
+
addValidProp(propositions, answer);
|
|
73
|
+
propWhile(propositions, n, () => {
|
|
74
|
+
const identifiersWrong = createRandomIdentifiersCurated();
|
|
75
|
+
const texWrong = getAnswer(identifiersWrong);
|
|
76
|
+
tryToAddWrongProp(propositions, texWrong);
|
|
77
|
+
});
|
|
78
|
+
return shuffle(propositions);
|
|
79
|
+
};
|
|
80
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
81
|
+
try {
|
|
82
|
+
return numberVEA(ans, answer);
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
return handleVEAError(err);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const createRandomIdentifiersRaw = () => {
|
|
89
|
+
const isDivergent = coinFlip();
|
|
90
|
+
const isReasonNegative = coinFlip();
|
|
91
|
+
const signReason = isReasonNegative ? -1 : +1;
|
|
92
|
+
function createGeometricDivergent() {
|
|
93
|
+
const precisionInitial = 1;
|
|
94
|
+
const initial = randfloat(1, 10, precisionInitial, [1]);
|
|
95
|
+
const precisionReason = 0;
|
|
96
|
+
const reason = signReason * randint(2, 10);
|
|
97
|
+
return [initial, precisionInitial, reason, precisionReason];
|
|
98
|
+
}
|
|
99
|
+
function createGeometricConvergent() {
|
|
100
|
+
const poolReasonStuff = [
|
|
101
|
+
{
|
|
102
|
+
q: 0.5,
|
|
103
|
+
precision: 1,
|
|
104
|
+
invQ: 2,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
q: 0.25,
|
|
108
|
+
precision: 2,
|
|
109
|
+
invQ: 4,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
q: 0.2,
|
|
113
|
+
precision: 1,
|
|
114
|
+
invQ: 5,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
q: 0.1,
|
|
118
|
+
precision: 1,
|
|
119
|
+
invQ: 10,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
q: 0.05,
|
|
123
|
+
precision: 2,
|
|
124
|
+
invQ: 20,
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
const { q, invQ, precision: precisionReason } = random(poolReasonStuff);
|
|
128
|
+
const reason = signReason * q;
|
|
129
|
+
const precisionInitial = 0;
|
|
130
|
+
const initial = round(randint(10, 20) * Math.pow(invQ, 8), precisionInitial);
|
|
131
|
+
return [initial, precisionInitial, reason, precisionReason];
|
|
132
|
+
}
|
|
133
|
+
const [initial, precisionInitial, reason, precisionReason] = (() => {
|
|
134
|
+
if (isDivergent) {
|
|
135
|
+
return createGeometricDivergent();
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return createGeometricConvergent();
|
|
139
|
+
}
|
|
140
|
+
})();
|
|
141
|
+
const rank1 = randint(1, 5);
|
|
142
|
+
const rank2 = rank1 + 1;
|
|
143
|
+
const rankAsked = rank2 + 1;
|
|
144
|
+
function valueForRank(initial, reason, rank) {
|
|
145
|
+
return initial * Math.pow(reason, rank);
|
|
146
|
+
}
|
|
147
|
+
const [value1, value2] = [rank1, rank2].map((rank) => round(valueForRank(initial, reason, rank), 4));
|
|
148
|
+
const identifiers = {
|
|
149
|
+
rank1,
|
|
150
|
+
value1,
|
|
151
|
+
rank2,
|
|
152
|
+
value2,
|
|
153
|
+
precisionInitial,
|
|
154
|
+
precisionReason,
|
|
155
|
+
rankAsked,
|
|
156
|
+
};
|
|
157
|
+
return identifiers;
|
|
158
|
+
};
|
|
159
|
+
const createRandomIdentifiersCurated = () => {
|
|
160
|
+
let identifiers;
|
|
161
|
+
let isValid = false;
|
|
162
|
+
let counter = -1;
|
|
163
|
+
while (!isValid && counter < 100) {
|
|
164
|
+
counter++;
|
|
165
|
+
const identifiersCandidate = createRandomIdentifiersRaw();
|
|
166
|
+
getAnswerStuff(identifiersCandidate);
|
|
167
|
+
const answer = getAnswer(identifiersCandidate);
|
|
168
|
+
isValid = !answer.includes("NaN");
|
|
169
|
+
if (isValid) {
|
|
170
|
+
identifiers = identifiersCandidate;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (!isValid) {
|
|
174
|
+
//2.5 * 2^n
|
|
175
|
+
const identifiersDefault = {
|
|
176
|
+
rank1: 2,
|
|
177
|
+
value1: 10,
|
|
178
|
+
rank2: 5,
|
|
179
|
+
value2: 40,
|
|
180
|
+
precisionInitial: 1,
|
|
181
|
+
precisionReason: 0,
|
|
182
|
+
};
|
|
183
|
+
identifiers = identifiersDefault;
|
|
184
|
+
}
|
|
185
|
+
return identifiers;
|
|
186
|
+
};
|
|
187
|
+
const getGeometricFindNextTermFromTwoConsecutiveTermsQuestion = () => {
|
|
188
|
+
const identifiers = createRandomIdentifiersCurated();
|
|
189
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
190
|
+
};
|
|
191
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
192
|
+
const question = {
|
|
193
|
+
answer: getAnswer(identifiers, opts),
|
|
194
|
+
instruction: getInstruction(identifiers, opts),
|
|
195
|
+
keys: [],
|
|
196
|
+
answerFormat: "tex",
|
|
197
|
+
identifiers,
|
|
198
|
+
hint: getHint(identifiers, opts),
|
|
199
|
+
correction: getCorrection(identifiers, opts),
|
|
200
|
+
options: opts,
|
|
201
|
+
};
|
|
202
|
+
return question;
|
|
203
|
+
};
|
|
204
|
+
export const geometricFindNextTermFromTwoConsecutiveTerms = {
|
|
205
|
+
id: "geometricFindNextTermFromTwoConsecutiveTerms",
|
|
206
|
+
connector: "=",
|
|
207
|
+
label: "Connaissant deux termes consécutifs d'une suite géométrique, calculer le terme suivant",
|
|
208
|
+
isSingleStep: true,
|
|
209
|
+
generator: (nb, opts) => getDistinctQuestions(() => getGeometricFindNextTermFromTwoConsecutiveTermsQuestion(opts), nb),
|
|
210
|
+
qcmTimer: 60,
|
|
211
|
+
freeTimer: 60,
|
|
212
|
+
getPropositions,
|
|
213
|
+
isAnswerValid,
|
|
214
|
+
subject: "Mathématiques",
|
|
215
|
+
getQuestionFromIdentifiers,
|
|
216
|
+
hasHintAndCorrection: true,
|
|
217
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { OptionFirstTermRankOne } from "../../../../exercises/options/optionFirstTermRankOne.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
reason: number;
|
|
5
|
+
firstValue: number;
|
|
6
|
+
};
|
|
7
|
+
type Options = OptionFirstTermRankOne;
|
|
8
|
+
export declare const geometricFindRecurrenceFormula: Exercise<Identifiers, Options>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=geometricFindRecurrenceFormula.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricFindRecurrenceFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAgB3D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAuNF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBzE,CAAC"}
|