math-exercises 2.2.58 → 2.2.59
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+EF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
|
|
@@ -7,13 +7,20 @@ const randint_1 = require("../../../../math/utils/random/randint");
|
|
|
7
7
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
8
8
|
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
9
9
|
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
10
|
-
const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
11
10
|
const probaFlip_1 = require("../../../../utils/alea/probaFlip");
|
|
12
|
-
const
|
|
11
|
+
const getAnswerNode = (roots, a) => {
|
|
13
12
|
const isSingleRoot = roots.length === 1;
|
|
14
13
|
return isSingleRoot
|
|
15
|
-
?
|
|
16
|
-
|
|
14
|
+
? (0, multiplyNode_1.multiply)(a, (0, powerNode_1.square)((0, substractNode_1.substract)("x", roots[0]))).simplify({
|
|
15
|
+
keepPowers: true,
|
|
16
|
+
})
|
|
17
|
+
: (0, multiplyNode_1.multiply)((0, multiplyNode_1.multiply)(a, (0, substractNode_1.substract)("x", roots[0])), (0, substractNode_1.substract)("x", roots[1])).simplify();
|
|
18
|
+
};
|
|
19
|
+
const getInstruction = (identifiers) => {
|
|
20
|
+
const { a, roots } = identifiers;
|
|
21
|
+
return `Soit $f(x) = ax^2 + bx + c$ un polynôme du second degré avec $a = ${a}$ et qui a ${roots.length === 1
|
|
22
|
+
? `pour seule racine : $${roots[0]}$`
|
|
23
|
+
: `deux racines : $${roots[0]}$ et $${roots[1]}$`}. Déterminer la forme factorisée de $f$.`;
|
|
17
24
|
};
|
|
18
25
|
const getFactorizedFormFromRootsQuestion = () => {
|
|
19
26
|
const a = (0, randint_1.randint)(-10, 10, [0]);
|
|
@@ -23,32 +30,31 @@ const getFactorizedFormFromRootsQuestion = () => {
|
|
|
23
30
|
const roots = isSingleRoot
|
|
24
31
|
? [firstRoot]
|
|
25
32
|
: [firstRoot, secondRoot].sort((a, b) => a - b);
|
|
26
|
-
const answer =
|
|
33
|
+
const answer = getAnswerNode(roots, a);
|
|
27
34
|
const answerTex = answer.toTex();
|
|
35
|
+
const identifiers = { a, roots };
|
|
28
36
|
const question = {
|
|
29
37
|
answer: answerTex,
|
|
30
|
-
instruction:
|
|
31
|
-
? `une racine : $${roots[0]}$`
|
|
32
|
-
: `deux racines : $${roots[0]}$ et $${roots[1]}$`}. Déterminer la forme factorisée de $f$.`,
|
|
38
|
+
instruction: getInstruction(identifiers),
|
|
33
39
|
keys: ["x"],
|
|
34
40
|
answerFormat: "tex",
|
|
35
|
-
identifiers
|
|
41
|
+
identifiers,
|
|
36
42
|
};
|
|
37
43
|
return question;
|
|
38
44
|
};
|
|
39
45
|
const getPropositions = (n, { answer, a, roots }) => {
|
|
40
46
|
const propositions = [];
|
|
41
47
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
42
|
-
(0, exercise_1.tryToAddWrongProp)(propositions,
|
|
48
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, getAnswerNode(roots.map((r) => -r), a).toTex());
|
|
43
49
|
while (propositions.length < n) {
|
|
44
50
|
const x1 = (0, randint_1.randint)(-10, 10);
|
|
45
51
|
const x2 = (0, randint_1.randint)(-10, 10, [x1]);
|
|
46
|
-
(0, exercise_1.tryToAddWrongProp)(propositions,
|
|
52
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, getAnswerNode([x1, x2].sort((a, b) => a - b), (0, randint_1.randint)(-10, 10, [0])).toTex());
|
|
47
53
|
}
|
|
48
54
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
49
55
|
};
|
|
50
56
|
const isAnswerValid = (ans, { answer, a, roots }) => {
|
|
51
|
-
const answerNode =
|
|
57
|
+
const answerNode = getAnswerNode(roots, a);
|
|
52
58
|
const texs = answerNode.toAllValidTexs();
|
|
53
59
|
return texs.includes(ans);
|
|
54
60
|
};
|
|
@@ -66,7 +66,7 @@ ${identifiers.isSentence
|
|
|
66
66
|
: `Calculer en donnant la réponse à $10^{-2}$ près :
|
|
67
67
|
|
|
68
68
|
$$
|
|
69
|
-
${interval.toInequality("
|
|
69
|
+
P\\left(${interval.toInequality("X".toTree()).toTex()}\\right)
|
|
70
70
|
$$`}`;
|
|
71
71
|
};
|
|
72
72
|
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
@@ -145,7 +145,7 @@ const options = [
|
|
|
145
145
|
exports.binomialInequation = {
|
|
146
146
|
id: "binomialInequation",
|
|
147
147
|
connector: "\\iff",
|
|
148
|
-
label: "Calculer une probabilité binomiale du type $P(X
|
|
148
|
+
label: "Calculer une probabilité binomiale du type $P(X \\leq a)$, $P(X \\geq a)$ ou $P(a\\leq X\\leq b)$",
|
|
149
149
|
isSingleStep: true,
|
|
150
150
|
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getBinomialInequationQuestion(opts), nb),
|
|
151
151
|
qcmTimer: 60,
|