math-exercises 3.0.187 → 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/exp/expDerivativeProductFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +22 -6
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +16 -8
- 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/derivativeNumber/derivativeNumberAndImageReading.d.ts +9 -0
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.js +155 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivativeNumber/index.js +1 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +80 -29
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +30 -2
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +59 -16
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +23 -9
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +2 -7
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +18 -68
- 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/functions/sign/equationFromSignTable.d.ts +1 -0
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/equationFromSignTable.js +60 -33
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts +6 -4
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.js +160 -63
- package/lib/exercises/math/functions/sign/readSignTable.d.ts +4 -1
- package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/readSignTable.js +32 -9
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +6 -4
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/signTableFromGraph.js +160 -57
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts +9 -0
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts.map +1 -0
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.js +135 -0
- package/lib/exercises/math/percent/evolutions/index.d.ts +1 -0
- package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/index.js +1 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts +9 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts.map +1 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.js +118 -0
- package/lib/exercises/math/powers/estimateNthRoot.d.ts +13 -0
- package/lib/exercises/math/powers/estimateNthRoot.d.ts.map +1 -0
- package/lib/exercises/math/powers/estimateNthRoot.js +126 -0
- package/lib/exercises/math/powers/index.d.ts +3 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +3 -0
- package/lib/exercises/math/powers/solveNthRootEquation.d.ts +9 -0
- package/lib/exercises/math/powers/solveNthRootEquation.d.ts.map +1 -0
- package/lib/exercises/math/powers/solveNthRootEquation.js +111 -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/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +2 -2
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +1 -1
- package/lib/exercises/vea/percentVEA.d.ts +6 -1
- package/lib/exercises/vea/percentVEA.d.ts.map +1 -1
- package/lib/exercises/vea/percentVEA.js +15 -1
- package/lib/index.d.ts +78 -33
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +5 -8
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +1 -3
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqGeometricSituations.js +8 -10
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +8 -0
- package/lib/tree/nodes/sets/closure.d.ts +1 -0
- package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
- package/lib/tree/nodes/sets/closure.js +12 -0
- 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
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../math/utils/round.js";
|
|
7
|
+
import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { add } from "../../../tree/nodes/operators/addNode.js";
|
|
9
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
10
|
+
import { power } from "../../../tree/nodes/operators/powerNode.js";
|
|
11
|
+
import { substract } from "../../../tree/nodes/operators/substractNode.js";
|
|
12
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
13
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
14
|
+
const getPropositions = (n, { answer }) => {
|
|
15
|
+
const propositions = [];
|
|
16
|
+
addValidProp(propositions, answer);
|
|
17
|
+
propWhile(propositions, n, () => {
|
|
18
|
+
tryToAddWrongProp(propositions, randfloat(0.1, 1.1, 2).frenchify());
|
|
19
|
+
});
|
|
20
|
+
return shuffleProps(propositions, n);
|
|
21
|
+
};
|
|
22
|
+
const getAnswer = (identifiers) => {
|
|
23
|
+
const { nIds, kIds } = identifiers;
|
|
24
|
+
const n = reifyAlgebraic(nIds);
|
|
25
|
+
const k = reifyAlgebraic(kIds);
|
|
26
|
+
return round(substract(power(k, frac(1, n)), 1).evaluate(), 2).frenchify();
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
const { nIds, kIds } = identifiers;
|
|
30
|
+
const n = reifyAlgebraic(nIds);
|
|
31
|
+
const k = reifyAlgebraic(kIds);
|
|
32
|
+
return `Résoudre l'équation suivante :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
${power(add(1, "t"), n).toTex()}= ${k.toTex()}
|
|
36
|
+
$$
|
|
37
|
+
|
|
38
|
+
Donner la solution arrondie au centième.`;
|
|
39
|
+
};
|
|
40
|
+
const getHint = () => {
|
|
41
|
+
return `Utilise la propriété suivante :
|
|
42
|
+
|
|
43
|
+
$$
|
|
44
|
+
a^n = k \\iff a = k^{\\frac{1}{n}}
|
|
45
|
+
$$`;
|
|
46
|
+
};
|
|
47
|
+
const getCorrection = (identifiers) => {
|
|
48
|
+
const { nIds, kIds } = identifiers;
|
|
49
|
+
const n = reifyAlgebraic(nIds);
|
|
50
|
+
const k = reifyAlgebraic(kIds);
|
|
51
|
+
return `On sait que :
|
|
52
|
+
|
|
53
|
+
$$
|
|
54
|
+
a^n = k \\iff a = k^{\\frac{1}{n}}
|
|
55
|
+
$$
|
|
56
|
+
|
|
57
|
+
Ici, on a donc :
|
|
58
|
+
|
|
59
|
+
${alignTex([
|
|
60
|
+
["1+t", "=", power(k, frac(1, n)).toTex()],
|
|
61
|
+
["", "\\approx", round(power(k, frac(1, n)).evaluate(), 2).frenchify()],
|
|
62
|
+
])}
|
|
63
|
+
|
|
64
|
+
On en déduit donc :
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
t \\approx ${getAnswer(identifiers)}
|
|
68
|
+
$$`;
|
|
69
|
+
};
|
|
70
|
+
const getKeys = () => {
|
|
71
|
+
return [];
|
|
72
|
+
};
|
|
73
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
74
|
+
try {
|
|
75
|
+
return numberVEA(ans, answer);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
return handleVEAError(err);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const getEquationOnePlusTPowerNQuestion = () => {
|
|
82
|
+
const n = randint(3, 10);
|
|
83
|
+
const k = randint(2, 10);
|
|
84
|
+
const identifiers = {
|
|
85
|
+
kIds: k.toTree().toIdentifiers(),
|
|
86
|
+
nIds: n.toTree().toIdentifiers(),
|
|
87
|
+
};
|
|
88
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
89
|
+
};
|
|
90
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
91
|
+
return {
|
|
92
|
+
answer: getAnswer(identifiers),
|
|
93
|
+
instruction: getInstruction(identifiers),
|
|
94
|
+
keys: getKeys(identifiers),
|
|
95
|
+
answerFormat: "tex",
|
|
96
|
+
identifiers,
|
|
97
|
+
hint: getHint(identifiers),
|
|
98
|
+
correction: getCorrection(identifiers),
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export const equationOnePlusTPowerN = {
|
|
102
|
+
id: "equationOnePlusTPowerN",
|
|
103
|
+
connector: "=",
|
|
104
|
+
label: "Résoudre une équation du type $(1 + t)^n = k$, d'inconnue $t$",
|
|
105
|
+
isSingleStep: true,
|
|
106
|
+
generator: (nb, opts) => getDistinctQuestions(() => getEquationOnePlusTPowerNQuestion(opts), nb),
|
|
107
|
+
qcmTimer: 60,
|
|
108
|
+
freeTimer: 60,
|
|
109
|
+
getPropositions,
|
|
110
|
+
isAnswerValid,
|
|
111
|
+
subject: "Mathématiques",
|
|
112
|
+
getInstruction,
|
|
113
|
+
getHint,
|
|
114
|
+
getCorrection,
|
|
115
|
+
getAnswer,
|
|
116
|
+
getQuestionFromIdentifiers,
|
|
117
|
+
hasHintAndCorrection: true,
|
|
118
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
writeAsRoot: boolean;
|
|
5
|
+
aIds: NodeIdentifiers;
|
|
6
|
+
nIds: NodeIdentifiers;
|
|
7
|
+
};
|
|
8
|
+
type Options = {
|
|
9
|
+
writeAsRoot: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const estimateNthRoot: Exercise<Identifiers, Options>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=estimateNthRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimateNthRoot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/estimateNthRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,OAAO,CAAC;IAErB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AA0GF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAYF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB1D,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, GeneratorOptionType, GeneratorOptionTarget, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../math/utils/round.js";
|
|
7
|
+
import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { power } from "../../../tree/nodes/operators/powerNode.js";
|
|
10
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
11
|
+
const getPropositions = (n, { answer }) => {
|
|
12
|
+
const propositions = [];
|
|
13
|
+
addValidProp(propositions, answer);
|
|
14
|
+
propWhile(propositions, n, () => {
|
|
15
|
+
tryToAddWrongProp(propositions, randfloat(0.1, 3, 2).frenchify());
|
|
16
|
+
});
|
|
17
|
+
return shuffleProps(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { aIds, nIds } = identifiers;
|
|
21
|
+
const a = reifyAlgebraic(aIds);
|
|
22
|
+
const n = reifyAlgebraic(nIds);
|
|
23
|
+
const value = Math.pow(a.evaluate(), 1 / n.evaluate());
|
|
24
|
+
return round(value, 2).frenchify();
|
|
25
|
+
};
|
|
26
|
+
const getStatement = (identifiers) => {
|
|
27
|
+
const { writeAsRoot, aIds, nIds } = identifiers;
|
|
28
|
+
const a = reifyAlgebraic(aIds);
|
|
29
|
+
const n = reifyAlgebraic(nIds);
|
|
30
|
+
return writeAsRoot
|
|
31
|
+
? `\\sqrt[${n.evaluate()}]{${a.toTex()}}`
|
|
32
|
+
: `${power(a, frac(1, n)).toTex()}`;
|
|
33
|
+
};
|
|
34
|
+
const getInstruction = (identifiers) => {
|
|
35
|
+
const { aIds, nIds } = identifiers;
|
|
36
|
+
const a = reifyAlgebraic(aIds);
|
|
37
|
+
const n = reifyAlgebraic(nIds);
|
|
38
|
+
const value = Math.pow(a.evaluate(), 1 / n.evaluate());
|
|
39
|
+
const isExact = round(value, 2) === value;
|
|
40
|
+
return `Calculer :
|
|
41
|
+
|
|
42
|
+
$$
|
|
43
|
+
${getStatement(identifiers)}
|
|
44
|
+
$$
|
|
45
|
+
|
|
46
|
+
${isExact
|
|
47
|
+
? `Donner la valeur exacte.`
|
|
48
|
+
: `Donner une valeur arrondie au centième.`}
|
|
49
|
+
`;
|
|
50
|
+
};
|
|
51
|
+
const getHint = () => {
|
|
52
|
+
return `Sers-toi de la calculatrice.`;
|
|
53
|
+
};
|
|
54
|
+
const getCorrection = (identifiers) => {
|
|
55
|
+
const { aIds, nIds } = identifiers;
|
|
56
|
+
const a = reifyAlgebraic(aIds);
|
|
57
|
+
const n = reifyAlgebraic(nIds);
|
|
58
|
+
const value = Math.pow(a.evaluate(), 1 / n.evaluate());
|
|
59
|
+
const isExact = round(value, 2) === value;
|
|
60
|
+
return `On utilise la calculatrice :
|
|
61
|
+
|
|
62
|
+
$$
|
|
63
|
+
${getStatement(identifiers)} ${isExact ? "=" : "\\approx"} ${getAnswer(identifiers)}
|
|
64
|
+
$$`;
|
|
65
|
+
};
|
|
66
|
+
const getKeys = () => {
|
|
67
|
+
return [];
|
|
68
|
+
};
|
|
69
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
70
|
+
try {
|
|
71
|
+
return numberVEA(ans, answer);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
return handleVEAError(err);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const getEstimateNthRootQuestion = (ops) => {
|
|
78
|
+
const writeAsRoot = !!ops?.writeAsRoot;
|
|
79
|
+
const a = randint(2, 20).toTree();
|
|
80
|
+
const n = randint(3, 20).toTree();
|
|
81
|
+
const identifiers = {
|
|
82
|
+
aIds: a.toIdentifiers(),
|
|
83
|
+
nIds: n.toIdentifiers(),
|
|
84
|
+
writeAsRoot,
|
|
85
|
+
};
|
|
86
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
87
|
+
};
|
|
88
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
89
|
+
return {
|
|
90
|
+
answer: getAnswer(identifiers),
|
|
91
|
+
instruction: getInstruction(identifiers),
|
|
92
|
+
keys: getKeys(identifiers),
|
|
93
|
+
answerFormat: "tex",
|
|
94
|
+
identifiers,
|
|
95
|
+
hint: getHint(identifiers),
|
|
96
|
+
correction: getCorrection(identifiers),
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const options = [
|
|
100
|
+
{
|
|
101
|
+
id: "writeAsRoot",
|
|
102
|
+
label: "Écrire comme racine $n$-ème $\\sqrt[n]{a}$",
|
|
103
|
+
type: GeneratorOptionType.checkbox,
|
|
104
|
+
target: GeneratorOptionTarget.instruction,
|
|
105
|
+
defaultValue: false,
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
export const estimateNthRoot = {
|
|
109
|
+
id: "estimateNthRoot",
|
|
110
|
+
connector: "=",
|
|
111
|
+
label: "Calculer une puissance du type $a^{\\frac{1}{n}}$ (racine $n$-ième) avec la calculatrice",
|
|
112
|
+
isSingleStep: true,
|
|
113
|
+
generator: (nb, opts) => getDistinctQuestions(() => getEstimateNthRootQuestion(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
|
+
options,
|
|
126
|
+
};
|
|
@@ -10,4 +10,7 @@ export * from "./scientificToDecimal.js";
|
|
|
10
10
|
export * from "./powersMixOperations.js";
|
|
11
11
|
export * from "./powersOfTenMixOperations.js";
|
|
12
12
|
export * from "./powerNotation.js";
|
|
13
|
+
export * from "./estimateNthRoot.js";
|
|
14
|
+
export * from "./solveNthRootEquation.js";
|
|
15
|
+
export * from "./equationOnePlusTPowerN.js";
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC"}
|
|
@@ -10,3 +10,6 @@ export * from "./scientificToDecimal.js";
|
|
|
10
10
|
export * from "./powersMixOperations.js";
|
|
11
11
|
export * from "./powersOfTenMixOperations.js";
|
|
12
12
|
export * from "./powerNotation.js";
|
|
13
|
+
export * from "./estimateNthRoot.js";
|
|
14
|
+
export * from "./solveNthRootEquation.js";
|
|
15
|
+
export * from "./equationOnePlusTPowerN.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
nIds: NodeIdentifiers;
|
|
5
|
+
kIds: NodeIdentifiers;
|
|
6
|
+
};
|
|
7
|
+
export declare const solveNthRootEquation: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=solveNthRootEquation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solveNthRootEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/solveNthRootEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IAEjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AA4FF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../math/utils/round.js";
|
|
7
|
+
import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { power } from "../../../tree/nodes/operators/powerNode.js";
|
|
10
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
11
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
12
|
+
const getPropositions = (n, { answer }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
addValidProp(propositions, answer);
|
|
15
|
+
propWhile(propositions, n, () => {
|
|
16
|
+
tryToAddWrongProp(propositions, randfloat(1, 3, 2).frenchify());
|
|
17
|
+
});
|
|
18
|
+
return shuffleProps(propositions, n);
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { nIds, kIds } = identifiers;
|
|
22
|
+
const n = reifyAlgebraic(nIds);
|
|
23
|
+
const k = reifyAlgebraic(kIds);
|
|
24
|
+
return round(Math.pow(k.evaluate(), 1 / n.evaluate()), 2).frenchify();
|
|
25
|
+
};
|
|
26
|
+
const getInstruction = (identifiers) => {
|
|
27
|
+
const { nIds, kIds } = identifiers;
|
|
28
|
+
const n = reifyAlgebraic(nIds);
|
|
29
|
+
const k = reifyAlgebraic(kIds);
|
|
30
|
+
return `Résoudre l'équation suivante :
|
|
31
|
+
|
|
32
|
+
$$
|
|
33
|
+
a^${n.toTex()} = ${k.toTex()}
|
|
34
|
+
$$
|
|
35
|
+
|
|
36
|
+
Donner la solution arrondie au centième.`;
|
|
37
|
+
};
|
|
38
|
+
const getHint = () => {
|
|
39
|
+
return `Utilise la propriété suivante :
|
|
40
|
+
|
|
41
|
+
$$
|
|
42
|
+
a^n = k \\iff a = k^{\\frac{1}{n}}
|
|
43
|
+
$$`;
|
|
44
|
+
};
|
|
45
|
+
const getCorrection = (identifiers) => {
|
|
46
|
+
const { nIds, kIds } = identifiers;
|
|
47
|
+
const n = reifyAlgebraic(nIds);
|
|
48
|
+
const k = reifyAlgebraic(kIds);
|
|
49
|
+
return `On sait que :
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
a^n = k \\iff a = k^{\\frac{1}{n}}
|
|
53
|
+
$$
|
|
54
|
+
|
|
55
|
+
Ici, on a donc :
|
|
56
|
+
|
|
57
|
+
${alignTex([
|
|
58
|
+
["a", "=", power(k, frac(1, n)).toTex()],
|
|
59
|
+
["", "\\approx", getAnswer(identifiers)],
|
|
60
|
+
])}
|
|
61
|
+
`;
|
|
62
|
+
};
|
|
63
|
+
const getKeys = () => {
|
|
64
|
+
return [];
|
|
65
|
+
};
|
|
66
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
67
|
+
try {
|
|
68
|
+
return numberVEA(ans, answer);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
return handleVEAError(err);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const getSolveNthRootEquationQuestion = () => {
|
|
75
|
+
const n = randint(3, 10);
|
|
76
|
+
const k = randint(2, 10);
|
|
77
|
+
const identifiers = {
|
|
78
|
+
nIds: n.toTree().toIdentifiers(),
|
|
79
|
+
kIds: k.toTree().toIdentifiers(),
|
|
80
|
+
};
|
|
81
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
82
|
+
};
|
|
83
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
84
|
+
return {
|
|
85
|
+
answer: getAnswer(identifiers),
|
|
86
|
+
instruction: getInstruction(identifiers),
|
|
87
|
+
keys: getKeys(identifiers),
|
|
88
|
+
answerFormat: "tex",
|
|
89
|
+
identifiers,
|
|
90
|
+
hint: getHint(identifiers),
|
|
91
|
+
correction: getCorrection(identifiers),
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export const solveNthRootEquation = {
|
|
95
|
+
id: "solveNthRootEquation",
|
|
96
|
+
connector: "=",
|
|
97
|
+
label: "Résoudre une équation du type $a^n = k$, d'inconnue $a$",
|
|
98
|
+
isSingleStep: true,
|
|
99
|
+
generator: (nb, opts) => getDistinctQuestions(() => getSolveNthRootEquationQuestion(opts), nb),
|
|
100
|
+
qcmTimer: 60,
|
|
101
|
+
freeTimer: 60,
|
|
102
|
+
getPropositions,
|
|
103
|
+
isAnswerValid,
|
|
104
|
+
subject: "Mathématiques",
|
|
105
|
+
getInstruction,
|
|
106
|
+
getHint,
|
|
107
|
+
getCorrection,
|
|
108
|
+
getAnswer,
|
|
109
|
+
getQuestionFromIdentifiers,
|
|
110
|
+
hasHintAndCorrection: true,
|
|
111
|
+
};
|
|
@@ -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"}
|