math-exercises 3.0.207 → 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/continuity/signTableFromVarTableWithZeroes.d.ts.map +1 -1
- package/lib/exercises/math/functions/continuity/signTableFromVarTableWithZeroes.js +8 -7
- package/lib/exercises/math/functions/continuity/thirdDegreeZeroesFramingWithCalculator.js +14 -13
- 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":"signTableFromVarTableWithZeroes.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/continuity/signTableFromVarTableWithZeroes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"signTableFromVarTableWithZeroes.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/continuity/signTableFromVarTableWithZeroes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAiKF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAqBjE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
2
2
|
import { signTableVEA } from "../../../../exercises/vea/signTableVEA.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
4
5
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
5
6
|
const getAnswerTable = (identifiers) => {
|
|
6
7
|
const { xValues, yValues, xZeroes } = identifiers;
|
|
@@ -91,7 +92,7 @@ const isAnswerTableValid = (ans, { answerTable }) => {
|
|
|
91
92
|
};
|
|
92
93
|
const getSignTableFromVarTableWithZeroesQuestion = () => {
|
|
93
94
|
const xValues = [
|
|
94
|
-
randint(-12, -
|
|
95
|
+
randint(-12, -5),
|
|
95
96
|
randint(-4, 2),
|
|
96
97
|
randint(3, 7),
|
|
97
98
|
randint(8, 10),
|
|
@@ -99,30 +100,30 @@ const getSignTableFromVarTableWithZeroesQuestion = () => {
|
|
|
99
100
|
const yValues = [randint(-9, 10, [-1, 0, 1])];
|
|
100
101
|
// x = [a,b,c,d]
|
|
101
102
|
// deux zéros
|
|
102
|
-
const nonZeroInterval =
|
|
103
|
+
const nonZeroInterval = random([0, 2]);
|
|
103
104
|
for (let i = 0; i < 3; i++) {
|
|
104
105
|
const prevY = yValues[i];
|
|
105
106
|
if (nonZeroInterval === i) {
|
|
106
107
|
if (i === 0) {
|
|
107
108
|
if (prevY < 0) {
|
|
108
109
|
//on doit descendre car on remontera post 0 après
|
|
109
|
-
yValues.push(randint(-15, prevY));
|
|
110
|
+
yValues.push(randint(-15, prevY, [-1]));
|
|
110
111
|
}
|
|
111
112
|
else {
|
|
112
113
|
//on doit monter car on descendra post 0 après
|
|
113
|
-
yValues.push(randint(prevY + 1, 15));
|
|
114
|
+
yValues.push(randint(prevY + 1, 15, [1]));
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
else {
|
|
117
118
|
const prevPrevY = yValues[i - 1];
|
|
118
119
|
if (prevY < prevPrevY)
|
|
119
|
-
yValues.push(randint(prevY + 1,
|
|
120
|
+
yValues.push(randint(prevY + 1, prevY < 0 ? 0 : 15));
|
|
120
121
|
else
|
|
121
|
-
yValues.push(randint(
|
|
122
|
+
yValues.push(randint(1, prevY));
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
else {
|
|
125
|
-
yValues.push(prevY < 0 ? randint(
|
|
126
|
+
yValues.push(prevY < 0 ? randint(2, 15) : randint(-15, -1));
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
const xZeroes = [];
|
|
@@ -15,7 +15,7 @@ const getPropositions = (n, { answer, xValues }) => {
|
|
|
15
15
|
});
|
|
16
16
|
return shuffleProps(propositions, n);
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const getTable = (identifiers) => {
|
|
19
19
|
const { xValues, coeffs } = identifiers;
|
|
20
20
|
const poly = new Polynomial(coeffs).toTree();
|
|
21
21
|
const [fa, fb] = xValues.map((x) => poly.evaluate({ x }));
|
|
@@ -100,24 +100,25 @@ const getAnswer = (identifiers) => {
|
|
|
100
100
|
return round((xStart + xEnd) / 2, 2).frenchify();
|
|
101
101
|
};
|
|
102
102
|
const getInstruction = (identifiers) => {
|
|
103
|
-
const { coeffs
|
|
103
|
+
const { coeffs } = identifiers;
|
|
104
104
|
const poly = new Polynomial(coeffs);
|
|
105
|
-
return `Soit $f$ la fonction définie par :
|
|
106
|
-
|
|
107
|
-
$$
|
|
108
|
-
f(x) = ${poly.toTree().toTex()}
|
|
109
|
-
$$
|
|
110
|
-
|
|
111
|
-
On admet qu'il existe un nombre réel $\\alpha \\in [${xValues[0].frenchify()}, ${xValues[1].frenchify()}]$ tel que $f(\\alpha) = 0$.
|
|
112
|
-
|
|
113
|
-
Donner une valeur approchée au centième de $\\alpha$.`;
|
|
114
105
|
// return `Soit $f$ la fonction définie par :
|
|
115
106
|
// $$
|
|
116
107
|
// f(x) = ${poly.toTree().toTex()}
|
|
117
108
|
// $$
|
|
118
|
-
//
|
|
119
|
-
// <svg id="varTable">${JSON.stringify(getTable(identifiers))}</svg>
|
|
109
|
+
// On admet qu'il existe un nombre réel $\\alpha \\in [${xValues[0].frenchify()}, ${xValues[1].frenchify()}]$ tel que $f(\\alpha) = 0$.
|
|
120
110
|
// Donner une valeur approchée au centième de $\\alpha$.`;
|
|
111
|
+
return `Soit $f$ la fonction définie par :
|
|
112
|
+
|
|
113
|
+
$$
|
|
114
|
+
f(x) = ${poly.toTree().toTex()}
|
|
115
|
+
$$
|
|
116
|
+
|
|
117
|
+
Le tableau de variations de $f$ est le suivant :
|
|
118
|
+
|
|
119
|
+
<svg id="varTable">${JSON.stringify(getTable(identifiers))}</svg>
|
|
120
|
+
|
|
121
|
+
Donner une valeur approchée au centième de $\\alpha$.`;
|
|
121
122
|
};
|
|
122
123
|
const getHint = () => {
|
|
123
124
|
return `Utilise le menu TABLE de la calculatrice. En réduisant peu à peu le pas, tu peux obtenir une valeur approchée au centième de $\\alpha$.`;
|
|
@@ -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"}
|