math-exercises 3.0.130 → 3.0.132
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/exercise.d.ts +37 -30
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +3 -3
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +48 -44
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.js +3 -3
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +0 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +2 -0
- package/lib/exercises/math/calcul/rounding/rounding.d.ts +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.js +7 -6
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.js +15 -11
- package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +6 -5
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +0 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -1
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +15 -60
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +14 -10
- package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +1 -0
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
- package/lib/exercises/math/conversion/prefixToNumber.js +10 -8
- package/lib/exercises/math/conversion/secondsToHours.js +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +2 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +4 -5
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +10 -11
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +8 -8
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +2 -2
- package/lib/exercises/math/percent/evolutions/evolutionRateFromValues.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/evolutionRateFromValues.js +29 -16
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts +4 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.js +37 -21
- package/lib/exercises/math/percent/findProportion.d.ts +1 -5
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +67 -75
- package/lib/exercises/math/percent/percentToDecimal.d.ts +4 -1
- package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/percent/percentToDecimal.js +55 -35
- package/lib/exercises/math/powers/calculateNegativePower.d.ts +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +17 -10
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts +5 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +76 -12
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +3 -3
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +17 -45
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +12 -5
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +354 -94
- package/lib/exercises/math/probaStat/randomVariable/randomVariableAverage.js +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +4 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +43 -23
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +4 -4
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +13 -10
- package/lib/exercises/pc/optics/lensFormula.d.ts +1 -2
- package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -1
- package/lib/exercises/pc/optics/lensFormula.js +7 -10
- package/lib/exercises/pc/weight/calculateWeight.d.ts +1 -2
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +15 -14
- package/lib/exercises/vea/isNodesEqual.d.ts +3 -0
- package/lib/exercises/vea/isNodesEqual.d.ts.map +1 -0
- package/lib/exercises/vea/isNodesEqual.js +6 -0
- package/lib/exercises/vea/setVEA.d.ts +5 -0
- package/lib/exercises/vea/setVEA.d.ts.map +1 -0
- package/lib/exercises/vea/setVEA.js +25 -0
- package/lib/index.d.ts +932 -934
- package/lib/index.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.d.ts +2 -2
- package/lib/math/progCalc/progCalc.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.js +4 -11
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +13 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -25,8 +25,14 @@ const isNodeContainingOperatorId = (node, opId) => {
|
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
+
const rebuildIdentifiers = (oldIds) => {
|
|
29
|
+
const newIds = Object.assign({}, oldIds, {
|
|
30
|
+
isPowerAllowed: true,
|
|
31
|
+
});
|
|
32
|
+
return newIds;
|
|
33
|
+
};
|
|
28
34
|
const getInstruction = (identifiers) => {
|
|
29
|
-
const { int, power,
|
|
35
|
+
const { int, power, isPowerAllowed } = identifiers;
|
|
30
36
|
const statement = new PowerNode(new NumberNode(int), new NumberNode(power)).toTex();
|
|
31
37
|
return `Calculer et donner le résultat sous la forme d'une fraction ou d'un entier :
|
|
32
38
|
|
|
@@ -34,14 +40,14 @@ $$
|
|
|
34
40
|
${statement}
|
|
35
41
|
$$
|
|
36
42
|
|
|
37
|
-
${
|
|
43
|
+
${isPowerAllowed
|
|
38
44
|
? `La réponse pourra comporter un exposant.`
|
|
39
45
|
: `La réponse ne devra comporter aucun exposant.`}`;
|
|
40
46
|
};
|
|
41
47
|
const getAnswer = (identifiers) => {
|
|
42
|
-
const { int, power,
|
|
48
|
+
const { int, power, isPowerAllowed } = identifiers;
|
|
43
49
|
const powerNode = new PowerNode(int.toTree(), Math.abs(power).toTree());
|
|
44
|
-
const fraction = frac(1,
|
|
50
|
+
const fraction = frac(1, isPowerAllowed ? powerNode : powerNode.evaluate().toTree());
|
|
45
51
|
const answer = fraction.simplify();
|
|
46
52
|
return answer.toTex();
|
|
47
53
|
};
|
|
@@ -53,7 +59,7 @@ a^{-x} = \\frac{1}{a^x}
|
|
|
53
59
|
$$`;
|
|
54
60
|
};
|
|
55
61
|
const getCorrection = (identifiers) => {
|
|
56
|
-
const { int, power,
|
|
62
|
+
const { int, power, isPowerAllowed } = identifiers;
|
|
57
63
|
const statement = new PowerNode(new NumberNode(int), new NumberNode(power)).toTex();
|
|
58
64
|
const fraction = frac(1, new PowerNode(int.toTree(), Math.abs(power).toTree()));
|
|
59
65
|
const simplificationTex = fraction.toSimplificationTex();
|
|
@@ -64,7 +70,7 @@ ${statement} = ${simplificationTex}
|
|
|
64
70
|
$$
|
|
65
71
|
|
|
66
72
|
${(() => {
|
|
67
|
-
if (!
|
|
73
|
+
if (!isPowerAllowed) {
|
|
68
74
|
const fractionNoPower = frac(1, new PowerNode(int.toTree(), Math.abs(power).toTree()).evaluate().toTree());
|
|
69
75
|
const texNoPower = fractionNoPower.toTex();
|
|
70
76
|
return !simplificationTex.includes(texNoPower)
|
|
@@ -105,12 +111,12 @@ const getPropositions = (n, { answer, int, power }) => {
|
|
|
105
111
|
});
|
|
106
112
|
return shuffleProps(propositions, n);
|
|
107
113
|
};
|
|
108
|
-
const isAnswerValid = (ans, { answer,
|
|
114
|
+
const isAnswerValid = (ans, { answer, isPowerAllowed }) => {
|
|
109
115
|
try {
|
|
110
116
|
const parsed = parseAlgebraic(ans);
|
|
111
117
|
if (!isNumberNode(parsed) &&
|
|
112
118
|
!(isFractionNode(parsed) &&
|
|
113
|
-
(
|
|
119
|
+
(isPowerAllowed ||
|
|
114
120
|
!isNodeContainingOperatorId(parsed, OperatorIds.power)))) {
|
|
115
121
|
return false;
|
|
116
122
|
}
|
|
@@ -122,9 +128,10 @@ const isAnswerValid = (ans, { answer, opts }) => {
|
|
|
122
128
|
};
|
|
123
129
|
const getCalculatePowerQuestion = (optsIn) => {
|
|
124
130
|
const opts = optsIn ?? optsDefault;
|
|
131
|
+
const isPowerAllowed = opts.isPowerAllowed;
|
|
125
132
|
const int = randint(1, 11);
|
|
126
133
|
const power = randint(-5, 0);
|
|
127
|
-
const identifiers = { int, power,
|
|
134
|
+
const identifiers = { int, power, isPowerAllowed };
|
|
128
135
|
return getQuestionFromIdentifiers(identifiers, opts);
|
|
129
136
|
};
|
|
130
137
|
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
@@ -149,7 +156,6 @@ const options = [
|
|
|
149
156
|
label: "Exposant accepté dans la réponse",
|
|
150
157
|
target: GeneratorOptionTarget.generation,
|
|
151
158
|
type: GeneratorOptionType.checkbox,
|
|
152
|
-
values: [true, false],
|
|
153
159
|
defaultValue: optsDefault.isPowerAllowed,
|
|
154
160
|
},
|
|
155
161
|
];
|
|
@@ -168,4 +174,5 @@ export const calculateNegativePower = {
|
|
|
168
174
|
getQuestionFromIdentifiers,
|
|
169
175
|
hasHintAndCorrection: true,
|
|
170
176
|
shouldHaveCalculator: false,
|
|
177
|
+
rebuildIdentifiers: rebuildIdentifiers,
|
|
171
178
|
};
|
|
@@ -2,7 +2,11 @@ import { Exercise } from "../../../../exercises/exercise.js";
|
|
|
2
2
|
type Identifiers = {
|
|
3
3
|
values: number[];
|
|
4
4
|
target: number;
|
|
5
|
+
allowedAnsType: string[];
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
+
type Options = {
|
|
8
|
+
allowedAnsType: string[];
|
|
9
|
+
};
|
|
10
|
+
export declare const calculateFrequencyInList: Exercise<Identifiers, Options>;
|
|
7
11
|
export {};
|
|
8
12
|
//# sourceMappingURL=calculateFrequencyInList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateFrequencyInList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicStats/calculateFrequencyInList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"calculateFrequencyInList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicStats/calculateFrequencyInList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AA8LF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAsBF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBnE,CAAC"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { round } from "../../../../math/utils/round.js";
|
|
5
6
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
6
8
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
7
9
|
import { probaFlip } from "../../../../utils/alea/probaFlip.js";
|
|
8
10
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
|
+
const rebuildIdentifiers = (oldIds) => {
|
|
12
|
+
const newIds = Object.assign({}, oldIds, {
|
|
13
|
+
allowedAnsType: ["exacte", "arrondie à 2 décimales"],
|
|
14
|
+
});
|
|
15
|
+
return newIds;
|
|
16
|
+
};
|
|
9
17
|
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
10
18
|
const propositions = [];
|
|
11
19
|
addValidProp(propositions, answer);
|
|
@@ -17,13 +25,17 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
17
25
|
});
|
|
18
26
|
return shuffleProps(propositions, n);
|
|
19
27
|
};
|
|
20
|
-
const
|
|
21
|
-
const { target, values } = identifiers;
|
|
28
|
+
const getAnswerNode = (identifiers) => {
|
|
29
|
+
const { target, values, allowedAnsType } = identifiers;
|
|
22
30
|
const nb = values.filter((v) => v === target).length;
|
|
23
|
-
|
|
31
|
+
const exactNode = frac(nb, values.length);
|
|
32
|
+
return createFormattedNode(exactNode, getStrInternalAllowedAnswerTypes(allowedAnsType));
|
|
33
|
+
};
|
|
34
|
+
const getAnswer = (identifiers) => {
|
|
35
|
+
return getAnswerNode(identifiers).toTex();
|
|
24
36
|
};
|
|
25
37
|
const getInstruction = (identifiers) => {
|
|
26
|
-
const { target, values } = identifiers;
|
|
38
|
+
const { target, values, allowedAnsType } = identifiers;
|
|
27
39
|
const length = values.length;
|
|
28
40
|
return `Voici une liste de nombres :
|
|
29
41
|
|
|
@@ -35,7 +47,7 @@ $$
|
|
|
35
47
|
|
|
36
48
|
Quelle est la fréquence d'apparition du nombre $${target}$ dans cette liste ?
|
|
37
49
|
|
|
38
|
-
Donner
|
|
50
|
+
Donner ${getStrAllowedAnswerTypes(getStrInternalAllowedAnswerTypes(allowedAnsType))}.`;
|
|
39
51
|
};
|
|
40
52
|
const getHint = (identifiers) => {
|
|
41
53
|
const { target } = identifiers;
|
|
@@ -59,25 +71,32 @@ $$
|
|
|
59
71
|
const getKeys = () => {
|
|
60
72
|
return ["percent"];
|
|
61
73
|
};
|
|
62
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
74
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
63
75
|
try {
|
|
76
|
+
let ansNode;
|
|
64
77
|
if (ans.includes("%")) {
|
|
65
78
|
const formated = ans.replace("\\%", "");
|
|
66
79
|
const nb = formated.unfrenchify();
|
|
67
80
|
if (isNaN(nb))
|
|
68
81
|
return false;
|
|
69
|
-
|
|
82
|
+
ansNode = frac(nb, 100);
|
|
70
83
|
}
|
|
71
84
|
else {
|
|
72
|
-
|
|
73
|
-
return parsed.simplify({ fractionsToDecimal: true }).toTex() === answer;
|
|
85
|
+
ansNode = parseAlgebraic(ans);
|
|
74
86
|
}
|
|
87
|
+
if (!ansNode)
|
|
88
|
+
return false;
|
|
89
|
+
return getAllValidNodes(identifiers).some((answerNode) => {
|
|
90
|
+
return substract(ansNode, answerNode).simplify().evaluate() === 0;
|
|
91
|
+
});
|
|
75
92
|
}
|
|
76
93
|
catch (err) {
|
|
77
94
|
return handleVEAError(err);
|
|
78
95
|
}
|
|
79
96
|
};
|
|
80
|
-
const getCalculateFrequencyInListQuestion = () => {
|
|
97
|
+
const getCalculateFrequencyInListQuestion = (optsIn) => {
|
|
98
|
+
const opts = optsIn ?? optsDefault;
|
|
99
|
+
const allowedAnsType = opts.allowedAnsType;
|
|
81
100
|
const target = randint(1, 10);
|
|
82
101
|
const length = randint(6, 13);
|
|
83
102
|
const values = [];
|
|
@@ -87,10 +106,11 @@ const getCalculateFrequencyInListQuestion = () => {
|
|
|
87
106
|
const identifiers = {
|
|
88
107
|
target,
|
|
89
108
|
values,
|
|
109
|
+
allowedAnsType,
|
|
90
110
|
};
|
|
91
111
|
return getQuestionFromIdentifiers(identifiers);
|
|
92
112
|
};
|
|
93
|
-
const getQuestionFromIdentifiers = (identifiers) => {
|
|
113
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
94
114
|
return {
|
|
95
115
|
answer: getAnswer(identifiers),
|
|
96
116
|
instruction: getInstruction(identifiers),
|
|
@@ -99,14 +119,57 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
99
119
|
identifiers,
|
|
100
120
|
hint: getHint(identifiers),
|
|
101
121
|
correction: getCorrection(identifiers),
|
|
122
|
+
options: opts,
|
|
102
123
|
};
|
|
103
124
|
};
|
|
125
|
+
const getStrInternalAllowedAnswerTypes = (allowedAnsType) => {
|
|
126
|
+
return allowedAnsType.toSorted((a, b) => a.localeCompare(b)).join(" | ");
|
|
127
|
+
};
|
|
128
|
+
const getStrAllowedAnswerTypes = (strInternalAllowedAnswerTypes) => {
|
|
129
|
+
switch (strInternalAllowedAnswerTypes) {
|
|
130
|
+
case "arrondie à 2 décimales | exacte":
|
|
131
|
+
return "la valeur exacte ou la valeur arrondie à $2$ décimales";
|
|
132
|
+
case "arrondie à 2 décimales":
|
|
133
|
+
return "la valeur arrondie à $2$ décimales";
|
|
134
|
+
case "exacte":
|
|
135
|
+
return "la valeur exacte";
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const createFormattedNode = (exactNode, strInternalAllowedAnswerTypes) => {
|
|
139
|
+
switch (strInternalAllowedAnswerTypes) {
|
|
140
|
+
case "arrondie à 2 décimales":
|
|
141
|
+
return round(exactNode.evaluate(), 2).toTree();
|
|
142
|
+
default:
|
|
143
|
+
return exactNode;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const getAllValidNodes = (identifiers) => {
|
|
147
|
+
return identifiers.allowedAnsType.map((ansType) => getAnswerNode((() => {
|
|
148
|
+
const identifiersCopy = Object.assign({}, identifiers);
|
|
149
|
+
identifiersCopy.allowedAnsType = [ansType];
|
|
150
|
+
return identifiersCopy;
|
|
151
|
+
})()));
|
|
152
|
+
};
|
|
153
|
+
const optsDefault = {
|
|
154
|
+
allowedAnsType: ["exacte", "arrondie à 2 décimales"],
|
|
155
|
+
};
|
|
156
|
+
const options = [
|
|
157
|
+
{
|
|
158
|
+
id: "allowedAnsType",
|
|
159
|
+
label: "Forme de réponse acceptée",
|
|
160
|
+
target: GeneratorOptionTarget.generation,
|
|
161
|
+
type: GeneratorOptionType.multiselect,
|
|
162
|
+
values: ["exacte", "arrondie à 2 décimales"],
|
|
163
|
+
defaultValue: optsDefault.allowedAnsType,
|
|
164
|
+
},
|
|
165
|
+
];
|
|
104
166
|
export const calculateFrequencyInList = {
|
|
105
167
|
id: "calculateFrequencyInList",
|
|
106
168
|
connector: "=",
|
|
107
169
|
label: "Calculer la fréquence d'apparition d'un nombre dans une liste",
|
|
108
170
|
isSingleStep: true,
|
|
109
171
|
generator: (nb, opts) => getDistinctQuestions(() => getCalculateFrequencyInListQuestion(opts), nb),
|
|
172
|
+
options,
|
|
110
173
|
qcmTimer: 60,
|
|
111
174
|
freeTimer: 60,
|
|
112
175
|
getPropositions,
|
|
@@ -114,4 +177,5 @@ export const calculateFrequencyInList = {
|
|
|
114
177
|
subject: "Mathématiques",
|
|
115
178
|
getQuestionFromIdentifiers,
|
|
116
179
|
hasHintAndCorrection: true,
|
|
180
|
+
rebuildIdentifiers: rebuildIdentifiers,
|
|
117
181
|
};
|
|
@@ -207,7 +207,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
207
207
|
export const conditionalProbaWriteFromFrench = {
|
|
208
208
|
id: "conditionalProbaWriteFromFrench",
|
|
209
209
|
connector: "=",
|
|
210
|
-
label: "
|
|
210
|
+
label: "Écrire une probabilité en langage mathématique",
|
|
211
211
|
isSingleStep: false,
|
|
212
212
|
generator: (nb) => getDistinctQuestions(getConditionalProbaWriteFromFrenchQuestion, nb),
|
|
213
213
|
qcmTimer: 60,
|
|
@@ -20,9 +20,9 @@ type EventIdentifiers = {
|
|
|
20
20
|
isTailoredStr: boolean;
|
|
21
21
|
};
|
|
22
22
|
type Options = {
|
|
23
|
-
nbElem:
|
|
24
|
-
unionLength:
|
|
25
|
-
isProbasAreNumbers: boolean
|
|
23
|
+
nbElem: string[];
|
|
24
|
+
unionLength: string[];
|
|
25
|
+
isProbasAreNumbers: boolean;
|
|
26
26
|
};
|
|
27
27
|
export declare const probaAsSumOfProbas: Exercise<Identifiers, Options>;
|
|
28
28
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaAsSumOfProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaAsSumOfProbas.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAkBT,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"probaAsSumOfProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaAsSumOfProbas.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAkBT,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAa7C,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,gBAAgB,GACjB;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,eAAe,CAAC;CACpB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,eAAe,CAAC;IACnB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AA4eN,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAqRF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe7D,CAAC"}
|
|
@@ -112,7 +112,7 @@ class SituationConstructor {
|
|
|
112
112
|
const str = `On lance un dé à $${nbSides}$ faces numérotées de $1$ à $${nbSides}$.
|
|
113
113
|
Le dé n'est pas équilibré.`;
|
|
114
114
|
const strElem = `Pour $i$ allant de $1$ à $${nbSides}$, on note $E_i$ l'évènement:
|
|
115
|
-
"Le résultat est $i
|
|
115
|
+
"Le résultat est $i$".`;
|
|
116
116
|
const nbPickSomeElem = Math.min(nbSides, 6);
|
|
117
117
|
const allIndexesElem = [...Array(nbSides).keys()].map((i) => i + 1);
|
|
118
118
|
const dictAllElem = Object.fromEntries(allIndexesElem.map((index) => [
|
|
@@ -342,9 +342,9 @@ $$`;
|
|
|
342
342
|
return strCorrection;
|
|
343
343
|
};
|
|
344
344
|
const optsDefault = {
|
|
345
|
-
nbElem: [4, 6, 10, 12],
|
|
346
|
-
unionLength: [2, 3, 4, 5],
|
|
347
|
-
isProbasAreNumbers:
|
|
345
|
+
nbElem: ["4", "6", "10", "12"],
|
|
346
|
+
unionLength: ["2", "3", "4", "5"],
|
|
347
|
+
isProbasAreNumbers: true,
|
|
348
348
|
};
|
|
349
349
|
const options = [
|
|
350
350
|
{
|
|
@@ -352,7 +352,7 @@ const options = [
|
|
|
352
352
|
label: "Nombre d'évènements élémentaires",
|
|
353
353
|
type: GeneratorOptionType.multiselect,
|
|
354
354
|
target: GeneratorOptionTarget.generation,
|
|
355
|
-
values: [4, 6, 10, 12],
|
|
355
|
+
values: ["4", "6", "10", "12"],
|
|
356
356
|
defaultValue: optsDefault.nbElem,
|
|
357
357
|
},
|
|
358
358
|
{
|
|
@@ -360,47 +360,19 @@ const options = [
|
|
|
360
360
|
label: "Longueur de l'union",
|
|
361
361
|
type: GeneratorOptionType.multiselect,
|
|
362
362
|
target: GeneratorOptionTarget.generation,
|
|
363
|
-
values: [2, 3, 4, 5, 6],
|
|
363
|
+
values: ["2", "3", "4", "5", "6"],
|
|
364
364
|
defaultValue: optsDefault.unionLength,
|
|
365
365
|
},
|
|
366
|
-
{
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
},
|
|
366
|
+
// {
|
|
367
|
+
// id: "isProbasAreNumbers",
|
|
368
|
+
// label: "Probabilités sous forme de nombres ?",
|
|
369
|
+
// type: GeneratorOptionType.checkbox,
|
|
370
|
+
// target: GeneratorOptionTarget.generation,
|
|
371
|
+
// defaultValue: optsDefault.isProbasAreNumbers,
|
|
372
|
+
// },
|
|
374
373
|
];
|
|
375
|
-
const getKeys = (
|
|
376
|
-
|
|
377
|
-
const isProbasAreNumbers = true;
|
|
378
|
-
const situation = arrayOfSituations[indexSituation];
|
|
379
|
-
return [
|
|
380
|
-
...[
|
|
381
|
-
...new Set(situation.someElem
|
|
382
|
-
.map((event) => {
|
|
383
|
-
if (isProbasAreNumbers) {
|
|
384
|
-
const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
|
|
385
|
-
return finiteProbDistr.getPForIndex(event.index).simplify();
|
|
386
|
-
}
|
|
387
|
-
else {
|
|
388
|
-
return event.p;
|
|
389
|
-
}
|
|
390
|
-
})
|
|
391
|
-
.map((node) => node.toTex())),
|
|
392
|
-
].map((tex) => {
|
|
393
|
-
return {
|
|
394
|
-
id: "custom",
|
|
395
|
-
label: tex,
|
|
396
|
-
labelType: "tex",
|
|
397
|
-
mathfieldInstructions: {
|
|
398
|
-
method: "write",
|
|
399
|
-
content: tex,
|
|
400
|
-
},
|
|
401
|
-
};
|
|
402
|
-
}),
|
|
403
|
-
];
|
|
374
|
+
const getKeys = () => {
|
|
375
|
+
return [];
|
|
404
376
|
};
|
|
405
377
|
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
406
378
|
const { eventIds, arrProba } = identifiers;
|
|
@@ -499,7 +471,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
499
471
|
};
|
|
500
472
|
const getProbaAsSumOfProbasQuestion = (optsIn) => {
|
|
501
473
|
const opts = Object.assign(optsDefault, optsIn) ?? optsDefault;
|
|
502
|
-
const unionLength = random(opts.unionLength);
|
|
474
|
+
const unionLength = Number(random(opts.unionLength));
|
|
503
475
|
const indexSituation = random([...Array(arrayOfSituations.length).keys()].filter((indexSituation) => {
|
|
504
476
|
const situation = arrayOfSituations[indexSituation];
|
|
505
477
|
return situation.someElem.length >= unionLength;
|
|
@@ -509,7 +481,7 @@ const getProbaAsSumOfProbasQuestion = (optsIn) => {
|
|
|
509
481
|
const eventIds = evUnion.toIdentifiers();
|
|
510
482
|
const nbUnique = Math.min(randint(3, 7), situation.allElem.length - 1);
|
|
511
483
|
const finiteProbDistr = FiniteProbDistrConstructor.randomDistr(situation.allElem.length, nbUnique);
|
|
512
|
-
const isProbasAreNumbers =
|
|
484
|
+
const isProbasAreNumbers = opts.isProbasAreNumbers;
|
|
513
485
|
const identifiers = {
|
|
514
486
|
indexSituation,
|
|
515
487
|
eventIds,
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
2
|
type Identifiers = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
indexSituation: number;
|
|
4
|
+
values: {
|
|
5
|
+
"A \\cap B": number;
|
|
6
|
+
"A \\cap \\overline{B}": number;
|
|
7
|
+
"\\overline{A} \\cap B": number;
|
|
8
|
+
"\\overline{A} \\cap \\overline{B}": number;
|
|
9
|
+
};
|
|
7
10
|
event: string;
|
|
8
11
|
type: string;
|
|
9
12
|
probaFrac: number[];
|
|
13
|
+
allowedAnsType: string[];
|
|
10
14
|
};
|
|
11
|
-
|
|
15
|
+
type Options = {
|
|
16
|
+
allowedAnsType: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare const probaFromTableWithContext: Exercise<Identifiers, Options>;
|
|
12
19
|
export {};
|
|
13
20
|
//# sourceMappingURL=probaFromTableWithContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,uBAAuB,EAAE,MAAM,CAAC;QAChC,uBAAuB,EAAE,MAAM,CAAC;QAChC,mCAAmC,EAAE,MAAM,CAAC;KAC7C,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAqpBF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAsBF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
|