math-exercises 3.0.133 → 3.0.135
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/calcul/arithmetics/coprime.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/coprime.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/coprime.js +113 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +1 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
- package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.d.ts +11 -0
- package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.d.ts.map +1 -0
- package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.js +243 -0
- package/lib/exercises/math/calcul/decimals/index.d.ts +1 -0
- package/lib/exercises/math/calcul/decimals/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/decimals/index.js +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.js +4 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.d.ts +12 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.js +173 -0
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/index.js +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationSecondDegreeWithNoB.d.ts +7 -0
- package/lib/exercises/math/calculLitteral/equation/equationSecondDegreeWithNoB.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationSecondDegreeWithNoB.js +160 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +1 -1
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +0 -1
- package/lib/exercises/math/derivation/derivative/composition/functionCompositionDerivative.d.ts +11 -0
- package/lib/exercises/math/derivation/derivative/composition/functionCompositionDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/composition/functionCompositionDerivative.js +372 -0
- package/lib/exercises/math/derivation/derivative/composition/index.d.ts +2 -0
- package/lib/exercises/math/derivation/derivative/composition/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/composition/index.js +1 -0
- package/lib/exercises/math/derivation/derivative/index.d.ts +1 -0
- package/lib/exercises/math/derivation/derivative/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/index.js +1 -0
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +3 -3
- package/lib/exercises/math/functions/affines/recognizeExprAffine.js +2 -2
- package/lib/exercises/math/functions/composition/functionComposition.js +1 -1
- package/lib/exercises/math/functions/composition/functionDecompositionFindPossibleUVs.d.ts +13 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindPossibleUVs.d.ts.map +1 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindPossibleUVs.js +223 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindUOrV.d.ts +9 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindUOrV.d.ts.map +1 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindUOrV.js +252 -0
- package/lib/exercises/math/functions/composition/index.d.ts +2 -0
- package/lib/exercises/math/functions/composition/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts +4 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +29 -9
- package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/midpoint.js +8 -1
- package/lib/exercises/math/geometry/vectors/constructions/index.d.ts +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/constructions/index.js +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorCL.d.ts +13 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorCL.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorCL.js +178 -0
- package/lib/exercises/math/percent/evolutions/findEndValueAfterEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/findEndValueAfterEvolution.js +1 -1
- package/lib/exercises/math/powers/powersMixOperations.d.ts +4 -1
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersMixOperations.js +17 -7
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.d.ts +8 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.js +105 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.d.ts +9 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.js +99 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.js +9 -1
- package/lib/exercises/math/sequences/arithmetic/index.d.ts +2 -0
- package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/index.js +2 -0
- package/lib/exercises/math/sequences/genericSequenceVariations.d.ts.map +1 -1
- package/lib/exercises/math/sequences/genericSequenceVariations.js +5 -1
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.js +7 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +3 -2
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts +8 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.js +112 -0
- package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.d.ts +9 -0
- package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.js +97 -0
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts +5 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.js +23 -6
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +3 -1
- package/lib/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.js +9 -1
- package/lib/exercises/math/sequences/geometric/index.d.ts +2 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +2 -0
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.js +10 -3
- package/lib/index.d.ts +59 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/arithmetic/isCoprime.d.ts +2 -0
- package/lib/math/utils/arithmetic/isCoprime.d.ts.map +1 -0
- package/lib/math/utils/arithmetic/isCoprime.js +10 -0
- package/lib/math/utils/arithmetic/primeDecompNode.d.ts +3 -0
- package/lib/math/utils/arithmetic/primeDecompNode.d.ts.map +1 -0
- package/lib/math/utils/arithmetic/primeDecompNode.js +24 -0
- package/lib/math/utils/functions/functionComparison.d.ts +3 -0
- package/lib/math/utils/functions/functionComparison.d.ts.map +1 -0
- package/lib/math/utils/functions/functionComparison.js +58 -0
- package/lib/math/utils/functions/functionComposition.d.ts +13 -0
- package/lib/math/utils/functions/functionComposition.d.ts.map +1 -0
- package/lib/math/utils/functions/functionComposition.js +117 -0
- package/lib/math/utils/functions/functionDecomposition.d.ts +10 -0
- package/lib/math/utils/functions/functionDecomposition.d.ts.map +1 -0
- package/lib/math/utils/functions/functionDecomposition.js +256 -0
- package/lib/server.js +24 -23
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +4 -0
- package/lib/utils/strings/joinanded.d.ts +2 -0
- package/lib/utils/strings/joinanded.d.ts.map +1 -0
- package/lib/utils/strings/joinanded.js +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { SquareRoot } from "../../../../math/numbers/reals/real.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
7
|
+
import { OppositeNode } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
8
|
+
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
9
|
+
import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
|
|
10
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { diceFlip } from "../../../../utils/alea/diceFlip.js";
|
|
12
|
+
import { isInt } from "../../../../utils/isInt.js";
|
|
13
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
14
|
+
import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
|
|
15
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
16
|
+
const squares = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((el) => el ** 2);
|
|
17
|
+
const higherFactor = (n) => {
|
|
18
|
+
for (let i = Math.floor(Math.sqrt(n)); i > 0; i--)
|
|
19
|
+
if (n % i ** 2 === 0)
|
|
20
|
+
return i;
|
|
21
|
+
return 1;
|
|
22
|
+
};
|
|
23
|
+
const getInstruction = (identifiers) => {
|
|
24
|
+
const { randNbr } = identifiers;
|
|
25
|
+
return `Résoudre l'équation :
|
|
26
|
+
|
|
27
|
+
$$
|
|
28
|
+
x^2 = ${randNbr}
|
|
29
|
+
$$`;
|
|
30
|
+
};
|
|
31
|
+
const getHint = () => {
|
|
32
|
+
return `L'équation $x^2 = k$ :
|
|
33
|
+
|
|
34
|
+
- n'admet pas de solution si $k<0$ ;
|
|
35
|
+
- admet une solution si $k=0$, qui est $0$ ;
|
|
36
|
+
- admet deux solutions si $k>0$, qui sont $-\\sqrt{k}$ et $\\sqrt{k}$.
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
const getAnswer = (identifiers) => {
|
|
40
|
+
const { randNbr } = identifiers;
|
|
41
|
+
let solutionsSet;
|
|
42
|
+
if (randNbr < 0) {
|
|
43
|
+
solutionsSet = new DiscreteSetNode([]);
|
|
44
|
+
}
|
|
45
|
+
else if (randNbr === 0) {
|
|
46
|
+
solutionsSet = new DiscreteSetNode([new NumberNode(0)]);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const tree = new SquareRoot(randNbr).simplify().toTree();
|
|
50
|
+
solutionsSet = new DiscreteSetNode([new OppositeNode(tree), tree]);
|
|
51
|
+
}
|
|
52
|
+
const answer = new EquationSolutionNode(solutionsSet).toTex();
|
|
53
|
+
return answer;
|
|
54
|
+
};
|
|
55
|
+
const getCorrection = (identifiers) => {
|
|
56
|
+
const { randNbr } = identifiers;
|
|
57
|
+
const answer = getAnswer(identifiers);
|
|
58
|
+
return `
|
|
59
|
+
${randNbr < 0
|
|
60
|
+
? `L'équation $x^2 = ${randNbr}$ n'admet pas de solution, car $${randNbr}$ est négatif. Ainsi, $${answer}$.`
|
|
61
|
+
: randNbr === 0
|
|
62
|
+
? `L'équation $x^2 = 0$ admet une unique solution : $0$. En effet, $0$ est le seul nombre qui au carré est égal à $0$. Ainsi, $${answer}$.`
|
|
63
|
+
: `Puisque $${randNbr}>0$, l'équation $x^2 = ${randNbr}$ admet deux solutions : $-\\sqrt{${randNbr}}$ et $\\sqrt{${randNbr}}$.
|
|
64
|
+
|
|
65
|
+
${new SquareRoot(randNbr).isSimplifiable()
|
|
66
|
+
? `Or, $\\sqrt{${randNbr}}=${new SquareRoot(randNbr)
|
|
67
|
+
.simplify()
|
|
68
|
+
.toTree()
|
|
69
|
+
.toTex()}$.`
|
|
70
|
+
: ""}
|
|
71
|
+
|
|
72
|
+
Ainsi, $${answer}$.
|
|
73
|
+
`}
|
|
74
|
+
`;
|
|
75
|
+
};
|
|
76
|
+
const getEquationSimpleSquare = () => {
|
|
77
|
+
let randNbr;
|
|
78
|
+
const rand = diceFlip(10);
|
|
79
|
+
if (rand === 1)
|
|
80
|
+
randNbr = randint(-20, 0);
|
|
81
|
+
else if (rand < 6)
|
|
82
|
+
randNbr = random(squares);
|
|
83
|
+
else
|
|
84
|
+
randNbr = randint(2, 100);
|
|
85
|
+
const identifiers = { randNbr };
|
|
86
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
87
|
+
};
|
|
88
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
89
|
+
const question = {
|
|
90
|
+
instruction: getInstruction(identifiers),
|
|
91
|
+
answer: getAnswer(identifiers),
|
|
92
|
+
keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
|
|
93
|
+
answerFormat: "tex",
|
|
94
|
+
identifiers,
|
|
95
|
+
hint: getHint(identifiers),
|
|
96
|
+
correction: getCorrection(identifiers),
|
|
97
|
+
};
|
|
98
|
+
return question;
|
|
99
|
+
};
|
|
100
|
+
const getPropositions = (n, { answer, randNbr }) => {
|
|
101
|
+
const propositions = [];
|
|
102
|
+
addValidProp(propositions, answer);
|
|
103
|
+
const half = new Rational(randNbr, 2).simplify().toTree();
|
|
104
|
+
if (randNbr < 0) {
|
|
105
|
+
tryToAddWrongProp(propositions, `S=\\left\\{-\\sqrt{${-randNbr}}\\right\\}`);
|
|
106
|
+
tryToAddWrongProp(propositions, `S=\\left\\{\\sqrt{-${-randNbr}}\\right\\}`);
|
|
107
|
+
tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode([half])).toTex());
|
|
108
|
+
}
|
|
109
|
+
else if (isInt(Math.sqrt(randNbr))) {
|
|
110
|
+
const sqrt = Math.sqrt(randNbr);
|
|
111
|
+
tryToAddWrongProp(propositions, `S=\\left\\{${sqrt}\\right\\}`);
|
|
112
|
+
tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode([half])).toTex());
|
|
113
|
+
propWhile(propositions, n, () => {
|
|
114
|
+
const tempAns = sqrt + randint(-sqrt + 1, 7, [0]);
|
|
115
|
+
tryToAddWrongProp(propositions, coinFlip()
|
|
116
|
+
? `S=\\left\\{-${tempAns};${tempAns}\\right\\}`
|
|
117
|
+
: `S=\\varnothing`);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
const sqrtTree = new SquareRoot(randNbr).simplify().toTree();
|
|
122
|
+
const factor = higherFactor(randNbr);
|
|
123
|
+
const radicand = randNbr / factor ** 2;
|
|
124
|
+
tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode([sqrtTree])).toTex());
|
|
125
|
+
tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode([half])).toTex());
|
|
126
|
+
propWhile(propositions, n, () => {
|
|
127
|
+
const tempFactor = factor + randint(-factor + 1, 7, [0]);
|
|
128
|
+
const tempRadicand = radicand + randint(-radicand + 1, 7, [0]);
|
|
129
|
+
tryToAddWrongProp(propositions, coinFlip()
|
|
130
|
+
? `S=\\left\\{-${tempFactor}\\sqrt{${tempRadicand}};${tempFactor}\\sqrt{${tempRadicand}}\\right\\}`
|
|
131
|
+
: `S=\\varnothing`);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return shuffleProps(propositions, n);
|
|
135
|
+
};
|
|
136
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
137
|
+
try {
|
|
138
|
+
const parsed = discreteSetParser(ans);
|
|
139
|
+
if (!parsed)
|
|
140
|
+
return false;
|
|
141
|
+
return "S=" + parsed.simplify().toTex() === answer;
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
return handleVEAError(err);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
export const equationSecondDegreeWithNoB = {
|
|
148
|
+
id: "equationSecondDegreeWithNoB",
|
|
149
|
+
connector: "=",
|
|
150
|
+
label: "Résoudre une équation du type $ax^2 + b = 0$",
|
|
151
|
+
isSingleStep: false,
|
|
152
|
+
generator: (nb) => getDistinctQuestions(getEquationSimpleSquare, nb),
|
|
153
|
+
qcmTimer: 60,
|
|
154
|
+
freeTimer: 60,
|
|
155
|
+
getPropositions,
|
|
156
|
+
isAnswerValid,
|
|
157
|
+
subject: "Mathématiques",
|
|
158
|
+
hasHintAndCorrection: true,
|
|
159
|
+
getQuestionFromIdentifiers,
|
|
160
|
+
};
|
|
@@ -82,7 +82,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
82
82
|
};
|
|
83
83
|
export const compareMinusA = {
|
|
84
84
|
id: "compareMinusA",
|
|
85
|
-
label: "Comparer $(
|
|
85
|
+
label: "Comparer $(-1) \\times a$ ; $\\frac{a}{-1}$ et $-a$",
|
|
86
86
|
isSingleStep: true,
|
|
87
87
|
generator: (nb) => getDistinctQuestions(() => getCompareMinusAQuestion(), nb, 30),
|
|
88
88
|
qcmTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"barChartInterpreting.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartInterpreting.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,QAAQ,EAKT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,cAAc,GAAG,cAAc,CAAC;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5C,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,GAAG,GAAG;IACT,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"barChartInterpreting.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartInterpreting.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,QAAQ,EAKT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,cAAc,GAAG,cAAc,CAAC;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5C,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,GAAG,GAAG;IACT,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AA6tBF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAsBF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe/D,CAAC"}
|
|
@@ -427,7 +427,6 @@ const getGGBOptions = (identifiers, opts) => {
|
|
|
427
427
|
}
|
|
428
428
|
};
|
|
429
429
|
const getBarChartInterpretingQuestion = (optsIn) => {
|
|
430
|
-
console.log("optsIn", optsIn);
|
|
431
430
|
const arrayedOptions = optsIn ?? optsDefault;
|
|
432
431
|
const opts = {
|
|
433
432
|
displayType: random(arrayedOptions.displayType),
|
package/lib/exercises/math/derivation/derivative/composition/functionCompositionDerivative.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
nodeUIds: NodeIdentifiers;
|
|
5
|
+
nodeVIds: NodeIdentifiers;
|
|
6
|
+
nodeUPrimeIds: NodeIdentifiers;
|
|
7
|
+
nodeVPrimeIds: NodeIdentifiers;
|
|
8
|
+
};
|
|
9
|
+
export declare const functionCompositionDerivative: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=functionCompositionDerivative.d.ts.map
|
package/lib/exercises/math/derivation/derivative/composition/functionCompositionDerivative.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functionCompositionDerivative.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/composition/functionCompositionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAsE7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,aAAa,EAAE,eAAe,CAAC;IAC/B,aAAa,EAAE,eAAe,CAAC;CAChC,CAAC;AAoXF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAoB/D,CAAC"}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { isEquivalentNodes } from "../../../../../math/utils/functions/functionComparison.js";
|
|
4
|
+
import { nodeBySubstitutingVar } from "../../../../../math/utils/functions/functionComposition.js";
|
|
5
|
+
import { realize } from "../../../../../math/utils/latex/realize.js";
|
|
6
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
7
|
+
import { isFunctionNode, } from "../../../../../tree/nodes/functions/functionNode.js";
|
|
8
|
+
import { NodeConstructor, } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
9
|
+
import { add } from "../../../../../tree/nodes/operators/addNode.js";
|
|
10
|
+
import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
+
import { isOperatorNode } from "../../../../../tree/nodes/operators/operatorNode.js";
|
|
13
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
14
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
15
|
+
import { random } from "../../../../../utils/alea/random.js";
|
|
16
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
17
|
+
const getFunctionNode = (nodeU, nodeV) => {
|
|
18
|
+
return nodeBySubstitutingVar(nodeU, nodeV);
|
|
19
|
+
};
|
|
20
|
+
const getFunctionDerivativeNode = (nodeUPrime, nodeV, nodeVPrime) => {
|
|
21
|
+
return multiply(nodeVPrime, nodeBySubstitutingVar(nodeUPrime, nodeV));
|
|
22
|
+
};
|
|
23
|
+
const functionNameForFunctionId = (functionId) => {
|
|
24
|
+
return [
|
|
25
|
+
"opposite",
|
|
26
|
+
"sqrt",
|
|
27
|
+
"cos",
|
|
28
|
+
"sin",
|
|
29
|
+
"tan",
|
|
30
|
+
"log",
|
|
31
|
+
"log10",
|
|
32
|
+
"exp",
|
|
33
|
+
"abs",
|
|
34
|
+
"arcsin",
|
|
35
|
+
"arccos",
|
|
36
|
+
"arctan",
|
|
37
|
+
][functionId];
|
|
38
|
+
};
|
|
39
|
+
const extractElementaryFunctionNamesDict = (nodes, functionNamesDictIn = {}) => {
|
|
40
|
+
let functionNamesDict = functionNamesDictIn;
|
|
41
|
+
nodes.forEach((node) => {
|
|
42
|
+
if (isFunctionNode(node)) {
|
|
43
|
+
const functionId = node.id;
|
|
44
|
+
const functionName = functionNameForFunctionId(functionId);
|
|
45
|
+
if (!(functionName in functionNamesDict)) {
|
|
46
|
+
functionNamesDict[functionName] = functionName;
|
|
47
|
+
}
|
|
48
|
+
functionNamesDict = Object.assign(functionNamesDict, extractElementaryFunctionNamesDict([node.child], functionNamesDict));
|
|
49
|
+
}
|
|
50
|
+
else if (isOperatorNode(node)) {
|
|
51
|
+
functionNamesDict = Object.assign(functionNamesDict, extractElementaryFunctionNamesDict([node.leftChild, node.rightChild], functionNamesDict));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return functionNamesDict;
|
|
55
|
+
};
|
|
56
|
+
const getInstruction = (identifiers) => {
|
|
57
|
+
const nodeUOV = getFunctionNodeFromIdentifiers(identifiers);
|
|
58
|
+
return `Déterminer l'expression de la fonction dérivée $f'$ de la fonction $f$ (sur son intervalle de dérivation) :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
f(x)=${nodeUOV.toTex()}
|
|
62
|
+
$$
|
|
63
|
+
|
|
64
|
+
`;
|
|
65
|
+
};
|
|
66
|
+
const getHint = () => {
|
|
67
|
+
return `Pour tout $x$ réel on a:
|
|
68
|
+
|
|
69
|
+
$$
|
|
70
|
+
(u \\circ v)'(x) = v'(x) \\times (u' \\circ v)(x)
|
|
71
|
+
$$
|
|
72
|
+
|
|
73
|
+
`;
|
|
74
|
+
};
|
|
75
|
+
const getCorrection = (identifiers) => {
|
|
76
|
+
const { nodeUIds, nodeUPrimeIds, nodeVIds, nodeVPrimeIds } = identifiers;
|
|
77
|
+
const [nodeU, nodeUPrime, nodeV, nodeVPrime] = [
|
|
78
|
+
nodeUIds,
|
|
79
|
+
nodeUPrimeIds,
|
|
80
|
+
nodeVIds,
|
|
81
|
+
nodeVPrimeIds,
|
|
82
|
+
].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
83
|
+
return `Il faut calculer la dérivée de la fonction composée $u \\circ v$,
|
|
84
|
+
|
|
85
|
+
avec :
|
|
86
|
+
|
|
87
|
+
$$
|
|
88
|
+
u(x) = ${nodeU.toTex()}
|
|
89
|
+
$$
|
|
90
|
+
|
|
91
|
+
$$
|
|
92
|
+
v(x) = ${nodeV.toTex()}
|
|
93
|
+
$$
|
|
94
|
+
|
|
95
|
+
On a :
|
|
96
|
+
|
|
97
|
+
$$
|
|
98
|
+
u'(x) = ${nodeUPrime.toTex()}
|
|
99
|
+
$$
|
|
100
|
+
|
|
101
|
+
$$
|
|
102
|
+
v'(x) = ${nodeVPrime.toTex()}
|
|
103
|
+
$$
|
|
104
|
+
|
|
105
|
+
Donc
|
|
106
|
+
|
|
107
|
+
${alignTex([
|
|
108
|
+
[`f'(x)`, `=`, `v'(x) \\times (u' \\circ v)(x)`],
|
|
109
|
+
[
|
|
110
|
+
``,
|
|
111
|
+
`=`,
|
|
112
|
+
`(${nodeVPrime.toTex()}) \\times (${nodeBySubstitutingVar(nodeUPrime, nodeV).toTex()})`,
|
|
113
|
+
],
|
|
114
|
+
[``, `=`, `${getAnswerNode(identifiers).simplify().toTex()}`],
|
|
115
|
+
])}`;
|
|
116
|
+
};
|
|
117
|
+
const getFunctionNodeFromIdentifiers = (identifiers) => {
|
|
118
|
+
const { nodeUIds, nodeVIds } = identifiers;
|
|
119
|
+
const [nodeU, nodeV] = [nodeUIds, nodeVIds].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
120
|
+
return getFunctionNode(nodeU, nodeV);
|
|
121
|
+
};
|
|
122
|
+
const getAnswerNode = (identifiers) => {
|
|
123
|
+
const { nodeUPrimeIds, nodeVIds, nodeVPrimeIds } = identifiers;
|
|
124
|
+
const [nodeUPrime, nodeV, nodeVPrime] = [
|
|
125
|
+
nodeUPrimeIds,
|
|
126
|
+
nodeVIds,
|
|
127
|
+
nodeVPrimeIds,
|
|
128
|
+
].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
129
|
+
return getFunctionDerivativeNode(nodeUPrime, nodeV, nodeVPrime);
|
|
130
|
+
};
|
|
131
|
+
const getAnswer = (identifiers) => {
|
|
132
|
+
return getAnswerNode(identifiers)
|
|
133
|
+
.simplify({
|
|
134
|
+
distributePowersOnFrac: true,
|
|
135
|
+
calculatePowers: true,
|
|
136
|
+
})
|
|
137
|
+
.toTex();
|
|
138
|
+
};
|
|
139
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
140
|
+
if (ans === answer) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const nodeAns = parseAlgebraic(ans);
|
|
145
|
+
const nodeAnswer = parseAlgebraic(answer);
|
|
146
|
+
return isEquivalentNodes(nodeAns, nodeAnswer);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
150
|
+
const { nodeUIds, nodeUPrimeIds, nodeVIds, nodeVPrimeIds } = identifiers;
|
|
151
|
+
const [nodeU, nodeUPrime, nodeV, nodeVPrime] = [
|
|
152
|
+
nodeUIds,
|
|
153
|
+
nodeUPrimeIds,
|
|
154
|
+
nodeVIds,
|
|
155
|
+
nodeVPrimeIds,
|
|
156
|
+
].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
157
|
+
const answerNode = getAnswerNode(identifiers);
|
|
158
|
+
const propositions = [];
|
|
159
|
+
addValidProp(propositions, answerNode.toTex());
|
|
160
|
+
const wannabeWrongNodes = [
|
|
161
|
+
//(vou)'
|
|
162
|
+
multiply(nodeUPrime, nodeBySubstitutingVar(nodeVPrime, nodeU)),
|
|
163
|
+
//v(x) * u'(v'(x))
|
|
164
|
+
multiply(nodeV, nodeBySubstitutingVar(nodeUPrime, nodeVPrime)),
|
|
165
|
+
//u'v+uv'
|
|
166
|
+
add(multiply(nodeUPrime, nodeV), multiply(nodeU, nodeVPrime)),
|
|
167
|
+
//(u'v-uv')/v²
|
|
168
|
+
frac(substract(multiply(nodeUPrime, nodeV), multiply(nodeU, nodeVPrime)), multiply(nodeV, nodeV).simplify()),
|
|
169
|
+
];
|
|
170
|
+
wannabeWrongNodes.forEach((wannabeWrongNode) => {
|
|
171
|
+
if (!isEquivalentNodes(wannabeWrongNode, answerNode)) {
|
|
172
|
+
tryToAddWrongProp(propositions, wannabeWrongNode.toTex());
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
if (propositions.length < n) {
|
|
176
|
+
[
|
|
177
|
+
`${nodeBySubstitutingVar(nodeU, nodeU).toTex({
|
|
178
|
+
forceParenthesis: true,
|
|
179
|
+
})}`,
|
|
180
|
+
`${nodeBySubstitutingVar(nodeU, nodeU).simplify().toTex()}`,
|
|
181
|
+
`${nodeBySubstitutingVar(nodeV, nodeV).toTex({
|
|
182
|
+
forceParenthesis: true,
|
|
183
|
+
})}`,
|
|
184
|
+
`${nodeBySubstitutingVar(nodeV, nodeV).simplify().toTex()}`,
|
|
185
|
+
].forEach((wrongTex) => {
|
|
186
|
+
tryToAddWrongProp(propositions, wrongTex);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return shuffleProps(propositions, n);
|
|
190
|
+
};
|
|
191
|
+
const getKeys = (identifiers) => {
|
|
192
|
+
const { nodeUIds, nodeUPrimeIds, nodeVIds, nodeVPrimeIds } = identifiers;
|
|
193
|
+
const [nodeU, nodeUPrime, nodeV, nodeVPrime] = [
|
|
194
|
+
nodeUIds,
|
|
195
|
+
nodeUPrimeIds,
|
|
196
|
+
nodeVIds,
|
|
197
|
+
nodeVPrimeIds,
|
|
198
|
+
].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
199
|
+
const functionNamesDict = extractElementaryFunctionNamesDict([
|
|
200
|
+
nodeU,
|
|
201
|
+
nodeUPrime,
|
|
202
|
+
nodeV,
|
|
203
|
+
nodeVPrime,
|
|
204
|
+
]);
|
|
205
|
+
const texs = Object.values(functionNamesDict)
|
|
206
|
+
.map((functionName) => {
|
|
207
|
+
switch (functionName) {
|
|
208
|
+
case "cos":
|
|
209
|
+
case "sin":
|
|
210
|
+
case "tan":
|
|
211
|
+
case "arcsin":
|
|
212
|
+
case "arccos":
|
|
213
|
+
case "arctan":
|
|
214
|
+
case "abs":
|
|
215
|
+
return `\\${functionName}`;
|
|
216
|
+
case "log":
|
|
217
|
+
return "\\ln";
|
|
218
|
+
case "log10":
|
|
219
|
+
return "\\log";
|
|
220
|
+
case "exp":
|
|
221
|
+
return "e";
|
|
222
|
+
case "sqrt":
|
|
223
|
+
case "opposite":
|
|
224
|
+
default:
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
.filter((tex) => !!tex);
|
|
229
|
+
return [
|
|
230
|
+
"x",
|
|
231
|
+
...texs.map((tex) => {
|
|
232
|
+
return {
|
|
233
|
+
id: "custom",
|
|
234
|
+
label: tex,
|
|
235
|
+
labelType: "tex",
|
|
236
|
+
mathfieldInstructions: {
|
|
237
|
+
method: "write",
|
|
238
|
+
content: tex,
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}),
|
|
242
|
+
];
|
|
243
|
+
};
|
|
244
|
+
const dictFunctionAndDerivative = {
|
|
245
|
+
// "ax+b": {
|
|
246
|
+
// f: "ax+b",
|
|
247
|
+
// fprime: "a",
|
|
248
|
+
// },
|
|
249
|
+
"(ax+b)^2": {
|
|
250
|
+
f: "(ax+b)^2",
|
|
251
|
+
fprime: "2ax+2ab",
|
|
252
|
+
},
|
|
253
|
+
"ax^2+bx+c": {
|
|
254
|
+
f: "ax^2+bx+c",
|
|
255
|
+
fprime: "2ax+b",
|
|
256
|
+
},
|
|
257
|
+
// "(x+a)(x+b)": {
|
|
258
|
+
// f: "(x+a)(x+b)",
|
|
259
|
+
// fprime: "2x+(a+b)",
|
|
260
|
+
// },
|
|
261
|
+
sin: {
|
|
262
|
+
f: "\\sin{x}",
|
|
263
|
+
fprime: "\\cos{x}",
|
|
264
|
+
},
|
|
265
|
+
cos: {
|
|
266
|
+
f: "\\cos{x}",
|
|
267
|
+
fprime: "-\\sin{x}",
|
|
268
|
+
},
|
|
269
|
+
ln: {
|
|
270
|
+
f: "\\ln{x}",
|
|
271
|
+
fprime: "\\frac{1}{x}",
|
|
272
|
+
},
|
|
273
|
+
"x^n": {
|
|
274
|
+
f: "x^n",
|
|
275
|
+
fprime: "n \\times x^{n-1}",
|
|
276
|
+
},
|
|
277
|
+
sqrt: {
|
|
278
|
+
f: "\\sqrt{x}",
|
|
279
|
+
fprime: "\\frac{1}{(2)\\sqrt{x}}",
|
|
280
|
+
},
|
|
281
|
+
exp: {
|
|
282
|
+
f: "e^x",
|
|
283
|
+
fprime: "e^x",
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
const getFunctionCompositionDerivativeQuestion = (_) => {
|
|
287
|
+
function realizeFunctionAndDerivative(functionAndDerivative) {
|
|
288
|
+
switch (functionAndDerivative.f) {
|
|
289
|
+
case "x^n": {
|
|
290
|
+
const n = randint(2, 10).toTree();
|
|
291
|
+
const randomNodeN = { custom: () => n };
|
|
292
|
+
return [functionAndDerivative.f, functionAndDerivative.fprime].map((f) => realize({ n: randomNodeN })(f));
|
|
293
|
+
}
|
|
294
|
+
// case "ax+b":
|
|
295
|
+
case "(ax+b)^2": {
|
|
296
|
+
// case "(x+a)(x+b)":
|
|
297
|
+
const a = randint(-9, 10, [0]).toTree();
|
|
298
|
+
const randomNodeA = { custom: () => a };
|
|
299
|
+
const b = randint(-9, 10, [0]).toTree();
|
|
300
|
+
const randomNodeB = { custom: () => b };
|
|
301
|
+
return [functionAndDerivative.f, functionAndDerivative.fprime].map((f) => realize({ a: randomNodeA, b: randomNodeB })(f));
|
|
302
|
+
}
|
|
303
|
+
case "ax^2+bx+c": {
|
|
304
|
+
const a = randint(-9, 10, [0]).toTree();
|
|
305
|
+
const randomNodeA = { custom: () => a };
|
|
306
|
+
const b = randint(-9, 10, [0]).toTree();
|
|
307
|
+
const randomNodeB = { custom: () => b };
|
|
308
|
+
const c = randint(-9, 10, [0]).toTree();
|
|
309
|
+
const randomNodeC = { custom: () => c };
|
|
310
|
+
return [functionAndDerivative.f, functionAndDerivative.fprime].map((f) => realize({ a: randomNodeA, b: randomNodeB, c: randomNodeC })(f));
|
|
311
|
+
}
|
|
312
|
+
default: {
|
|
313
|
+
return [functionAndDerivative.f, functionAndDerivative.fprime].map((f) => realize({})(f));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
function createNodeFromRealized(strRealized) {
|
|
318
|
+
return parseAlgebraic(strRealized).simplify({ forbidFactorize: true });
|
|
319
|
+
}
|
|
320
|
+
function getRandomNodeNodeForFunctionAndDerivative(functionAndDerivative) {
|
|
321
|
+
return realizeFunctionAndDerivative(functionAndDerivative).map(createNodeFromRealized);
|
|
322
|
+
}
|
|
323
|
+
const functionAndDerivativeU = dictFunctionAndDerivative[random(["sin", "cos", "ln", "sqrt", "exp", "x^n"])];
|
|
324
|
+
const functionAndDerivativeV = (() => {
|
|
325
|
+
switch (functionAndDerivativeU.f) {
|
|
326
|
+
case "x^n": {
|
|
327
|
+
//pour éviter le problème de ...^2^5 au moment de .toTex()
|
|
328
|
+
return dictFunctionAndDerivative[random(["sin", "cos", "ln", "sqrt"])];
|
|
329
|
+
}
|
|
330
|
+
default: {
|
|
331
|
+
return dictFunctionAndDerivative[random(Object.keys(dictFunctionAndDerivative))];
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
})();
|
|
335
|
+
const [nodeU, nodeUPrime] = getRandomNodeNodeForFunctionAndDerivative(functionAndDerivativeU);
|
|
336
|
+
const [nodeV, nodeVPrime] = getRandomNodeNodeForFunctionAndDerivative(functionAndDerivativeV);
|
|
337
|
+
const identifiers = {
|
|
338
|
+
nodeUIds: nodeU.toIdentifiers(),
|
|
339
|
+
nodeVIds: nodeV.toIdentifiers(),
|
|
340
|
+
nodeUPrimeIds: nodeUPrime.toIdentifiers(),
|
|
341
|
+
nodeVPrimeIds: nodeVPrime.toIdentifiers(),
|
|
342
|
+
};
|
|
343
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
344
|
+
};
|
|
345
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
346
|
+
return {
|
|
347
|
+
answer: getAnswer(identifiers),
|
|
348
|
+
instruction: getInstruction(identifiers),
|
|
349
|
+
keys: getKeys(identifiers),
|
|
350
|
+
answerFormat: "tex",
|
|
351
|
+
identifiers,
|
|
352
|
+
hint: getHint(identifiers),
|
|
353
|
+
correction: getCorrection(identifiers),
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
export const functionCompositionDerivative = {
|
|
357
|
+
id: "functionCompositionDerivative",
|
|
358
|
+
label: "Déterminer la dérivée d'une fonction composée",
|
|
359
|
+
isSingleStep: true,
|
|
360
|
+
generator: (nb, opts) => getDistinctQuestions(() => getFunctionCompositionDerivativeQuestion(opts), nb),
|
|
361
|
+
qcmTimer: 60,
|
|
362
|
+
freeTimer: 60,
|
|
363
|
+
getPropositions,
|
|
364
|
+
isAnswerValid,
|
|
365
|
+
subject: "Mathématiques",
|
|
366
|
+
getInstruction,
|
|
367
|
+
getHint,
|
|
368
|
+
getCorrection,
|
|
369
|
+
getAnswer,
|
|
370
|
+
getQuestionFromIdentifiers,
|
|
371
|
+
hasHintAndCorrection: true,
|
|
372
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/composition/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./functionCompositionDerivative.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognizeAffineGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/recognizeAffineGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAc7C,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAmBF,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"recognizeAffineGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/recognizeAffineGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAc7C,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAmBF,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAgKF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
|
|
@@ -42,13 +42,14 @@ const getInstruction = (identifiers) => {
|
|
|
42
42
|
};
|
|
43
43
|
const getGGBOptions = (identifiers) => {
|
|
44
44
|
const { arrFProps } = identifiers;
|
|
45
|
+
const { xMin, xMax, yMin, yMax } = DISPLAY_PROPS;
|
|
45
46
|
function createFunctionCommands(nodeIds, fName, color) {
|
|
46
47
|
const nodeF = NodeConstructor.fromIdentifiers(nodeIds);
|
|
47
48
|
const expr = nodeF.toMathString();
|
|
48
49
|
return [
|
|
49
50
|
`${fName} = Function(${expr}, x, -20, 20)`,
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
`ShowLabel(${fName}, true)`,
|
|
52
|
+
`SetCaption(${fName}, "$\\mathcal C_${fName}$")`,
|
|
52
53
|
`SetColor(${fName}, "${color}")`,
|
|
53
54
|
];
|
|
54
55
|
}
|
|
@@ -56,7 +57,6 @@ const getGGBOptions = (identifiers) => {
|
|
|
56
57
|
const ggb = new GeogebraConstructor({
|
|
57
58
|
commands,
|
|
58
59
|
});
|
|
59
|
-
const { xMin, xMax, yMin, yMax } = DISPLAY_PROPS;
|
|
60
60
|
return ggb.getOptions({
|
|
61
61
|
coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
|
|
62
62
|
});
|
|
@@ -252,7 +252,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
252
252
|
};
|
|
253
253
|
export const recognizeExprAffine = {
|
|
254
254
|
id: "recognizeExprAffine",
|
|
255
|
-
label: "Reconnaître l
|
|
255
|
+
label: "Reconnaître l'expression d'une fonction affine",
|
|
256
256
|
isSingleStep: true,
|
|
257
257
|
generator: (nb) => getDistinctQuestions(() => getRecognizeExprAffineQuestion({
|
|
258
258
|
askedType: "affine",
|
|
@@ -268,7 +268,7 @@ export const recognizeExprAffine = {
|
|
|
268
268
|
};
|
|
269
269
|
export const recognizeExprLinear = {
|
|
270
270
|
id: "recognizeExprLinear",
|
|
271
|
-
label: "Reconnaître l
|
|
271
|
+
label: "Reconnaître l'expression d'une fonction linéaire",
|
|
272
272
|
isSingleStep: true,
|
|
273
273
|
generator: (nb) => getDistinctQuestions(() => getRecognizeExprAffineQuestion({
|
|
274
274
|
askedType: "linear",
|
|
@@ -195,7 +195,7 @@ const getFunctionCompositionQuestion = (_) => {
|
|
|
195
195
|
`\\sin(x)`,
|
|
196
196
|
realize({ a: "I" })(`\\sin(ax)`),
|
|
197
197
|
`\\cos(x)`,
|
|
198
|
-
realize({ a: "I" })(`\\
|
|
198
|
+
realize({ a: "I" })(`\\cos(ax)`),
|
|
199
199
|
].map((tex) => parseAlgebraic(tex)),
|
|
200
200
|
//! TODO: simplify({maxSimplificationSteps: 100}) to allow using fracs
|
|
201
201
|
// frac(randomNodeWithType("I"), "x"),
|