math-exercises 3.0.77 → 3.0.79
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 +6 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.d.ts +10 -0
- package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.js +112 -0
- package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.js +123 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +3 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +3 -0
- package/lib/exercises/math/calcul/arithmetics/sqrtInequality.d.ts +10 -0
- package/lib/exercises/math/calcul/arithmetics/sqrtInequality.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/sqrtInequality.js +160 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/index.js +1 -0
- package/lib/exercises/math/calcul/fractions/simplifyFractionWithPrimeFactorization.d.ts +8 -0
- package/lib/exercises/math/calcul/fractions/simplifyFractionWithPrimeFactorization.d.ts.map +1 -0
- package/lib/exercises/math/calcul/fractions/simplifyFractionWithPrimeFactorization.js +104 -0
- package/lib/exercises/math/calcul/sign/absoluteNumber.js +1 -1
- package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +5 -1
- package/lib/exercises/math/functions/basics/graphicEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicEquation.js +33 -1
- package/lib/exercises/math/functions/basics/index.d.ts +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -1
- package/lib/exercises/math/functions/basics/twoFunctionsEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/twoFunctionsEquation.js +27 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts +2 -1
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/valueTableCompletion.js +103 -29
- package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/varTableExtremaReading.js +23 -8
- package/lib/exercises/math/geometry/angles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/index.js +1 -0
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts +8 -0
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.js +92 -0
- package/lib/exercises/math/probaStat/checkEquiprobability.d.ts +9 -0
- package/lib/exercises/math/probaStat/checkEquiprobability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/checkEquiprobability.js +129 -0
- package/lib/exercises/math/probaStat/describeEvent.d.ts +15 -0
- package/lib/exercises/math/probaStat/describeEvent.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/describeEvent.js +182 -0
- package/lib/exercises/math/probaStat/getSampleCountAndSize.d.ts +9 -0
- package/lib/exercises/math/probaStat/getSampleCountAndSize.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/getSampleCountAndSize.js +95 -0
- package/lib/exercises/math/probaStat/index.d.ts +4 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +4 -0
- package/lib/exercises/math/probaStat/mostLeastProbable.d.ts +8 -0
- package/lib/exercises/math/probaStat/mostLeastProbable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/mostLeastProbable.js +114 -0
- package/lib/exercises/math/sets/index.d.ts +1 -0
- package/lib/exercises/math/sets/index.d.ts.map +1 -1
- package/lib/exercises/math/sets/index.js +1 -0
- package/lib/exercises/math/sets/subsetsOfKnownSets.d.ts +8 -0
- package/lib/exercises/math/sets/subsetsOfKnownSets.d.ts.map +1 -0
- package/lib/exercises/math/sets/subsetsOfKnownSets.js +99 -0
- package/lib/index.d.ts +41 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +2 -0
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +9 -2
- package/lib/tests/pdfExo.test.d.ts.map +1 -1
- package/lib/tests/pdfExo.test.js +2 -2
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +21 -2
- package/lib/tree/nodes/numbers/numberNode.d.ts +2 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +32 -0
- package/lib/utils/markdown/mdTable.d.ts +1 -1
- package/lib/utils/markdown/mdTable.d.ts.map +1 -1
- package/lib/utils/markdown/mdTable.js +10 -5
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
total: number;
|
|
4
|
+
distribution: number[];
|
|
5
|
+
observe: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const checkEquiprobability: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=checkEquiprobability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkEquiprobability.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/checkEquiprobability.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAsIF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
5
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
6
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
7
|
+
const getPropositions = (n, { answer }) => {
|
|
8
|
+
const propositions = [];
|
|
9
|
+
addValidProp(propositions, answer, "raw");
|
|
10
|
+
const wrong = answer === "Oui" ? "Non" : "Oui";
|
|
11
|
+
tryToAddWrongProp(propositions, wrong, "raw");
|
|
12
|
+
tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
|
|
13
|
+
return shuffleProps(propositions, n);
|
|
14
|
+
};
|
|
15
|
+
const getAnswer = (identifiers) => {
|
|
16
|
+
const { observe, distribution } = identifiers;
|
|
17
|
+
if (observe) {
|
|
18
|
+
return "Oui";
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return distribution.every((v) => v === distribution[0]) ? "Oui" : "Non";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const getInstruction = ({ total, distribution, observe, }) => {
|
|
25
|
+
const colors = ["rouges", "vertes", "bleues", "jaunes"];
|
|
26
|
+
const colorLines = distribution
|
|
27
|
+
.map((count, i) => `$${count}$ cartes sont ${colors[i]}`)
|
|
28
|
+
.join(", ");
|
|
29
|
+
return `Un jeu est constitué de $${total}$ cartes numérotées de $1$ à $${total}$.
|
|
30
|
+
|
|
31
|
+
${colorLines}.
|
|
32
|
+
|
|
33
|
+
On tire une carte au hasard.
|
|
34
|
+
|
|
35
|
+
On observe ${observe ? "le numéro" : "la couleur"} de la carte tirée.
|
|
36
|
+
|
|
37
|
+
Les issues sont-elles équiprobables ?`;
|
|
38
|
+
};
|
|
39
|
+
const getHint = ({ observe }) => {
|
|
40
|
+
if (observe) {
|
|
41
|
+
return `Pense à combien de cartes portent chaque numéro.
|
|
42
|
+
Y a-t-il autant de cartes pour chaque numéro possible ?`;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return `Regarde le nombre de cartes de chaque couleur.
|
|
46
|
+
A-t-on autant de chances d'obtenir toutes les couleurs ?`;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const getCorrection = ({ total, distribution, observe, }) => {
|
|
50
|
+
const colors = ["rouge", "vert", "bleu", "jaune"];
|
|
51
|
+
const probs = distribution
|
|
52
|
+
.map((count, i) => `$$
|
|
53
|
+
P(\\text{${colors[i]}}) = ${frac(count, total).toTex()}
|
|
54
|
+
$$`)
|
|
55
|
+
.join("\n \n");
|
|
56
|
+
const explanation = observe
|
|
57
|
+
? `Chaque carte a un numéro distinct entre $1$ et $${total}$, donc chaque numéro a une probabilité d'être tiré égale à $${frac(1, total).toTex()}$.
|
|
58
|
+
Toutes les issues sont donc équiprobables.`
|
|
59
|
+
: `Les probabilités associées à chaque couleur sont : \n\n ${probs} \n\n
|
|
60
|
+
${distribution.every((v) => v === distribution[0])
|
|
61
|
+
? "Puisqu'il y autant de cartes de chaque couleur, les issues sont équiprobables."
|
|
62
|
+
: "Les couleurs n'ont pas toutes le même nombre de cartes, donc les issues ne sont pas équiprobables."}`;
|
|
63
|
+
return `${explanation}`;
|
|
64
|
+
};
|
|
65
|
+
const getKeys = (identifiers) => {
|
|
66
|
+
return [];
|
|
67
|
+
};
|
|
68
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
69
|
+
try {
|
|
70
|
+
return ans === answer;
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
return handleVEAError(err);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const getCheckEquiprobabilityQuestion = (ops) => {
|
|
77
|
+
let total;
|
|
78
|
+
let distribution;
|
|
79
|
+
const isEquiprobable = coinFlip();
|
|
80
|
+
const observe = coinFlip();
|
|
81
|
+
if (isEquiprobable) {
|
|
82
|
+
total = 4 * randint(10, 30);
|
|
83
|
+
const value = total / 4;
|
|
84
|
+
distribution = [value, value, value, value];
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
total = randint(30, 61);
|
|
88
|
+
const a = randint(2, total - 6);
|
|
89
|
+
const b = randint(2, total - a - 4);
|
|
90
|
+
const c = randint(2, total - a - b - 2);
|
|
91
|
+
const d = total - a - b - c;
|
|
92
|
+
distribution = [a, b, c, d];
|
|
93
|
+
}
|
|
94
|
+
const identifiers = {
|
|
95
|
+
total,
|
|
96
|
+
distribution,
|
|
97
|
+
observe,
|
|
98
|
+
};
|
|
99
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
100
|
+
};
|
|
101
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
102
|
+
return {
|
|
103
|
+
answer: getAnswer(identifiers),
|
|
104
|
+
instruction: getInstruction(identifiers),
|
|
105
|
+
keys: getKeys(identifiers),
|
|
106
|
+
answerFormat: "tex",
|
|
107
|
+
identifiers,
|
|
108
|
+
hint: getHint(identifiers),
|
|
109
|
+
correction: getCorrection(identifiers),
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export const checkEquiprobability = {
|
|
113
|
+
id: "checkEquiprobability",
|
|
114
|
+
label: "Reconnaître une situation équiprobable",
|
|
115
|
+
isSingleStep: true,
|
|
116
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCheckEquiprobabilityQuestion(opts), nb),
|
|
117
|
+
qcmTimer: 60,
|
|
118
|
+
freeTimer: 60,
|
|
119
|
+
getPropositions,
|
|
120
|
+
isAnswerValid,
|
|
121
|
+
subject: "Mathématiques",
|
|
122
|
+
getInstruction,
|
|
123
|
+
getHint,
|
|
124
|
+
getCorrection,
|
|
125
|
+
getAnswer,
|
|
126
|
+
getQuestionFromIdentifiers,
|
|
127
|
+
hasHintAndCorrection: true,
|
|
128
|
+
answerType: "QCU",
|
|
129
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
eventA: {
|
|
4
|
+
desc: string;
|
|
5
|
+
isComplementary: boolean;
|
|
6
|
+
};
|
|
7
|
+
eventB: {
|
|
8
|
+
desc: string;
|
|
9
|
+
isComplementary: boolean;
|
|
10
|
+
};
|
|
11
|
+
question: "union" | "intersection" | "comp";
|
|
12
|
+
};
|
|
13
|
+
export declare const describeEvent: Exercise<Identifiers>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=describeEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describeEvent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/describeEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,QAAQ,EAAE,OAAO,GAAG,cAAc,GAAG,MAAM,CAAC;CAC7C,CAAC;AA0LF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAkB/C,CAAC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
4
|
+
import { random } from "../../../utils/alea/random.js";
|
|
5
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
6
|
+
const getPropositions = (n, { answer, eventA, eventB, question }) => {
|
|
7
|
+
const propositions = [];
|
|
8
|
+
addValidProp(propositions, answer, "raw");
|
|
9
|
+
const flipComplement = (event) => ({
|
|
10
|
+
desc: event.desc,
|
|
11
|
+
isComplementary: !event.isComplementary,
|
|
12
|
+
});
|
|
13
|
+
const generateWrongAnswer = () => {
|
|
14
|
+
const templates = [
|
|
15
|
+
() => {
|
|
16
|
+
const descA = flipComplement(eventA).isComplementary
|
|
17
|
+
? `ne pas ${eventA.desc}`
|
|
18
|
+
: eventA.desc;
|
|
19
|
+
const descB = eventB.isComplementary
|
|
20
|
+
? `ne pas ${eventB.desc}`
|
|
21
|
+
: eventB.desc;
|
|
22
|
+
return `${descA} et ${descB}`;
|
|
23
|
+
},
|
|
24
|
+
() => {
|
|
25
|
+
const descA = eventA.isComplementary
|
|
26
|
+
? `ne pas ${eventA.desc}`
|
|
27
|
+
: eventA.desc;
|
|
28
|
+
const descB = flipComplement(eventB).isComplementary
|
|
29
|
+
? `ne pas ${eventB.desc}`
|
|
30
|
+
: eventB.desc;
|
|
31
|
+
return `${descA} ou ${descB}`;
|
|
32
|
+
},
|
|
33
|
+
() => {
|
|
34
|
+
const descA = flipComplement(eventA).isComplementary
|
|
35
|
+
? `ne pas ${eventA.desc}`
|
|
36
|
+
: eventA.desc;
|
|
37
|
+
const descB = flipComplement(eventB).isComplementary
|
|
38
|
+
? `ne pas ${eventB.desc}`
|
|
39
|
+
: eventB.desc;
|
|
40
|
+
const op = coinFlip() ? "et" : "ou";
|
|
41
|
+
return `${descA} ${op} ${descB}`;
|
|
42
|
+
},
|
|
43
|
+
() => {
|
|
44
|
+
const descA1 = eventA.isComplementary
|
|
45
|
+
? `ne pas ${eventA.desc}`
|
|
46
|
+
: eventA.desc;
|
|
47
|
+
const descA2 = flipComplement(eventA).isComplementary
|
|
48
|
+
? `ne pas ${eventA.desc}`
|
|
49
|
+
: eventA.desc;
|
|
50
|
+
const op = coinFlip() ? "et" : "ou";
|
|
51
|
+
return `${descA1} ${op} ${descA2}`;
|
|
52
|
+
},
|
|
53
|
+
() => {
|
|
54
|
+
return `ne pas ne pas ${eventA.desc}`.replace("ne pas ne pas", eventA.desc);
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
return random(templates)();
|
|
58
|
+
};
|
|
59
|
+
while (propositions.length < n) {
|
|
60
|
+
const wrong = generateWrongAnswer();
|
|
61
|
+
tryToAddWrongProp(propositions, wrong, "raw");
|
|
62
|
+
}
|
|
63
|
+
return shuffleProps(propositions, n);
|
|
64
|
+
};
|
|
65
|
+
const getAnswer = ({ eventA, eventB, question }) => {
|
|
66
|
+
const describe = (e) => e.isComplementary ? `ne pas ${e.desc}` : `${e.desc}`;
|
|
67
|
+
if (question === "comp") {
|
|
68
|
+
return `ne pas ${eventA.desc}`;
|
|
69
|
+
}
|
|
70
|
+
else if (question === "union") {
|
|
71
|
+
return `${describe(eventA)} ou ${describe(eventB)}`;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return `${describe(eventA)} et ${describe(eventB)}`;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const getInstruction = (identifiers) => {
|
|
78
|
+
const { eventA, eventB, question } = identifiers;
|
|
79
|
+
let instruction = `$A$ est l'évènement "${eventA.desc}" et $B$ est l'évènement "${eventB.desc}".\n\n`;
|
|
80
|
+
if (question === "comp") {
|
|
81
|
+
return instruction + `Décrire par une phrase l'évènement $\\overline{A}$.`;
|
|
82
|
+
}
|
|
83
|
+
const overlineA = eventA.isComplementary ? "\\overline{A}" : "A";
|
|
84
|
+
const overlineB = eventB.isComplementary ? "\\overline{B}" : "B";
|
|
85
|
+
const operator = question === "union" ? "\\cup" : "\\cap";
|
|
86
|
+
return (instruction +
|
|
87
|
+
`Décrire par une phrase l'évènement $${overlineA} ${operator} ${overlineB}$.`);
|
|
88
|
+
};
|
|
89
|
+
const getHint = ({ question }) => {
|
|
90
|
+
switch (question) {
|
|
91
|
+
case "comp":
|
|
92
|
+
return `Le contraire ($\\overline{A})$ d'un évènement $A$ signifie que l'évènement ne se réalise pas.`;
|
|
93
|
+
case "union":
|
|
94
|
+
return `L'union ($\\cup$) de deux événements signifie que l'un ou l'autre des évènements (ou les deux) se réalisent.`;
|
|
95
|
+
case "intersection":
|
|
96
|
+
return `L'intersection ($\\cap$) de deux événements signifie que les deux évènements se réalisent en même temps.`;
|
|
97
|
+
default:
|
|
98
|
+
return "";
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const getCorrection = (identifiers) => {
|
|
102
|
+
const { eventA, eventB, question } = identifiers;
|
|
103
|
+
const answer = getAnswer(identifiers);
|
|
104
|
+
if (question === "comp") {
|
|
105
|
+
return `Le contraire de l'évènement "${eventA.desc}" est l'évènement "${answer}".`;
|
|
106
|
+
}
|
|
107
|
+
else if (question === "union") {
|
|
108
|
+
return `L'union signifie que l'un ou l'autre (ou les deux) évènement(s) se produit : "${answer}".`;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
return `L'intersection signifie que les deux évènements se produisent en même temps : "${answer}".`;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const getKeys = (identifiers) => {
|
|
115
|
+
return [];
|
|
116
|
+
};
|
|
117
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
118
|
+
try {
|
|
119
|
+
throw Error("VEA not implemented");
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
return handleVEAError(err);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const getDescribeEventQuestion = (ops) => {
|
|
126
|
+
const allEvents = [
|
|
127
|
+
"trouver des mures",
|
|
128
|
+
"trouver des fraises",
|
|
129
|
+
"trouver des pommes",
|
|
130
|
+
"perdre son parapluie",
|
|
131
|
+
"rater le bus",
|
|
132
|
+
"avoir un bonbon",
|
|
133
|
+
"avoir un bonbon au chocolat",
|
|
134
|
+
"avoir un bonbon à la menthe",
|
|
135
|
+
"avoir un bonbon à la fraise",
|
|
136
|
+
];
|
|
137
|
+
const eventA = {
|
|
138
|
+
desc: random(allEvents),
|
|
139
|
+
isComplementary: coinFlip(),
|
|
140
|
+
};
|
|
141
|
+
const eventB = {
|
|
142
|
+
desc: random(allEvents.filter((e) => e !== eventA.desc)),
|
|
143
|
+
isComplementary: coinFlip(),
|
|
144
|
+
};
|
|
145
|
+
const questionTypes = [
|
|
146
|
+
"union",
|
|
147
|
+
"intersection",
|
|
148
|
+
"comp",
|
|
149
|
+
];
|
|
150
|
+
const question = random(questionTypes);
|
|
151
|
+
const identifiers = { eventA, eventB, question };
|
|
152
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
153
|
+
};
|
|
154
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
155
|
+
return {
|
|
156
|
+
answer: getAnswer(identifiers),
|
|
157
|
+
instruction: getInstruction(identifiers),
|
|
158
|
+
keys: getKeys(identifiers),
|
|
159
|
+
answerFormat: "raw",
|
|
160
|
+
identifiers,
|
|
161
|
+
hint: getHint(identifiers),
|
|
162
|
+
correction: getCorrection(identifiers),
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export const describeEvent = {
|
|
166
|
+
id: "describeEvent",
|
|
167
|
+
label: "Décrire un évènement en une phrase à partir de sa notation",
|
|
168
|
+
isSingleStep: true,
|
|
169
|
+
generator: (nb, opts) => getDistinctQuestions(() => getDescribeEventQuestion(opts), nb),
|
|
170
|
+
qcmTimer: 60,
|
|
171
|
+
freeTimer: 60,
|
|
172
|
+
getPropositions,
|
|
173
|
+
isAnswerValid,
|
|
174
|
+
subject: "Mathématiques",
|
|
175
|
+
getInstruction,
|
|
176
|
+
getHint,
|
|
177
|
+
getCorrection,
|
|
178
|
+
getAnswer,
|
|
179
|
+
getQuestionFromIdentifiers,
|
|
180
|
+
hasHintAndCorrection: true,
|
|
181
|
+
answerType: "QCU",
|
|
182
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
expCount: number;
|
|
4
|
+
repCount: number;
|
|
5
|
+
isSize: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const getSampleCountAndSize: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=getSampleCountAndSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSampleCountAndSize.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/getSampleCountAndSize.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AA4FF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAiBvD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
|
+
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
5
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
6
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
7
|
+
const getPropositions = (n, { answer, expCount, isSize, repCount }) => {
|
|
8
|
+
const propositions = [];
|
|
9
|
+
addValidProp(propositions, answer);
|
|
10
|
+
tryToAddWrongProp(propositions, expCount.frenchify());
|
|
11
|
+
tryToAddWrongProp(propositions, repCount.frenchify());
|
|
12
|
+
while (propositions.length < n) {
|
|
13
|
+
let wrongValue;
|
|
14
|
+
wrongValue = randint(1, 200);
|
|
15
|
+
tryToAddWrongProp(propositions, wrongValue.frenchify());
|
|
16
|
+
}
|
|
17
|
+
return shuffleProps(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { expCount, repCount, isSize } = identifiers;
|
|
21
|
+
const answer = isSize ? expCount.frenchify() : repCount.frenchify();
|
|
22
|
+
return answer;
|
|
23
|
+
};
|
|
24
|
+
const getInstruction = (identifiers) => {
|
|
25
|
+
const { expCount, repCount, isSize } = identifiers;
|
|
26
|
+
const qst = isSize
|
|
27
|
+
? "Quelle est la taille de chaque échantillon ?"
|
|
28
|
+
: "Quel est le nombre d'échantillons obtenus?";
|
|
29
|
+
return `On lance $${expCount}$ fois trois pièces simultanément.\n\n
|
|
30
|
+
On répète l'expérience $${repCount}$ fois.\n\n
|
|
31
|
+
${qst}`;
|
|
32
|
+
};
|
|
33
|
+
const getHint = ({ isSize }) => {
|
|
34
|
+
return isSize
|
|
35
|
+
? `La taille d'un échantillon correspond au nombre de répétitions à l'intérieur d'une même expérience.`
|
|
36
|
+
: `Le nombre d'échantillons correspond au nombre de fois qu'on répète l'expérience entière.`;
|
|
37
|
+
};
|
|
38
|
+
const getCorrection = ({ expCount, repCount, isSize, }) => {
|
|
39
|
+
if (isSize) {
|
|
40
|
+
return `Chaque fois qu'on répète l'expérience, on lance $${expCount}$ fois trois pièces.
|
|
41
|
+
La taille de chaque échantillon est donc $${expCount}$.`;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return `On répète l'expérience complète $${repCount}$ fois.
|
|
45
|
+
On obtient donc $${repCount}$ échantillons.`;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const getKeys = (identifiers) => {
|
|
49
|
+
return [];
|
|
50
|
+
};
|
|
51
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
52
|
+
try {
|
|
53
|
+
const ansNode = parseAlgebraic(ans);
|
|
54
|
+
const answerNode = parseAlgebraic(answer);
|
|
55
|
+
return answerNode.simplify().equals(ansNode.simplify());
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
return handleVEAError(err);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const getGetSampleCountAndSizeQuestion = (ops) => {
|
|
62
|
+
const expCount = randint(1, 301);
|
|
63
|
+
const repCount = randint(1, 51);
|
|
64
|
+
const isSize = coinFlip();
|
|
65
|
+
const identifiers = { expCount, repCount, isSize };
|
|
66
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
67
|
+
};
|
|
68
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
69
|
+
return {
|
|
70
|
+
answer: getAnswer(identifiers),
|
|
71
|
+
instruction: getInstruction(identifiers),
|
|
72
|
+
keys: getKeys(identifiers),
|
|
73
|
+
answerFormat: "tex",
|
|
74
|
+
identifiers,
|
|
75
|
+
hint: getHint(identifiers),
|
|
76
|
+
correction: getCorrection(identifiers),
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export const getSampleCountAndSize = {
|
|
80
|
+
id: "getSampleCountAndSize",
|
|
81
|
+
label: "Distinguer taille et nombre d'échantillons",
|
|
82
|
+
isSingleStep: true,
|
|
83
|
+
generator: (nb, opts) => getDistinctQuestions(() => getGetSampleCountAndSizeQuestion(opts), nb),
|
|
84
|
+
qcmTimer: 60,
|
|
85
|
+
freeTimer: 60,
|
|
86
|
+
getPropositions,
|
|
87
|
+
isAnswerValid,
|
|
88
|
+
subject: "Mathématiques",
|
|
89
|
+
getInstruction,
|
|
90
|
+
getHint,
|
|
91
|
+
getCorrection,
|
|
92
|
+
getAnswer,
|
|
93
|
+
getQuestionFromIdentifiers,
|
|
94
|
+
hasHintAndCorrection: true,
|
|
95
|
+
};
|
|
@@ -16,4 +16,8 @@ export * from "./getMissingProbabilityValue.js";
|
|
|
16
16
|
export * from "./getComplementaryProbability.js";
|
|
17
17
|
export * from "./unionIntersectionProba.js";
|
|
18
18
|
export * from "./calculateMeanFromFrequencies.js";
|
|
19
|
+
export * from "./mostLeastProbable.js";
|
|
20
|
+
export * from "./checkEquiprobability.js";
|
|
21
|
+
export * from "./getSampleCountAndSize.js";
|
|
22
|
+
export * from "./describeEvent.js";
|
|
19
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC"}
|
|
@@ -16,3 +16,7 @@ export * from "./getMissingProbabilityValue.js";
|
|
|
16
16
|
export * from "./getComplementaryProbability.js";
|
|
17
17
|
export * from "./unionIntersectionProba.js";
|
|
18
18
|
export * from "./calculateMeanFromFrequencies.js";
|
|
19
|
+
export * from "./mostLeastProbable.js";
|
|
20
|
+
export * from "./checkEquiprobability.js";
|
|
21
|
+
export * from "./getSampleCountAndSize.js";
|
|
22
|
+
export * from "./describeEvent.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
export type Identifiers = {
|
|
4
|
+
numericValues: NodeIdentifiers[];
|
|
5
|
+
isMax: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const mostLeastProbable: Exercise<Identifiers>;
|
|
8
|
+
//# sourceMappingURL=mostLeastProbable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mostLeastProbable.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/mostLeastProbable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AA2HF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAkBnD,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, shuffleProps, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { RationalConstructor } from "../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
6
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
7
|
+
import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { round } from "../../../math/utils/round.js";
|
|
9
|
+
import { approxOrEqual } from "../../../utils/latex/approxOrEqual.js";
|
|
10
|
+
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
11
|
+
const getPropositions = (n, { answer }) => {
|
|
12
|
+
const allLabels = ["J", "R", "V"];
|
|
13
|
+
const props = [];
|
|
14
|
+
addValidProp(props, answer);
|
|
15
|
+
for (const label of allLabels) {
|
|
16
|
+
tryToAddWrongProp(props, label);
|
|
17
|
+
}
|
|
18
|
+
return shuffleProps(props, n);
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = ({ numericValues, isMax }) => {
|
|
21
|
+
const numericValuesParsed = numericValues.map((v) => reifyAlgebraic(v).evaluate());
|
|
22
|
+
const targetValue = isMax
|
|
23
|
+
? Math.max(...numericValuesParsed)
|
|
24
|
+
: Math.min(...numericValuesParsed);
|
|
25
|
+
const index = numericValuesParsed.indexOf(targetValue);
|
|
26
|
+
return ["J", "R", "V"][index];
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = ({ numericValues, isMax, }) => {
|
|
29
|
+
const labels = ["$J$", "$R$", "$V$"];
|
|
30
|
+
const displayValues = numericValues.map((v, i) => {
|
|
31
|
+
if (labels[i] === "$R$") {
|
|
32
|
+
const pct = round(reifyAlgebraic(v).evaluate() * 100, 6);
|
|
33
|
+
return `${pct.frenchify()}\\%`;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return reifyAlgebraic(v).toTex();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const header = `Une expérience aléatoire a trois issues : ${labels.join(", ")}.
|
|
40
|
+
|
|
41
|
+
Leurs probabilités sont respectivement $${displayValues[0]}$ , $${displayValues[1]}$ et $${displayValues[2]}$.\n\n`;
|
|
42
|
+
return header + `Quelle issue est la ${isMax ? "plus" : "moins"} probable ?`;
|
|
43
|
+
};
|
|
44
|
+
const getHint = () => {
|
|
45
|
+
return "Convertis les probabilités dans le même format pour les comparer.";
|
|
46
|
+
};
|
|
47
|
+
const getCorrection = ({ numericValues, isMax, }) => {
|
|
48
|
+
const fraction = reifyAlgebraic(numericValues[0]);
|
|
49
|
+
const percent = reifyAlgebraic(numericValues[1]);
|
|
50
|
+
const evaluatedValues = numericValues.map((v) => round(reifyAlgebraic(v).evaluate(), 2));
|
|
51
|
+
const sortedAsc = [...evaluatedValues].sort((a, b) => a - b);
|
|
52
|
+
const target = isMax ? "plus" : "moins";
|
|
53
|
+
const result = getAnswer({ numericValues, isMax });
|
|
54
|
+
return `On convertit le pourcentage et la fraction en nombres décimaux (éventuellement avec une valeur approchée) pour pouvoir les comparer :
|
|
55
|
+
|
|
56
|
+
- $${fraction.toTex()} ${approxOrEqual(fraction.evaluate(), 2).join("")}$
|
|
57
|
+
|
|
58
|
+
- $${multiply(percent, 100).simplify().toTex()}\\% = ${percent.toTex()}$
|
|
59
|
+
|
|
60
|
+
Puisque $${sortedAsc
|
|
61
|
+
.map((e) => e.frenchify())
|
|
62
|
+
.join("\\leq")}$, l'issue la ${target} probable est donc $${result}$.`;
|
|
63
|
+
};
|
|
64
|
+
const getKeys = () => [];
|
|
65
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
66
|
+
try {
|
|
67
|
+
return ans.trim() === answer;
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
return handleVEAError(err);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const getMostLeastProbableQuestion = (opts) => {
|
|
74
|
+
let numericValues = [];
|
|
75
|
+
do {
|
|
76
|
+
numericValues = [
|
|
77
|
+
RationalConstructor.randomIrreductibleProba().toTree(),
|
|
78
|
+
randfloat(0.1, 0.9, 2).toTree(),
|
|
79
|
+
randfloat(0.1, 0.9, 2).toTree(),
|
|
80
|
+
];
|
|
81
|
+
} while (numericValues.some((e, i) => numericValues.some((e2, i2) => i2 !== i && round(e2.evaluate(), 2) === round(e.evaluate(), 2))));
|
|
82
|
+
const isMax = coinFlip();
|
|
83
|
+
return getQuestionFromIdentifiers({
|
|
84
|
+
numericValues: numericValues.map((e) => e.toIdentifiers()),
|
|
85
|
+
isMax,
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
const getQuestionFromIdentifiers = (identifiers) => ({
|
|
89
|
+
answer: getAnswer(identifiers),
|
|
90
|
+
instruction: getInstruction(identifiers),
|
|
91
|
+
keys: getKeys(identifiers),
|
|
92
|
+
answerFormat: "tex",
|
|
93
|
+
identifiers,
|
|
94
|
+
hint: getHint(identifiers),
|
|
95
|
+
correction: getCorrection(identifiers),
|
|
96
|
+
});
|
|
97
|
+
export const mostLeastProbable = {
|
|
98
|
+
id: "mostLeastProbable",
|
|
99
|
+
label: "Identifier l'issue la plus ou la moins probable",
|
|
100
|
+
isSingleStep: true,
|
|
101
|
+
generator: (nb, opts) => getDistinctQuestions(() => getMostLeastProbableQuestion(opts), nb),
|
|
102
|
+
qcmTimer: 60,
|
|
103
|
+
freeTimer: 60,
|
|
104
|
+
getPropositions,
|
|
105
|
+
isAnswerValid,
|
|
106
|
+
subject: "Mathématiques",
|
|
107
|
+
getInstruction,
|
|
108
|
+
getHint,
|
|
109
|
+
getCorrection,
|
|
110
|
+
getAnswer,
|
|
111
|
+
getQuestionFromIdentifiers,
|
|
112
|
+
hasHintAndCorrection: true,
|
|
113
|
+
answerType: "QCU",
|
|
114
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subsetsOfKnownSets.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/subsetsOfKnownSets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAiGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAiBpD,CAAC"}
|