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
|
@@ -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"}
|
|
@@ -2,9 +2,11 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercis
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
-
import { LogNode } from "../../../../tree/nodes/functions/logNode.js";
|
|
5
|
+
import { logn, LogNode } from "../../../../tree/nodes/functions/logNode.js";
|
|
6
6
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
7
7
|
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
10
|
import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
11
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
10
12
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
@@ -21,7 +23,7 @@ const getStatementNode = (identifiers) => {
|
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
25
|
const getInstruction = (identifiers) => {
|
|
24
|
-
return `Écrire le nombre suivant sous la forme $\\ln\\left(a\\right)$ :
|
|
26
|
+
return `Écrire le nombre suivant sous la forme $\\ln\\left(a\\right)$, avec $a\\in \\mathbb{R}$ :
|
|
25
27
|
|
|
26
28
|
$$
|
|
27
29
|
${getStatementNode(identifiers).toTex()}
|
|
@@ -36,15 +38,50 @@ const getAnswer = (identifiers) => {
|
|
|
36
38
|
return new LogNode(new Rational(a, b).simplify().toTree()).toTex();
|
|
37
39
|
}
|
|
38
40
|
};
|
|
41
|
+
const getHint = () => {
|
|
42
|
+
return `Pour tous nombres réels $a$ et $b$ strictement positifs, on a :
|
|
43
|
+
|
|
44
|
+
- $\\ln(a) + \\ln(b) = \\ln(a\\times b)$
|
|
45
|
+
- $\\ln(a) - \\ln(b) = \\ln(\\frac{a}{b})$`;
|
|
46
|
+
};
|
|
47
|
+
const getCorrection = (identifiers) => {
|
|
48
|
+
const { a, b, pm } = identifiers;
|
|
49
|
+
if (pm === 1) {
|
|
50
|
+
return `On sait que pour tous nombres réels $a$ et $b$ strictement positifs, on a :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
\\ln(a) + \\ln(b) = \\ln(a\\times b)
|
|
54
|
+
$$
|
|
55
|
+
|
|
56
|
+
Ici on a donc :
|
|
57
|
+
|
|
58
|
+
$$
|
|
59
|
+
\\ln(${a}) + \\ln(${b}) = ${logn(multiply(a, b)).toSimplificationTex()}
|
|
60
|
+
$$`;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return `On sait que pour tous nombres réels $a$ et $b$ strictement positifs, on a :
|
|
64
|
+
|
|
65
|
+
$$
|
|
66
|
+
\\ln(a) - \\ln(b) = \\ln(\\frac{a}{b})
|
|
67
|
+
$$
|
|
68
|
+
|
|
69
|
+
Ici on a donc :
|
|
70
|
+
|
|
71
|
+
$$
|
|
72
|
+
\\ln(${a}) - \\ln(${b}) = ${logn(frac(a, b)).toSimplificationTex()}
|
|
73
|
+
$$`;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
39
76
|
const getKeys = () => {
|
|
40
77
|
return ["lnBrackets"];
|
|
41
78
|
};
|
|
42
79
|
const getExpSimplifiying = () => {
|
|
43
80
|
const pm = coinFlip() ? 1 : -1;
|
|
44
|
-
const a = randint(
|
|
81
|
+
const a = randint(2, 10);
|
|
45
82
|
let b;
|
|
46
83
|
do {
|
|
47
|
-
b = randint(
|
|
84
|
+
b = randint(2, 10);
|
|
48
85
|
} while (pm === -1 && a === b);
|
|
49
86
|
const identifiers = { pm, a, b };
|
|
50
87
|
return getQuestionFromIdentifiers(identifiers);
|
|
@@ -56,6 +93,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
56
93
|
keys: getKeys(identifiers),
|
|
57
94
|
answerFormat: "tex",
|
|
58
95
|
identifiers,
|
|
96
|
+
hint: getHint(identifiers),
|
|
97
|
+
correction: getCorrection(identifiers),
|
|
59
98
|
};
|
|
60
99
|
return question;
|
|
61
100
|
};
|
|
@@ -85,7 +124,7 @@ const isAnswerValid = (ans, { a, b, pm }) => {
|
|
|
85
124
|
export const logSimplifiying = {
|
|
86
125
|
id: "logSimplifiying",
|
|
87
126
|
connector: "\\iff",
|
|
88
|
-
label: "
|
|
127
|
+
label: "Utiliser la propriété algébrique du logarithme népérien $\\ln(a) \\pm \\ln(b) = \\ln(ab)$",
|
|
89
128
|
isSingleStep: false,
|
|
90
129
|
generator: (nb) => getDistinctQuestions(getExpSimplifiying, nb),
|
|
91
130
|
qcmTimer: 60,
|
|
@@ -94,4 +133,5 @@ export const logSimplifiying = {
|
|
|
94
133
|
isAnswerValid,
|
|
95
134
|
subject: "Mathématiques",
|
|
96
135
|
getQuestionFromIdentifiers,
|
|
136
|
+
hasHintAndCorrection: true,
|
|
97
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findParamToMakeDensity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/density/findParamToMakeDensity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CAEX,CAAC;AAyHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAmBxD,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getPropositions = (n, { answer }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
addValidProp(propositions, answer);
|
|
13
|
+
propWhile(propositions, n, () => {
|
|
14
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductibleProba().toTree().toTex());
|
|
15
|
+
});
|
|
16
|
+
return shuffleProps(propositions, n);
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { a, b } = identifiers;
|
|
20
|
+
// k = 2/(b^2-a^2)
|
|
21
|
+
return frac(2, substract(b ** 2, a ** 2))
|
|
22
|
+
.simplify()
|
|
23
|
+
.toTex();
|
|
24
|
+
};
|
|
25
|
+
const getInstruction = (identifiers) => {
|
|
26
|
+
const { a, b } = identifiers;
|
|
27
|
+
return `On considère la fonction $f$ définie sur $I = [${a};${b}]$ par :
|
|
28
|
+
|
|
29
|
+
$$
|
|
30
|
+
f(t) = kt
|
|
31
|
+
$$
|
|
32
|
+
|
|
33
|
+
où $k$ est un réel strictement positif.
|
|
34
|
+
|
|
35
|
+
Déterminer la valeur de $k$ pour que $f$ soit une densité de probabilité sur $I$.`;
|
|
36
|
+
};
|
|
37
|
+
const getHint = (identifiers) => {
|
|
38
|
+
const { a, b } = identifiers;
|
|
39
|
+
return `Une fonction $f$ est une densité de probabilité sur un intervalle $[a;b]$ si et seulement si $f$ est continue et positive sur $[a;b]$ et :
|
|
40
|
+
|
|
41
|
+
$$
|
|
42
|
+
\\int_{a}^{b} f(x)\\ \\mathrm{d}x = 1
|
|
43
|
+
$$
|
|
44
|
+
|
|
45
|
+
Ici, il faut donc vérifier que $f$ est continue et positive sur $[${a};${b}]$ et déterminer la valeur de $k$ pour laquelle :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
\\int_{${a}}^{${b}} kt\\ \\mathrm{d}t = 1
|
|
49
|
+
$$`;
|
|
50
|
+
};
|
|
51
|
+
const getCorrection = (identifiers) => {
|
|
52
|
+
const { a, b } = identifiers;
|
|
53
|
+
const k = frac(2, substract(b ** 2, a ** 2)).simplify();
|
|
54
|
+
return `$f$ est une fonction affine, elle est donc continue sur $[${a};${b}]$. Puisque $k$ est positif, $f$ est également positive sur $[${a};${b}]$.
|
|
55
|
+
|
|
56
|
+
Une primitive de $f$ sur $[${a};${b}]$ est :
|
|
57
|
+
|
|
58
|
+
$$
|
|
59
|
+
F(t) = \\frac{k}{2}t^2
|
|
60
|
+
$$
|
|
61
|
+
|
|
62
|
+
On intègre alors $f$ sur $[${a};${b}]$ :
|
|
63
|
+
|
|
64
|
+
$$
|
|
65
|
+
\\int_{${a}}^{${b}} f(t)\\ \\mathrm{d}t = F(${b})-F(${a}) = \\frac{k}{2}(${b}^2-${a}^2)
|
|
66
|
+
$$
|
|
67
|
+
|
|
68
|
+
On doit donc résoudre l'équation suivante :
|
|
69
|
+
|
|
70
|
+
$$
|
|
71
|
+
${multiply(b ** 2 - a ** 2, frac("k", 2)).toTex()} = 1
|
|
72
|
+
$$
|
|
73
|
+
|
|
74
|
+
On trouve $k = ${k.toTex()}$.
|
|
75
|
+
|
|
76
|
+
La fonction $f$ définie par $f(t) = ${multiply(k, "t").toTex()}$ est donc une densité de probabilité sur $[${a};${b}]$.
|
|
77
|
+
`;
|
|
78
|
+
};
|
|
79
|
+
const getKeys = () => {
|
|
80
|
+
return [];
|
|
81
|
+
};
|
|
82
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
83
|
+
try {
|
|
84
|
+
return rationalVEA(ans, answer);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
return handleVEAError(err);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const getFindParamToMakeDensityQuestion = () => {
|
|
91
|
+
const a = randint(1, 10);
|
|
92
|
+
const b = randint(a + 1, a + 8);
|
|
93
|
+
const identifiers = {
|
|
94
|
+
a,
|
|
95
|
+
b,
|
|
96
|
+
};
|
|
97
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
98
|
+
};
|
|
99
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
100
|
+
return {
|
|
101
|
+
answer: getAnswer(identifiers),
|
|
102
|
+
instruction: getInstruction(identifiers),
|
|
103
|
+
keys: getKeys(identifiers),
|
|
104
|
+
answerFormat: "tex",
|
|
105
|
+
identifiers,
|
|
106
|
+
hint: getHint(identifiers),
|
|
107
|
+
correction: getCorrection(identifiers),
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
export const findParamToMakeDensity = {
|
|
111
|
+
id: "findParamToMakeDensity",
|
|
112
|
+
connector: "=",
|
|
113
|
+
label: "Déterminer un paramètre pour qu'une fonction soit une densité de probabilité",
|
|
114
|
+
isSingleStep: true,
|
|
115
|
+
generator: (nb, opts) => getDistinctQuestions(() => getFindParamToMakeDensityQuestion(opts), nb),
|
|
116
|
+
qcmTimer: 60,
|
|
117
|
+
freeTimer: 60,
|
|
118
|
+
getPropositions,
|
|
119
|
+
isAnswerValid,
|
|
120
|
+
subject: "Mathématiques",
|
|
121
|
+
getInstruction,
|
|
122
|
+
getHint,
|
|
123
|
+
getCorrection,
|
|
124
|
+
getAnswer,
|
|
125
|
+
getQuestionFromIdentifiers,
|
|
126
|
+
hasHintAndCorrection: true,
|
|
127
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/density/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./findParamToMakeDensity.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exponentialLawAverage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/exponential/exponentialLawAverage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAgFF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAkBvD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { round } from "../../../../math/utils/round.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
8
|
+
import { approxOrEqual } from "../../../../utils/latex/approxOrEqual.js";
|
|
9
|
+
const getPropositions = (n, { answer }) => {
|
|
10
|
+
const propositions = [];
|
|
11
|
+
addValidProp(propositions, answer);
|
|
12
|
+
propWhile(propositions, n, () => {
|
|
13
|
+
tryToAddWrongProp(propositions, randfloat(0.01, 0.9, 2).frenchify());
|
|
14
|
+
});
|
|
15
|
+
return shuffleProps(propositions, n);
|
|
16
|
+
};
|
|
17
|
+
const getAnswer = (identifiers) => {
|
|
18
|
+
const { lambda } = identifiers;
|
|
19
|
+
return round(frac(1, lambda).evaluate(), 2).frenchify();
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers) => {
|
|
22
|
+
const { lambda } = identifiers;
|
|
23
|
+
return `Soit $X$ une variable aléatoire qui suit une loi exponentielle de paramètre $${lambda.frenchify()}$.
|
|
24
|
+
|
|
25
|
+
Quelle est l'espérance $E(X)$ de $X$ ? Donner une valeur arrondie au centième.`;
|
|
26
|
+
};
|
|
27
|
+
const getHint = () => {
|
|
28
|
+
return `L'espérance d'une variable aléatoire $X$ de loi exponentielle de paramètre $\\lambda>0$ est égale à :
|
|
29
|
+
|
|
30
|
+
$$
|
|
31
|
+
E(X) = \\frac{1}{\\lambda}
|
|
32
|
+
$$`;
|
|
33
|
+
};
|
|
34
|
+
const getCorrection = (identifiers) => {
|
|
35
|
+
const { lambda } = identifiers;
|
|
36
|
+
const ans = frac(1, lambda).evaluate();
|
|
37
|
+
return `L'espérance d'une variable aléatoire $X$ de loi exponentielle de paramètre $\\lambda>0$ est égale à :
|
|
38
|
+
|
|
39
|
+
$$
|
|
40
|
+
E(X) = \\frac{1}{\\lambda}
|
|
41
|
+
$$
|
|
42
|
+
|
|
43
|
+
Ici, on a donc :
|
|
44
|
+
|
|
45
|
+
$$
|
|
46
|
+
E(X) = ${frac(1, lambda).toTex()} ${approxOrEqual(ans, 2).join("")}
|
|
47
|
+
$$`;
|
|
48
|
+
};
|
|
49
|
+
const getKeys = () => {
|
|
50
|
+
return [];
|
|
51
|
+
};
|
|
52
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
53
|
+
try {
|
|
54
|
+
return numberVEA(ans, answer);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
return handleVEAError(err);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const getExponentialLawAverageQuestion = () => {
|
|
61
|
+
const lambda = randfloat(0.01, 1, 2);
|
|
62
|
+
const identifiers = {
|
|
63
|
+
lambda,
|
|
64
|
+
};
|
|
65
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
66
|
+
};
|
|
67
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
68
|
+
return {
|
|
69
|
+
answer: getAnswer(identifiers),
|
|
70
|
+
instruction: getInstruction(identifiers),
|
|
71
|
+
keys: getKeys(identifiers),
|
|
72
|
+
answerFormat: "tex",
|
|
73
|
+
identifiers,
|
|
74
|
+
hint: getHint(identifiers),
|
|
75
|
+
correction: getCorrection(identifiers),
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export const exponentialLawAverage = {
|
|
79
|
+
id: "exponentialLawAverage",
|
|
80
|
+
connector: "=",
|
|
81
|
+
label: "Calculer l'espérance d'une loi exponentielle",
|
|
82
|
+
isSingleStep: true,
|
|
83
|
+
generator: (nb, opts) => getDistinctQuestions(() => getExponentialLawAverageQuestion(opts), nb),
|
|
84
|
+
qcmTimer: 60,
|
|
85
|
+
freeTimer: 60,
|
|
86
|
+
getPropositions,
|
|
87
|
+
isAnswerValid,
|
|
88
|
+
subject: "Mathématiques",
|
|
89
|
+
getInstruction,
|
|
90
|
+
getHint,
|
|
91
|
+
getCorrection,
|
|
92
|
+
getAnswer,
|
|
93
|
+
getQuestionFromIdentifiers,
|
|
94
|
+
hasHintAndCorrection: true,
|
|
95
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
lambda: number;
|
|
4
|
+
a: number;
|
|
5
|
+
b: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const exponentialLawComputeIntervalProba: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=exponentialLawComputeIntervalProba.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exponentialLawComputeIntervalProba.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/exponential/exponentialLawComputeIntervalProba.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CAEX,CAAC;AA8GF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAmBpE,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../../math/utils/round.js";
|
|
7
|
+
import { exp } from "../../../../tree/nodes/functions/expNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
|
+
const getPropositions = (n, { answer }) => {
|
|
12
|
+
const propositions = [];
|
|
13
|
+
addValidProp(propositions, answer);
|
|
14
|
+
propWhile(propositions, n, () => {
|
|
15
|
+
tryToAddWrongProp(propositions, randfloat(0.01, 0.9, 2).frenchify());
|
|
16
|
+
});
|
|
17
|
+
return shuffleProps(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { a, b, lambda } = identifiers;
|
|
21
|
+
return round(substract(exp(-a * lambda), exp(-b * lambda)).evaluate(), 2).frenchify();
|
|
22
|
+
};
|
|
23
|
+
const getInstruction = (identifiers) => {
|
|
24
|
+
const { a, b, lambda } = identifiers;
|
|
25
|
+
return `Soit $X$ une variable aléatoire qui suit une loi exponentielle de paramètre $${lambda.frenchify()}$.
|
|
26
|
+
|
|
27
|
+
Calculer $P(${a}\\leq X\\leq ${b})$.
|
|
28
|
+
|
|
29
|
+
Donner une valeur approchée au centième.`;
|
|
30
|
+
};
|
|
31
|
+
const getHint = () => {
|
|
32
|
+
return `Si $X$ suit une loi exponentielle de paramètre $\\lambda$, alors pour tous réels
|
|
33
|
+
$c$ et $d$ positifs tels que $c\\leq d$, on a :
|
|
34
|
+
|
|
35
|
+
$$
|
|
36
|
+
P(a\\leq X\\leq b) = e^{-\\lambda a} - e^{-\\lambda b}
|
|
37
|
+
$$`;
|
|
38
|
+
};
|
|
39
|
+
const getCorrection = (identifiers) => {
|
|
40
|
+
const { a, b, lambda } = identifiers;
|
|
41
|
+
return `Si $X$ suit une loi exponentielle de paramètre $\\lambda$, alors pour tous réels
|
|
42
|
+
$c$ et $d$ positifs tels que $c\\leq d$, on a :
|
|
43
|
+
|
|
44
|
+
$$
|
|
45
|
+
P(a\\leq X\\leq b) = e^{-\\lambda a} - e^{-\\lambda b}
|
|
46
|
+
$$
|
|
47
|
+
|
|
48
|
+
Ici, on a donc :
|
|
49
|
+
|
|
50
|
+
$$
|
|
51
|
+
P(${a}\\leq X\\leq ${b}) = e^{${multiply(-lambda, a).toTex()}}-e^{${multiply(-lambda, b).toTex()}} \\approx ${getAnswer(identifiers)}
|
|
52
|
+
$$`;
|
|
53
|
+
};
|
|
54
|
+
const getKeys = () => {
|
|
55
|
+
return [];
|
|
56
|
+
};
|
|
57
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
58
|
+
try {
|
|
59
|
+
return numberVEA(ans, answer);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
return handleVEAError(err);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const getExponentialLawComputeProbaQuestion = () => {
|
|
66
|
+
let lambda;
|
|
67
|
+
let a;
|
|
68
|
+
let b;
|
|
69
|
+
let rounded;
|
|
70
|
+
let counter = 0;
|
|
71
|
+
do {
|
|
72
|
+
counter++;
|
|
73
|
+
if (counter > 1000)
|
|
74
|
+
throw new Error("too many iterations in exponentialLawComputeProba");
|
|
75
|
+
lambda = randfloat(0.01, 1, 2);
|
|
76
|
+
a = randint(2, 20);
|
|
77
|
+
b = randint(a + 5, a + 15);
|
|
78
|
+
rounded = round(substract(exp(-a * lambda), exp(-b * lambda)).evaluate(), 2);
|
|
79
|
+
} while (rounded === 0);
|
|
80
|
+
const identifiers = {
|
|
81
|
+
lambda,
|
|
82
|
+
a,
|
|
83
|
+
b,
|
|
84
|
+
};
|
|
85
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
86
|
+
};
|
|
87
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
88
|
+
return {
|
|
89
|
+
answer: getAnswer(identifiers),
|
|
90
|
+
instruction: getInstruction(identifiers),
|
|
91
|
+
keys: getKeys(identifiers),
|
|
92
|
+
answerFormat: "tex",
|
|
93
|
+
identifiers,
|
|
94
|
+
hint: getHint(identifiers),
|
|
95
|
+
correction: getCorrection(identifiers),
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export const exponentialLawComputeIntervalProba = {
|
|
99
|
+
id: "exponentialLawComputeIntervalProba",
|
|
100
|
+
connector: "=",
|
|
101
|
+
label: "Calculer une probabilité du type $P(a\\leq X\\leq b)$ pour une loi exponentielle",
|
|
102
|
+
isSingleStep: true,
|
|
103
|
+
generator: (nb, opts) => getDistinctQuestions(() => getExponentialLawComputeProbaQuestion(opts), nb),
|
|
104
|
+
qcmTimer: 60,
|
|
105
|
+
freeTimer: 60,
|
|
106
|
+
getPropositions,
|
|
107
|
+
isAnswerValid,
|
|
108
|
+
subject: "Mathématiques",
|
|
109
|
+
getInstruction,
|
|
110
|
+
getHint,
|
|
111
|
+
getCorrection,
|
|
112
|
+
getAnswer,
|
|
113
|
+
getQuestionFromIdentifiers,
|
|
114
|
+
hasHintAndCorrection: true,
|
|
115
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
lambda: number;
|
|
4
|
+
k: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const exponentialLawComputeProba: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=exponentialLawComputeProba.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exponentialLawComputeProba.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/exponential/exponentialLawComputeProba.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;CAEX,CAAC;AAkGF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAmB5D,CAAC"}
|