math-exercises 3.0.180 → 3.0.182
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/derivation/applications/index.d.ts +3 -0
- package/lib/exercises/math/derivation/applications/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/applications/index.js +2 -0
- package/lib/exercises/math/derivation/applications/maxBenefice.d.ts +11 -0
- package/lib/exercises/math/derivation/applications/maxBenefice.d.ts.map +1 -0
- package/lib/exercises/math/derivation/applications/maxBenefice.js +184 -0
- package/lib/exercises/math/derivation/applications/minimalCost.d.ts +11 -0
- package/lib/exercises/math/derivation/applications/minimalCost.d.ts.map +1 -0
- package/lib/exercises/math/derivation/applications/minimalCost.js +181 -0
- package/lib/exercises/math/derivation/index.d.ts +1 -0
- package/lib/exercises/math/derivation/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/index.js +1 -0
- package/lib/exercises/math/derivation/tangent/horizontalTangentFromAlgebraic.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/horizontalTangentFromAlgebraic.js +8 -4
- package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/functionComposition.js +20 -15
- package/lib/exercises/math/functions/exponential/algebraic/index.d.ts +0 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.js +1 -1
- package/lib/exercises/math/probaStat/independancy/independancyFromEffectifTable.d.ts +10 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromEffectifTable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromEffectifTable.js +154 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromProbaTree.d.ts +10 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromProbaTree.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/independancy/independancyFromProbaTree.js +152 -0
- package/lib/exercises/math/probaStat/independancy/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/independancy/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/independancy/index.js +2 -0
- package/lib/exercises/math/probaStat/trees/index.d.ts +4 -1
- package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/trees/index.js +4 -8
- package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.d.ts +6 -0
- package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.js +125 -80
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +0 -4
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +38 -26
- package/lib/exercises/math/sequences/geometric/index.d.ts +0 -3
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +3 -3
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +1 -1
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts +0 -1
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/situations/index.js +1 -1
- package/lib/exercises/math/sequences/index.d.ts +1 -1
- package/lib/exercises/math/sequences/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/index.js +1 -2
- package/lib/exercises/math/sequences/limits/index.d.ts +2 -1
- package/lib/exercises/math/sequences/limits/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/limits/index.js +2 -2
- package/lib/exercises/math/sequences/limits/readSequenceConvergencyType.d.ts +9 -0
- package/lib/exercises/math/sequences/limits/readSequenceConvergencyType.d.ts.map +1 -0
- package/lib/exercises/math/sequences/limits/readSequenceConvergencyType.js +256 -0
- package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts +7 -0
- package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts.map +1 -1
- package/lib/exercises/math/sequences/limits/sequenceLimitReading.js +232 -163
- package/lib/exercises/math/sequences/variations/genericSequenceVariations.d.ts +7 -0
- package/lib/exercises/math/sequences/variations/genericSequenceVariations.d.ts.map +1 -0
- package/lib/exercises/math/sequences/variations/genericSequenceVariations.js +122 -0
- package/lib/exercises/math/sequences/variations/index.d.ts +2 -0
- package/lib/exercises/math/sequences/variations/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/variations/index.js +2 -0
- package/lib/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.d.ts +9 -0
- package/lib/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.d.ts.map +1 -0
- package/lib/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.js +155 -0
- package/lib/index.d.ts +47 -39
- package/lib/index.d.ts.map +1 -1
- package/lib/tests/singleExo.test.js +2 -2
- package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
- package/lib/tree/parsers/rationalParser.js +7 -1
- package/package.json +1 -1
|
@@ -0,0 +1,154 @@
|
|
|
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 { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
7
|
+
import { dollarize } from "../../../../utils/latex/dollarize.js";
|
|
8
|
+
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
9
|
+
const getPropositions = (n, { answer }) => {
|
|
10
|
+
const propositions = [];
|
|
11
|
+
addValidProp(propositions, answer, "raw");
|
|
12
|
+
["Oui", "Non", "On ne peut pas savoir"].forEach((prop) => tryToAddWrongProp(propositions, prop, "raw"));
|
|
13
|
+
return shuffleProps(propositions, n);
|
|
14
|
+
};
|
|
15
|
+
const getAnswer = (identifiers) => {
|
|
16
|
+
const { aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre } = identifiers;
|
|
17
|
+
return aCapB * aBarreCapBBarre === aCapBBarre * aBarreCapB ? "Oui" : "Non";
|
|
18
|
+
};
|
|
19
|
+
const getInstruction = (identifiers) => {
|
|
20
|
+
const { aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre } = identifiers;
|
|
21
|
+
const total = aBarreCapB + aBarreCapBBarre + aCapB + aCapBBarre;
|
|
22
|
+
const aTotal = aCapB + aCapBBarre;
|
|
23
|
+
const bTotal = aCapB + aBarreCapB;
|
|
24
|
+
const aBarreTotal = aBarreCapB + aBarreCapBBarre;
|
|
25
|
+
const bBarreTotal = aBarreCapBBarre + aCapBBarre;
|
|
26
|
+
return `On considère deux événements $A$ et $B$.
|
|
27
|
+
|
|
28
|
+
Le tableau suivant donne le nombre d'issues pour chacun des événements $A\\cap B$, $\\overline A\\cap B$, $A\\cap \\overline B$ et $\\overline A \\cap \\overline B$.
|
|
29
|
+
|
|
30
|
+
${mdTable([
|
|
31
|
+
[" ", "$B$", "$\\overline{B}$", "Total"],
|
|
32
|
+
["$A$", dollarize(aCapB), `$${aCapBBarre}$`, `$${aTotal}$`],
|
|
33
|
+
[
|
|
34
|
+
"$\\overline{A}$",
|
|
35
|
+
dollarize(aBarreCapB),
|
|
36
|
+
dollarize(aBarreCapBBarre),
|
|
37
|
+
dollarize(aBarreTotal),
|
|
38
|
+
],
|
|
39
|
+
["Total", dollarize(bTotal), dollarize(bBarreTotal), dollarize(total)],
|
|
40
|
+
])}
|
|
41
|
+
|
|
42
|
+
Les événements $A$ et $B$ sont-ils indépendants ?
|
|
43
|
+
`;
|
|
44
|
+
};
|
|
45
|
+
const getHint = () => {
|
|
46
|
+
return `Deux évènements $A$ et $B$ sont indépendants lorsque :
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
$$
|
|
50
|
+
P(A\\cap B) = P(A)\\times P(B)
|
|
51
|
+
$$
|
|
52
|
+
|
|
53
|
+
Une autre façon de vérifier si deux évènements sont indépendants utilise les probabilités conditionnelles : $A$ et $B$ sont indépendants si et seulement si :
|
|
54
|
+
|
|
55
|
+
$$
|
|
56
|
+
P_B(A) = P(A)
|
|
57
|
+
$$
|
|
58
|
+
|
|
59
|
+
Choisis une de ces deux méthodes, puis vérifie si l'égalité est vraie.`;
|
|
60
|
+
};
|
|
61
|
+
const getCorrection = (identifiers) => {
|
|
62
|
+
const { aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre } = identifiers;
|
|
63
|
+
const total = aBarreCapB + aBarreCapBBarre + aCapB + aCapBBarre;
|
|
64
|
+
const aTotal = aCapB + aCapBBarre;
|
|
65
|
+
const bTotal = aCapB + aBarreCapB;
|
|
66
|
+
const pA = frac(aTotal, total);
|
|
67
|
+
const pB = frac(bTotal, total);
|
|
68
|
+
const pANB = frac(aCapB, total);
|
|
69
|
+
const isInde = getAnswer(identifiers) === "Oui";
|
|
70
|
+
return `On vérifie si $P(A\\cap B) = P(A)\\times P(B)$.
|
|
71
|
+
|
|
72
|
+
On a :
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
P(A\\cap B) = ${pANB.toSimplificationTex()}
|
|
76
|
+
$$
|
|
77
|
+
|
|
78
|
+
$$
|
|
79
|
+
P(A) = ${pA.toSimplificationTex()}
|
|
80
|
+
$$
|
|
81
|
+
|
|
82
|
+
$$
|
|
83
|
+
P(B) = ${pB.toSimplificationTex()}
|
|
84
|
+
$$
|
|
85
|
+
|
|
86
|
+
donc :
|
|
87
|
+
|
|
88
|
+
$$
|
|
89
|
+
P(A) \\times P(B) = ${multiply(pA.simplify(), pB.simplify()).toSimplificationTex()}
|
|
90
|
+
$$
|
|
91
|
+
|
|
92
|
+
Puisque $P(A\\cap B) ${isInde ? "=" : "\\neq"} P(A)\\times P(B)$, les évènements $A$ et $B$ ${isInde ? "sont" : "ne sont pas"} indépendants.`;
|
|
93
|
+
};
|
|
94
|
+
const getIndependancyFromEffectifTableQuestion = () => {
|
|
95
|
+
const isInde = coinFlip();
|
|
96
|
+
let aCapB;
|
|
97
|
+
let aCapBBarre;
|
|
98
|
+
let aBarreCapB;
|
|
99
|
+
let aBarreCapBBarre;
|
|
100
|
+
if (isInde) {
|
|
101
|
+
const r = randint(1, 7);
|
|
102
|
+
const u = randint(1, 7, [r]);
|
|
103
|
+
const s = randint(1, 7);
|
|
104
|
+
const t = randint(1, 7, [s]);
|
|
105
|
+
console.log(r, u, s, t);
|
|
106
|
+
aCapB = r * s;
|
|
107
|
+
aCapBBarre = r * t;
|
|
108
|
+
aBarreCapB = u * s;
|
|
109
|
+
aBarreCapBBarre = u * t;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
do {
|
|
113
|
+
aCapB = randint(1, 20);
|
|
114
|
+
aCapBBarre = randint(1, 20, [aCapB]);
|
|
115
|
+
aBarreCapB = randint(1, 20, [aCapB, aCapBBarre]);
|
|
116
|
+
aBarreCapBBarre = randint(1, 20, [aCapB, aCapBBarre, aBarreCapB]);
|
|
117
|
+
} while (aCapB * aBarreCapBBarre === aCapBBarre * aBarreCapB);
|
|
118
|
+
}
|
|
119
|
+
const identifiers = {
|
|
120
|
+
aBarreCapB,
|
|
121
|
+
aBarreCapBBarre,
|
|
122
|
+
aCapB,
|
|
123
|
+
aCapBBarre,
|
|
124
|
+
};
|
|
125
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
126
|
+
};
|
|
127
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
128
|
+
return {
|
|
129
|
+
answer: getAnswer(identifiers),
|
|
130
|
+
instruction: getInstruction(identifiers),
|
|
131
|
+
keys: [],
|
|
132
|
+
answerFormat: "raw",
|
|
133
|
+
identifiers,
|
|
134
|
+
hint: getHint(identifiers),
|
|
135
|
+
correction: getCorrection(identifiers),
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
export const independancyFromEffectifTable = {
|
|
139
|
+
id: "independancyFromEffectifTable",
|
|
140
|
+
label: "Déterminer si deux évènements sont indépendants à partir d'un tableau d'effectifs",
|
|
141
|
+
isSingleStep: true,
|
|
142
|
+
generator: (nb, opts) => getDistinctQuestions(() => getIndependancyFromEffectifTableQuestion(opts), nb),
|
|
143
|
+
qcmTimer: 60,
|
|
144
|
+
freeTimer: 60,
|
|
145
|
+
getPropositions,
|
|
146
|
+
answerType: "QCU",
|
|
147
|
+
subject: "Mathématiques",
|
|
148
|
+
getInstruction,
|
|
149
|
+
getHint,
|
|
150
|
+
getCorrection,
|
|
151
|
+
getAnswer,
|
|
152
|
+
getQuestionFromIdentifiers,
|
|
153
|
+
hasHintAndCorrection: true,
|
|
154
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
pAIds: NodeIdentifiers;
|
|
5
|
+
p_ABIds: NodeIdentifiers;
|
|
6
|
+
p_ABarreBIds: NodeIdentifiers;
|
|
7
|
+
};
|
|
8
|
+
export declare const independancyFromProbaTree: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=independancyFromProbaTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"independancyFromProbaTree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/independancyFromProbaTree.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AAoJF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAiB3D,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
3
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
6
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
7
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
12
|
+
const getPropositions = (n, { answer }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
addValidProp(propositions, answer, "raw");
|
|
15
|
+
["Oui", "Non", "On ne peut pas savoir"].forEach((prop) => tryToAddWrongProp(propositions, prop, "raw"));
|
|
16
|
+
return shuffleProps(propositions, n);
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { p_ABIds, p_ABarreBIds } = identifiers;
|
|
20
|
+
const p_AB = reifyAlgebraic(p_ABIds);
|
|
21
|
+
const p_ABarreB = reifyAlgebraic(p_ABarreBIds);
|
|
22
|
+
return p_AB.simplify().toTex() === p_ABarreB.simplify().toTex()
|
|
23
|
+
? "Oui"
|
|
24
|
+
: "Non";
|
|
25
|
+
};
|
|
26
|
+
const getInstruction = (identifiers) => {
|
|
27
|
+
const { pAIds, p_ABIds, p_ABarreBIds } = identifiers;
|
|
28
|
+
const pA = reifyAlgebraic(pAIds);
|
|
29
|
+
const pABarre = substract(1, pA).simplify();
|
|
30
|
+
const p_AB = reifyAlgebraic(p_ABIds);
|
|
31
|
+
const p_ABBarre = substract(1, p_AB).simplify();
|
|
32
|
+
const p_ABarreB = reifyAlgebraic(p_ABarreBIds);
|
|
33
|
+
const p_ABarreBBarre = substract(1, p_ABarreB).simplify();
|
|
34
|
+
const tree = [
|
|
35
|
+
[
|
|
36
|
+
[
|
|
37
|
+
[`£${pA.toTex()}£`, "£A£"],
|
|
38
|
+
[`£${pABarre.toTex()}£`, "£\\overline{A}£"],
|
|
39
|
+
],
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
[
|
|
43
|
+
[`£${p_AB.toTex()}£`, "£B£"],
|
|
44
|
+
[`£${p_ABBarre.toTex()}£`, "£\\overline{B}£"],
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
[`£${p_ABarreB.toTex()}£`, "£B£"],
|
|
48
|
+
[`£${p_ABarreBBarre.toTex()}£`, "£\\overline{B}£"],
|
|
49
|
+
],
|
|
50
|
+
],
|
|
51
|
+
];
|
|
52
|
+
return `On considère l'arbre de probabilités ci-dessous :
|
|
53
|
+
|
|
54
|
+
<svg id="treeDiagram">${JSON.stringify(tree)}</svg>
|
|
55
|
+
|
|
56
|
+
Les événements $A$ et $B$ sont-ils indépendants ?`;
|
|
57
|
+
};
|
|
58
|
+
const getHint = () => {
|
|
59
|
+
return `Deux évènements $A$ et $B$ sont indépendants lorsque :
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
$$
|
|
63
|
+
P(A\\cap B) = P(A)\\times P(B)
|
|
64
|
+
$$
|
|
65
|
+
|
|
66
|
+
Une autre façon de vérifier si deux évènements sont indépendants utilise les probabilités conditionnelles : $A$ et $B$ sont indépendants si et seulement si :
|
|
67
|
+
|
|
68
|
+
$$
|
|
69
|
+
P_A(B) = P(B)
|
|
70
|
+
$$
|
|
71
|
+
|
|
72
|
+
Choisis une de ces deux méthodes, puis vérifie si l'égalité est vraie.`;
|
|
73
|
+
};
|
|
74
|
+
const getCorrection = (identifiers) => {
|
|
75
|
+
const { pAIds, p_ABIds, p_ABarreBIds } = identifiers;
|
|
76
|
+
const pA = reifyAlgebraic(pAIds);
|
|
77
|
+
const p_AB = reifyAlgebraic(p_ABIds);
|
|
78
|
+
const p_ABarreB = reifyAlgebraic(p_ABarreBIds);
|
|
79
|
+
const pB = add(multiply(pA, p_AB), multiply(substract(1, pA), p_ABarreB));
|
|
80
|
+
const isInde = p_AB.simplify().toTex() === pB.simplify().toTex();
|
|
81
|
+
return `Deux évènements $A$ et $B$ sont indépendants si et seulement si :
|
|
82
|
+
|
|
83
|
+
$$
|
|
84
|
+
P_A(B) = P(B)
|
|
85
|
+
$$
|
|
86
|
+
|
|
87
|
+
Ici, $P_A(B)$ se lit dans l'arbre :
|
|
88
|
+
|
|
89
|
+
$$
|
|
90
|
+
P_A(B) = ${p_AB.simplify().toTex()}
|
|
91
|
+
$$
|
|
92
|
+
|
|
93
|
+
Il reste donc à calculer $P(B)$, en utilisant la formule des probabilités totales :
|
|
94
|
+
|
|
95
|
+
${alignTex([
|
|
96
|
+
["P(B)", "=", "P(A\\cap B)+P(\\overline{A}\\cap B)"],
|
|
97
|
+
["", "=", pB.toTex()],
|
|
98
|
+
["", "=", pB.simplify().toTex()],
|
|
99
|
+
])}
|
|
100
|
+
|
|
101
|
+
Puisque $P_A(B) ${isInde ? "=" : "\\neq"} P(B)$, les évènements $A$ et $B$ ${isInde ? "sont" : "ne sont pas"} indépendants.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
**Remarque** : en fait, on peut voir directement si $A$ et $B$ sont indépendants ou non, en comparant $P_A(B)$ et $P_{\\overline{A}}(B)$. En effet, ces deux probabilités sont égales si et seulement si $A$ et $B$ sont indépendants. L'idée est que si $A$ et $B$ sont indépendants, le fait que $A$ soit réalisé ou non ne change pas la probabilité de $B$.
|
|
105
|
+
`;
|
|
106
|
+
};
|
|
107
|
+
const getIndependancyFromProbaTreeQuestion = () => {
|
|
108
|
+
const getProba = (isFrac = false) => {
|
|
109
|
+
return isFrac
|
|
110
|
+
? RationalConstructor.randomIrreductibleProba().toTree()
|
|
111
|
+
: randfloat(0.1, 0.91, 1).toTree();
|
|
112
|
+
};
|
|
113
|
+
const isInde = coinFlip();
|
|
114
|
+
const isFrac = coinFlip();
|
|
115
|
+
const pAIds = getProba(isFrac);
|
|
116
|
+
const p_ABIds = getProba(isFrac);
|
|
117
|
+
const p_ABarreBIds = isInde ? p_ABIds : getProba(isFrac);
|
|
118
|
+
const identifiers = {
|
|
119
|
+
p_ABarreBIds: p_ABarreBIds.toIdentifiers(),
|
|
120
|
+
p_ABIds: p_ABIds.toIdentifiers(),
|
|
121
|
+
pAIds: pAIds.toIdentifiers(),
|
|
122
|
+
};
|
|
123
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
124
|
+
};
|
|
125
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
126
|
+
return {
|
|
127
|
+
answer: getAnswer(identifiers),
|
|
128
|
+
instruction: getInstruction(identifiers),
|
|
129
|
+
keys: [],
|
|
130
|
+
answerFormat: "raw",
|
|
131
|
+
identifiers,
|
|
132
|
+
hint: getHint(identifiers),
|
|
133
|
+
correction: getCorrection(identifiers),
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
export const independancyFromProbaTree = {
|
|
137
|
+
id: "independancyFromProbaTree",
|
|
138
|
+
label: "Déterminer si deux évènements sont indépendants à partir d'un arbre",
|
|
139
|
+
isSingleStep: true,
|
|
140
|
+
generator: (nb, opts) => getDistinctQuestions(() => getIndependancyFromProbaTreeQuestion(opts), nb),
|
|
141
|
+
qcmTimer: 60,
|
|
142
|
+
freeTimer: 60,
|
|
143
|
+
getPropositions,
|
|
144
|
+
subject: "Mathématiques",
|
|
145
|
+
getInstruction,
|
|
146
|
+
getHint,
|
|
147
|
+
getCorrection,
|
|
148
|
+
getAnswer,
|
|
149
|
+
getQuestionFromIdentifiers,
|
|
150
|
+
hasHintAndCorrection: true,
|
|
151
|
+
answerType: "QCU",
|
|
152
|
+
};
|
|
@@ -2,4 +2,6 @@ export * from "./independancy.js";
|
|
|
2
2
|
export * from "./isIndependantFromDefinition.js";
|
|
3
3
|
export * from "./independancyFindCap.js";
|
|
4
4
|
export * from "./independancyFindCup.js";
|
|
5
|
+
export * from "./independancyFromEffectifTable.js";
|
|
6
|
+
export * from "./independancyFromProbaTree.js";
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC"}
|
|
@@ -2,3 +2,5 @@ export * from "./independancy.js";
|
|
|
2
2
|
export * from "./isIndependantFromDefinition.js";
|
|
3
3
|
export * from "./independancyFindCap.js";
|
|
4
4
|
export * from "./independancyFindCup.js";
|
|
5
|
+
export * from "./independancyFromEffectifTable.js";
|
|
6
|
+
export * from "./independancyFromProbaTree.js";
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { probabilityTree, } from "./
|
|
1
|
+
export { probabilityTree, probabilityTreeIntersection, probabilityTreeTotalProbability, probabilityTreeReadProbability, probabilityTreeInversionProbability, } from "./probabilityTreeV2.js";
|
|
2
|
+
export * from "./fillProbaTreeWithComplementaryProbabilities.js";
|
|
3
|
+
export * from "./buildTreeFromSituation.js";
|
|
4
|
+
export * from "./probaTreeSituationTotalProbaFormula.js";
|
|
2
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,+BAA+B,EAC/B,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,wBAAwB,CAAC;AAChC,cAAc,kDAAkD,CAAC;AACjE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0CAA0C,CAAC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
// export * from "./treeInInstruction.js";
|
|
2
2
|
// export * from "./treeInAnswer.js";
|
|
3
|
-
export { probabilityTree,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// probabilityTreeInversionProbability,
|
|
8
|
-
} from "./probabilityTree.js";
|
|
9
|
-
// export * from "./fillProbaTreeWithComplementaryProbabilities.js";
|
|
10
|
-
// export * from "./buildTreeFromSituation.js";
|
|
3
|
+
export { probabilityTree, probabilityTreeIntersection, probabilityTreeTotalProbability, probabilityTreeReadProbability, probabilityTreeInversionProbability, } from "./probabilityTreeV2.js";
|
|
4
|
+
export * from "./fillProbaTreeWithComplementaryProbabilities.js";
|
|
5
|
+
export * from "./buildTreeFromSituation.js";
|
|
6
|
+
export * from "./probaTreeSituationTotalProbaFormula.js";
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { ProbaTreeSituationParams } from "./probaTreeSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: ProbaTreeSituationParams;
|
|
5
|
+
};
|
|
6
|
+
export declare const probaTreeSituationTotalProbaFormula: Exercise<Identifiers>;
|
|
1
7
|
export {};
|
|
2
8
|
//# sourceMappingURL=probaTreeSituationTotalProbaFormula.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaTreeSituationTotalProbaFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"probaTreeSituationTotalProbaFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EAGL,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAElC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,wBAAwB,CAAC;CAClC,CAAC;AA2HF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAqBrE,CAAC"}
|
|
@@ -1,80 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { round } from "../../../../math/utils/round.js";
|
|
6
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
12
|
+
import { buildProbaTreeSituation, getProbaTreeSituation, } from "./probaTreeSituations.js";
|
|
13
|
+
const getPropositions = (n, { answer }) => {
|
|
14
|
+
const propositions = [];
|
|
15
|
+
addValidProp(propositions, answer);
|
|
16
|
+
propWhile(propositions, n, () => {
|
|
17
|
+
tryToAddWrongProp(propositions, round(randfloat(0, 1, 4), 4).frenchify());
|
|
18
|
+
});
|
|
19
|
+
return shuffleProps(propositions, n);
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { params } = identifiers;
|
|
23
|
+
const situation = getProbaTreeSituation(params);
|
|
24
|
+
const { firstCondProba, mainEventProba, secondCondProba } = situation;
|
|
25
|
+
const firstCondProbaDec = frac(firstCondProba, 100).evaluate();
|
|
26
|
+
const mainEventProbaDec = frac(mainEventProba, 100).evaluate();
|
|
27
|
+
const secondCondProbaDec = frac(secondCondProba, 100).evaluate();
|
|
28
|
+
const aNb = multiply(mainEventProbaDec, firstCondProbaDec).evaluate();
|
|
29
|
+
const abarreNb = multiply(substract(1, mainEventProbaDec), secondCondProbaDec).evaluate();
|
|
30
|
+
const pb = round(add(aNb, abarreNb).evaluate(), 6);
|
|
31
|
+
return pb.frenchify();
|
|
32
|
+
};
|
|
33
|
+
const getInstruction = (identifiers) => {
|
|
34
|
+
const { params } = identifiers;
|
|
35
|
+
const situation = getProbaTreeSituation(params);
|
|
36
|
+
return (situation.context +
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
Calculer $P(${situation.secondEvent})$.`);
|
|
40
|
+
};
|
|
41
|
+
const getHint = () => {
|
|
42
|
+
return `Modélise la situation par un arbre pondéré.
|
|
43
|
+
|
|
44
|
+
Puis, utilise la formule des probabilités totales : pour deux évènements $A$ et $B$, on a :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
P(B) = P(A\\cap B)+P(\\overline{A}\\cap B)
|
|
48
|
+
$$`;
|
|
49
|
+
};
|
|
50
|
+
const getCorrection = (identifiers) => {
|
|
51
|
+
const { params } = identifiers;
|
|
52
|
+
const situation = getProbaTreeSituation(params);
|
|
53
|
+
const { mainEvent, mainEventProba, firstCondProba, secondCondProba, secondEvent, tree, } = situation;
|
|
54
|
+
const firstCondProbaDec = frac(firstCondProba, 100).evaluate();
|
|
55
|
+
const mainEventProbaDec = frac(mainEventProba, 100).evaluate();
|
|
56
|
+
const secondCondProbaDec = frac(secondCondProba, 100).evaluate();
|
|
57
|
+
return `On commence par modéliser la situation par un arbre :
|
|
58
|
+
|
|
59
|
+
<svg id="treeDiagram">${JSON.stringify(tree)}</svg>
|
|
60
|
+
|
|
61
|
+
On utilise ensuite la formule des probabilités totales :
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
P(${secondEvent}) = P(${mainEvent}\\cap ${secondEvent})+P(\\overline{${mainEvent}}\\cap ${secondEvent})
|
|
65
|
+
$$
|
|
66
|
+
|
|
67
|
+
On a donc :
|
|
68
|
+
|
|
69
|
+
${alignTex([
|
|
70
|
+
[
|
|
71
|
+
`P(${secondEvent})`,
|
|
72
|
+
"=",
|
|
73
|
+
add(multiply(mainEventProbaDec, firstCondProbaDec), multiply(substract(1, mainEventProbaDec).simplify(), secondCondProbaDec)).toTex(),
|
|
74
|
+
],
|
|
75
|
+
["", "=", getAnswer(identifiers)],
|
|
76
|
+
])}
|
|
77
|
+
`;
|
|
78
|
+
};
|
|
79
|
+
const getKeys = () => {
|
|
80
|
+
return ["percent"];
|
|
81
|
+
};
|
|
82
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
83
|
+
try {
|
|
84
|
+
return rationalVEA(ans, answer);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
return handleVEAError(err);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const getProbaTreeSituationTotalProbaFormulaQuestion = () => {
|
|
91
|
+
const params = buildProbaTreeSituation();
|
|
92
|
+
const identifiers = {
|
|
93
|
+
params,
|
|
94
|
+
};
|
|
95
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
96
|
+
};
|
|
97
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
98
|
+
return {
|
|
99
|
+
answer: getAnswer(identifiers),
|
|
100
|
+
instruction: getInstruction(identifiers),
|
|
101
|
+
keys: getKeys(identifiers),
|
|
102
|
+
answerFormat: "tex",
|
|
103
|
+
identifiers,
|
|
104
|
+
hint: getHint(identifiers),
|
|
105
|
+
correction: getCorrection(identifiers),
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export const probaTreeSituationTotalProbaFormula = {
|
|
109
|
+
id: "probaTreeSituationTotalProbaFormula",
|
|
110
|
+
connector: "=",
|
|
111
|
+
label: "Utiliser la formule des probabilités totales dans un contexte",
|
|
112
|
+
isSingleStep: true,
|
|
113
|
+
generator: (nb, opts) => getDistinctQuestions(() => getProbaTreeSituationTotalProbaFormulaQuestion(opts), nb),
|
|
114
|
+
qcmTimer: 60,
|
|
115
|
+
freeTimer: 60,
|
|
116
|
+
getPropositions,
|
|
117
|
+
isAnswerValid,
|
|
118
|
+
subject: "Mathématiques",
|
|
119
|
+
getInstruction,
|
|
120
|
+
getHint,
|
|
121
|
+
getCorrection,
|
|
122
|
+
getAnswer,
|
|
123
|
+
getQuestionFromIdentifiers,
|
|
124
|
+
hasHintAndCorrection: true,
|
|
125
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticFindRecurrenceFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;
|
|
1
|
+
{"version":3,"file":"arithmeticFindRecurrenceFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAW1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;CACtD,CAAC;AAiRF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,4CAA4C,EAAE,QAAQ,CACjE,WAAW,EACX,OAAO,CAoBR,CAAC"}
|
|
@@ -10,10 +10,6 @@ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
|
10
10
|
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
11
11
|
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
12
12
|
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
13
|
-
const _getNodeFactor = (firstRank, varName = "n") => {
|
|
14
|
-
const nodeN = varName.toTree();
|
|
15
|
-
return firstRank === 0 ? nodeN : substract(nodeN, 1);
|
|
16
|
-
};
|
|
17
13
|
const situations = situationsArithmetic;
|
|
18
14
|
const getInstruction = (identifiers, optsIn) => {
|
|
19
15
|
const opts = optsIn ?? optsDefault;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAiB3D,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;AAwVF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,mDAAmD,EAAE,QAAQ,CACxE,WAAW,EACX,OAAO,CAqBR,CAAC"}
|