math-exercises 3.0.188 → 3.0.189
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/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +44 -37
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +16 -61
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.js +27 -35
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts +8 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.js +129 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.d.ts +8 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.js +108 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts +8 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.js +92 -0
- package/lib/exercises/math/functions/affines/adjustment/index.d.ts +4 -0
- package/lib/exercises/math/functions/affines/adjustment/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/index.js +3 -0
- package/lib/exercises/math/functions/affines/index.d.ts +2 -4
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +2 -4
- package/lib/exercises/math/functions/affines/situations/affineFromExercise.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineFromExercise.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineFromExercise.js +219 -0
- package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.js +69 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.js +133 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.js +229 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.js +166 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationVariation.d.ts +9 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationVariation.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationVariation.js +78 -0
- package/lib/exercises/math/functions/affines/situations/index.d.ts +6 -0
- package/lib/exercises/math/functions/affines/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/index.js +5 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts +1 -7
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +1 -7
- package/lib/exercises/math/probaStat/randomVariable/situations/index.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/index.js +7 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts +11 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.js +112 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.js +176 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.js +94 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.js +166 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.js +133 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.js +211 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.js +113 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.d.ts +41 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.js +173 -0
- package/lib/exercises/math/python/list/pyListMutationMix.d.ts.map +1 -1
- package/lib/exercises/math/python/list/pyListMutationMix.js +11 -6
- package/lib/index.d.ts +44 -24
- package/lib/index.d.ts.map +1 -1
- package/lib/tree/utilities/nodeUtils.d.ts +2 -0
- package/lib/tree/utilities/nodeUtils.d.ts.map +1 -1
- package/lib/tree/utilities/nodeUtils.js +40 -0
- package/package.json +1 -1
|
@@ -4,12 +4,6 @@ export * from "./isTableProbabilityLaw.js";
|
|
|
4
4
|
export * from "./randomVariableStandardDeviation.js";
|
|
5
5
|
export * from "./findValueToMatchRandomVariableAverage.js";
|
|
6
6
|
export * from "./calculateProbaFromVATableLaw.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./randomVariableSituationComputeProbability.js";
|
|
9
|
-
export * from "./randomVariableSituationAverage.js";
|
|
10
|
-
export * from "./randomVariableSituationVariance.js";
|
|
11
|
-
export * from "./randomVariableSituationStandardDeviation.js";
|
|
12
|
-
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
13
|
-
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
7
|
+
export * from "./situations/index.js";
|
|
14
8
|
export * from "./missingValueInRandomVariableProbabilityLaw.js";
|
|
15
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AAGrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AAGrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAElD,cAAc,uBAAuB,CAAC;AAEtC,cAAc,iDAAiD,CAAC"}
|
|
@@ -6,12 +6,6 @@ export * from "./randomVariableStandardDeviation.js";
|
|
|
6
6
|
// export * from "./findValueToMatchRandomVariableAverage.js";
|
|
7
7
|
export * from "./findValueToMatchRandomVariableAverage.js";
|
|
8
8
|
export * from "./calculateProbaFromVATableLaw.js";
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./randomVariableSituationComputeProbability.js";
|
|
11
|
-
export * from "./randomVariableSituationAverage.js";
|
|
12
|
-
export * from "./randomVariableSituationVariance.js";
|
|
13
|
-
export * from "./randomVariableSituationStandardDeviation.js";
|
|
14
|
-
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
15
|
-
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
9
|
+
export * from "./situations/index.js";
|
|
16
10
|
// export * from "./decideWhichGameIsLessRisky.js";
|
|
17
11
|
export * from "./missingValueInRandomVariableProbabilityLaw.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./randomVariableSituationAverage.js";
|
|
2
|
+
export * from "./randomVariableSituationComputeProbability.js";
|
|
3
|
+
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
4
|
+
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
5
|
+
export * from "./randomVariableSituationStandardDeviation.js";
|
|
6
|
+
export * from "./randomVariableSituationValues.js";
|
|
7
|
+
export * from "./randomVariableSituationVariance.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./randomVariableSituationAverage.js";
|
|
2
|
+
export * from "./randomVariableSituationComputeProbability.js";
|
|
3
|
+
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
4
|
+
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
5
|
+
export * from "./randomVariableSituationStandardDeviation.js";
|
|
6
|
+
export * from "./randomVariableSituationValues.js";
|
|
7
|
+
export * from "./randomVariableSituationVariance.js";
|
package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { RandomVariableSituationParams } from "./randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: RandomVariableSituationParams;
|
|
5
|
+
};
|
|
6
|
+
type Options = {
|
|
7
|
+
averageFormulation: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const randomVariableSituationAverage: Exercise<Identifiers, Options>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=randomVariableSituationAverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationAverage.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;CACvC,CAAC;AAqGF,KAAK,OAAO,GAAG;IACb,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAWF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBzE,CAAC"}
|
package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
6
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
7
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./randomVariableSituations.js";
|
|
8
|
+
const getPropositions = (n, { answer }) => {
|
|
9
|
+
const propositions = [];
|
|
10
|
+
addValidProp(propositions, answer);
|
|
11
|
+
propWhile(propositions, n, () => {
|
|
12
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductibleWithSign().toTree().toTex());
|
|
13
|
+
});
|
|
14
|
+
return shuffleProps(propositions, n);
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const { params } = identifiers;
|
|
18
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
19
|
+
return va.getAverage().simplify().toTex();
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers, opts) => {
|
|
22
|
+
const { params } = identifiers;
|
|
23
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
24
|
+
const question = opts?.averageFormulation === "Calculer $E(X)$"
|
|
25
|
+
? "Déterminer l'espérance $E(X)$ de $X$."
|
|
26
|
+
: "Déterminer le gain moyen auquel un joueur peut s'attendre après un grand nombre de parties.";
|
|
27
|
+
return (context +
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
${question}`);
|
|
31
|
+
};
|
|
32
|
+
const getHint = () => {
|
|
33
|
+
return `Dresse la loi de probabilité de $X$. Pour cela, détermine les valeurs possibles $x_i$ que peut prendre $X$, puis pour chaque valeur, calcule la probabilité $p_i$ associée.
|
|
34
|
+
|
|
35
|
+
Tu peux alors calculer l'espérance de $X$ par la formule :
|
|
36
|
+
|
|
37
|
+
$$
|
|
38
|
+
E(X) = x_1\\times p_1 + \\ldots + x_n\\times p_n
|
|
39
|
+
$$`;
|
|
40
|
+
};
|
|
41
|
+
const getCorrection = (identifiers) => {
|
|
42
|
+
const { params } = identifiers;
|
|
43
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
44
|
+
return `On dresse la loi de probabilité de $X$ :
|
|
45
|
+
|
|
46
|
+
${va.getLawMdTable()}
|
|
47
|
+
|
|
48
|
+
Puis on calcule l'espérance :
|
|
49
|
+
|
|
50
|
+
${alignTex([
|
|
51
|
+
["E(X)", "=", va.getAverage().toTex()],
|
|
52
|
+
["", "=", va.getAverage().simplify().toTex()],
|
|
53
|
+
])}
|
|
54
|
+
`;
|
|
55
|
+
};
|
|
56
|
+
const getKeys = () => {
|
|
57
|
+
return [];
|
|
58
|
+
};
|
|
59
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
60
|
+
try {
|
|
61
|
+
return rationalVEA(ans, answer);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
return handleVEAError(err);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const getRandomVariableSituationAverageQuestion = (opts) => {
|
|
68
|
+
const params = buildRandomVariableSituation();
|
|
69
|
+
const identifiers = {
|
|
70
|
+
params,
|
|
71
|
+
};
|
|
72
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
73
|
+
};
|
|
74
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
75
|
+
return {
|
|
76
|
+
answer: getAnswer(identifiers),
|
|
77
|
+
instruction: getInstruction(identifiers, opts),
|
|
78
|
+
keys: getKeys(identifiers),
|
|
79
|
+
answerFormat: "tex",
|
|
80
|
+
identifiers,
|
|
81
|
+
hint: getHint(identifiers),
|
|
82
|
+
correction: getCorrection(identifiers),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const options = [
|
|
86
|
+
{
|
|
87
|
+
id: "averageFormulation",
|
|
88
|
+
label: "Formulation de la consigne",
|
|
89
|
+
target: GeneratorOptionTarget.instruction,
|
|
90
|
+
type: GeneratorOptionType.select,
|
|
91
|
+
values: ["Calculer $E(X)$", "Calculer le gain moyen"],
|
|
92
|
+
defaultValue: "Calculer $E(X)$",
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
export const randomVariableSituationAverage = {
|
|
96
|
+
id: "randomVariableSituationAverage",
|
|
97
|
+
connector: "=",
|
|
98
|
+
label: "Calculer l'espérance $E(X)$ d'une variable aléatoire dans un contexte",
|
|
99
|
+
isSingleStep: true,
|
|
100
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationAverageQuestion(opts), nb),
|
|
101
|
+
options,
|
|
102
|
+
qcmTimer: 60,
|
|
103
|
+
freeTimer: 60,
|
|
104
|
+
getPropositions,
|
|
105
|
+
isAnswerValid,
|
|
106
|
+
subject: "Mathématiques",
|
|
107
|
+
getHint,
|
|
108
|
+
getCorrection,
|
|
109
|
+
getAnswer,
|
|
110
|
+
getQuestionFromIdentifiers,
|
|
111
|
+
hasHintAndCorrection: true,
|
|
112
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { RandomVariableSituationParams } from "./randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: RandomVariableSituationParams;
|
|
5
|
+
xi: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const randomVariableSituationComputeProbability: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=randomVariableSituationComputeProbability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationComputeProbability.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;IACtC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA4LF,eAAO,MAAM,yCAAyC,EAAE,QAAQ,CAAC,WAAW,CAuBzE,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
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 { RationalConstructor } from "../../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
6
|
+
import { random } from "../../../../../utils/alea/random.js";
|
|
7
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
8
|
+
import { pluralize } from "../../../../../utils/strings/pluralize.js";
|
|
9
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./randomVariableSituations.js";
|
|
10
|
+
const getPropositions = (n, { answer, params }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
addValidProp(propositions, answer);
|
|
13
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
14
|
+
for (const p of va.yValues) {
|
|
15
|
+
tryToAddWrongProp(propositions, p.toTex());
|
|
16
|
+
}
|
|
17
|
+
propWhile(propositions, n, () => {
|
|
18
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductibleProba().toTree().toTex());
|
|
19
|
+
});
|
|
20
|
+
return shuffleProps(propositions, n);
|
|
21
|
+
};
|
|
22
|
+
const getAnswer = (identifiers) => {
|
|
23
|
+
const { params, xi } = identifiers;
|
|
24
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
25
|
+
const index = va.xValues.findIndex((x) => x.evaluate() === xi);
|
|
26
|
+
return va.yValues[index].toTex();
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
const { params, xi } = identifiers;
|
|
30
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
31
|
+
return (context +
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
Calculer $P(X = ${xi})$.`);
|
|
35
|
+
};
|
|
36
|
+
const getHint = (identifiers) => {
|
|
37
|
+
const { xi } = identifiers;
|
|
38
|
+
return `Détermine l'ensemble des issues possibles pour cette expérience aléatoire. Puis, détermine les issues qui réalisent l'événement $X = ${xi}$. Tu peux alors utiliser l'équiprobabilité pour déterminer $P(X = ${xi})$.`;
|
|
39
|
+
};
|
|
40
|
+
const getCorrection = (identifiers) => {
|
|
41
|
+
const { xi, params } = identifiers;
|
|
42
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
43
|
+
const index = va.xValues.findIndex((x) => x.evaluate() === xi);
|
|
44
|
+
switch (params.id) {
|
|
45
|
+
case "coin": {
|
|
46
|
+
const throws = index === 0
|
|
47
|
+
? "deux fois faces"
|
|
48
|
+
: index === 1
|
|
49
|
+
? "une fois pile, et une fois face"
|
|
50
|
+
: "deux fois piles";
|
|
51
|
+
return `Cette expérience aléatoire a $4$ issues :
|
|
52
|
+
|
|
53
|
+
- obtenir deux faces;
|
|
54
|
+
- obtenir face au premier lancer, puis pile au deuxième;
|
|
55
|
+
- obtenir pile au premier lancer, puis face au deuxième;
|
|
56
|
+
- obtenir deux piles.
|
|
57
|
+
|
|
58
|
+
L'issue $X = ${xi}$ se réalise si on obtient ${throws}.
|
|
59
|
+
|
|
60
|
+
${index === 0 || index === 2
|
|
61
|
+
? `Il n'y a qu'une issue qui réalise cet évènement sur les $4$ issues possibles. La probabilité recherchée vaut donc :
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
${frac(1, 4).toTex()}
|
|
65
|
+
$$`
|
|
66
|
+
: `Il y a deux issues qui réalise cet évènement sur les $4$ issues possibles. La probabilité recherchée vaut donc :
|
|
67
|
+
|
|
68
|
+
$$
|
|
69
|
+
${frac(2, 4).toSimplificationTex()}
|
|
70
|
+
$$`}
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
case "urne": {
|
|
74
|
+
const effectif = xi === params.gb ? params.b : xi === params.gr ? params.r : params.n;
|
|
75
|
+
const color = xi === params.gb ? "blanche" : xi === params.gr ? "rouge" : "noire";
|
|
76
|
+
return `L'issue $X = ${xi}$ se réalise si on tire une boule ${color}.
|
|
77
|
+
|
|
78
|
+
Puisqu'il y a $${effectif}$ ${pluralize("boule", effectif)} ${pluralize(color, effectif)} sur un total de $${params.b + params.r + params.n}$ boules, la probabilité recherchée vaut :
|
|
79
|
+
|
|
80
|
+
$$
|
|
81
|
+
P(X=${xi}) = ${getAnswer(identifiers)}
|
|
82
|
+
$$`;
|
|
83
|
+
}
|
|
84
|
+
case "diceMultiple": {
|
|
85
|
+
const multiples = [];
|
|
86
|
+
for (let i = 1; i < params.n; i++) {
|
|
87
|
+
if (i % params.winningMultiple === 0) {
|
|
88
|
+
multiples.push(i);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return `L'issue $X = ${xi}$ se réalise si on ${xi > 0 ? `obtient` : "n'obtient pas"} un multiple de $${params.winningMultiple}$.
|
|
92
|
+
|
|
93
|
+
Les faces du dés qui sont des multiples de $${params.winningMultiple}$ sont : $${multiples.join("\\ ; \\ ")}$.
|
|
94
|
+
|
|
95
|
+
Il y a donc $${multiples.length}$ multiples de $${params.winningMultiple}$ possibles sur les $${params.n}$ faces.
|
|
96
|
+
|
|
97
|
+
La probabilité recherchée est donc :
|
|
98
|
+
|
|
99
|
+
$$
|
|
100
|
+
P(X=${xi}) = ${frac(multiples.length, params.n).toSimplificationTex()}
|
|
101
|
+
$$
|
|
102
|
+
`;
|
|
103
|
+
// case "diceSum":
|
|
104
|
+
// return ``
|
|
105
|
+
}
|
|
106
|
+
case "cards": {
|
|
107
|
+
const effectif = xi === params.gAs ? "4" : xi === params.gFigure ? "12" : "36";
|
|
108
|
+
const card = xi === params.gAs
|
|
109
|
+
? "as"
|
|
110
|
+
: xi === params.gFigure
|
|
111
|
+
? "figures"
|
|
112
|
+
: "cartes qui ne sont ni des as ni des figures";
|
|
113
|
+
const card2 = xi === params.gAs
|
|
114
|
+
? "un as"
|
|
115
|
+
: xi === params.gFigure
|
|
116
|
+
? "une figure"
|
|
117
|
+
: "une carte qui n'est ni un as ni une figure";
|
|
118
|
+
return `L'issue $X = ${xi}$ se réalise si on tire ${card2}.
|
|
119
|
+
|
|
120
|
+
Puisqu'il y a $${effectif}$ ${card} sur un total de $52$ cartes, la probabilité recherchée vaut :
|
|
121
|
+
|
|
122
|
+
$$
|
|
123
|
+
P(X=${xi}) = ${frac(effectif, 52).toSimplificationTex()}
|
|
124
|
+
$$`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const getKeys = () => {
|
|
129
|
+
return [];
|
|
130
|
+
};
|
|
131
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
132
|
+
try {
|
|
133
|
+
return rationalVEA(ans, answer);
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
return handleVEAError(err);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const getRandomVariableSituationComputeProbabilityQuestion = () => {
|
|
140
|
+
const params = buildRandomVariableSituation();
|
|
141
|
+
const xi = random(getRandomVariableSituation(params).getVA().xValues).evaluate();
|
|
142
|
+
const identifiers = {
|
|
143
|
+
params,
|
|
144
|
+
xi,
|
|
145
|
+
};
|
|
146
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
147
|
+
};
|
|
148
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
149
|
+
return {
|
|
150
|
+
answer: getAnswer(identifiers),
|
|
151
|
+
instruction: getInstruction(identifiers),
|
|
152
|
+
keys: getKeys(identifiers),
|
|
153
|
+
answerFormat: "tex",
|
|
154
|
+
identifiers,
|
|
155
|
+
hint: getHint(identifiers),
|
|
156
|
+
correction: getCorrection(identifiers),
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
export const randomVariableSituationComputeProbability = {
|
|
160
|
+
id: "randomVariableSituationComputeProbability",
|
|
161
|
+
connector: "=",
|
|
162
|
+
label: "Calculer une probabilité du type $P(X=k)$ pour une variable aléatoire $X$ dans un contexte",
|
|
163
|
+
isSingleStep: true,
|
|
164
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationComputeProbabilityQuestion(opts), nb),
|
|
165
|
+
qcmTimer: 60,
|
|
166
|
+
freeTimer: 60,
|
|
167
|
+
getPropositions,
|
|
168
|
+
isAnswerValid,
|
|
169
|
+
subject: "Mathématiques",
|
|
170
|
+
getInstruction,
|
|
171
|
+
getHint,
|
|
172
|
+
getCorrection,
|
|
173
|
+
getAnswer,
|
|
174
|
+
getQuestionFromIdentifiers,
|
|
175
|
+
hasHintAndCorrection: true,
|
|
176
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { RandomVariableSituationParams } from "./randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: RandomVariableSituationParams;
|
|
5
|
+
};
|
|
6
|
+
export declare const randomVariableSituationIsGameFavorable: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=randomVariableSituationIsGameFavorable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationIsGameFavorable.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;CACvC,CAAC;AA2FF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,WAAW,CAqBxE,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
4
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./randomVariableSituations.js";
|
|
5
|
+
const getPropositions = (n, { answer }) => {
|
|
6
|
+
const propositions = [];
|
|
7
|
+
addValidProp(propositions, answer, "raw");
|
|
8
|
+
tryToAddWrongProp(propositions, "Favorable au joueur", "raw");
|
|
9
|
+
tryToAddWrongProp(propositions, "Défavorable au joueur", "raw");
|
|
10
|
+
tryToAddWrongProp(propositions, "Équitable", "raw");
|
|
11
|
+
tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
|
|
12
|
+
return shuffleProps(propositions, n);
|
|
13
|
+
};
|
|
14
|
+
const getAnswer = (identifiers) => {
|
|
15
|
+
const { params } = identifiers;
|
|
16
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
17
|
+
const ev = va.getAverage().evaluate();
|
|
18
|
+
if (ev > 0)
|
|
19
|
+
return "Favorable au joueur";
|
|
20
|
+
if (ev < 0)
|
|
21
|
+
return "Défavorable au joueur";
|
|
22
|
+
return "Équitable";
|
|
23
|
+
};
|
|
24
|
+
const getInstruction = (identifiers) => {
|
|
25
|
+
const { params } = identifiers;
|
|
26
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
27
|
+
return (context +
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
Ce jeu est-il favorable au joueur, défavorable au joueur, ou équitable ? `);
|
|
31
|
+
};
|
|
32
|
+
const getHint = () => {
|
|
33
|
+
return `Dresse la loi de probabilité de $X$. Pour cela, détermine les valeurs possibles $x_i$ que peut prendre $X$, puis pour chaque valeur, calcule la probabilité $p_i$ associée.
|
|
34
|
+
|
|
35
|
+
Tu peux alors calculer l'espérance de $X$ par la formule :
|
|
36
|
+
|
|
37
|
+
$$
|
|
38
|
+
E(X) = x_1\\times p_1 + \\ldots + x_n\\times p_n
|
|
39
|
+
$$
|
|
40
|
+
|
|
41
|
+
On dit alors que le jeu est favorable au joueur si $E(X)>0$, defavorable au joueur si $E(X)<0$, et équitable si $E(X)=0$.`;
|
|
42
|
+
};
|
|
43
|
+
const getCorrection = (identifiers) => {
|
|
44
|
+
const { params } = identifiers;
|
|
45
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
46
|
+
const avg = va.getAverage();
|
|
47
|
+
return `On dresse la loi de probabilité de $X$ :
|
|
48
|
+
|
|
49
|
+
${va.getLawMdTable()}
|
|
50
|
+
|
|
51
|
+
Puis on calcule l'espérance :
|
|
52
|
+
|
|
53
|
+
${alignTex([
|
|
54
|
+
["E(X)", "=", avg.toTex()],
|
|
55
|
+
["", "=", avg.simplify().toTex()],
|
|
56
|
+
])}
|
|
57
|
+
|
|
58
|
+
Puisque $E(X)${avg.toSignInequationTex().slice(-2)}$, le jeu est ${getAnswer(identifiers).toLocaleLowerCase()}.`;
|
|
59
|
+
};
|
|
60
|
+
const getRandomVariableSituationAverageQuestion = (opts) => {
|
|
61
|
+
const params = buildRandomVariableSituation();
|
|
62
|
+
const identifiers = {
|
|
63
|
+
params,
|
|
64
|
+
};
|
|
65
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
66
|
+
};
|
|
67
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
68
|
+
return {
|
|
69
|
+
answer: getAnswer(identifiers),
|
|
70
|
+
instruction: getInstruction(identifiers, opts),
|
|
71
|
+
keys: [],
|
|
72
|
+
answerFormat: "raw",
|
|
73
|
+
identifiers,
|
|
74
|
+
hint: getHint(identifiers),
|
|
75
|
+
correction: getCorrection(identifiers),
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export const randomVariableSituationIsGameFavorable = {
|
|
79
|
+
id: "randomVariableSituationIsGameFavorable",
|
|
80
|
+
connector: "=",
|
|
81
|
+
label: "Déterminer si un jeu est favorable, défavorable ou équitable à l'aide de l'espérance d'une variable aléatoire dans un contexte",
|
|
82
|
+
isSingleStep: true,
|
|
83
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationAverageQuestion(opts), nb),
|
|
84
|
+
qcmTimer: 60,
|
|
85
|
+
freeTimer: 60,
|
|
86
|
+
getPropositions,
|
|
87
|
+
answerType: "QCU",
|
|
88
|
+
subject: "Mathématiques",
|
|
89
|
+
getHint,
|
|
90
|
+
getCorrection,
|
|
91
|
+
getAnswer,
|
|
92
|
+
getQuestionFromIdentifiers,
|
|
93
|
+
hasHintAndCorrection: true,
|
|
94
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { RandomVariableSituationParams } from "./randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: RandomVariableSituationParams;
|
|
5
|
+
initTable: string[][];
|
|
6
|
+
};
|
|
7
|
+
export declare const randomVariableSituationProbabilityLaw: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=randomVariableSituationProbabilityLaw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationProbabilityLaw.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;IACtC,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;CACvB,CAAC;AA+MF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAAC,WAAW,CAiBvE,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
2
|
+
import { xTableLineVEA } from "../../../../../exercises/vea/xTableLineVEA.js";
|
|
3
|
+
import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
|
|
4
|
+
import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
5
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
7
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
8
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./randomVariableSituations.js";
|
|
9
|
+
const getAnswerTable = (identifiers) => {
|
|
10
|
+
const { params } = identifiers;
|
|
11
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
12
|
+
return va.getLawTable();
|
|
13
|
+
};
|
|
14
|
+
const getInstruction = (identifiers) => {
|
|
15
|
+
const { params } = identifiers;
|
|
16
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
17
|
+
return (context +
|
|
18
|
+
`
|
|
19
|
+
|
|
20
|
+
Déterminer la loi de probabilité de $X$.`);
|
|
21
|
+
};
|
|
22
|
+
const getHint = () => {
|
|
23
|
+
return `Détermine les valeurs possibles $x_i$ que peut prendre $X$. Puis, pour chaque valeur, calcule la probabilité $p_i$ associée.`;
|
|
24
|
+
};
|
|
25
|
+
const getCorrection = (identifiers) => {
|
|
26
|
+
const { params } = identifiers;
|
|
27
|
+
const table = getRandomVariableSituation(params).getVA().getLawMdTable();
|
|
28
|
+
switch (params.id) {
|
|
29
|
+
case "coin":
|
|
30
|
+
return `On liste toutes les issues possibles :
|
|
31
|
+
|
|
32
|
+
- $2$ piles : le gain du joueur est alors $${multiply(2, params.a).toSimplificationTex()}$ points. De plus, la probabilité d'obtenir $2$ piles est :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
\\frac{1}{2}\\times \\frac{1}{2} = \\frac{1}{4}
|
|
36
|
+
$$
|
|
37
|
+
|
|
38
|
+
- $1$ pile, $1$ face : le gain du joueur est alors $${substract(params.a, params.b).toSimplificationTex()}$ points. De plus, il y a deux possibilités pour réaliser cette issue : obtenir pile au premier lancer puis face au deuxième, ou obtenir face au premier lance puis pile au deuxième. La probabilité de cette issue est donc :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
\\frac{1}{2}\\times \\frac{1}{2} + \\frac{1}{2}\\times \\frac{1}{2} = \\frac{1}{2}
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
- $2$ faces: le gain du joueur est alors $${opposite(multiply(2, params.b)).toSimplificationTex()}$ points. De plus, la probabilité d'obtenir $2$ piles est :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
\\frac{1}{2}\\times \\frac{1}{2} = \\frac{1}{4}
|
|
49
|
+
$$
|
|
50
|
+
|
|
51
|
+
La loi de probabilité de $X$ est donc :
|
|
52
|
+
|
|
53
|
+
${table}
|
|
54
|
+
|
|
55
|
+
`;
|
|
56
|
+
case "urne": {
|
|
57
|
+
const total = params.n + params.r + params.b;
|
|
58
|
+
return `On s'intéresse à chaque issue :
|
|
59
|
+
|
|
60
|
+
- Tirer une boule blanche : le gain algébrique est $${params.gb}$, et la probabilité vaut $${frac(params.b, total).toSimplificationTex()}$ ;
|
|
61
|
+
- Tirer une boule rouge : le gain algébrique est $${params.gr}$, et la probabilité vaut $${frac(params.r, total).toSimplificationTex()}$ ;
|
|
62
|
+
- Tirer une boule noire : le gain algébrique est $${params.gn}$, et la probabilité vaut $${frac(params.n, total).toSimplificationTex()}$.
|
|
63
|
+
|
|
64
|
+
La loi de probabilité de $X$ est donc :
|
|
65
|
+
|
|
66
|
+
${table}
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
case "diceMultiple": {
|
|
70
|
+
const multiples = [];
|
|
71
|
+
for (let i = 1; i <= params.n; i++) {
|
|
72
|
+
if (i % params.winningMultiple === 0) {
|
|
73
|
+
multiples.push(i);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return `Les faces du dés qui sont des multiples de $${params.winningMultiple}$ sont : $${multiples.join("\\ ; \\ ")}$.
|
|
77
|
+
|
|
78
|
+
La probabilité d'obtenir un multiple de $${params.winningMultiple}$ est donc $${frac(multiples.length, params.n).toSimplificationTex()}$, et dans ce cas on gagne $${params.gain}\\ €$.
|
|
79
|
+
|
|
80
|
+
La probabilité de ne pas obtenir un multiple de $${params.winningMultiple}$ est alors $${frac(params.n - multiples.length, params.n).toSimplificationTex()}$, et dans ce cas on perd $${params.loss}\\ €$.
|
|
81
|
+
|
|
82
|
+
La loi de probabilité de $X$ est donc :
|
|
83
|
+
|
|
84
|
+
${table}
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
case "cards": {
|
|
88
|
+
return `On s'intéresse à chaque issue :
|
|
89
|
+
|
|
90
|
+
- Tirer un as : le gain algébrique est $${params.gAs}$, et la probabilité vaut $${frac(4, 52).toSimplificationTex()}$ ;
|
|
91
|
+
- Tirer une figure: le gain algébrique est $${params.gFigure}$, et la probabilité vaut $${frac(12, 52).toSimplificationTex()}$ ;
|
|
92
|
+
- Tirer une autre carte : le gain algébrique est $${params.gOther}$, et la probabilité vaut $${frac(36, 52).toSimplificationTex()}$.
|
|
93
|
+
|
|
94
|
+
La loi de probabilité de $X$ est donc :
|
|
95
|
+
|
|
96
|
+
${table}
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
// case "diceSum": {
|
|
100
|
+
// const results = [["\\ ", "1", "2", "3", "4"], ["1"], ["2"], ["3"], ["4"]];
|
|
101
|
+
// for (let i = 1; i < 5; i++) {
|
|
102
|
+
// for (let j = 1; j < 5; j++) {
|
|
103
|
+
// results[i][j] = (i + j).frenchify();
|
|
104
|
+
// }
|
|
105
|
+
// }
|
|
106
|
+
// return `Voici tous les résultats possibles en fonction du résultat de chaque dé :
|
|
107
|
+
// ${mdTable(results, true)}
|
|
108
|
+
// Les valeurs possibles pour $X$ sont donc :
|
|
109
|
+
// ${mdTable(getAnswerTable(identifiers), true)}`;
|
|
110
|
+
// }
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const getKeys = () => {
|
|
114
|
+
return [];
|
|
115
|
+
};
|
|
116
|
+
const isAnswerTableValid = (ans, { answerTable }) => {
|
|
117
|
+
try {
|
|
118
|
+
const sorted = ans[0]
|
|
119
|
+
.map((v, i) => [v, ans[1][i]])
|
|
120
|
+
.sort((a, b) => a[0].unfrenchify() - b[0].unfrenchify());
|
|
121
|
+
const sortedStudentAns = [sorted.map((x) => x[0]), sorted.map((x) => x[1])];
|
|
122
|
+
return (xTableLineVEA(sortedStudentAns[0], answerTable[0]) &&
|
|
123
|
+
xTableLineVEA(sortedStudentAns[1], answerTable[1]));
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
return handleVEAError(err);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const getRandomVariableSituationValuesQuestion = () => {
|
|
130
|
+
const params = buildRandomVariableSituation();
|
|
131
|
+
const values = getRandomVariableSituation(params).getVA().xValues;
|
|
132
|
+
const identifiers = {
|
|
133
|
+
params,
|
|
134
|
+
initTable: [
|
|
135
|
+
[`$x_i$`, ...values.map((_e) => "")],
|
|
136
|
+
[`$P(X=x_i)$`, ...values.map((_e) => "")],
|
|
137
|
+
],
|
|
138
|
+
};
|
|
139
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
140
|
+
};
|
|
141
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
142
|
+
return {
|
|
143
|
+
answerTable: getAnswerTable(identifiers),
|
|
144
|
+
instruction: getInstruction(identifiers),
|
|
145
|
+
keys: getKeys(identifiers),
|
|
146
|
+
answerFormat: "tex",
|
|
147
|
+
identifiers,
|
|
148
|
+
hint: getHint(identifiers),
|
|
149
|
+
correction: getCorrection(identifiers),
|
|
150
|
+
initTable: identifiers.initTable,
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export const randomVariableSituationProbabilityLaw = {
|
|
154
|
+
id: "randomVariableSituationProbabilityLaw",
|
|
155
|
+
label: "Dresser la loi de probabilité d'une variable aléatoire avec contexte",
|
|
156
|
+
isSingleStep: true,
|
|
157
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationValuesQuestion(opts), nb),
|
|
158
|
+
qcmTimer: 60,
|
|
159
|
+
freeTimer: 60,
|
|
160
|
+
isAnswerTableValid,
|
|
161
|
+
getAnswerTable,
|
|
162
|
+
subject: "Mathématiques",
|
|
163
|
+
getQuestionFromIdentifiers,
|
|
164
|
+
hasHintAndCorrection: true,
|
|
165
|
+
answerType: "valueTable",
|
|
166
|
+
};
|