math-exercises 3.0.183 → 3.0.184
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/functions/composition/functionComposition.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/functionComposition.js +11 -22
- package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.js +18 -3
- package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.d.ts +8 -0
- package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.js +108 -0
- package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.d.ts +8 -0
- package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.js +144 -0
- package/lib/exercises/math/functions/exponential/expKT/index.d.ts +3 -0
- package/lib/exercises/math/functions/exponential/expKT/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/expKT/index.js +2 -0
- package/lib/exercises/math/functions/exponential/expSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/expSimplifiying.js +94 -4
- package/lib/exercises/math/functions/exponential/index.d.ts +3 -0
- package/lib/exercises/math/functions/exponential/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/index.js +3 -0
- package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts +9 -0
- package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.js +101 -0
- package/lib/exercises/math/functions/exponential/sign/index.d.ts +2 -0
- package/lib/exercises/math/functions/exponential/sign/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/sign/index.js +1 -0
- package/lib/exercises/math/functions/exponential/variations/index.d.ts +3 -0
- package/lib/exercises/math/functions/exponential/variations/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/variations/index.js +2 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.d.ts +7 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.js +144 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.d.ts +7 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.js +139 -0
- package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.d.ts +7 -0
- package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.js +100 -0
- package/lib/exercises/math/probaStat/independancy/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/independancy/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/independancy/index.js +1 -0
- package/lib/exercises/math/probaStat/trees/index.d.ts +4 -1
- package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/trees/index.js +4 -9
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +37 -39
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +14 -4
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +12 -3
- package/lib/exercises/vea/treeTableVEA.d.ts.map +1 -1
- package/lib/exercises/vea/treeTableVEA.js +3 -0
- package/lib/index.d.ts +33 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +1 -1
- package/lib/tests/singleExo.test.js +2 -2
- package/lib/tree/nodes/functions/expNode.d.ts +1 -1
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +3 -6
- package/lib/tree/nodes/operators/addNode.d.ts +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +2 -2
- package/lib/tree/nodes/operators/substractNode.d.ts +1 -1
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +2 -2
- package/lib/tree/utilities/nodeComparator.d.ts +7 -0
- package/lib/tree/utilities/nodeComparator.d.ts.map +1 -0
- package/lib/tree/utilities/nodeComparator.js +88 -0
- package/lib/tree/utilities/nodeInspector.d.ts +5 -0
- package/lib/tree/utilities/nodeInspector.d.ts.map +1 -0
- package/lib/tree/utilities/nodeInspector.js +15 -0
- package/lib/tree/utilities/nodeRewriter.d.ts +9 -0
- package/lib/tree/utilities/nodeRewriter.d.ts.map +1 -0
- package/lib/tree/utilities/nodeRewriter.js +172 -0
- package/lib/tree/utilities/nodeShuffler.d.ts +2 -4
- package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -1
- package/lib/tree/utilities/nodeShuffler.js +13 -104
- package/lib/tree/utilities/nodeSimplifier.d.ts +1 -2
- package/lib/tree/utilities/nodeSimplifier.d.ts.map +1 -1
- package/lib/tree/utilities/nodeSimplifier.js +14 -88
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functionComposition.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/composition/functionComposition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"functionComposition.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/composition/functionComposition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgE7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B,CAAC;AAgNF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
|
|
@@ -8,6 +8,8 @@ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
|
8
8
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
9
|
import { isOperatorNode } from "../../../../tree/nodes/operators/operatorNode.js";
|
|
10
10
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
|
+
import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
|
|
12
|
+
import { NodeRewriter } from "../../../../tree/utilities/nodeRewriter.js";
|
|
11
13
|
import { random } from "../../../../utils/alea/random.js";
|
|
12
14
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
13
15
|
const nodeBySubstitutingX = (node, strVar) => {
|
|
@@ -99,28 +101,15 @@ const getAnswer = (identifiers) => {
|
|
|
99
101
|
const isAnswerValid = (ans, { answer }) => {
|
|
100
102
|
const nodeAns = parseAlgebraic(ans);
|
|
101
103
|
const nodeAnswer = parseAlgebraic(answer);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// const nodeAnswerOfAns = nodeBySubstitutingX(
|
|
112
|
-
// nodeAnswer.simplify(),
|
|
113
|
-
// nodeAns.simplify().toTex(),
|
|
114
|
-
// ).simplify();
|
|
115
|
-
// return [0, 1, 1000].every((x) => {
|
|
116
|
-
// return (
|
|
117
|
-
// substract(
|
|
118
|
-
// nodeAnsOfAnswer.evaluate({ x }),
|
|
119
|
-
// nodeAnswerOfAns.evaluate({ x }),
|
|
120
|
-
// ).evaluate() === 0
|
|
121
|
-
// );
|
|
122
|
-
// });
|
|
123
|
-
return nodeAns.simplify().toTex() === nodeAnswer.simplify().toTex();
|
|
104
|
+
const isEquivalentFound = () => {
|
|
105
|
+
const arrNodeAnswerEquivalent = NodeRewriter.getArrNodeEquivalent(nodeAnswer);
|
|
106
|
+
return arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
107
|
+
const isEqual = NodeComparator.isEqualViaSub(nodeAns, nodeAnswerRefined);
|
|
108
|
+
return isEqual;
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const isValid = isEquivalentFound();
|
|
112
|
+
return isValid;
|
|
124
113
|
};
|
|
125
114
|
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
126
115
|
const { nodeIds } = identifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewriteExpUsingExpA.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"rewriteExpUsingExpA.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAkB7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,eAAe,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAiZF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAcF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB9D,CAAC"}
|
|
@@ -12,6 +12,8 @@ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
|
12
12
|
import { power } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
13
13
|
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
14
14
|
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
15
|
+
import { NodeComparator } from "../../../../../tree/utilities/nodeComparator.js";
|
|
16
|
+
import { NodeRewriter } from "../../../../../tree/utilities/nodeRewriter.js";
|
|
15
17
|
import { random } from "../../../../../utils/alea/random.js";
|
|
16
18
|
const myExpFunc = (opts) => {
|
|
17
19
|
return (nodeChild) => new ExpNode(nodeChild, { useExpNotation: opts.isUseExpNotation });
|
|
@@ -170,13 +172,18 @@ $$
|
|
|
170
172
|
const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
171
173
|
const opts = optsIn ?? optsDefault;
|
|
172
174
|
const myExp = myExpFunc(opts);
|
|
175
|
+
const nodeAnswer = getAnswerNode(identifiers, opts);
|
|
176
|
+
const nodeAnswerSameOrEquivalent = random(NodeRewriter.getArrNodeEquivalent(nodeAnswer));
|
|
173
177
|
const { nodeIdsA, nodeIdsB } = identifiers;
|
|
174
178
|
const [nodeA, nodeB] = [nodeIdsA, nodeIdsB].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
175
179
|
const propositions = [];
|
|
176
|
-
addValidProp(propositions,
|
|
180
|
+
addValidProp(propositions, nodeAnswerSameOrEquivalent.toTex());
|
|
177
181
|
[0, 1, 2].forEach((rand) => {
|
|
178
182
|
const identifiersWrong = Object.assign({}, identifiers, { rand });
|
|
179
|
-
|
|
183
|
+
const nodeWrong = getAnswerNode(identifiersWrong, opts);
|
|
184
|
+
if (!NodeComparator.isEqualViaSub(nodeWrong, nodeAnswerSameOrEquivalent)) {
|
|
185
|
+
tryToAddWrongProp(propositions, getAnswer(identifiersWrong, opts));
|
|
186
|
+
}
|
|
180
187
|
});
|
|
181
188
|
//exp(a)+exp(b)
|
|
182
189
|
{
|
|
@@ -225,7 +232,15 @@ const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
|
|
|
225
232
|
}
|
|
226
233
|
}
|
|
227
234
|
const nodeAnswer = parseAlgebraic(answer);
|
|
228
|
-
|
|
235
|
+
const isEquivalentFound = () => {
|
|
236
|
+
const arrNodeAnswerEquivalent = NodeRewriter.getArrNodeEquivalent(nodeAnswer);
|
|
237
|
+
return arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
238
|
+
const isEqual = NodeComparator.isEqualViaSub(nodeAns, nodeAnswerRefined);
|
|
239
|
+
return isEqual;
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
const isValid = isEquivalentFound();
|
|
243
|
+
return isValid;
|
|
229
244
|
};
|
|
230
245
|
const getRewriteExpUsingExpAQuestion = (optsIn) => {
|
|
231
246
|
const opts = optsIn ?? optsDefault;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivativeOfAExpKT.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IAEjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
4
|
+
import { exp } from "../../../../../tree/nodes/functions/expNode.js";
|
|
5
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
7
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
8
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
9
|
+
const getPropositions = (n, { answer, a, k }) => {
|
|
10
|
+
const propositions = [];
|
|
11
|
+
addValidProp(propositions, answer);
|
|
12
|
+
tryToAddWrongProp(propositions, multiply(a, exp(multiply(k, "t"))).toTex());
|
|
13
|
+
tryToAddWrongProp(propositions, multiply(a, exp("t")).toTex());
|
|
14
|
+
propWhile(propositions, n, () => {
|
|
15
|
+
tryToAddWrongProp(propositions, multiply(randint(-10, 10, [0]), exp(multiply(k, "t"))).toTex());
|
|
16
|
+
});
|
|
17
|
+
return shuffleProps(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { a, k } = identifiers;
|
|
21
|
+
return multiply(multiply(a, k), exp(multiply(k, "t")))
|
|
22
|
+
.simplify()
|
|
23
|
+
.toTex();
|
|
24
|
+
};
|
|
25
|
+
const getInstruction = (identifiers) => {
|
|
26
|
+
const { a, k } = identifiers;
|
|
27
|
+
return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
|
|
28
|
+
|
|
29
|
+
$$
|
|
30
|
+
f(t) = ${multiply(a, exp(multiply(k, "t"))).toTex()}
|
|
31
|
+
$$
|
|
32
|
+
|
|
33
|
+
Calculer la dérivée $f'$ de $f$.`;
|
|
34
|
+
};
|
|
35
|
+
const getHint = () => {
|
|
36
|
+
return `Pour tout $k$ réel, on a :
|
|
37
|
+
|
|
38
|
+
$$
|
|
39
|
+
\\left(e^{kt}\\right)' = ke^{kt}
|
|
40
|
+
$$`;
|
|
41
|
+
};
|
|
42
|
+
const getCorrection = (identifiers) => {
|
|
43
|
+
const { a, k } = identifiers;
|
|
44
|
+
return `Pour tout $k$ réel, on a :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
\\left(e^{kt}\\right)' = ke^{kt}
|
|
48
|
+
$$
|
|
49
|
+
|
|
50
|
+
Ici, on a donc pour tout $t$ réel :
|
|
51
|
+
|
|
52
|
+
${alignTex([
|
|
53
|
+
["f'(t)", "=", multiply(a, multiply(k, exp(multiply(k, "t")))).toTex()],
|
|
54
|
+
["", "=", getAnswer(identifiers)],
|
|
55
|
+
])}`;
|
|
56
|
+
};
|
|
57
|
+
const getKeys = () => {
|
|
58
|
+
return ["epower", "t"];
|
|
59
|
+
};
|
|
60
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
61
|
+
try {
|
|
62
|
+
const parsed = parseAlgebraic(ans);
|
|
63
|
+
if (!parsed)
|
|
64
|
+
return false;
|
|
65
|
+
return parsed.simplify().toTex() === answer;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
return handleVEAError(err);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const getDerivativeOfAExpKtQuestion = () => {
|
|
72
|
+
const a = randint(-10, 10, [0, 1]);
|
|
73
|
+
const k = randint(-10, 10, [0, 1]);
|
|
74
|
+
const identifiers = {
|
|
75
|
+
a,
|
|
76
|
+
k,
|
|
77
|
+
};
|
|
78
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
79
|
+
};
|
|
80
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
81
|
+
return {
|
|
82
|
+
answer: getAnswer(identifiers),
|
|
83
|
+
instruction: getInstruction(identifiers),
|
|
84
|
+
keys: getKeys(identifiers),
|
|
85
|
+
answerFormat: "tex",
|
|
86
|
+
identifiers,
|
|
87
|
+
hint: getHint(identifiers),
|
|
88
|
+
correction: getCorrection(identifiers),
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export const derivativeOfAExpKT = {
|
|
92
|
+
id: "derivativeOfAExpKT",
|
|
93
|
+
connector: "=",
|
|
94
|
+
label: "Dérivée du type $ae^{kt}$",
|
|
95
|
+
isSingleStep: true,
|
|
96
|
+
generator: (nb, opts) => getDistinctQuestions(() => getDerivativeOfAExpKtQuestion(opts), nb),
|
|
97
|
+
qcmTimer: 60,
|
|
98
|
+
freeTimer: 60,
|
|
99
|
+
getPropositions,
|
|
100
|
+
isAnswerValid,
|
|
101
|
+
subject: "Mathématiques",
|
|
102
|
+
getInstruction,
|
|
103
|
+
getHint,
|
|
104
|
+
getCorrection,
|
|
105
|
+
getAnswer,
|
|
106
|
+
getQuestionFromIdentifiers,
|
|
107
|
+
hasHintAndCorrection: true,
|
|
108
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drugConcentrationMaximum.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CAEX,CAAC;AAyIF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAmB1D,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
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 { 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 { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
13
|
+
const getPropositions = (n, { answer }) => {
|
|
14
|
+
const propositions = [];
|
|
15
|
+
addValidProp(propositions, answer);
|
|
16
|
+
propWhile(propositions, n, () => {
|
|
17
|
+
tryToAddWrongProp(propositions, randfloat(0.1, 4, 2).frenchify());
|
|
18
|
+
});
|
|
19
|
+
return shuffleProps(propositions, n);
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
//t = 1/k
|
|
23
|
+
return round(frac(1, identifiers.k).evaluate(), 2).frenchify();
|
|
24
|
+
};
|
|
25
|
+
const getFunc = (identifiers) => {
|
|
26
|
+
const { a, k } = identifiers;
|
|
27
|
+
return multiply(a, multiply("t", exp(multiply(-k, "t")))).simplify();
|
|
28
|
+
};
|
|
29
|
+
const getInstruction = (identifiers) => {
|
|
30
|
+
return `On fait absorber un médicament, sous forme de compriné, à un patient. On modélise la quantité de médicament présente dans le sang du patient, exprimé en $\\textrm{mg}$, par la fonction $f$ définie sur l'intervalle $[0; +\\infty[$ par :
|
|
31
|
+
|
|
32
|
+
$$
|
|
33
|
+
f(t)=${getFunc(identifiers).toTex()}
|
|
34
|
+
$$
|
|
35
|
+
|
|
36
|
+
où $t$ définit le temps, exprimé en heure, écoulé depuis
|
|
37
|
+
la prise du comprimé.
|
|
38
|
+
|
|
39
|
+
Au bout de combien de temps la quantité de médicament présente dans le sang du patient sera-t-elle maximale ?
|
|
40
|
+
|
|
41
|
+
Donner une valeur arrondie au centième.`;
|
|
42
|
+
};
|
|
43
|
+
const getHint = () => {
|
|
44
|
+
return `Dérive la fonction $f$, puis étudie le signe de $f'(x)$. Tu pourras alors en déduire les variations de $f$, et ainsi déterminer la valeur de $t$ pour laquelle la quantité de médicament dans le sang du patient sera maximale.`;
|
|
45
|
+
};
|
|
46
|
+
const getCorrection = (identifiers) => {
|
|
47
|
+
const { a, k } = identifiers;
|
|
48
|
+
//atexp(-kt)
|
|
49
|
+
//f' = aexp(-kt) + at(-kexp(-kt))
|
|
50
|
+
//f' = exp(-kt)(a-kat)
|
|
51
|
+
//f' = (aexp(-kt)(1-kt)
|
|
52
|
+
//t = 1/k
|
|
53
|
+
const expo = exp(multiply(-k, "t"));
|
|
54
|
+
return `On calcule $f'(t)$. Pour cela, on utilise les deux propriétés suivantes :
|
|
55
|
+
|
|
56
|
+
$$
|
|
57
|
+
(uv)' = u'v+uv'
|
|
58
|
+
$$
|
|
59
|
+
|
|
60
|
+
et
|
|
61
|
+
|
|
62
|
+
$$
|
|
63
|
+
\\left(e^{kx}\\right)' = ke^{kx}
|
|
64
|
+
$$
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
On a donc :
|
|
68
|
+
|
|
69
|
+
${alignTex([
|
|
70
|
+
[
|
|
71
|
+
"f'(t)",
|
|
72
|
+
"=",
|
|
73
|
+
substract(multiply(a, expo), multiply(multiply(a, "t"), multiply(-k, expo))).toTex(),
|
|
74
|
+
],
|
|
75
|
+
[
|
|
76
|
+
"",
|
|
77
|
+
"=",
|
|
78
|
+
multiply(multiply(a, expo), substract(1, multiply(k, "t"))).toTex(),
|
|
79
|
+
],
|
|
80
|
+
])}
|
|
81
|
+
|
|
82
|
+
On étudie alors le signe de $f'(t)$ :
|
|
83
|
+
|
|
84
|
+
- $${multiply(a, expo).toTex()}$ est positif sur $\\mathbb{R}$ car l'exponentielle est strictement positive sur $\\mathbb{R}$.
|
|
85
|
+
|
|
86
|
+
- $${substract(1, multiply(k, "t")).toTex()}\\geq 0 \\iff t\\leq ${frac(1, k).toTex()}$
|
|
87
|
+
|
|
88
|
+
La fonction $f$ admet donc un maximum pour $t\\approx ${getAnswer(identifiers)}$.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
`;
|
|
92
|
+
};
|
|
93
|
+
const getKeys = () => {
|
|
94
|
+
return [];
|
|
95
|
+
};
|
|
96
|
+
const isAnswerValid = (ans, { k }) => {
|
|
97
|
+
try {
|
|
98
|
+
return rationalVEA(ans, frac(1, k).toTex(), {
|
|
99
|
+
allowDecimal: true,
|
|
100
|
+
decimalPrecision: 2,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
return handleVEAError(err);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const getDrugConcentrationMaximumQuestion = () => {
|
|
108
|
+
const a = 0.5 * randint(1, 20);
|
|
109
|
+
const k = randfloat(0.1, 3, 1, [1]);
|
|
110
|
+
const identifiers = {
|
|
111
|
+
a,
|
|
112
|
+
k,
|
|
113
|
+
};
|
|
114
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
115
|
+
};
|
|
116
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
117
|
+
return {
|
|
118
|
+
answer: getAnswer(identifiers),
|
|
119
|
+
instruction: getInstruction(identifiers),
|
|
120
|
+
keys: getKeys(identifiers),
|
|
121
|
+
answerFormat: "tex",
|
|
122
|
+
identifiers,
|
|
123
|
+
hint: getHint(identifiers),
|
|
124
|
+
correction: getCorrection(identifiers),
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export const drugConcentrationMaximum = {
|
|
128
|
+
id: "drugConcentrationMaximum",
|
|
129
|
+
connector: "=",
|
|
130
|
+
label: "Déterminer la concentration maximale d'un médicament dans le sang pour une fonction avec exponentielle du type $f(t) = ate^{-kt}$",
|
|
131
|
+
isSingleStep: true,
|
|
132
|
+
generator: (nb, opts) => getDistinctQuestions(() => getDrugConcentrationMaximumQuestion(opts), nb),
|
|
133
|
+
qcmTimer: 60,
|
|
134
|
+
freeTimer: 60,
|
|
135
|
+
getPropositions,
|
|
136
|
+
isAnswerValid,
|
|
137
|
+
subject: "Mathématiques",
|
|
138
|
+
getInstruction,
|
|
139
|
+
getHint,
|
|
140
|
+
getCorrection,
|
|
141
|
+
getAnswer,
|
|
142
|
+
getQuestionFromIdentifiers,
|
|
143
|
+
hasHintAndCorrection: true,
|
|
144
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/expKT/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponential/expSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"expSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponential/expSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA0PF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
|
|
@@ -2,13 +2,16 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercis
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
-
import { ExpNode, isExpNode } from "../../../../tree/nodes/functions/expNode.js";
|
|
5
|
+
import { exp, ExpNode, isExpNode } from "../../../../tree/nodes/functions/expNode.js";
|
|
6
6
|
import { isNumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
7
|
-
import {
|
|
7
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { frac, FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
9
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
11
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
10
12
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
11
13
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
12
15
|
const getStatementNode = (identifiers) => {
|
|
13
16
|
const { random, a, uCoeffs, vCoeffs } = identifiers;
|
|
14
17
|
const u = new Polynomial(uCoeffs);
|
|
@@ -47,8 +50,92 @@ const getAnswer = (identifiers) => {
|
|
|
47
50
|
})
|
|
48
51
|
.toTex();
|
|
49
52
|
};
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
const getHint = () => {
|
|
54
|
+
return `Utilise les propriétés suivantes : pour tout $x$, $y$ réels, on a :
|
|
55
|
+
|
|
56
|
+
$$
|
|
57
|
+
e^x \\times e^y = e^{x+y}
|
|
58
|
+
$$
|
|
59
|
+
|
|
60
|
+
et
|
|
61
|
+
|
|
62
|
+
$$
|
|
63
|
+
\\frac{e^x}{e^y} = e^{x-y}
|
|
64
|
+
$$`;
|
|
65
|
+
};
|
|
66
|
+
const getCorrection = (identifiers) => {
|
|
67
|
+
const { random, uCoeffs, vCoeffs, a } = identifiers;
|
|
68
|
+
const u = new Polynomial(uCoeffs).toTree();
|
|
69
|
+
const v = new Polynomial(vCoeffs).toTree();
|
|
70
|
+
const statement = getStatementNode(identifiers);
|
|
71
|
+
switch (random) {
|
|
72
|
+
case 1:
|
|
73
|
+
//e^u*e^a / e^v
|
|
74
|
+
return `Pour tout $x$ et $y$ réels, on a :
|
|
75
|
+
|
|
76
|
+
$$
|
|
77
|
+
e^x \\times e^y = e^{x+y}
|
|
78
|
+
$$
|
|
79
|
+
|
|
80
|
+
et
|
|
81
|
+
|
|
82
|
+
$$
|
|
83
|
+
\\frac{e^x}{e^y} = e^{x-y}
|
|
84
|
+
$$
|
|
85
|
+
|
|
86
|
+
Ici, on peut donc simplifier de la sorte :
|
|
87
|
+
|
|
88
|
+
${alignTex([
|
|
89
|
+
[
|
|
90
|
+
statement.toTex(),
|
|
91
|
+
"=",
|
|
92
|
+
frac(exp(add(u, a)).simplify({ forbidFactorize: true }), exp(v)).toTex(),
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
"",
|
|
96
|
+
"=",
|
|
97
|
+
exp(substract(add(u, a).simplify({ forbidFactorize: true }), v)).toTex(),
|
|
98
|
+
],
|
|
99
|
+
["", "=", getAnswer(identifiers)],
|
|
100
|
+
])}
|
|
101
|
+
`;
|
|
102
|
+
break;
|
|
103
|
+
case 2:
|
|
104
|
+
//e^u * e^v
|
|
105
|
+
{
|
|
106
|
+
return `Pour tous $x$ et $y$ réels, on a :
|
|
107
|
+
|
|
108
|
+
$$
|
|
109
|
+
e^x \\times e^y = e^{x+y}
|
|
110
|
+
$$
|
|
111
|
+
|
|
112
|
+
Ici, on peut donc simplifier de la sorte :
|
|
113
|
+
|
|
114
|
+
${alignTex([
|
|
115
|
+
[statement.toTex(), "=", exp(add(u, v)).toTex()],
|
|
116
|
+
["", "=", getAnswer(identifiers)],
|
|
117
|
+
])}`;
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
case 3:
|
|
121
|
+
default: {
|
|
122
|
+
//e^u / e^v
|
|
123
|
+
return `Pour tous $x$ et $y$ réels, on a :
|
|
124
|
+
|
|
125
|
+
$$
|
|
126
|
+
\\frac{e^x}{e^y} = e^{x-y}
|
|
127
|
+
$$
|
|
128
|
+
|
|
129
|
+
Ici, on peut donc simplifier de la sorte :
|
|
130
|
+
|
|
131
|
+
${alignTex([
|
|
132
|
+
[statement.toTex(), "=", exp(substract(u, v)).toTex()],
|
|
133
|
+
["", "=", getAnswer(identifiers)],
|
|
134
|
+
])}`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return ``;
|
|
138
|
+
};
|
|
52
139
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
53
140
|
const question = {
|
|
54
141
|
instruction: getInstruction(identifiers),
|
|
@@ -56,6 +143,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
56
143
|
keys: ["x", "epower", "exp"],
|
|
57
144
|
answerFormat: "tex",
|
|
58
145
|
identifiers,
|
|
146
|
+
hint: getHint(identifiers),
|
|
147
|
+
correction: getCorrection(identifiers),
|
|
59
148
|
};
|
|
60
149
|
return question;
|
|
61
150
|
};
|
|
@@ -148,4 +237,5 @@ export const expSimplifiying = {
|
|
|
148
237
|
isAnswerValid,
|
|
149
238
|
subject: "Mathématiques",
|
|
150
239
|
getQuestionFromIdentifiers,
|
|
240
|
+
hasHintAndCorrection: true,
|
|
151
241
|
};
|
|
@@ -3,4 +3,7 @@ export * from "./expSimplifiying.js";
|
|
|
3
3
|
export * from "./expFactorization.js";
|
|
4
4
|
export * from "./algebraic/index.js";
|
|
5
5
|
export * from "./definition/index.js";
|
|
6
|
+
export * from "./expKT/index.js";
|
|
7
|
+
export * from "./variations/index.js";
|
|
8
|
+
export * from "./sign/index.js";
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponential/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponential/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
k: number;
|
|
5
|
+
type: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const expFunctionBasicSign: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=expFunctionBasicSign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expFunctionBasicSign.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/sign/expFunctionBasicSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IAGjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
|