math-exercises 3.0.132 → 3.0.134
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/calcul/mentalCaluls/mentalProgramSolve.d.ts +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +5 -5
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.js +12 -7
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +8 -6
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.js +4 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +8 -9
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +4 -4
- package/lib/exercises/math/conversion/prefixToNumber.d.ts +0 -2
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
- package/lib/exercises/math/conversion/prefixToNumber.js +27 -22
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +1 -2
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts +4 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +29 -9
- package/lib/exercises/math/geometry/cartesian/index.d.ts +1 -0
- package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/index.js +1 -0
- package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/midpoint.js +8 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +6 -9
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +60 -137
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts +16 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +213 -0
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +2 -2
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +6 -6
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +0 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +52 -59
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +70 -23
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.d.ts +8 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.js +105 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.d.ts +9 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.js +99 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.js +9 -1
- package/lib/exercises/math/sequences/arithmetic/index.d.ts +2 -0
- package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/index.js +2 -0
- package/lib/exercises/math/sequences/genericSequenceVariations.d.ts.map +1 -1
- package/lib/exercises/math/sequences/genericSequenceVariations.js +5 -1
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.js +7 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts +8 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.js +112 -0
- package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.d.ts +9 -0
- package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.js +97 -0
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +3 -1
- package/lib/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.js +9 -1
- package/lib/exercises/math/sequences/geometric/index.d.ts +2 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +2 -0
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.js +10 -3
- package/lib/exercises/pc/index.d.ts +0 -1
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +0 -1
- package/lib/exercises/pc/motion/averageSpeed.d.ts +0 -2
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +28 -36
- package/lib/exercises/pc/weight/calculateWeight.d.ts +0 -1
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +26 -19
- package/lib/index.d.ts +26 -39
- package/lib/index.d.ts.map +1 -1
- package/lib/playgroundUtils.d.ts +3 -0
- package/lib/playgroundUtils.d.ts.map +1 -0
- package/lib/playgroundUtils.js +13 -0
- package/lib/server.js +126 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
reason: number;
|
|
4
|
+
firstValue: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const geometricFindExplicitFormulaFirstRankOne: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=geometricFindExplicitFormulaFirstRankOne.d.ts.map
|
package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricFindExplicitFormulaFirstRankOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAoIF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAe1E,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
5
|
+
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
6
|
+
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
|
+
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
8
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
9
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
10
|
+
import { parseLatex } from "../../../../tree/parsers/latexParser.js";
|
|
11
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
12
|
+
const getInstruction = (identifiers) => {
|
|
13
|
+
const { firstValue, reason } = identifiers;
|
|
14
|
+
const firstRank = 1;
|
|
15
|
+
return `$(u_n)$ est une suite géométrique de premier terme $u_{${firstRank}} = ${firstValue}$ et de raison $q = ${reason}$.
|
|
16
|
+
|
|
17
|
+
Donner l'expression de $u_n$ en fonction de $n$.`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { firstValue, reason } = identifiers;
|
|
21
|
+
const formula = new MultiplyNode(new NumberNode(firstValue), new PowerNode(new NumberNode(reason), substract("n", 1)));
|
|
22
|
+
const answer = "u_n=" + formula.toTex();
|
|
23
|
+
return answer;
|
|
24
|
+
};
|
|
25
|
+
const getHint = () => {
|
|
26
|
+
return `Utilise la formule générale d'une suite géométrique :
|
|
27
|
+
|
|
28
|
+
$$
|
|
29
|
+
u_n = u_1 \\times r^{n-1}
|
|
30
|
+
$$
|
|
31
|
+
|
|
32
|
+
où $u_1$ est le premier terme et $r$ la raison.`;
|
|
33
|
+
};
|
|
34
|
+
const getCorrection = (identifiers) => {
|
|
35
|
+
const { firstValue, reason } = identifiers;
|
|
36
|
+
const answer = getAnswer(identifiers);
|
|
37
|
+
return `La formule générale d'une suite géométrique est :
|
|
38
|
+
|
|
39
|
+
$$
|
|
40
|
+
u_n = u_1 \\times r^{n-1}
|
|
41
|
+
$$
|
|
42
|
+
|
|
43
|
+
où $u_1$ est le premier terme et $r$ la raison.
|
|
44
|
+
|
|
45
|
+
Ici, puisque $u_1 = ${firstValue}$ et $r = ${reason}$, on a :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
${answer}
|
|
49
|
+
$$`;
|
|
50
|
+
};
|
|
51
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
52
|
+
const question = {
|
|
53
|
+
instruction: getInstruction(identifiers),
|
|
54
|
+
answer: getAnswer(identifiers),
|
|
55
|
+
keys: ["un", "equal", "n"],
|
|
56
|
+
answerFormat: "tex",
|
|
57
|
+
identifiers,
|
|
58
|
+
hint: getHint(identifiers),
|
|
59
|
+
correction: getCorrection(identifiers),
|
|
60
|
+
};
|
|
61
|
+
return question;
|
|
62
|
+
};
|
|
63
|
+
const getGeometricFindExplicitFormula = () => {
|
|
64
|
+
const firstValue = randint(1, 10);
|
|
65
|
+
const reason = randint(2, 10);
|
|
66
|
+
const identifiers = { reason, firstValue };
|
|
67
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
68
|
+
};
|
|
69
|
+
const getPropositions = (n, { answer, reason, firstValue }) => {
|
|
70
|
+
const propositions = [];
|
|
71
|
+
addValidProp(propositions, answer);
|
|
72
|
+
tryToAddWrongProp(propositions, "u_n=" +
|
|
73
|
+
new MultiplyNode(new NumberNode(firstValue), new PowerNode(new NumberNode(reason), new VariableNode("n"))).toTex());
|
|
74
|
+
tryToAddWrongProp(propositions, "u_n=" +
|
|
75
|
+
new MultiplyNode(new NumberNode(reason), new PowerNode(new NumberNode(firstValue), substract("n", 1))).toTex());
|
|
76
|
+
propWhile(propositions, n, () => {
|
|
77
|
+
const wrongAnswer = new MultiplyNode(new NumberNode(firstValue + randint(-firstValue, 2 * firstValue + 1)), new PowerNode(new NumberNode(reason + +randint(-reason + 1, 2 * reason + 1)), substract("n", 1)));
|
|
78
|
+
tryToAddWrongProp(propositions, "u_n=" + wrongAnswer.toTex());
|
|
79
|
+
});
|
|
80
|
+
return shuffle(propositions);
|
|
81
|
+
};
|
|
82
|
+
const isAnswerValid = (ans, { reason, firstValue }) => {
|
|
83
|
+
const formula = new MultiplyNode(new NumberNode(firstValue), new PowerNode(new NumberNode(reason), substract("n", 1)));
|
|
84
|
+
const equal = new EqualNode(new VariableNode("u_n"), formula, {
|
|
85
|
+
allowRawRightChildAsSolution: true,
|
|
86
|
+
});
|
|
87
|
+
const texs = equal.toAllValidTexs();
|
|
88
|
+
return (texs.includes(ans) ||
|
|
89
|
+
(() => {
|
|
90
|
+
const splitted = ans.split("=");
|
|
91
|
+
const rightTerm = splitted[1] ?? splitted[0];
|
|
92
|
+
const nodeAns = parseLatex(rightTerm);
|
|
93
|
+
const differenceNode = substract(nodeAns, formula);
|
|
94
|
+
return (differenceNode.evaluate({ n: 0 }) === 0 &&
|
|
95
|
+
differenceNode.evaluate({ n: 1 }) === 0 &&
|
|
96
|
+
differenceNode.evaluate({ n: 5 }) === 0);
|
|
97
|
+
})());
|
|
98
|
+
};
|
|
99
|
+
export const geometricFindExplicitFormulaFirstRankOne = {
|
|
100
|
+
id: "geometricFindExplicitFormulaFirstRankOne",
|
|
101
|
+
connector: "=",
|
|
102
|
+
label: "Déterminer la formule générale d'une suite géométrique (premier rang $u_1$)",
|
|
103
|
+
isSingleStep: false,
|
|
104
|
+
generator: (nb) => getDistinctQuestions(getGeometricFindExplicitFormula, nb),
|
|
105
|
+
qcmTimer: 60,
|
|
106
|
+
freeTimer: 60,
|
|
107
|
+
getPropositions,
|
|
108
|
+
isAnswerValid,
|
|
109
|
+
subject: "Mathématiques",
|
|
110
|
+
hasHintAndCorrection: true,
|
|
111
|
+
getQuestionFromIdentifiers,
|
|
112
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
firstTerm: number;
|
|
4
|
+
reason: number;
|
|
5
|
+
askedRank: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const geometricFindTermFirstRankOne: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=geometricFindTermFirstRankOne.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricFindTermFirstRankOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAiGF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAe/D,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
5
|
+
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
6
|
+
import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
|
|
7
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
8
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
9
|
+
const getInstruction = (identifiers) => {
|
|
10
|
+
const { firstTerm, reason, askedRank } = identifiers;
|
|
11
|
+
return `Soit $u$ la suite géométrique de premier terme $u_1 = ${firstTerm}$ et de raison $q = ${reason}$. Calculer $u_{${askedRank}}$.`;
|
|
12
|
+
};
|
|
13
|
+
const getAnswer = (identifiers) => {
|
|
14
|
+
const { firstTerm, reason, askedRank } = identifiers;
|
|
15
|
+
const answer = firstTerm * Math.pow(reason, askedRank - 1);
|
|
16
|
+
return answer.frenchify();
|
|
17
|
+
};
|
|
18
|
+
const getHint = () => {
|
|
19
|
+
return `Le terme général d'une suite geométrique est :
|
|
20
|
+
|
|
21
|
+
$$
|
|
22
|
+
u_n = u_1 \\times q^{n-1}
|
|
23
|
+
$$
|
|
24
|
+
|
|
25
|
+
où $u_1$ est le premier terme et $q$ la raison.`;
|
|
26
|
+
};
|
|
27
|
+
const getCorrection = (identifiers) => {
|
|
28
|
+
const { firstTerm, reason, askedRank } = identifiers;
|
|
29
|
+
return `Le terme général de la suite $u$ est :
|
|
30
|
+
|
|
31
|
+
${alignTex([
|
|
32
|
+
[`u_n`, "=", `u_1 \\times q^{n-1}`],
|
|
33
|
+
[
|
|
34
|
+
"",
|
|
35
|
+
"=",
|
|
36
|
+
new MultiplyNode(firstTerm.toTree(), new PowerNode(reason.toTree(), new SubstractNode(new VariableNode("n"), (1).toTree()))).toTex(),
|
|
37
|
+
],
|
|
38
|
+
])}
|
|
39
|
+
|
|
40
|
+
Il suffit alors de remplacer $n$ par $${askedRank}$ dans la formule :
|
|
41
|
+
|
|
42
|
+
${alignTex([
|
|
43
|
+
[
|
|
44
|
+
`u_{${askedRank}}`,
|
|
45
|
+
"=",
|
|
46
|
+
`${new MultiplyNode(firstTerm.toTree(), new PowerNode(reason.toTree(), (askedRank - 1).toTree())).toTex()}`,
|
|
47
|
+
],
|
|
48
|
+
["", "=", getAnswer(identifiers)],
|
|
49
|
+
])}
|
|
50
|
+
`;
|
|
51
|
+
};
|
|
52
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
53
|
+
const question = {
|
|
54
|
+
answer: getAnswer(identifiers),
|
|
55
|
+
instruction: getInstruction(identifiers),
|
|
56
|
+
keys: [],
|
|
57
|
+
answerFormat: "tex",
|
|
58
|
+
hint: getHint(identifiers),
|
|
59
|
+
correction: getCorrection(identifiers),
|
|
60
|
+
identifiers,
|
|
61
|
+
};
|
|
62
|
+
return question;
|
|
63
|
+
};
|
|
64
|
+
const getGeometricFindTermQuestion = () => {
|
|
65
|
+
const firstRank = 1;
|
|
66
|
+
const firstTerm = randint(-10, 10, [0]);
|
|
67
|
+
const reason = randint(2, 6);
|
|
68
|
+
const askedRank = randint(5, 12);
|
|
69
|
+
const identifiers = { firstRank, askedRank, firstTerm, reason };
|
|
70
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
71
|
+
};
|
|
72
|
+
const getPropositions = (n, { answer, askedRank, firstTerm, reason }) => {
|
|
73
|
+
const propositions = [];
|
|
74
|
+
addValidProp(propositions, answer);
|
|
75
|
+
propWhile(propositions, n, () => {
|
|
76
|
+
const fake = firstTerm * Math.pow(reason, askedRank - randint(-5, 3, [1]));
|
|
77
|
+
tryToAddWrongProp(propositions, fake + "");
|
|
78
|
+
});
|
|
79
|
+
return shuffleProps(propositions, n);
|
|
80
|
+
};
|
|
81
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
82
|
+
return ans === answer;
|
|
83
|
+
};
|
|
84
|
+
export const geometricFindTermFirstRankOne = {
|
|
85
|
+
id: "geometricFindTermFirstRankOne",
|
|
86
|
+
connector: "=",
|
|
87
|
+
label: "Calculer un terme d'une suite géométrique à partir de son premier terme ($u_1$) et sa raison",
|
|
88
|
+
isSingleStep: true,
|
|
89
|
+
generator: (nb) => getDistinctQuestions(getGeometricFindTermQuestion, nb),
|
|
90
|
+
qcmTimer: 60,
|
|
91
|
+
freeTimer: 60,
|
|
92
|
+
getPropositions,
|
|
93
|
+
isAnswerValid,
|
|
94
|
+
subject: "Mathématiques",
|
|
95
|
+
hasHintAndCorrection: true,
|
|
96
|
+
getQuestionFromIdentifiers,
|
|
97
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA0GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAYtD,CAAC"}
|
|
@@ -9,7 +9,9 @@ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
|
9
9
|
import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
|
|
10
10
|
const getInstruction = (identifiers) => {
|
|
11
11
|
const { reason, startRank, startValue, askedRank } = identifiers;
|
|
12
|
-
return `$(u_n)$ est une suite géométrique de raison $q = ${reason}$ et on sait que $u_{${startRank}} = ${startValue}$.
|
|
12
|
+
return `$(u_n)$ est une suite géométrique de raison $q = ${reason}$ et on sait que $u_{${startRank}} = ${startValue}$.
|
|
13
|
+
|
|
14
|
+
Calculer le terme $u_{${askedRank}}$.`;
|
|
13
15
|
};
|
|
14
16
|
const getAnswer = (identifiers) => {
|
|
15
17
|
const answer = getAnswerNode(identifiers).evaluate().frenchify();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAgFF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAajE,CAAC"}
|
|
@@ -5,7 +5,15 @@ import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
|
5
5
|
const getInstruction = (identifiers) => {
|
|
6
6
|
const { firstRank, firstValue, reason } = identifiers;
|
|
7
7
|
const askedRank = firstRank + 1;
|
|
8
|
-
return `$(u_n)$ est une suite définie par
|
|
8
|
+
return `$(u_n)$ est une suite définie par :
|
|
9
|
+
|
|
10
|
+
$$
|
|
11
|
+
u_{n+1} = ${reason}\\times u_n
|
|
12
|
+
$$
|
|
13
|
+
|
|
14
|
+
et $u_{${firstRank}} = ${firstValue}$.
|
|
15
|
+
|
|
16
|
+
Calculer le terme $u_{${askedRank}}$.`;
|
|
9
17
|
};
|
|
10
18
|
const getAnswer = (identifiers) => {
|
|
11
19
|
const { firstValue, reason } = identifiers;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export * from "./geometricExplicitFormulaUsage.js";
|
|
2
2
|
export * from "./geometricFindExplicitFormula.js";
|
|
3
|
+
export * from "./geometricFindExplicitFormulaFirstRankOne.js";
|
|
3
4
|
export * from "./geometricFindReason.js";
|
|
4
5
|
export * from "./geometricFirstTermsSum.js";
|
|
5
6
|
export * from "./geometricReasonUsage.js";
|
|
6
7
|
export * from "./geometricRecurrenceFormulaUsage.js";
|
|
7
8
|
export * from "./geometricFindExplicitFormulaFirstTermRandom.js";
|
|
8
9
|
export * from "./geometricFindTerm.js";
|
|
10
|
+
export * from "./geometricFindTermFirstRankOne.js";
|
|
9
11
|
export * from "./geometricRecognizeReasonFromFirstTerms.js";
|
|
10
12
|
export * from "./geometricFirstTermsGeneralSum.js";
|
|
11
13
|
export * from "./geometricVariations.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAE9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export * from "./geometricExplicitFormulaUsage.js";
|
|
2
2
|
export * from "./geometricFindExplicitFormula.js";
|
|
3
|
+
export * from "./geometricFindExplicitFormulaFirstRankOne.js";
|
|
3
4
|
export * from "./geometricFindReason.js";
|
|
4
5
|
export * from "./geometricFirstTermsSum.js";
|
|
5
6
|
export * from "./geometricReasonUsage.js";
|
|
6
7
|
export * from "./geometricRecurrenceFormulaUsage.js";
|
|
7
8
|
export * from "./geometricFindExplicitFormulaFirstTermRandom.js";
|
|
8
9
|
export * from "./geometricFindTerm.js";
|
|
10
|
+
export * from "./geometricFindTermFirstRankOne.js";
|
|
9
11
|
export * from "./geometricRecognizeReasonFromFirstTerms.js";
|
|
10
12
|
export * from "./geometricFirstTermsGeneralSum.js";
|
|
11
13
|
export * from "./geometricVariations.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sequences/recurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"recurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sequences/recurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAwEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAaxD,CAAC"}
|
|
@@ -5,9 +5,16 @@ import { randint } from "../../../math/utils/random/randint.js";
|
|
|
5
5
|
const getInstruction = (identifiers) => {
|
|
6
6
|
const { rank, u0, coeffs } = identifiers;
|
|
7
7
|
const u = new Polynomial(coeffs, "u_n");
|
|
8
|
-
return `Soit $u$ la suite définie par
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
return `Soit $u$ la suite définie par :
|
|
9
|
+
|
|
10
|
+
- $u_0 = ${u0}$,
|
|
11
|
+
|
|
12
|
+
- pour tout $n\\geq 1$ :
|
|
13
|
+
$$
|
|
14
|
+
u_{n+1} = ${u.toTree().toTex()}
|
|
15
|
+
$$
|
|
16
|
+
|
|
17
|
+
Calculer $u_${rank}$.`;
|
|
11
18
|
};
|
|
12
19
|
const getAnswer = (identifiers) => {
|
|
13
20
|
const { rank, u0, coeffs } = identifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/pc/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;AAClD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AAEtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/pc/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;AAClD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AAEtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"averageSpeed.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/motion/averageSpeed.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"averageSpeed.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/motion/averageSpeed.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,GAAG,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhD,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAkOF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAqBF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAcvD,CAAC"}
|
|
@@ -11,20 +11,23 @@ import { VariableNode } from "../../../tree/nodes/variables/variableNode.js";
|
|
|
11
11
|
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
12
12
|
const timeUnits = [TimeUnit.h, TimeUnit.min];
|
|
13
13
|
const distanceUnitValues = [DistanceUnit.km, DistanceUnit.m];
|
|
14
|
-
const getAcceptedInputTypesSentence = (
|
|
15
|
-
const { opts } = identifiers;
|
|
14
|
+
const getAcceptedInputTypesSentence = (acceptedInputType) => {
|
|
16
15
|
return `Donner le résultat
|
|
17
16
|
${(() => {
|
|
18
|
-
switch (
|
|
17
|
+
switch (acceptedInputType) {
|
|
19
18
|
case "exact":
|
|
20
19
|
return "sous forme exacte";
|
|
21
|
-
|
|
20
|
+
default:
|
|
21
|
+
case "arrondi avec 3 chiffres significatifs":
|
|
22
22
|
return "approché avec $3$ chiffres significatifs";
|
|
23
23
|
}
|
|
24
24
|
})()}.`;
|
|
25
25
|
};
|
|
26
|
-
const getInstruction = (identifiers) => {
|
|
27
|
-
const
|
|
26
|
+
const getInstruction = (identifiers, optsIn) => {
|
|
27
|
+
const opts = optsIn ?? optsDefault;
|
|
28
|
+
const acceptedInputType = "arrondi avec 3 chiffres significatifs";
|
|
29
|
+
const { distance, time } = identifiers;
|
|
30
|
+
const { unitTex } = opts;
|
|
28
31
|
const distanceMeasure = new Measure(distance.value, 0, distanceUnitValues[distance.unitIndex]);
|
|
29
32
|
const timeMeasure = new Measure(time.value, 0, timeUnits[time.unitIndex]);
|
|
30
33
|
const instruction = `Soit un objet parcourant $${distanceMeasure.toTex({
|
|
@@ -32,13 +35,14 @@ const getInstruction = (identifiers) => {
|
|
|
32
35
|
})}$ en $${timeMeasure.toTex({ notScientific: true })}$.
|
|
33
36
|
|
|
34
37
|
|
|
35
|
-
Calculer la vitesse moyenne de cet objet en ${
|
|
38
|
+
Calculer la vitesse moyenne de cet objet en ${unitTex}.
|
|
36
39
|
|
|
37
|
-
${getAcceptedInputTypesSentence(
|
|
40
|
+
${getAcceptedInputTypesSentence(acceptedInputType)}
|
|
38
41
|
`;
|
|
39
42
|
return instruction;
|
|
40
43
|
};
|
|
41
|
-
const getHint = (
|
|
44
|
+
const getHint = (_, optsIn) => {
|
|
45
|
+
const opts = optsIn ?? optsDefault;
|
|
42
46
|
const unlatexUnit = opts.unitTex.substring(1, opts.unitTex.length - 1);
|
|
43
47
|
return `La vitesse moyenne est donnée par :
|
|
44
48
|
|
|
@@ -46,8 +50,9 @@ $$
|
|
|
46
50
|
\\frac{\\text{distance}}{\\text{temps}} \\ ${unlatexUnit}
|
|
47
51
|
$$`;
|
|
48
52
|
};
|
|
49
|
-
const getCorrection = (identifiers) => {
|
|
50
|
-
const
|
|
53
|
+
const getCorrection = (identifiers, optsIn) => {
|
|
54
|
+
const opts = optsIn ?? optsDefault;
|
|
55
|
+
const { distance, time } = identifiers;
|
|
51
56
|
let correction = ``;
|
|
52
57
|
const distanceMeasure = new Measure(distance.value, 0, distanceUnitValues[distance.unitIndex]).convert("m");
|
|
53
58
|
const timeMeasure = new Measure(time.value, 0, timeUnits[time.unitIndex]).convert("s");
|
|
@@ -105,7 +110,8 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
105
110
|
const answerNode = parseAlgebraic(getAnswerMeasure(identifiers).toTex({ hideUnit: true }));
|
|
106
111
|
return substract(ansNode, answerNode).simplify().evaluate() === 0;
|
|
107
112
|
};
|
|
108
|
-
const getPropositions = (n, { answer, distance, time,
|
|
113
|
+
const getPropositions = (n, { answer, distance, time }, optsIn) => {
|
|
114
|
+
const opts = optsIn ?? optsDefault;
|
|
109
115
|
const propositions = [];
|
|
110
116
|
const unlatexUnit = opts.unitTex.substring(1, opts.unitTex.length - 1);
|
|
111
117
|
addValidProp(propositions, `${answer} \\ ${unlatexUnit}`);
|
|
@@ -138,41 +144,27 @@ const generatePropositions = (distance, time) => {
|
|
|
138
144
|
distance.divide(time).toSignificant(2).toTex({ hideUnit: true }),
|
|
139
145
|
];
|
|
140
146
|
};
|
|
141
|
-
const getKeys = () => {
|
|
142
|
-
return [];
|
|
143
|
-
// return [`\\text{m} \\cdot \\text{s}^{-1}`].map((tex) => {
|
|
144
|
-
// return {
|
|
145
|
-
// id: "custom",
|
|
146
|
-
// label: tex,
|
|
147
|
-
// labelType: "raw",
|
|
148
|
-
// mathfieldInstructions: {
|
|
149
|
-
// method: "write",
|
|
150
|
-
// content: tex,
|
|
151
|
-
// },
|
|
152
|
-
// } as KeyProps;
|
|
153
|
-
// });
|
|
154
|
-
};
|
|
155
147
|
const getAverageSpeedQuestion = (optsIn) => {
|
|
156
|
-
const opts =
|
|
148
|
+
const opts = optsIn ?? optsDefault;
|
|
157
149
|
const distance = { value: randint(70, 151), unitIndex: randint(0, 2) };
|
|
158
150
|
const time = { value: randint(10, 61), unitIndex: randint(0, 2) };
|
|
159
|
-
const identifiers = { distance, time
|
|
160
|
-
return getQuestionFromIdentifiers(identifiers);
|
|
151
|
+
const identifiers = { distance, time };
|
|
152
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
161
153
|
};
|
|
162
|
-
const getQuestionFromIdentifiers = (identifiers) => {
|
|
154
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
163
155
|
const question = {
|
|
164
|
-
answer: getAnswer(identifiers),
|
|
165
|
-
instruction: getInstruction(identifiers),
|
|
166
|
-
keys:
|
|
167
|
-
hint: getHint(identifiers),
|
|
168
|
-
correction: getCorrection(identifiers),
|
|
156
|
+
answer: getAnswer(identifiers, opts),
|
|
157
|
+
instruction: getInstruction(identifiers, opts),
|
|
158
|
+
keys: [],
|
|
159
|
+
hint: getHint(identifiers, opts),
|
|
160
|
+
correction: getCorrection(identifiers, opts),
|
|
169
161
|
answerFormat: "tex",
|
|
170
162
|
identifiers,
|
|
163
|
+
options: opts,
|
|
171
164
|
};
|
|
172
165
|
return question;
|
|
173
166
|
};
|
|
174
167
|
const optsDefault = {
|
|
175
|
-
acceptedInputType: "significant(3)",
|
|
176
168
|
unitTex: "$\\text{m} \\cdot \\text{s}^{-1}$",
|
|
177
169
|
};
|
|
178
170
|
const options = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateWeight.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/weight/calculateWeight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"calculateWeight.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/weight/calculateWeight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,SAAS,GAAG,SAAS,GAAG,KAAK,CAAC;AAEnC,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAkNF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAc1D,CAAC"}
|
|
@@ -28,8 +28,9 @@ const options = [
|
|
|
28
28
|
defaultValue: [optsDefault.nbDigits],
|
|
29
29
|
},
|
|
30
30
|
];
|
|
31
|
-
const getInstruction = (identifiers) => {
|
|
32
|
-
const
|
|
31
|
+
const getInstruction = (identifiers, optsIn) => {
|
|
32
|
+
const opts = optsIn ?? optsDefault;
|
|
33
|
+
const { mass } = identifiers;
|
|
33
34
|
const instruction = `Soit un objet avec une masse de $${mass}\\ \\textrm{kg}$.
|
|
34
35
|
|
|
35
36
|
L'accélération due à la gravité vaut $${g.frenchify()}$ $\\textrm{m} \\cdot \\textrm{s}^{${-2}}$.
|
|
@@ -37,7 +38,7 @@ L'accélération due à la gravité vaut $${g.frenchify()}$ $\\textrm{m} \\cdot
|
|
|
37
38
|
Calculer le poids de cet objet en Newtons.
|
|
38
39
|
Donner le résultat
|
|
39
40
|
${(() => {
|
|
40
|
-
switch (
|
|
41
|
+
switch (opts.inputType) {
|
|
41
42
|
case "decimal":
|
|
42
43
|
return `en écriture décimale`;
|
|
43
44
|
case "sci":
|
|
@@ -45,7 +46,7 @@ ${(() => {
|
|
|
45
46
|
}
|
|
46
47
|
})()}
|
|
47
48
|
${(() => {
|
|
48
|
-
switch (
|
|
49
|
+
switch (opts.nbDigits) {
|
|
49
50
|
case "0":
|
|
50
51
|
return `arrondie à l'unité`;
|
|
51
52
|
case "1":
|
|
@@ -77,25 +78,30 @@ const getCorrection = (identifiers) => {
|
|
|
77
78
|
const correction = `Pour calculer le poids de l'objet, on utilise la formule :
|
|
78
79
|
|
|
79
80
|
$$
|
|
80
|
-
P=m \\cdot g
|
|
81
|
+
P = m \\cdot g
|
|
81
82
|
$$
|
|
82
83
|
|
|
83
84
|
On a :
|
|
84
85
|
|
|
85
86
|
$$
|
|
86
|
-
P = ${mass.frenchify()} \\times ${g.frenchify()}
|
|
87
|
+
P = ${mass.frenchify()} \\times ${g.frenchify()}
|
|
88
|
+
$$
|
|
89
|
+
|
|
90
|
+
$$
|
|
91
|
+
P \\approx ${answer}
|
|
87
92
|
$$`;
|
|
88
93
|
return correction;
|
|
89
94
|
};
|
|
90
|
-
const getAnswer = (identifiers) => {
|
|
91
|
-
const
|
|
92
|
-
|
|
95
|
+
const getAnswer = (identifiers, optsIn) => {
|
|
96
|
+
const opts = optsIn ?? optsDefault;
|
|
97
|
+
const { mass } = identifiers;
|
|
98
|
+
switch (opts.inputType) {
|
|
93
99
|
case "decimal": {
|
|
94
|
-
const answer = round(mass * g, Number(
|
|
100
|
+
const answer = round(mass * g, Number(opts.nbDigits));
|
|
95
101
|
return `${answer.frenchify()}N`;
|
|
96
102
|
}
|
|
97
103
|
case "sci": {
|
|
98
|
-
const answer = (mass * g).toScientific(Number(
|
|
104
|
+
const answer = (mass * g).toScientific(Number(opts.nbDigits));
|
|
99
105
|
return `${answer.toTex()}N`;
|
|
100
106
|
}
|
|
101
107
|
}
|
|
@@ -103,12 +109,13 @@ const getAnswer = (identifiers) => {
|
|
|
103
109
|
const isAnswerValid = (ans, { answer }) => {
|
|
104
110
|
return ans === answer;
|
|
105
111
|
};
|
|
106
|
-
const getPropositions = (n, { answer, mass,
|
|
112
|
+
const getPropositions = (n, { answer, mass }, optsIn) => {
|
|
113
|
+
const opts = optsIn ?? optsDefault;
|
|
107
114
|
const propositions = [];
|
|
108
115
|
const weight = mass * g;
|
|
109
116
|
addValidProp(propositions, answer);
|
|
110
|
-
const nbDigits = Number(
|
|
111
|
-
switch (
|
|
117
|
+
const nbDigits = Number(opts.nbDigits);
|
|
118
|
+
switch (opts.inputType) {
|
|
112
119
|
case "decimal":
|
|
113
120
|
{
|
|
114
121
|
tryToAddWrongProp(propositions, `${round(weight * 10, nbDigits).frenchify()}N`);
|
|
@@ -142,16 +149,16 @@ const getCalculateWeightQuestion = (optsIn) => {
|
|
|
142
149
|
})
|
|
143
150
|
: optsDefault;
|
|
144
151
|
const mass = randint(30, 151);
|
|
145
|
-
const identifiers = { mass: mass
|
|
152
|
+
const identifiers = { mass: mass };
|
|
146
153
|
return getQuestionFromIdentifiers(identifiers, opts);
|
|
147
154
|
};
|
|
148
155
|
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
149
156
|
const question = {
|
|
150
|
-
answer: getAnswer(identifiers),
|
|
151
|
-
instruction: getInstruction(identifiers),
|
|
157
|
+
answer: getAnswer(identifiers, opts),
|
|
158
|
+
instruction: getInstruction(identifiers, opts),
|
|
152
159
|
keys: ["N"],
|
|
153
|
-
hint: getHint(identifiers),
|
|
154
|
-
correction: getCorrection(identifiers),
|
|
160
|
+
hint: getHint(identifiers, opts),
|
|
161
|
+
correction: getCorrection(identifiers, opts),
|
|
155
162
|
answerFormat: "tex",
|
|
156
163
|
identifiers,
|
|
157
164
|
options: opts,
|