math-exercises 3.0.208 → 3.0.209
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/arithmetic/congruenceBasicComputation.d.ts +8 -0
- package/lib/exercises/math/arithmetic/congruenceBasicComputation.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/congruenceBasicComputation.js +93 -0
- package/lib/exercises/math/arithmetic/index.d.ts +2 -0
- package/lib/exercises/math/arithmetic/index.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/index.js +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.js +15 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.js +15 -0
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.js +72 -33
- package/lib/exercises/math/functions/logarithm/logEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logEquation.js +40 -2
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logPowerEquation.js +55 -6
- package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logSimplifiying.js +45 -5
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/probaStat/density/findParamToMakeDensity.d.ts +8 -0
- package/lib/exercises/math/probaStat/density/findParamToMakeDensity.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/density/findParamToMakeDensity.js +127 -0
- package/lib/exercises/math/probaStat/density/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/density/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/density/index.js +1 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawAverage.d.ts +7 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawAverage.js +95 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeIntervalProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeIntervalProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeIntervalProba.js +115 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeProba.d.ts +8 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeProba.js +110 -0
- package/lib/exercises/math/probaStat/exponential/index.d.ts +4 -0
- package/lib/exercises/math/probaStat/exponential/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/exponential/index.js +3 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawAverage.d.ts +8 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawAverage.js +124 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawComputeProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawComputeProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawComputeProba.js +121 -0
- package/lib/exercises/math/probaStat/geometric/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/geometric/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/geometric/index.js +2 -0
- package/lib/exercises/math/probaStat/index.d.ts +4 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +4 -0
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +15 -0
- package/lib/exercises/math/probaStat/uniform/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/uniform/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/uniform/index.js +2 -0
- package/lib/exercises/math/probaStat/uniform/uniformAverage.d.ts +8 -0
- package/lib/exercises/math/probaStat/uniform/uniformAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/uniform/uniformAverage.js +100 -0
- package/lib/exercises/math/probaStat/uniform/uniformLawComputeProba.d.ts +10 -0
- package/lib/exercises/math/probaStat/uniform/uniformLawComputeProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/uniform/uniformLawComputeProba.js +105 -0
- package/lib/index.d.ts +29 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +1 -0
- package/lib/tests/pdfs/formatMdToLatex.js +1 -1
- package/lib/tree/nodes/functions/log10Node.d.ts +1 -0
- package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
- package/lib/tree/nodes/functions/log10Node.js +12 -1
- package/lib/tree/nodes/functions/logNode.d.ts +1 -0
- package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/logNode.js +12 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"congruenceBasicComputation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/arithmetic/congruenceBasicComputation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAmFF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAkB5D,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
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 { randint } from "../../../math/utils/random/randint.js";
|
|
5
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
6
|
+
const getPropositions = (n, { answer, mod }) => {
|
|
7
|
+
const propositions = [];
|
|
8
|
+
addValidProp(propositions, answer);
|
|
9
|
+
tryToAddWrongProp(propositions, mod.frenchify());
|
|
10
|
+
propWhile(propositions, n, () => {
|
|
11
|
+
tryToAddWrongProp(propositions, randint(1, 20).frenchify());
|
|
12
|
+
});
|
|
13
|
+
return shuffleProps(propositions, n);
|
|
14
|
+
};
|
|
15
|
+
const getAnswer = (identifiers) => {
|
|
16
|
+
const { a, mod } = identifiers;
|
|
17
|
+
return Math.floor(a % mod).frenchify();
|
|
18
|
+
};
|
|
19
|
+
const getInstruction = (identifiers) => {
|
|
20
|
+
const { a, mod } = identifiers;
|
|
21
|
+
return `Déterminer $x$ tel que $0\\leq x < ${mod}$ et :
|
|
22
|
+
|
|
23
|
+
$$
|
|
24
|
+
${a} \\equiv x \\ [${mod}]
|
|
25
|
+
$$`;
|
|
26
|
+
};
|
|
27
|
+
const getHint = (identifiers) => {
|
|
28
|
+
const { a, mod } = identifiers;
|
|
29
|
+
return `Puisque $0\\leq x < ${mod}$ et $${a} \\equiv x \\ [${mod}]$, alors $x$ est le reste de la division euclidienne de $${a}$ par $${mod}$.`;
|
|
30
|
+
};
|
|
31
|
+
const getCorrection = (identifiers) => {
|
|
32
|
+
const { a, mod } = identifiers;
|
|
33
|
+
const left = a % mod;
|
|
34
|
+
const quot = Math.floor(a / mod);
|
|
35
|
+
return `$x$ est le reste de la division euclidienne de $${a}$ par $${mod}$.
|
|
36
|
+
|
|
37
|
+
Or,
|
|
38
|
+
|
|
39
|
+
$$
|
|
40
|
+
${a} = ${quot}\\times ${mod} + ${left}
|
|
41
|
+
$$
|
|
42
|
+
|
|
43
|
+
Ainsi, $x= ${left}$`;
|
|
44
|
+
};
|
|
45
|
+
const getKeys = () => {
|
|
46
|
+
return [];
|
|
47
|
+
};
|
|
48
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
49
|
+
try {
|
|
50
|
+
return numberVEA(ans, answer);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
return handleVEAError(err);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const getCongruenceBasicComputationQuestion = () => {
|
|
57
|
+
const mod = randint(2, 12);
|
|
58
|
+
const a = randint(mod, mod * 3);
|
|
59
|
+
const identifiers = {
|
|
60
|
+
a,
|
|
61
|
+
mod,
|
|
62
|
+
};
|
|
63
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
64
|
+
};
|
|
65
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
66
|
+
return {
|
|
67
|
+
answer: getAnswer(identifiers),
|
|
68
|
+
instruction: getInstruction(identifiers),
|
|
69
|
+
keys: getKeys(identifiers),
|
|
70
|
+
answerFormat: "tex",
|
|
71
|
+
identifiers,
|
|
72
|
+
hint: getHint(identifiers),
|
|
73
|
+
correction: getCorrection(identifiers),
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export const congruenceBasicComputation = {
|
|
77
|
+
id: "congruenceBasicComputation",
|
|
78
|
+
connector: "=",
|
|
79
|
+
label: "Déterminer $x$ tel que $x$ est congru à $a$ modulo $n$",
|
|
80
|
+
isSingleStep: true,
|
|
81
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCongruenceBasicComputationQuestion(opts), nb),
|
|
82
|
+
qcmTimer: 60,
|
|
83
|
+
freeTimer: 60,
|
|
84
|
+
getPropositions,
|
|
85
|
+
isAnswerValid,
|
|
86
|
+
subject: "Mathématiques",
|
|
87
|
+
getInstruction,
|
|
88
|
+
getHint,
|
|
89
|
+
getCorrection,
|
|
90
|
+
getAnswer,
|
|
91
|
+
getQuestionFromIdentifiers,
|
|
92
|
+
hasHintAndCorrection: true,
|
|
93
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/arithmetic/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./congruenceBasicComputation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineAdjustment.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/affines/adjustment/affineAdjustment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"affineAdjustment.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/affines/adjustment/affineAdjustment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA6LF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
|
|
@@ -66,6 +66,18 @@ const getAffineAdjustmentQuestion = () => {
|
|
|
66
66
|
const identifiers = { xValues, yValues };
|
|
67
67
|
return getQuestionFromIdentifiers(identifiers);
|
|
68
68
|
};
|
|
69
|
+
const getHint = () => {
|
|
70
|
+
return `Utilise la calculatrice. Va dans le menu "Stats", puis entre les données de la série.`;
|
|
71
|
+
};
|
|
72
|
+
const getCorrection = (identifiers) => {
|
|
73
|
+
return `On utilise la calculatrice. On se rend dans le menu "Stats", puis on entre les données de la série. La calculatrice nous donne alors les indicateurs statistiques de cette série, et parmi eux, l'équation de la droite d'ajustement obtenue par la méthode des moindres carrés.
|
|
74
|
+
|
|
75
|
+
On trouve, arrondie au dixième :
|
|
76
|
+
|
|
77
|
+
$$
|
|
78
|
+
${getAnswer(identifiers)}
|
|
79
|
+
$$`;
|
|
80
|
+
};
|
|
69
81
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
70
82
|
const question = {
|
|
71
83
|
answer: getAnswer(identifiers),
|
|
@@ -80,6 +92,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
80
92
|
firstRowIsHeader: false,
|
|
81
93
|
},
|
|
82
94
|
},
|
|
95
|
+
hint: getHint(identifiers),
|
|
96
|
+
correction: getCorrection(identifiers),
|
|
83
97
|
};
|
|
84
98
|
return question;
|
|
85
99
|
};
|
|
@@ -125,5 +139,6 @@ export const affineAdjustmentExercise = {
|
|
|
125
139
|
getPropositions,
|
|
126
140
|
isAnswerValid,
|
|
127
141
|
subject: "Mathématiques",
|
|
142
|
+
hasHintAndCorrection: true,
|
|
128
143
|
getQuestionFromIdentifiers,
|
|
129
144
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineAdjustmentRsquared.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"affineAdjustmentRsquared.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAqIF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAclE,CAAC"}
|
|
@@ -36,6 +36,18 @@ const getAffineAdjustmentRsquaredQuestion = () => {
|
|
|
36
36
|
const identifiers = { xValues, yValues };
|
|
37
37
|
return getQuestionFromIdentifiers(identifiers);
|
|
38
38
|
};
|
|
39
|
+
const getHint = () => {
|
|
40
|
+
return `Utilise la calculatrice. Va dans le menu "Stats", puis entre les données de la série.`;
|
|
41
|
+
};
|
|
42
|
+
const getCorrection = (identifiers) => {
|
|
43
|
+
return `On utilise la calculatrice. On se rend dans le menu "Stats", puis on entre les données de la série. La calculatrice nous donne alors les indicateurs statistiques de cette série, et parmi eux, le coefficient de détermination $R^2$.
|
|
44
|
+
|
|
45
|
+
On trouve, arrondie au dixième :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
R^2 \\approx ${getAnswer(identifiers)}
|
|
49
|
+
$$`;
|
|
50
|
+
};
|
|
39
51
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
40
52
|
const question = {
|
|
41
53
|
answer: getAnswer(identifiers),
|
|
@@ -50,6 +62,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
50
62
|
firstRowIsHeader: false,
|
|
51
63
|
},
|
|
52
64
|
},
|
|
65
|
+
hint: getHint(identifiers),
|
|
66
|
+
correction: getCorrection(identifiers),
|
|
53
67
|
};
|
|
54
68
|
return question;
|
|
55
69
|
};
|
|
@@ -89,4 +103,5 @@ export const affineAdjustmentRsquaredExercise = {
|
|
|
89
103
|
isAnswerValid,
|
|
90
104
|
subject: "Mathématiques",
|
|
91
105
|
getQuestionFromIdentifiers,
|
|
106
|
+
hasHintAndCorrection: true,
|
|
92
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log10Simplifying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/log10Simplifying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"log10Simplifying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/log10Simplifying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AA8KF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB9D,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB5D,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
-
import { Log10Node } from "../../../../tree/nodes/functions/log10Node.js";
|
|
5
|
-
import { LogNode } from "../../../../tree/nodes/functions/logNode.js";
|
|
4
|
+
import { log10, Log10Node } from "../../../../tree/nodes/functions/log10Node.js";
|
|
5
|
+
import { logn, LogNode } from "../../../../tree/nodes/functions/logNode.js";
|
|
6
6
|
import { OppositeNode } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
7
7
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
8
8
|
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
9
9
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
-
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
10
|
+
import { power, PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
11
11
|
import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
|
|
12
12
|
import { random } from "../../../../utils/alea/random.js";
|
|
13
|
-
const
|
|
13
|
+
const getStatement = (identifiers, opts) => {
|
|
14
14
|
const { nb, powers, signs } = identifiers;
|
|
15
15
|
const nbNode = new NumberNode(nb);
|
|
16
16
|
const LNode = opts?.isLog10 ? Log10Node : LogNode;
|
|
@@ -21,8 +21,13 @@ const getInstruction = (identifiers, opts) => {
|
|
|
21
21
|
: signs[index] > 0
|
|
22
22
|
? new LNode(new PowerNode(nbNode, new NumberNode(power)))
|
|
23
23
|
: new OppositeNode(new LNode(new PowerNode(nbNode, new NumberNode(power)))));
|
|
24
|
-
const trueNb = [2, 4, 8].includes(nb) ? 2 : [3, 9].includes(nb) ? 3 : nb;
|
|
25
24
|
const statement = operatorComposition(AddNode, logs);
|
|
25
|
+
return statement;
|
|
26
|
+
};
|
|
27
|
+
const getInstruction = (identifiers, opts) => {
|
|
28
|
+
const { nb } = identifiers;
|
|
29
|
+
const trueNb = [2, 4, 8].includes(nb) ? 2 : [3, 9].includes(nb) ? 3 : nb;
|
|
30
|
+
const statement = getStatement(identifiers, opts);
|
|
26
31
|
return `Exprimer le nombre suivant sous la forme $a${opts?.isLog10 ? "\\log" : "\\ln"}\\left(${trueNb}\\right)$ :
|
|
27
32
|
|
|
28
33
|
$$
|
|
@@ -30,18 +35,7 @@ ${statement.toTex()}
|
|
|
30
35
|
$$`;
|
|
31
36
|
};
|
|
32
37
|
const getAnswer = (identifiers, opts) => {
|
|
33
|
-
const
|
|
34
|
-
const nbNode = new NumberNode(nb);
|
|
35
|
-
const LNode = opts?.isLog10 ? Log10Node : LogNode;
|
|
36
|
-
const logs = powers.map((power, index) => nb ** power < 100
|
|
37
|
-
? signs[index] > 0
|
|
38
|
-
? new LNode(new NumberNode(nb ** power))
|
|
39
|
-
: new OppositeNode(new LNode(new NumberNode(nb ** power)))
|
|
40
|
-
: signs[index] > 0
|
|
41
|
-
? new LNode(new PowerNode(nbNode, new NumberNode(power)))
|
|
42
|
-
: new OppositeNode(new LNode(new PowerNode(nbNode, new NumberNode(power)))));
|
|
43
|
-
const statement = operatorComposition(AddNode, logs);
|
|
44
|
-
const answer = statement.simplify();
|
|
38
|
+
const answer = getStatement(identifiers, opts).simplify();
|
|
45
39
|
return answer.toTex();
|
|
46
40
|
};
|
|
47
41
|
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
@@ -51,6 +45,9 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
51
45
|
keys: getKeys(identifiers, opts),
|
|
52
46
|
answerFormat: "tex",
|
|
53
47
|
identifiers,
|
|
48
|
+
hint: getHint(identifiers, opts),
|
|
49
|
+
correction: getCorrection(identifiers, opts),
|
|
50
|
+
options: opts,
|
|
54
51
|
};
|
|
55
52
|
return question;
|
|
56
53
|
};
|
|
@@ -58,7 +55,7 @@ const getKeys = (_identifiers, opts) => {
|
|
|
58
55
|
return [opts?.isLog10 ? "logBrackets" : "lnBrackets"];
|
|
59
56
|
};
|
|
60
57
|
const getLog10SumSimplifyingQuestion = (opts) => {
|
|
61
|
-
const nb =
|
|
58
|
+
const nb = random([2, 3, 5, 6, 7]);
|
|
62
59
|
const nbTerms = randint(2, 4);
|
|
63
60
|
const powers = [];
|
|
64
61
|
const signs = [];
|
|
@@ -81,25 +78,65 @@ const getPropositions = (n, { answer, nb, isLog10 }) => {
|
|
|
81
78
|
});
|
|
82
79
|
return shuffleProps(propositions, n);
|
|
83
80
|
};
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
const
|
|
81
|
+
const getHint = (_identifiers, opts) => {
|
|
82
|
+
const logString = opts?.isLog10 ? "\\log" : "\\ln";
|
|
83
|
+
return `Pour tous nombres réels $a$ et $b$ strictement positifs, on a :
|
|
84
|
+
|
|
85
|
+
- $${logString}(a) + ${logString}(b) = ${logString}(a\\times b)$
|
|
86
|
+
- $${logString}(a) - ${logString}(b) = ${logString}(\\frac{a}{b})$
|
|
87
|
+
- $${logString}(a^b) = b ${logString}(a)$`;
|
|
88
|
+
};
|
|
89
|
+
const getCorrection = (identifiers, opts) => {
|
|
90
|
+
const { nb, powers } = identifiers;
|
|
91
|
+
const fct = opts?.isLog10 ? log10 : logn;
|
|
92
|
+
const logString = opts?.isLog10 ? "\\log" : "\\ln";
|
|
93
|
+
const trueNb = [2, 4, 8].includes(nb) ? 2 : [3, 9].includes(nb) ? 3 : nb;
|
|
94
|
+
const truePowers = powers.map((pow) => {
|
|
95
|
+
if (nb !== trueNb) {
|
|
96
|
+
const truePow = Math.floor(Math.log(nb) / Math.log(trueNb));
|
|
97
|
+
return power(trueNb, truePow);
|
|
98
|
+
}
|
|
99
|
+
if (pow === 1)
|
|
100
|
+
return trueNb.toTree();
|
|
101
|
+
return power(trueNb, pow);
|
|
102
|
+
});
|
|
103
|
+
return `Pour tous nombres réels $a$ et $b$ strictement positifs, on a :
|
|
104
|
+
|
|
105
|
+
- $${logString}(a) + ${logString}(b) = ${logString}(a\\times b)$
|
|
106
|
+
- $${logString}(a) - ${logString}(b) = ${logString}(\\frac{a}{b})$
|
|
107
|
+
- $${logString}(a^b) = b ${logString}(a)$
|
|
108
|
+
|
|
109
|
+
On applique ces propriétés ici pour simplifier l'expression :
|
|
110
|
+
|
|
111
|
+
${truePowers
|
|
112
|
+
.map((e) => {
|
|
113
|
+
if (e.evaluate() === trueNb)
|
|
114
|
+
return "";
|
|
115
|
+
if (e.evaluate() < 100)
|
|
116
|
+
return `- $${fct(e.evaluate().frenchify()).toTex()} = ${fct(e).toSimplificationTex()}$`;
|
|
117
|
+
return `- $${fct(e).toSimplificationTex()}$`;
|
|
118
|
+
})
|
|
119
|
+
.filter(Boolean)
|
|
120
|
+
.join("\n \n")}
|
|
121
|
+
|
|
122
|
+
En additionnant, on obtient donc l'expression simplifiée :
|
|
123
|
+
|
|
124
|
+
$$
|
|
125
|
+
${getStatement(identifiers, opts).toTex()} = ${getAnswer(identifiers, opts)}
|
|
126
|
+
$$
|
|
127
|
+
`;
|
|
128
|
+
};
|
|
129
|
+
const isAnswerValid = (ans, { answer, ...identifiers }, opts) => {
|
|
130
|
+
const statement = getStatement(identifiers, opts);
|
|
131
|
+
console.log(opts, identifiers);
|
|
132
|
+
const answerNode = statement.simplify();
|
|
133
|
+
const texs = answerNode.toAllValidTexs();
|
|
97
134
|
return texs.includes(ans);
|
|
98
135
|
};
|
|
99
136
|
export const log10SumSimplifying = {
|
|
100
137
|
id: "log10SumSimplifying",
|
|
101
138
|
connector: "=",
|
|
102
|
-
label: "Simplifier une
|
|
139
|
+
label: "Simplifier une expression avec des logarithmes décimaux",
|
|
103
140
|
isSingleStep: true,
|
|
104
141
|
generator: (nb) => getDistinctQuestions(() => getLog10SumSimplifyingQuestion({ isLog10: true }), nb),
|
|
105
142
|
qcmTimer: 60,
|
|
@@ -108,11 +145,12 @@ export const log10SumSimplifying = {
|
|
|
108
145
|
isAnswerValid,
|
|
109
146
|
subject: "Mathématiques",
|
|
110
147
|
getQuestionFromIdentifiers,
|
|
148
|
+
hasHintAndCorrection: true,
|
|
111
149
|
};
|
|
112
150
|
export const logSumSimplifying = {
|
|
113
151
|
id: "logSumSimplifying",
|
|
114
152
|
connector: "=",
|
|
115
|
-
label: "Simplifier une
|
|
153
|
+
label: "Simplifier une expression avec des logarithmes népériens",
|
|
116
154
|
isSingleStep: true,
|
|
117
155
|
generator: (nb) => getDistinctQuestions(() => getLog10SumSimplifyingQuestion({ isLog10: false }), nb),
|
|
118
156
|
qcmTimer: 60,
|
|
@@ -121,4 +159,5 @@ export const logSumSimplifying = {
|
|
|
121
159
|
isAnswerValid,
|
|
122
160
|
subject: "Mathématiques",
|
|
123
161
|
getQuestionFromIdentifiers,
|
|
162
|
+
hasHintAndCorrection: true,
|
|
124
163
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"logEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAerC,cAAc;AACd,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgIF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAa7C,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
3
3
|
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
5
|
import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
6
|
-
import { ExpNode } from "../../../../tree/nodes/functions/expNode.js";
|
|
6
|
+
import { exp, ExpNode } from "../../../../tree/nodes/functions/expNode.js";
|
|
7
7
|
import { LogNode } from "../../../../tree/nodes/functions/logNode.js";
|
|
8
8
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
9
9
|
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
@@ -11,6 +11,7 @@ import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
|
11
11
|
import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
|
|
12
12
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
13
13
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
14
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
14
15
|
const getKeys = () => {
|
|
15
16
|
return [
|
|
16
17
|
"x",
|
|
@@ -40,11 +41,45 @@ const getAnswer = (identifiers) => {
|
|
|
40
41
|
return answer;
|
|
41
42
|
};
|
|
42
43
|
const getLnEquation = () => {
|
|
43
|
-
const a = randint(-9, 20, [0]);
|
|
44
|
+
const a = randint(-9, 20, [0, 1]);
|
|
44
45
|
const k = randint(-9, 20, [0]);
|
|
45
46
|
const identifiers = { a, k };
|
|
46
47
|
return getQuestionFromIdentifiers(identifiers);
|
|
47
48
|
};
|
|
49
|
+
const getHint = () => {
|
|
50
|
+
return `Isole $\\ln(x)$ d'un côté de l'équation. Puis, utilise la propriété suivante : pour tout nombre réel $x>0$ et tout nombre réel $k$, on a :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
\\ln(x) = k \\iff x = e^{k}
|
|
54
|
+
$$`;
|
|
55
|
+
};
|
|
56
|
+
const getCorrection = (identifiers) => {
|
|
57
|
+
const { a, k } = identifiers;
|
|
58
|
+
return `On isole $\\ln(x)$ d'un côté de l'équation :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
\\ln(x) = ${frac(k, a).toSimplificationTex()}
|
|
62
|
+
$$
|
|
63
|
+
|
|
64
|
+
Puis, on applique l'exponentielle. En effet, pour tout nombre réel $x>0$ et tout nombre réel $k$, on a :
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
\\ln(x) = k \\iff x = e^{k}
|
|
68
|
+
$$
|
|
69
|
+
|
|
70
|
+
Ici, on a donc :
|
|
71
|
+
|
|
72
|
+
$$
|
|
73
|
+
x = ${exp(frac(k, a).simplify()).toTex()}
|
|
74
|
+
$$
|
|
75
|
+
|
|
76
|
+
La solution de l'équation est donc :
|
|
77
|
+
|
|
78
|
+
$$
|
|
79
|
+
${getAnswer(identifiers)}
|
|
80
|
+
$$
|
|
81
|
+
`;
|
|
82
|
+
};
|
|
48
83
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
49
84
|
const question = {
|
|
50
85
|
instruction: getInstruction(identifiers),
|
|
@@ -52,6 +87,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
52
87
|
keys: getKeys(identifiers),
|
|
53
88
|
answerFormat: "tex",
|
|
54
89
|
identifiers,
|
|
90
|
+
hint: getHint(identifiers),
|
|
91
|
+
correction: getCorrection(identifiers),
|
|
55
92
|
};
|
|
56
93
|
return question;
|
|
57
94
|
};
|
|
@@ -86,4 +123,5 @@ export const logEquation = {
|
|
|
86
123
|
isAnswerValid,
|
|
87
124
|
subject: "Mathématiques",
|
|
88
125
|
getQuestionFromIdentifiers,
|
|
126
|
+
hasHintAndCorrection: true,
|
|
89
127
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logPowerEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logPowerEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"logPowerEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logPowerEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAwBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAyKF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe3D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB7D,CAAC"}
|
|
@@ -3,18 +3,20 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
5
5
|
import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
6
|
-
import { Log10Node } from "../../../../tree/nodes/functions/log10Node.js";
|
|
7
|
-
import { LogNode } from "../../../../tree/nodes/functions/logNode.js";
|
|
6
|
+
import { log10, Log10Node } from "../../../../tree/nodes/functions/log10Node.js";
|
|
7
|
+
import { logn, LogNode } from "../../../../tree/nodes/functions/logNode.js";
|
|
8
8
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
9
9
|
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
10
|
-
import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
-
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
-
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
10
|
+
import { frac, FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
+
import { multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
+
import { power, PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
13
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
13
14
|
import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
|
|
14
15
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
15
16
|
import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
|
|
16
17
|
import { equationSolutionParser } from "../../../../tree/parsers/equationSolutionParser.js";
|
|
17
18
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
19
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
18
20
|
/**a*b^x+c=d */
|
|
19
21
|
const getKeys = (_identifiers, opts) => {
|
|
20
22
|
const keys = ["x", "equal", "S", "lbrace", "semicolon", "rbrace"];
|
|
@@ -44,12 +46,55 @@ const getAnswer = (identifiers, opts) => {
|
|
|
44
46
|
};
|
|
45
47
|
const getLogPowerEquationQuestion = (opts) => {
|
|
46
48
|
const powered = randint(2, 8);
|
|
47
|
-
const a = randint(
|
|
49
|
+
const a = randint(2, 10, [powered]);
|
|
48
50
|
const c = randint(-5, 5, [a]);
|
|
49
51
|
const k = randint(5, 15, [powered]);
|
|
50
52
|
const identifiers = { a, c, k, powered, isLog10: opts?.isLog10 ?? false };
|
|
51
53
|
return getQuestionFromIdentifiers(identifiers, opts);
|
|
52
54
|
};
|
|
55
|
+
const getHint = (identifiers, opts) => {
|
|
56
|
+
const logString = opts?.isLog10 ? "\\log" : "\\ln";
|
|
57
|
+
const { powered } = identifiers;
|
|
58
|
+
const powerN = power(powered, "x");
|
|
59
|
+
return `Commence par isoler $${powerN.toTex()}$ d'un côté de l'équation.
|
|
60
|
+
|
|
61
|
+
Puis, applique le logarithme sur les deux membres de l'équation.
|
|
62
|
+
|
|
63
|
+
Cela te permettra d'obtenir la solution, en utilisant la propriété suivante : pour tout nombre réel $a>0$ et tout nombre réel $b$,
|
|
64
|
+
|
|
65
|
+
$$
|
|
66
|
+
${logString}(a^b) = b${logString}(a)
|
|
67
|
+
$$
|
|
68
|
+
`;
|
|
69
|
+
};
|
|
70
|
+
const getCorrection = (identifiers, opts) => {
|
|
71
|
+
const { a, powered, c, k } = identifiers;
|
|
72
|
+
const d = k * a + c;
|
|
73
|
+
const powerN = power(powered, "x");
|
|
74
|
+
const loga = opts?.isLog10 ? log10 : logn;
|
|
75
|
+
//a*powered^x+c = d
|
|
76
|
+
//poweerd^x = (d-c)/a
|
|
77
|
+
const b = frac(substract(d, c), a).simplify();
|
|
78
|
+
return `On commence par isoler $${powerN.toTex()}$ d'un côté de l'équation :
|
|
79
|
+
|
|
80
|
+
$$
|
|
81
|
+
${powerN.toTex()} = ${frac(substract(d, c), a).toSimplificationTex()}
|
|
82
|
+
$$
|
|
83
|
+
|
|
84
|
+
Ensuite, on applique le logarithme sur les deux membres de l'équation (ce qui est possible car les deux membres sont strictement positifs), et on utilise la propriété $${loga("a^x").toTex()}= x${loga("a").toTex()}$ :
|
|
85
|
+
|
|
86
|
+
${alignTex([
|
|
87
|
+
[loga(powerN).toTex(), "=", loga(b).toTex()],
|
|
88
|
+
[multiply("x", loga(powered)).toTex(), "=", loga(b).toTex()],
|
|
89
|
+
["x", "=", frac(loga(b), loga(powered)).toTex()],
|
|
90
|
+
])}
|
|
91
|
+
|
|
92
|
+
La solution est donc :
|
|
93
|
+
|
|
94
|
+
$$
|
|
95
|
+
${getAnswer(identifiers, opts)}
|
|
96
|
+
$$`;
|
|
97
|
+
};
|
|
53
98
|
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
54
99
|
const question = {
|
|
55
100
|
answer: getAnswer(identifiers, opts),
|
|
@@ -57,6 +102,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
57
102
|
keys: getKeys(identifiers, opts),
|
|
58
103
|
answerFormat: "tex",
|
|
59
104
|
identifiers,
|
|
105
|
+
hint: getHint(identifiers, opts),
|
|
106
|
+
correction: getCorrection(identifiers, opts),
|
|
60
107
|
};
|
|
61
108
|
return question;
|
|
62
109
|
};
|
|
@@ -106,6 +153,7 @@ export const logPowerEquation = {
|
|
|
106
153
|
isAnswerValid,
|
|
107
154
|
subject: "Mathématiques",
|
|
108
155
|
getQuestionFromIdentifiers,
|
|
156
|
+
hasHintAndCorrection: true,
|
|
109
157
|
};
|
|
110
158
|
export const log10PowerEquation = {
|
|
111
159
|
id: "log10PowerEquation",
|
|
@@ -119,4 +167,5 @@ export const log10PowerEquation = {
|
|
|
119
167
|
isAnswerValid,
|
|
120
168
|
subject: "Mathématiques",
|
|
121
169
|
getQuestionFromIdentifiers,
|
|
170
|
+
hasHintAndCorrection: true,
|
|
122
171
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"logSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
|