math-exercises 2.2.78 → 2.2.80
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/calculLitteral/inequations/firstDegreeInequationsType0.d.ts +5 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.js +95 -20
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.js +104 -26
- package/lib/exercises/math/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/firstDegreeDerivative.js +44 -5
- package/lib/exercises/math/derivation/derivative/lnDerivativeOne.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeOne.js +17 -7
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +46 -27
- package/lib/exercises/math/derivation/derivative/lnDerivativeTwo.js +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +57 -26
- package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.js +50 -8
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.js +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +67 -13
- package/lib/exercises/math/derivation/derivative/usualderivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/usualderivative.js +1 -2
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.js +66 -27
- package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequation.js +57 -36
- package/lib/exercises/math/functions/exponential/expEquation.js +1 -1
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts +9 -0
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.js +124 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts +2 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/index.js +17 -0
- package/lib/exercises/math/functions/index.d.ts +1 -0
- package/lib/exercises/math/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/index.js +1 -0
- package/lib/exercises/math/functions/integral/integralFractions.js +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.js +6 -2
- package/lib/exercises/math/functions/logarithm/logEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logEquation.js +22 -14
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logPowerEquation.js +14 -12
- package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logSimplifiying.js +36 -16
- package/lib/exercises/math/geometry/areas/rectangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rectangleArea.js +5 -2
- package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +4 -4
- 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/matrices/matrixInversibilityDomain.js +1 -0
- package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/applyPercent.js +2 -0
- package/lib/exercises/math/percent/findEndValueAfterEvolution.d.ts +8 -0
- package/lib/exercises/math/percent/findEndValueAfterEvolution.d.ts.map +1 -0
- package/lib/exercises/math/percent/findEndValueAfterEvolution.js +104 -0
- package/lib/exercises/math/percent/index.d.ts +1 -0
- package/lib/exercises/math/percent/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/index.js +1 -0
- package/lib/exercises/math/powers/index.d.ts +1 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +1 -0
- package/lib/exercises/math/powers/powersMixOperations.d.ts +11 -0
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -0
- package/lib/exercises/math/powers/powersMixOperations.js +99 -0
- package/lib/exercises/math/primitive/logarithmePrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/logarithmePrimitive.js +11 -3
- package/lib/exercises/math/sampling/confidenceInterval.d.ts +9 -0
- package/lib/exercises/math/sampling/confidenceInterval.d.ts.map +1 -0
- package/lib/exercises/math/sampling/confidenceInterval.js +134 -0
- package/lib/exercises/math/sampling/fluctuationInterval.d.ts +9 -0
- package/lib/exercises/math/sampling/fluctuationInterval.d.ts.map +1 -0
- package/lib/exercises/math/sampling/fluctuationInterval.js +131 -0
- package/lib/exercises/math/sampling/index.d.ts +4 -0
- package/lib/exercises/math/sampling/index.d.ts.map +1 -0
- package/lib/exercises/math/sampling/index.js +19 -0
- package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts +11 -0
- package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts.map +1 -0
- package/lib/exercises/math/sampling/isSamplingRepresentative.js +116 -0
- package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts +9 -0
- package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricVariations.js +124 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts +1 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +1 -0
- package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.js +11 -11
- package/lib/exercises/options/inequationSolutionFormat.d.ts +3 -0
- package/lib/exercises/options/inequationSolutionFormat.d.ts.map +1 -0
- package/lib/exercises/options/inequationSolutionFormat.js +12 -0
- package/lib/exercises/pc/pH.js +1 -1
- package/lib/index.d.ts +35 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/integer/integer.d.ts +1 -1
- package/lib/math/numbers/rationals/rational.d.ts +3 -1
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.js +3 -1
- package/lib/math/numbers/reals/real.d.ts +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +6 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.d.ts +5 -2
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +40 -3
- package/lib/tree/nodes/numbers/numberNode.d.ts +2 -2
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +7 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +15 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +8 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +4 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts +6 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +126 -2
- package/lib/tree/nodes/sets/intervalNode.d.ts +2 -2
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +2 -2
- package/lib/tree/nodes/sets/setNode.d.ts +1 -0
- package/lib/tree/nodes/sets/setNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +1 -1
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +2 -1
- package/lib/tree/parsers/inequationParser.d.ts +7 -0
- package/lib/tree/parsers/inequationParser.d.ts.map +1 -0
- package/lib/tree/parsers/inequationParser.js +30 -0
- package/lib/tree/parsers/intervalParser.d.ts +8 -0
- package/lib/tree/parsers/intervalParser.d.ts.map +1 -0
- package/lib/tree/parsers/intervalParser.js +44 -0
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +29 -6
- package/lib/tree/parsers/monomParser.d.ts +1 -3
- package/lib/tree/parsers/monomParser.d.ts.map +1 -1
- package/lib/tree/parsers/monomParser.js +7 -129
- package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
- package/lib/tree/parsers/polynomialParser.js +2 -1
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/powerParser.d.ts.map +1 -1
- package/lib/tree/parsers/powerParser.js +2 -1
- package/lib/tree/parsers/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/trinomParser.js +2 -2
- package/lib/tree/parsers/unionIntervalParser.d.ts +9 -0
- package/lib/tree/parsers/unionIntervalParser.d.ts.map +1 -0
- package/lib/tree/parsers/unionIntervalParser.js +26 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -6,11 +6,11 @@ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQ
|
|
|
6
6
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
7
7
|
const round_1 = require("../../../../math/utils/round");
|
|
8
8
|
const sqrtNode_1 = require("../../../../tree/nodes/functions/sqrtNode");
|
|
9
|
-
const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
|
|
10
9
|
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
11
10
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
12
|
-
const
|
|
11
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
13
12
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
13
|
+
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
14
14
|
const getStatementNode = (identifiers) => {
|
|
15
15
|
return (0, multiplyNode_1.multiply)(identifiers.a, (0, sqrtNode_1.sqrt)("x"));
|
|
16
16
|
};
|
|
@@ -21,27 +21,50 @@ $$
|
|
|
21
21
|
f(x) = ${getStatementNode(identifiers).toTex()}
|
|
22
22
|
$$ `;
|
|
23
23
|
};
|
|
24
|
+
const getAnswer = (identifiers) => {
|
|
25
|
+
return (0, fractionNode_1.frac)(identifiers.a, (0, multiplyNode_1.multiply)(2, (0, sqrtNode_1.sqrt)("x")))
|
|
26
|
+
.simplify()
|
|
27
|
+
.toTex();
|
|
28
|
+
};
|
|
29
|
+
const getHint = (identifiers) => {
|
|
30
|
+
return `La dérivée sur $]0; +\\infty[$ de la fonction $f(x) =\\sqrt{x}$ est :
|
|
31
|
+
|
|
32
|
+
$$
|
|
33
|
+
f'(x) = \\frac{1}{2\\sqrt{x}}
|
|
34
|
+
$$`;
|
|
35
|
+
};
|
|
36
|
+
const getCorrection = (identifiers) => {
|
|
37
|
+
const statement = getStatementNode(identifiers);
|
|
38
|
+
const answer = getAnswer(identifiers);
|
|
39
|
+
const a = identifiers.a;
|
|
40
|
+
return `La dérivée sur $]0; +\\infty[$ de la fonction $\\sqrt{x}$ est :
|
|
41
|
+
|
|
42
|
+
$$
|
|
43
|
+
\\frac{1}{2\\sqrt{x}}
|
|
44
|
+
$$
|
|
45
|
+
|
|
46
|
+
Ici, on a $f(x) = ${statement.toTex()}$.
|
|
47
|
+
|
|
48
|
+
On a donc :
|
|
49
|
+
|
|
50
|
+
${(0, alignTex_1.alignTex)([
|
|
51
|
+
["f'(x)", "=", (0, multiplyNode_1.multiply)(a, (0, fractionNode_1.frac)(1, (0, multiplyNode_1.multiply)(2, (0, sqrtNode_1.sqrt)("x")))).toTex()],
|
|
52
|
+
["", "=", answer],
|
|
53
|
+
])}
|
|
54
|
+
`;
|
|
55
|
+
};
|
|
24
56
|
const getRootFunctionDerivative = () => {
|
|
25
|
-
const a = (0, randint_1.randint)(-19, 20, [0]);
|
|
26
|
-
|
|
27
|
-
let answer = "";
|
|
28
|
-
if (a === 1)
|
|
29
|
-
instruction += `$\\sqrt{x}$.`;
|
|
30
|
-
else if (a === -1)
|
|
31
|
-
instruction += `$-\\sqrt{x}$.`;
|
|
32
|
-
else
|
|
33
|
-
instruction += `$${a}\\sqrt{x}$.`;
|
|
34
|
-
if (a % 2 === 0)
|
|
35
|
-
answer = `${a < 0 ? "-" : ""}\\frac{${Math.abs(a / 2)}}{\\sqrt{x}}`;
|
|
36
|
-
else
|
|
37
|
-
answer = `${a < 0 ? "-" : ""}\\frac{${Math.abs(a)}}{2\\sqrt{x}}`;
|
|
57
|
+
const a = (0, randint_1.randint)(-19, 20, [0, 1]);
|
|
58
|
+
const identifiers = { a };
|
|
38
59
|
const question = {
|
|
39
|
-
instruction,
|
|
60
|
+
instruction: getInstruction(identifiers),
|
|
40
61
|
startStatement: `f'(x)`,
|
|
41
|
-
answer,
|
|
62
|
+
answer: getAnswer(identifiers),
|
|
42
63
|
keys: ["x"],
|
|
43
64
|
answerFormat: "tex",
|
|
44
|
-
identifiers
|
|
65
|
+
identifiers,
|
|
66
|
+
hint: getHint(identifiers),
|
|
67
|
+
correction: getCorrection(identifiers),
|
|
45
68
|
};
|
|
46
69
|
return question;
|
|
47
70
|
};
|
|
@@ -63,14 +86,17 @@ const getPropositions = (n, { answer, a }) => {
|
|
|
63
86
|
}
|
|
64
87
|
return (0, shuffle_1.shuffle)(propositions);
|
|
65
88
|
};
|
|
66
|
-
const isAnswerValid = (ans, { a }) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
89
|
+
const isAnswerValid = (ans, { answer, a }) => {
|
|
90
|
+
try {
|
|
91
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
92
|
+
if (!parsed)
|
|
93
|
+
return false;
|
|
94
|
+
const simplified = parsed.simplify();
|
|
95
|
+
return simplified.toTex() === answer;
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
74
100
|
};
|
|
75
101
|
exports.rootFunctionDerivative = {
|
|
76
102
|
id: "rootFunctionDerivative",
|
|
@@ -85,4 +111,9 @@ exports.rootFunctionDerivative = {
|
|
|
85
111
|
getPropositions,
|
|
86
112
|
isAnswerValid,
|
|
87
113
|
subject: "Mathématiques",
|
|
114
|
+
getHint,
|
|
115
|
+
getCorrection,
|
|
116
|
+
getInstruction,
|
|
117
|
+
getAnswer,
|
|
118
|
+
hasHintAndCorrection: true,
|
|
88
119
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"secondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA4CF,eAAO,MAAM,yBAAyB,EAAE,iBAAiB,CAAC,WAAW,CAgBpE,CAAC;AAEF,eAAO,MAAM,qCAAqC,EAAE,YAAY,CAC9D,WAAW,CA+BZ,CAAC;AACF,eAAO,MAAM,mCAAmC,EAAE,GAAG,CAAC,WAAW,CAQhE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAyBxD,CAAC"}
|
|
@@ -5,21 +5,60 @@ const exercise_1 = require("../../../../exercises/exercise");
|
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const polynomial_1 = require("../../../../math/polynomials/polynomial");
|
|
7
7
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
9
|
+
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
8
10
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
11
|
+
const getAnswer = (identifiers) => {
|
|
12
|
+
const polynomial = new polynomial_1.Polynomial(identifiers.coefficients);
|
|
13
|
+
const derivative = polynomial.derivate();
|
|
14
|
+
return derivative.toTree().toTex();
|
|
15
|
+
};
|
|
16
|
+
const getHint = (identifiers) => {
|
|
17
|
+
return `Dérive chacun des termes de la somme, puis additionne les dérivées obtenues.
|
|
18
|
+
|
|
19
|
+
On rappelle que la dérivée de la fonction $kx^n$ est :
|
|
20
|
+
|
|
21
|
+
$$
|
|
22
|
+
k\\times n \\times x^{n-1}
|
|
23
|
+
$$`;
|
|
24
|
+
};
|
|
25
|
+
const getCorrection = (identifiers) => {
|
|
26
|
+
const monoms = identifiers.coefficients
|
|
27
|
+
.map((c, i) => (0, multiplyNode_1.multiply)(c, (0, powerNode_1.power)("x", i)).simplify())
|
|
28
|
+
.filter((n) => n.evaluate() !== 0);
|
|
29
|
+
const answer = getAnswer(identifiers);
|
|
30
|
+
return `On dérive chacun des termes de la somme :
|
|
31
|
+
|
|
32
|
+
${monoms
|
|
33
|
+
.reverse()
|
|
34
|
+
.map((n) => `- $${n.toTex()} \\to ${n.derivative().simplify().toTex()}$`)
|
|
35
|
+
.join(" \n ")}
|
|
36
|
+
|
|
37
|
+
Puis, on additionne ces résultats pour obtenir la dérivée de la fonction $f$ :
|
|
38
|
+
|
|
39
|
+
$$
|
|
40
|
+
f'(x) = ${answer}
|
|
41
|
+
$$
|
|
42
|
+
`;
|
|
43
|
+
};
|
|
44
|
+
const getInstruction = (identifiers) => {
|
|
45
|
+
const polynomial = new polynomial_1.Polynomial(identifiers.coefficients);
|
|
46
|
+
return `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial
|
|
47
|
+
.toTree()
|
|
48
|
+
.toTex()}$.`;
|
|
49
|
+
};
|
|
9
50
|
const getSecondDegreeDerivative = () => {
|
|
10
51
|
const coefficients = [(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])];
|
|
11
|
-
const
|
|
12
|
-
const derivative = polynomial.derivate();
|
|
13
|
-
const answer = derivative.toTree().toTex();
|
|
52
|
+
const identifiers = { coefficients };
|
|
14
53
|
const question = {
|
|
15
|
-
instruction:
|
|
16
|
-
.toTree()
|
|
17
|
-
.toTex()}$.`,
|
|
54
|
+
instruction: getInstruction(identifiers),
|
|
18
55
|
startStatement: `f'(x)`,
|
|
19
|
-
answer,
|
|
56
|
+
answer: getAnswer(identifiers),
|
|
20
57
|
keys: ["x"],
|
|
21
58
|
answerFormat: "tex",
|
|
22
|
-
identifiers
|
|
59
|
+
identifiers,
|
|
60
|
+
hint: getHint(identifiers),
|
|
61
|
+
correction: getCorrection(identifiers),
|
|
23
62
|
};
|
|
24
63
|
return question;
|
|
25
64
|
};
|
|
@@ -73,4 +112,7 @@ exports.secondDegreeDerivative = {
|
|
|
73
112
|
getPropositions: exports.getSecondDegreeDerivativePropositions,
|
|
74
113
|
isAnswerValid: exports.isSecondDegreeDerivativeAnswerValid,
|
|
75
114
|
subject: "Mathématiques",
|
|
115
|
+
getHint,
|
|
116
|
+
getCorrection,
|
|
117
|
+
hasHintAndCorrection: true,
|
|
76
118
|
};
|
|
@@ -15,7 +15,7 @@ const getSecondDerivativeOfExpoFunctionQuestion = () => {
|
|
|
15
15
|
const question = {
|
|
16
16
|
answer: correctAnswer.toTex(),
|
|
17
17
|
instruction: `Déterminer la fonction dérivée seconde $f''$ de la fonction $f$ définie par $f(x)=${funct.toTex()}$`,
|
|
18
|
-
keys: ["epower", "x", "
|
|
18
|
+
keys: ["epower", "x", "lnBrackets"],
|
|
19
19
|
answerFormat: "tex",
|
|
20
20
|
identifiers: { coeffs: polynom.coefficients },
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/thirdDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"thirdDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/thirdDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAIJ,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA4CF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,WAAW,CAmBnE,CAAC;AAEF,eAAO,MAAM,oCAAoC,EAAE,YAAY,CAAC,WAAW,CAwC1E,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,GAAG,CAAC,WAAW,CAe/D,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CA0BvD,CAAC"}
|
|
@@ -5,23 +5,63 @@ const exercise_1 = require("../../../../exercises/exercise");
|
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const polynomial_1 = require("../../../../math/polynomials/polynomial");
|
|
7
7
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
9
|
+
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
10
|
+
const polynomialParser_1 = require("../../../../tree/parsers/polynomialParser");
|
|
11
|
+
const getHint = (identifiers) => {
|
|
12
|
+
return `Dérive chacun des termes de la somme, puis additionne les dérivées obtenues.
|
|
13
|
+
|
|
14
|
+
On rappelle que la dérivée de la fonction $kx^n$ est :
|
|
15
|
+
|
|
16
|
+
$$
|
|
17
|
+
k\\times n \\times x^{n-1}
|
|
18
|
+
$$`;
|
|
19
|
+
};
|
|
20
|
+
const getCorrection = (identifiers) => {
|
|
21
|
+
const monoms = identifiers.coefficients
|
|
22
|
+
.map((c, i) => (0, multiplyNode_1.multiply)(c, (0, powerNode_1.power)("x", i)).simplify())
|
|
23
|
+
.filter((n) => n.evaluate() !== 0);
|
|
24
|
+
const answer = getAnswer(identifiers);
|
|
25
|
+
return `On dérive chacun des termes de la somme :
|
|
26
|
+
|
|
27
|
+
${monoms
|
|
28
|
+
.reverse()
|
|
29
|
+
.map((n) => `- $${n.toTex()} \\to ${n.derivative().simplify().toTex()}$`)
|
|
30
|
+
.join(" \n ")}
|
|
31
|
+
|
|
32
|
+
Puis, on additionne ces résultats pour obtenir la dérivée de la fonction $f$ :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
f'(x) = ${answer}
|
|
36
|
+
$$
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
const getInstruction = (identifiers) => {
|
|
40
|
+
const polynomial = new polynomial_1.Polynomial(identifiers.coefficients);
|
|
41
|
+
return `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial
|
|
42
|
+
.toTree()
|
|
43
|
+
.toTex()}$.`;
|
|
44
|
+
};
|
|
45
|
+
const getAnswer = (identifiers) => {
|
|
46
|
+
const polynomial = new polynomial_1.Polynomial(identifiers.coefficients);
|
|
47
|
+
const derivative = polynomial.derivate();
|
|
48
|
+
return derivative.toTree().toTex();
|
|
49
|
+
};
|
|
8
50
|
const getThirdDegreeDerivative = () => {
|
|
9
51
|
const coefficients = [];
|
|
10
52
|
for (let i = 1; i <= 3; i++)
|
|
11
53
|
coefficients.push((0, randint_1.randint)(-9, 10));
|
|
12
54
|
coefficients.push((0, randint_1.randint)(-9, 10, [0]));
|
|
13
|
-
const
|
|
14
|
-
const derivative = polynomial.derivate();
|
|
15
|
-
const answer = derivative.toTree().toTex();
|
|
55
|
+
const identifiers = { coefficients };
|
|
16
56
|
const question = {
|
|
17
|
-
instruction:
|
|
18
|
-
.toTree()
|
|
19
|
-
.toTex()}$.`,
|
|
57
|
+
instruction: getInstruction(identifiers),
|
|
20
58
|
startStatement: `f'(x)`,
|
|
21
|
-
answer:
|
|
59
|
+
answer: getAnswer(identifiers),
|
|
22
60
|
keys: ["x"],
|
|
23
61
|
answerFormat: "tex",
|
|
24
|
-
identifiers
|
|
62
|
+
identifiers,
|
|
63
|
+
hint: getHint(identifiers),
|
|
64
|
+
correction: getCorrection(identifiers),
|
|
25
65
|
};
|
|
26
66
|
return question;
|
|
27
67
|
};
|
|
@@ -52,11 +92,20 @@ const getThirdDegreeDerivativePropositions = (n, { answer, coefficients }) => {
|
|
|
52
92
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
53
93
|
};
|
|
54
94
|
exports.getThirdDegreeDerivativePropositions = getThirdDegreeDerivativePropositions;
|
|
55
|
-
const isThirdDegreeDerivativeAnswerValid = (ans, { coefficients }) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
95
|
+
const isThirdDegreeDerivativeAnswerValid = (ans, { answer, coefficients }) => {
|
|
96
|
+
try {
|
|
97
|
+
const parsed = (0, polynomialParser_1.polynomialParser)(ans);
|
|
98
|
+
if (!parsed)
|
|
99
|
+
return false;
|
|
100
|
+
const simp = parsed.simplify({
|
|
101
|
+
forbidFactorize: true,
|
|
102
|
+
towardsDistribute: true,
|
|
103
|
+
});
|
|
104
|
+
return simp.toTex() === answer;
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
60
109
|
};
|
|
61
110
|
exports.isThirdDegreeDerivativeAnswerValid = isThirdDegreeDerivativeAnswerValid;
|
|
62
111
|
exports.thirdDegreeDerivative = {
|
|
@@ -80,4 +129,9 @@ exports.thirdDegreeDerivative = {
|
|
|
80
129
|
getPropositions: exports.getThirdDegreeDerivativePropositions,
|
|
81
130
|
isAnswerValid: exports.isThirdDegreeDerivativeAnswerValid,
|
|
82
131
|
subject: "Mathématiques",
|
|
132
|
+
getInstruction,
|
|
133
|
+
getHint,
|
|
134
|
+
getAnswer,
|
|
135
|
+
getCorrection,
|
|
136
|
+
hasHintAndCorrection: true,
|
|
83
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usualderivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/usualderivative.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAMT,MAAM,mBAAmB,CAAC;AAuB3B,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;
|
|
1
|
+
{"version":3,"file":"usualderivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/usualderivative.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAMT,MAAM,mBAAmB,CAAC;AAuB3B,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AA0FF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAsBjD,CAAC"}
|
|
@@ -26,8 +26,6 @@ const getUsualDerivative = () => {
|
|
|
26
26
|
break;
|
|
27
27
|
case 4:
|
|
28
28
|
question = (0, constanteDerivative_1.getConstanteDerivative)();
|
|
29
|
-
question.hint = undefined;
|
|
30
|
-
question.correction = undefined;
|
|
31
29
|
identifiers = { ...question.identifiers, type: 4 };
|
|
32
30
|
break;
|
|
33
31
|
default:
|
|
@@ -108,4 +106,5 @@ exports.usualDerivative = {
|
|
|
108
106
|
getPropositions,
|
|
109
107
|
isAnswerValid,
|
|
110
108
|
subject: "Mathématiques",
|
|
109
|
+
hasHintAndCorrection: true,
|
|
111
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAmBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AA8HF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAe9C,CAAC"}
|
|
@@ -4,38 +4,77 @@ exports.signFunction = void 0;
|
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
7
|
+
const affine_1 = require("../../../../math/polynomials/affine");
|
|
7
8
|
const polynomial_1 = require("../../../../math/polynomials/polynomial");
|
|
8
9
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
10
|
+
const inequationNode_1 = require("../../../../tree/nodes/inequations/inequationNode");
|
|
9
11
|
const infiniteNode_1 = require("../../../../tree/nodes/numbers/infiniteNode");
|
|
10
12
|
const closure_1 = require("../../../../tree/nodes/sets/closure");
|
|
11
13
|
const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
|
|
14
|
+
const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
|
|
12
15
|
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
13
16
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
14
|
-
const
|
|
15
|
-
const a
|
|
16
|
-
const b = (0, randint_1.randint)(-9, 10);
|
|
17
|
+
const getHint = (identifiers) => {
|
|
18
|
+
const { a, b, askingPositive } = identifiers;
|
|
17
19
|
const affine = new polynomial_1.Polynomial([b, a]);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
return `Pour déterminer l'intervalle sur lequel la fonction $f(x) = ${affine.toTex()}$ est ${askingPositive ? "positive" : "négative"}, il faut résoudre l'inéquation :
|
|
21
|
+
|
|
22
|
+
$$
|
|
23
|
+
${affine.toTex()} ${askingPositive ? "\\geq" : "\\leq"} 0
|
|
24
|
+
$$
|
|
25
|
+
`;
|
|
26
|
+
};
|
|
27
|
+
const getCorrection = (identifiers) => {
|
|
28
|
+
const { a, b, askingPositive } = identifiers;
|
|
29
|
+
const affine = new affine_1.Affine(a, b);
|
|
30
|
+
const answer = getAnswer(identifiers);
|
|
31
|
+
const order = askingPositive ? "\\ge" : "\\le";
|
|
32
|
+
return `On résout l'inéquation :
|
|
33
|
+
|
|
34
|
+
${(0, inequationNode_1.firstDegreeInequationResolutionTex)(affine, order, (0).toTree())}
|
|
35
|
+
|
|
36
|
+
On en conclut que $f$ est ${identifiers.askingPositive ? "positive" : "négative"} sur l'intervalle :
|
|
37
|
+
|
|
38
|
+
$$
|
|
39
|
+
${answer}
|
|
40
|
+
$$
|
|
41
|
+
`;
|
|
42
|
+
};
|
|
43
|
+
const getInstruction = (identifiers) => {
|
|
44
|
+
const { a, b, askingPositive } = identifiers;
|
|
45
|
+
const affine = new polynomial_1.Polynomial([b, a]);
|
|
46
|
+
return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
|
|
47
|
+
|
|
48
|
+
$$
|
|
49
|
+
f(x) = ${affine.toTex()}
|
|
50
|
+
$$
|
|
51
|
+
|
|
52
|
+
Sur quel intervalle $f$ est-elle ${identifiers.askingPositive ? "positive" : "négative"} ?`;
|
|
53
|
+
};
|
|
54
|
+
const getAnswer = ({ a, b, askingPositive }) => {
|
|
21
55
|
const root = new rational_1.Rational(-b, a).simplify().toTree();
|
|
22
56
|
const toRightInfInterval = new intervalNode_1.IntervalNode(root, infiniteNode_1.PlusInfinityNode, closure_1.ClosureType.FO).toTex();
|
|
23
57
|
const toLeftInfInteral = new intervalNode_1.IntervalNode(infiniteNode_1.MinusInfinityNode, root, closure_1.ClosureType.OF).toTex();
|
|
24
58
|
if (askingPositive) {
|
|
25
|
-
|
|
26
|
-
answer = a > 0 ? toRightInfInterval : toLeftInfInteral;
|
|
59
|
+
return a > 0 ? toRightInfInterval : toLeftInfInteral;
|
|
27
60
|
}
|
|
28
61
|
else {
|
|
29
|
-
|
|
30
|
-
answer = a > 0 ? toLeftInfInteral : toRightInfInterval;
|
|
62
|
+
return a > 0 ? toLeftInfInteral : toRightInfInterval;
|
|
31
63
|
}
|
|
64
|
+
};
|
|
65
|
+
const getSignFunction = () => {
|
|
66
|
+
const a = (0, randint_1.randint)(-9, 10, [0]);
|
|
67
|
+
const b = (0, randint_1.randint)(-9, 10);
|
|
68
|
+
const askingPositive = (0, coinFlip_1.coinFlip)();
|
|
69
|
+
const identifiers = { a, askingPositive, b };
|
|
32
70
|
const question = {
|
|
33
|
-
instruction,
|
|
34
|
-
|
|
35
|
-
answer,
|
|
71
|
+
instruction: getInstruction(identifiers),
|
|
72
|
+
answer: getAnswer(identifiers),
|
|
36
73
|
keys: ["lbracket", "semicolon", "rbracket", "infty"],
|
|
37
74
|
answerFormat: "tex",
|
|
38
|
-
identifiers
|
|
75
|
+
identifiers,
|
|
76
|
+
hint: getHint(identifiers),
|
|
77
|
+
correction: getCorrection(identifiers),
|
|
39
78
|
};
|
|
40
79
|
return question;
|
|
41
80
|
};
|
|
@@ -53,21 +92,19 @@ const getPropositions = (n, { answer }) => {
|
|
|
53
92
|
}
|
|
54
93
|
return (0, shuffle_1.shuffle)(propositions);
|
|
55
94
|
};
|
|
56
|
-
const isAnswerValid = (ans, { a, b, askingPositive }) => {
|
|
57
|
-
|
|
58
|
-
.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
95
|
+
const isAnswerValid = (ans, { answer, a, b, askingPositive }) => {
|
|
96
|
+
try {
|
|
97
|
+
const parsed = (0, intervalParser_1.intervalParser)(ans, {
|
|
98
|
+
allowCommaInsteadOfSemicolon: true,
|
|
99
|
+
allowNoBrackets: true,
|
|
100
|
+
});
|
|
101
|
+
if (!parsed)
|
|
102
|
+
return false;
|
|
103
|
+
return parsed.simplify().toTex() === answer;
|
|
65
104
|
}
|
|
66
|
-
|
|
67
|
-
|
|
105
|
+
catch (err) {
|
|
106
|
+
return false;
|
|
68
107
|
}
|
|
69
|
-
const texs = answer.toAllValidTexs();
|
|
70
|
-
return texs.includes(ans);
|
|
71
108
|
};
|
|
72
109
|
exports.signFunction = {
|
|
73
110
|
id: "signFunction",
|
|
@@ -82,4 +119,6 @@ exports.signFunction = {
|
|
|
82
119
|
getPropositions,
|
|
83
120
|
isAnswerValid,
|
|
84
121
|
subject: "Mathématiques",
|
|
122
|
+
getHint,
|
|
123
|
+
hasHintAndCorrection: true,
|
|
85
124
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphicInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/graphicInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"graphicInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/graphicInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAO5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAC;AAgNF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
|
|
@@ -11,7 +11,42 @@ const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
|
|
|
11
11
|
const closure_1 = require("../../../../tree/nodes/sets/closure");
|
|
12
12
|
const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
|
|
13
13
|
const unionIntervalNode_1 = require("../../../../tree/nodes/sets/unionIntervalNode");
|
|
14
|
+
const unionIntervalParser_1 = require("../../../../tree/parsers/unionIntervalParser");
|
|
14
15
|
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const intervalsNodes = identifiers.intervals.map((n) => new intervalNode_1.IntervalNode(new numberNode_1.NumberNode(n.a), new numberNode_1.NumberNode(n.b), n.closure));
|
|
18
|
+
const intervalsTree = intervalsNodes.length === 1
|
|
19
|
+
? intervalsNodes[0]
|
|
20
|
+
: new unionIntervalNode_1.UnionIntervalNode(intervalsNodes);
|
|
21
|
+
const answerTree = new inequationSolutionNode_1.InequationSolutionNode(intervalsTree);
|
|
22
|
+
return answerTree.toTex();
|
|
23
|
+
};
|
|
24
|
+
const getInstruction = (identifiers) => {
|
|
25
|
+
return `Déterminer graphiquement les solutions de l'inéquation $f(x)${identifiers.isAskingSup
|
|
26
|
+
? identifiers.isStrict
|
|
27
|
+
? ">"
|
|
28
|
+
: "\\geq"
|
|
29
|
+
: identifiers.isStrict
|
|
30
|
+
? "<"
|
|
31
|
+
: "\\leq"}${identifiers.yValue}$ où $f$ est la fonction représentée ci-dessous.`;
|
|
32
|
+
};
|
|
33
|
+
const getGGBOptions = (identifiers) => {
|
|
34
|
+
const commands = [
|
|
35
|
+
`S =Spline(${identifiers.splinePoints
|
|
36
|
+
.map((point) => `(${point[0]},${point[1]})`)
|
|
37
|
+
.join(",")})`,
|
|
38
|
+
"SetFixed(S, true)",
|
|
39
|
+
`SetColor(S, "${(0, colors_1.randomColor)()}")`,
|
|
40
|
+
];
|
|
41
|
+
const ggb = new geogebraConstructor_1.GeogebraConstructor({ commands });
|
|
42
|
+
const xMin = Math.min(...identifiers.splinePoints.map((point) => point[0]));
|
|
43
|
+
const yMin = Math.min(...identifiers.splinePoints.map((point) => point[1]));
|
|
44
|
+
const xMax = Math.max(...identifiers.splinePoints.map((point) => point[0]));
|
|
45
|
+
const yMax = Math.max(...identifiers.splinePoints.map((point) => point[1]));
|
|
46
|
+
return ggb.getOptions({
|
|
47
|
+
coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
|
|
48
|
+
});
|
|
49
|
+
};
|
|
15
50
|
const getGraphicInequationQuestion = () => {
|
|
16
51
|
let xSolutions = [];
|
|
17
52
|
const nb = (0, randint_1.randint)(2, 4);
|
|
@@ -70,25 +105,16 @@ const getGraphicInequationQuestion = () => {
|
|
|
70
105
|
prevYWasAbove = y > 0;
|
|
71
106
|
splinePoints.push([x, yValue + y]);
|
|
72
107
|
}
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
: `S=\\ ${new unionIntervalNode_1.UnionIntervalNode(intervalsNodes).toTex()}`;
|
|
81
|
-
const commands = [
|
|
82
|
-
`S =Spline(${splinePoints
|
|
83
|
-
.map((point) => `(${point[0]},${point[1]})`)
|
|
84
|
-
.join(",")})`,
|
|
85
|
-
"SetFixed(S, true)",
|
|
86
|
-
`SetColor(S, "${(0, colors_1.randomColor)()}")`,
|
|
87
|
-
];
|
|
88
|
-
const ggb = new geogebraConstructor_1.GeogebraConstructor({ commands });
|
|
108
|
+
const identifiers = {
|
|
109
|
+
yValue,
|
|
110
|
+
splinePoints,
|
|
111
|
+
isAskingSup,
|
|
112
|
+
isStrict,
|
|
113
|
+
intervals,
|
|
114
|
+
};
|
|
89
115
|
const question = {
|
|
90
|
-
answer,
|
|
91
|
-
instruction:
|
|
116
|
+
answer: getAnswer(identifiers),
|
|
117
|
+
instruction: getInstruction(identifiers),
|
|
92
118
|
keys: [
|
|
93
119
|
"S",
|
|
94
120
|
"equal",
|
|
@@ -101,16 +127,8 @@ const getGraphicInequationQuestion = () => {
|
|
|
101
127
|
"varnothing",
|
|
102
128
|
],
|
|
103
129
|
answerFormat: "tex",
|
|
104
|
-
ggbOptions:
|
|
105
|
-
|
|
106
|
-
}),
|
|
107
|
-
identifiers: {
|
|
108
|
-
yValue,
|
|
109
|
-
splinePoints,
|
|
110
|
-
isAskingSup,
|
|
111
|
-
isStrict,
|
|
112
|
-
intervals,
|
|
113
|
-
},
|
|
130
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
131
|
+
identifiers,
|
|
114
132
|
};
|
|
115
133
|
return question;
|
|
116
134
|
};
|
|
@@ -138,14 +156,17 @@ const getPropositions = (n, { answer, intervals, splinePoints, yValue }) => {
|
|
|
138
156
|
}
|
|
139
157
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
140
158
|
};
|
|
141
|
-
const isAnswerValid = (ans, { intervals }) => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
const isAnswerValid = (ans, { answer, intervals }) => {
|
|
160
|
+
try {
|
|
161
|
+
const parsed = (0, unionIntervalParser_1.unionIntervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
|
|
162
|
+
if (!parsed)
|
|
163
|
+
return false;
|
|
164
|
+
console.log(parsed.simplify().toTex(), answer);
|
|
165
|
+
return "S=\\ " + parsed.simplify().toTex() === answer;
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
149
170
|
};
|
|
150
171
|
exports.graphicInequation = {
|
|
151
172
|
id: "graphicInequation",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
q: NodeIdentifiers;
|
|
5
|
+
a: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const exponentialsVariations: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=exponentialsVariations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exponentialsVariations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/exponentialsVariations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAM1C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
|