math-exercises 3.0.10 → 3.0.11
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/fractions/fractionsOperations.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +0 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.js +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +6 -2
- package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.d.ts +11 -0
- package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.js +134 -0
- package/lib/exercises/math/functions/trinoms/devForm/index.d.ts +3 -0
- package/lib/exercises/math/functions/trinoms/devForm/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/devForm/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.js +42 -0
- package/lib/exercises/math/functions/trinoms/equation/deltaTrinom.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/equation/deltaTrinom.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/deltaTrinom.js +50 -0
- package/lib/exercises/math/functions/trinoms/equation/index.d.ts +5 -0
- package/lib/exercises/math/functions/trinoms/equation/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/index.js +4 -0
- package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts +11 -0
- package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.js +102 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.js +131 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts +7 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.js +69 -0
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.js +72 -0
- package/lib/exercises/math/functions/trinoms/factoForm/index.d.ts +2 -0
- package/lib/exercises/math/functions/trinoms/factoForm/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/factoForm/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/index.d.ts +7 -23
- package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/index.js +7 -23
- package/lib/exercises/math/functions/trinoms/parabole/index.d.ts +3 -0
- package/lib/exercises/math/functions/trinoms/parabole/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.js +285 -0
- package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.js +112 -0
- package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.d.ts +10 -0
- package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.js +124 -0
- package/lib/exercises/math/functions/trinoms/roots/index.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/roots/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/index.js +7 -0
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.js +54 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +55 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +67 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsProduct.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsProduct.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsProduct.js +109 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +63 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsSum.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsSum.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsSum.js +109 -0
- package/lib/exercises/math/functions/trinoms/sign/index.d.ts +3 -0
- package/lib/exercises/math/functions/trinoms/sign/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/sign/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.js +120 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.js +119 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.js +49 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaInCanonicalForm.d.ts +10 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaInCanonicalForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaInCanonicalForm.js +64 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.js +48 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.js +55 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.js +42 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.js +8 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.js +90 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.js +55 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.js +59 -0
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts +2 -0
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.js +56 -31
- package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.js +34 -14
- package/lib/index.d.ts +42 -31
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/triangle.d.ts +1 -0
- package/lib/math/geometry/triangle.d.ts.map +1 -1
- package/lib/math/geometry/triangle.js +10 -2
- package/lib/math/systems/generalSystem.d.ts.map +1 -1
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/trinomNode.d.ts +1 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/trinomNode.js +9 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +1 -3
- package/package.json +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { equationKeys } from "../../../../../exercises/utils/keys/equationKeys.js";
|
|
4
|
+
import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
5
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
7
|
+
import { DiscreteSetNode } from "../../../../../tree/nodes/sets/discreteSetNode.js";
|
|
8
|
+
const getInstruction = (identifiers) => {
|
|
9
|
+
const { coeffs } = identifiers;
|
|
10
|
+
const trinom = TrinomConstructor.fromCoeffs(coeffs);
|
|
11
|
+
const statement = trinom.getCanonicalForm().toTex();
|
|
12
|
+
return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
|
|
13
|
+
|
|
14
|
+
$$
|
|
15
|
+
f(x) = ${statement}
|
|
16
|
+
$$
|
|
17
|
+
|
|
18
|
+
Résoudre l'équation $f(x) = 0$.`;
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { coeffs } = identifiers;
|
|
22
|
+
const trinom = TrinomConstructor.fromCoeffs(coeffs);
|
|
23
|
+
const roots = trinom.getRootsNode();
|
|
24
|
+
const answer = new EquationSolutionNode(new DiscreteSetNode(roots)).toTex();
|
|
25
|
+
return answer;
|
|
26
|
+
};
|
|
27
|
+
const getSolveSecondDegreeEquationFromCanoQuestion = () => {
|
|
28
|
+
const trinom = TrinomConstructor.randomNiceRootsAndSummit();
|
|
29
|
+
const identifiers = { coeffs: trinom.coefficients };
|
|
30
|
+
const question = {
|
|
31
|
+
answer: getAnswer(identifiers),
|
|
32
|
+
instruction: getInstruction(identifiers),
|
|
33
|
+
keys: [...equationKeys],
|
|
34
|
+
answerFormat: "tex",
|
|
35
|
+
identifiers,
|
|
36
|
+
};
|
|
37
|
+
return question;
|
|
38
|
+
};
|
|
39
|
+
const getPropositions = (n, { answer }) => {
|
|
40
|
+
const propositions = [];
|
|
41
|
+
addValidProp(propositions, answer);
|
|
42
|
+
while (propositions.length < n) {
|
|
43
|
+
tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode([randint(-9, 0), randint(1, 10)].map((e) => e.toTree()))).toTex());
|
|
44
|
+
}
|
|
45
|
+
return shuffleProps(propositions, n);
|
|
46
|
+
};
|
|
47
|
+
const isAnswerValid = (ans, { answer, coeffs }) => {
|
|
48
|
+
const trinom = TrinomConstructor.fromCoeffs(coeffs);
|
|
49
|
+
const roots = trinom.getRootsNode();
|
|
50
|
+
const answerTree = new EquationSolutionNode(new DiscreteSetNode(roots), {
|
|
51
|
+
opts: { allowFractionToDecimal: true, allowRawRightChildAsSolution: true },
|
|
52
|
+
});
|
|
53
|
+
const texs = answerTree.toAllValidTexs();
|
|
54
|
+
return texs.includes(ans);
|
|
55
|
+
};
|
|
56
|
+
export const solveSecondDegreeEquationFromCano = {
|
|
57
|
+
id: "solveSecondDegreeEquationFromCano",
|
|
58
|
+
connector: "\\iff",
|
|
59
|
+
label: "Résoudre une équation du type $a(x-b)^2 + c = 0$",
|
|
60
|
+
levels: [],
|
|
61
|
+
isSingleStep: true,
|
|
62
|
+
sections: [],
|
|
63
|
+
generator: (nb) => getDistinctQuestions(getSolveSecondDegreeEquationFromCanoQuestion, nb),
|
|
64
|
+
qcmTimer: 60,
|
|
65
|
+
freeTimer: 60,
|
|
66
|
+
getPropositions,
|
|
67
|
+
isAnswerValid,
|
|
68
|
+
subject: "Mathématiques",
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+EF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
4
|
+
import { multiply, } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
5
|
+
import { square } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
6
|
+
import { substract, } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
7
|
+
import { probaFlip } from "../../../../../utils/alea/probaFlip.js";
|
|
8
|
+
const getAnswerNode = (roots, a) => {
|
|
9
|
+
const isSingleRoot = roots.length === 1;
|
|
10
|
+
return isSingleRoot
|
|
11
|
+
? multiply(a, square(substract("x", roots[0]))).simplify({
|
|
12
|
+
keepPowers: true,
|
|
13
|
+
})
|
|
14
|
+
: multiply(multiply(a, substract("x", roots[0])), substract("x", roots[1])).simplify();
|
|
15
|
+
};
|
|
16
|
+
const getInstruction = (identifiers) => {
|
|
17
|
+
const { a, roots } = identifiers;
|
|
18
|
+
return `Soit $f(x) = ax^2 + bx + c$ un polynôme du second degré avec $a = ${a}$ et qui a ${roots.length === 1
|
|
19
|
+
? `pour seule racine : $${roots[0]}$`
|
|
20
|
+
: `deux racines : $${roots[0]}$ et $${roots[1]}$`}. Déterminer la forme factorisée de $f$.`;
|
|
21
|
+
};
|
|
22
|
+
const getFactorizedFormFromRootsQuestion = () => {
|
|
23
|
+
const a = randint(-10, 10, [0]);
|
|
24
|
+
const firstRoot = randint(-10, 10);
|
|
25
|
+
const secondRoot = randint(-10, 10, [firstRoot]);
|
|
26
|
+
const isSingleRoot = probaFlip(0.3);
|
|
27
|
+
const roots = isSingleRoot
|
|
28
|
+
? [firstRoot]
|
|
29
|
+
: [firstRoot, secondRoot].sort((a, b) => a - b);
|
|
30
|
+
const answer = getAnswerNode(roots, a);
|
|
31
|
+
const answerTex = answer.toTex();
|
|
32
|
+
const identifiers = { a, roots };
|
|
33
|
+
const question = {
|
|
34
|
+
answer: answerTex,
|
|
35
|
+
instruction: getInstruction(identifiers),
|
|
36
|
+
keys: ["x"],
|
|
37
|
+
answerFormat: "tex",
|
|
38
|
+
identifiers,
|
|
39
|
+
};
|
|
40
|
+
return question;
|
|
41
|
+
};
|
|
42
|
+
const getPropositions = (n, { answer, a, roots }) => {
|
|
43
|
+
const propositions = [];
|
|
44
|
+
addValidProp(propositions, answer);
|
|
45
|
+
tryToAddWrongProp(propositions, getAnswerNode(roots.map((r) => -r), a).toTex());
|
|
46
|
+
while (propositions.length < n) {
|
|
47
|
+
const x1 = randint(-10, 10);
|
|
48
|
+
const x2 = randint(-10, 10, [x1]);
|
|
49
|
+
tryToAddWrongProp(propositions, getAnswerNode([x1, x2].sort((a, b) => a - b), randint(-10, 10, [0])).toTex());
|
|
50
|
+
}
|
|
51
|
+
return shuffleProps(propositions, n);
|
|
52
|
+
};
|
|
53
|
+
const isAnswerValid = (ans, { answer, a, roots }) => {
|
|
54
|
+
const answerNode = getAnswerNode(roots, a);
|
|
55
|
+
const texs = answerNode.toAllValidTexs();
|
|
56
|
+
return texs.includes(ans);
|
|
57
|
+
};
|
|
58
|
+
export const factorizedFormFromRoots = {
|
|
59
|
+
id: "factorizedFormFromRoots",
|
|
60
|
+
connector: "=",
|
|
61
|
+
label: "Déterminer la forme factorisée en connaissant les racines",
|
|
62
|
+
levels: ["1rePro", "1reSpé"],
|
|
63
|
+
isSingleStep: true,
|
|
64
|
+
sections: ["Second degré"],
|
|
65
|
+
generator: (nb) => getDistinctQuestions(getFactorizedFormFromRootsQuestion, nb),
|
|
66
|
+
qcmTimer: 60,
|
|
67
|
+
freeTimer: 60,
|
|
68
|
+
getPropositions,
|
|
69
|
+
isAnswerValid,
|
|
70
|
+
subject: "Mathématiques",
|
|
71
|
+
getInstruction,
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./factorizedFormFromRoots.js";
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
export * from "./alphaBetaFromDevForm.js";
|
|
2
|
-
export * from "./alphaBetaInCanonicalForm.js";
|
|
3
|
-
export * from "./canonicalFromDevForm.js";
|
|
4
|
-
export * from "./deltaTrinom.js";
|
|
5
|
-
export * from "./extremumFromCanonicalForm.js";
|
|
6
|
-
export * from "./extremumTypeFromAlgebricForm.js";
|
|
7
|
-
export * from "./niceRootsFromDevForm.js";
|
|
8
|
-
export * from "./rootsFromDevForm.js";
|
|
9
|
-
export * from "./rootsFromFactorizedForm.js";
|
|
10
|
-
export * from "./variationsFromAlgebricForm.js";
|
|
11
|
-
export * from "./secondDegreeInequation.js";
|
|
12
|
-
export * from "./rootsReading.js";
|
|
13
|
-
export * from "./factorizedFormFromRoots.js";
|
|
14
|
-
export * from "./summitReading.js";
|
|
15
|
-
export * from "./summitAbscissFromRoots.js";
|
|
16
|
-
export * from "./summitAbscissFromDevForm.js";
|
|
17
1
|
export * from "./trinomialMeanValue.js";
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
22
|
-
export * from "./
|
|
23
|
-
export * from "./
|
|
24
|
-
export * from "./
|
|
2
|
+
export * from "./devForm/index.js";
|
|
3
|
+
export * from "./equation/index.js";
|
|
4
|
+
export * from "./factoForm/index.js";
|
|
5
|
+
export * from "./roots/index.js";
|
|
6
|
+
export * from "./sign/index.js";
|
|
7
|
+
export * from "./summitAndCanonical/index.js";
|
|
8
|
+
export * from "./parabole/index.js";
|
|
25
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
export * from "./alphaBetaFromDevForm.js";
|
|
2
|
-
export * from "./alphaBetaInCanonicalForm.js";
|
|
3
|
-
export * from "./canonicalFromDevForm.js";
|
|
4
|
-
export * from "./deltaTrinom.js";
|
|
5
|
-
export * from "./extremumFromCanonicalForm.js";
|
|
6
|
-
export * from "./extremumTypeFromAlgebricForm.js";
|
|
7
|
-
export * from "./niceRootsFromDevForm.js";
|
|
8
|
-
export * from "./rootsFromDevForm.js";
|
|
9
|
-
export * from "./rootsFromFactorizedForm.js";
|
|
10
|
-
export * from "./variationsFromAlgebricForm.js";
|
|
11
|
-
export * from "./secondDegreeInequation.js";
|
|
12
|
-
export * from "./rootsReading.js";
|
|
13
|
-
export * from "./factorizedFormFromRoots.js";
|
|
14
|
-
export * from "./summitReading.js";
|
|
15
|
-
export * from "./summitAbscissFromRoots.js";
|
|
16
|
-
export * from "./summitAbscissFromDevForm.js";
|
|
17
1
|
export * from "./trinomialMeanValue.js";
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
22
|
-
export * from "./
|
|
23
|
-
export * from "./
|
|
24
|
-
export * from "./
|
|
2
|
+
export * from "./devForm/index.js";
|
|
3
|
+
export * from "./equation/index.js";
|
|
4
|
+
export * from "./factoForm/index.js";
|
|
5
|
+
export * from "./roots/index.js";
|
|
6
|
+
export * from "./sign/index.js";
|
|
7
|
+
export * from "./summitAndCanonical/index.js";
|
|
8
|
+
export * from "./parabole/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/parabole/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
type: number;
|
|
4
|
+
points: number[][];
|
|
5
|
+
};
|
|
6
|
+
export declare const paraboleExpressionReading: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=paraboleExpressionReading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paraboleExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CAIpB,CAAC;AAoSF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAmB3D,CAAC"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
|
|
4
|
+
import { Parabola } from "../../../../../math/geometry/parabola.js";
|
|
5
|
+
import { Point } from "../../../../../math/geometry/point.js";
|
|
6
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
7
|
+
import { add } from "../../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { square } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
11
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
12
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
13
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
15
|
+
const propositions = [];
|
|
16
|
+
addValidProp(propositions, answer);
|
|
17
|
+
const { type, points } = identifiers;
|
|
18
|
+
while (propositions.length < n) {
|
|
19
|
+
switch (type) {
|
|
20
|
+
case 0:
|
|
21
|
+
tryToAddWrongProp(propositions, multiply(randint(-9, 10, [0]), square("x")).toTex());
|
|
22
|
+
break;
|
|
23
|
+
case 1:
|
|
24
|
+
tryToAddWrongProp(propositions, add(multiply(randint(-9, 10, [0]), square("x")), randint(-9, 10, [0])).toTex());
|
|
25
|
+
break;
|
|
26
|
+
case 2:
|
|
27
|
+
default:
|
|
28
|
+
let x1 = randint(-8, 9);
|
|
29
|
+
let x2 = randint(-8, 9, [0]);
|
|
30
|
+
if (x1 > x2)
|
|
31
|
+
[x1, x2] = [x2, x1];
|
|
32
|
+
tryToAddWrongProp(propositions, multiply(randint(-5, 6, [0]), multiply(substract("x", x1), substract("x", x2))).toTex());
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return shuffleProps(propositions, n);
|
|
37
|
+
};
|
|
38
|
+
const getAnswerNode = (identifiers) => {
|
|
39
|
+
//type 0 = ax^2, points = [[-1, a],[0,0],[1,a]]
|
|
40
|
+
//type 1 = ax^2 + b, points = [[-1, a+b], [0,b], [1, a+b]]
|
|
41
|
+
//type 2 = a(x-x1)(x-x2), points = [[x1,0],[x, y],[x2,0]], avec (x,y) random
|
|
42
|
+
const { type, points } = identifiers;
|
|
43
|
+
let a;
|
|
44
|
+
let b;
|
|
45
|
+
switch (type) {
|
|
46
|
+
case 0:
|
|
47
|
+
a = points[2][1];
|
|
48
|
+
return multiply(a, square("x"));
|
|
49
|
+
case 1:
|
|
50
|
+
b = points[1][1];
|
|
51
|
+
a = points[2][1] - b;
|
|
52
|
+
return add(multiply(a, square("x")), b).simplify({
|
|
53
|
+
towardsDistribute: true,
|
|
54
|
+
forbidFactorize: true,
|
|
55
|
+
});
|
|
56
|
+
case 2:
|
|
57
|
+
default:
|
|
58
|
+
const roots = points.filter((e) => e[1] === 0);
|
|
59
|
+
const x1 = roots[0][0];
|
|
60
|
+
const x2 = roots[1][0];
|
|
61
|
+
const [x, y] = points.find((el) => el[1] !== 0);
|
|
62
|
+
a = frac(y, (x - x1) * (x - x2)).simplify();
|
|
63
|
+
// a = round(y / (x - x1) / (x - x2), 2);
|
|
64
|
+
return multiply(a, multiply(substract("x", x1), substract("x", x2))).simplify({ forceDistributeFractions: true });
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const getAnswer = (identifiers) => {
|
|
69
|
+
return getAnswerNode(identifiers).toTex();
|
|
70
|
+
};
|
|
71
|
+
const getInstruction = (identifiers) => {
|
|
72
|
+
return `Déterminer l'expression de la fonction représentée ci-dessous.`;
|
|
73
|
+
};
|
|
74
|
+
const getHint = (identifiers) => {
|
|
75
|
+
const { type, points } = identifiers;
|
|
76
|
+
switch (type) {
|
|
77
|
+
case 0:
|
|
78
|
+
return `Si la parabole a pour sommet l'origine du repère, alors l'expression de $f$ est de la forme :
|
|
79
|
+
|
|
80
|
+
$$
|
|
81
|
+
f(x) = ax^2
|
|
82
|
+
$$
|
|
83
|
+
|
|
84
|
+
Pour déterminer $a$, on lit l'ordonnée du point d'abscisse $1$.`;
|
|
85
|
+
case 1:
|
|
86
|
+
return `Si la parabole a pour axe de symétrie l'axe des ordonnées, l'expression de $f$ est de la forme :
|
|
87
|
+
|
|
88
|
+
$$
|
|
89
|
+
f(x) = ax^2 + b
|
|
90
|
+
$$
|
|
91
|
+
|
|
92
|
+
Pour déterminer $b$, on lit l'ordonnée du sommet.
|
|
93
|
+
|
|
94
|
+
Pour déterminer $a$, on lit l'ordonnée du point d'abscisse $1$, puis on utilise le fait que $f(1) = a\\times 1^2 + b$.`;
|
|
95
|
+
case 2:
|
|
96
|
+
default:
|
|
97
|
+
return `Si la parabole possède deux racines $x_1$ et $x_2$, alors l'expression de $f$ est de la forme :
|
|
98
|
+
|
|
99
|
+
$$
|
|
100
|
+
f(x) = a(x-x_1)(x-x_2)
|
|
101
|
+
$$
|
|
102
|
+
|
|
103
|
+
On détermine $x_1$ et $x_2$ en lisant les racines de la parabole.
|
|
104
|
+
|
|
105
|
+
Pour déterminer $a$, on choisit un point $A(x_0;y_0)$ de la courbe tel que $x_0\\neq x_1$ et $x_0\\neq x_2$. On sait alors que $f(x_0) = y_0$. On remplace ces valeurs dans l'expression de $f$. On résout alors l'équation d'inconnue $a$.`;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const getCorrection = (identifiers) => {
|
|
109
|
+
const { type, points } = identifiers;
|
|
110
|
+
let a;
|
|
111
|
+
let b;
|
|
112
|
+
const answer = getAnswer(identifiers);
|
|
113
|
+
switch (type) {
|
|
114
|
+
case 0:
|
|
115
|
+
a = points[2][1];
|
|
116
|
+
return `La parabole a pour sommet l'origine du repère, donc l'expression de $f$ est de la forme :
|
|
117
|
+
|
|
118
|
+
$$
|
|
119
|
+
f(x) = ax^2
|
|
120
|
+
$$
|
|
121
|
+
|
|
122
|
+
La parabole passe par le point $A(1;${a})$, donc $a = ${a}$.
|
|
123
|
+
|
|
124
|
+
On a donc pour tout $x$ réel :
|
|
125
|
+
|
|
126
|
+
$$
|
|
127
|
+
f(x) = ${answer}
|
|
128
|
+
$$`;
|
|
129
|
+
case 1:
|
|
130
|
+
b = points[1][1];
|
|
131
|
+
a = points[2][1] - b;
|
|
132
|
+
return `La parabole a pour axe de symétrie l'axe des ordonnées, donc l'expression de $f$ est de la forme :
|
|
133
|
+
|
|
134
|
+
$$
|
|
135
|
+
f(x) = ax^2 + b
|
|
136
|
+
$$
|
|
137
|
+
|
|
138
|
+
L'ordonnée du sommet est $${b}$, donc $b = ${b}$.
|
|
139
|
+
|
|
140
|
+
La parabole passe par le point $A(1;${a + b})$, donc $f(1) = ${add("a", b).toTex()}= ${a + b}$. On en déduit que $a = ${a}$.
|
|
141
|
+
|
|
142
|
+
On a donc pour tout $x$ réel :
|
|
143
|
+
|
|
144
|
+
$$
|
|
145
|
+
f(x) = ${answer}
|
|
146
|
+
$$
|
|
147
|
+
`;
|
|
148
|
+
case 2:
|
|
149
|
+
default:
|
|
150
|
+
const roots = points.filter((e) => e[1] === 0);
|
|
151
|
+
const x1 = roots[0][0];
|
|
152
|
+
const x2 = roots[1][0];
|
|
153
|
+
const [x, y] = points.find((el) => el[1] !== 0);
|
|
154
|
+
// a = round(y / (x - x1) / (x - x2), 2);
|
|
155
|
+
a = frac(y, (x - x1) * (x - x2)).simplify();
|
|
156
|
+
const f = multiply(substract("x", x1), substract("x", x2)).simplify();
|
|
157
|
+
return `La parabole possède deux racines $x_1=${x1}$ et $x_2=${x2}$, donc l'expression de $f$ est de la forme :
|
|
158
|
+
|
|
159
|
+
$$
|
|
160
|
+
f(x) = a${f.toTex()}
|
|
161
|
+
$$
|
|
162
|
+
|
|
163
|
+
De plus, la parabole passe par le point $A(${x},${y})$.
|
|
164
|
+
|
|
165
|
+
On a donc $f(x) = a${f.toDetailedEvaluation({ x: x.toTree() }).toTex()} = ${y}$.
|
|
166
|
+
|
|
167
|
+
En résolvant cette équation, on obtient $a=${a.toTex()}$.
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
On a donc pour tout $x$ réel :
|
|
171
|
+
|
|
172
|
+
$$
|
|
173
|
+
f(x) = ${answer}
|
|
174
|
+
$$`;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const getGGBOptions = (identifiers) => {
|
|
178
|
+
const { type, points } = identifiers;
|
|
179
|
+
const sortedPoints = [...points].sort((a, b) => a[0] - b[0]);
|
|
180
|
+
const parabola = new Parabola(sortedPoints.map((p, i) => new Point(`A_${i}`, p[0], p[1])));
|
|
181
|
+
const ggb = new GeogebraConstructor({
|
|
182
|
+
commands: parabola.toGGBCommands(false),
|
|
183
|
+
});
|
|
184
|
+
const pointsXs = points.map((p) => p[0]);
|
|
185
|
+
const pointsYs = points.map((p) => p[1]);
|
|
186
|
+
let xMin = Math.min(Math.min(...pointsXs), -5) - 1;
|
|
187
|
+
let xMax = Math.max(Math.max(...pointsXs), 5) + 1;
|
|
188
|
+
let yMin = Math.min(Math.min(...pointsYs), -5) - 1;
|
|
189
|
+
let yMax = Math.max(Math.max(...pointsYs), 5) + 1;
|
|
190
|
+
return ggb.getOptions({
|
|
191
|
+
coords: [xMin, xMax, yMin, yMax],
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
const getKeys = (identifiers) => {
|
|
195
|
+
return ["x"];
|
|
196
|
+
};
|
|
197
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
198
|
+
try {
|
|
199
|
+
const parsed = parseAlgebraic(ans);
|
|
200
|
+
if (!parsed)
|
|
201
|
+
return false;
|
|
202
|
+
return (parsed
|
|
203
|
+
.simplify({
|
|
204
|
+
towardsDistribute: true,
|
|
205
|
+
forbidFactorize: true,
|
|
206
|
+
decimalToFractions: true,
|
|
207
|
+
})
|
|
208
|
+
.toTex() ===
|
|
209
|
+
getAnswerNode(identifiers)
|
|
210
|
+
.simplify({
|
|
211
|
+
towardsDistribute: true,
|
|
212
|
+
forbidFactorize: true,
|
|
213
|
+
})
|
|
214
|
+
.toTex());
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
return handleVEAError(err);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
const getParaboleExpressionReadingQuestion = (opts) => {
|
|
221
|
+
const type = randint(0, 3);
|
|
222
|
+
const points = [];
|
|
223
|
+
let a;
|
|
224
|
+
let b;
|
|
225
|
+
switch (type) {
|
|
226
|
+
case 0:
|
|
227
|
+
//type 0 = ax^2, points = [[-1, a],[0,0],[1,a]]
|
|
228
|
+
a = randint(-5, 6, [0]);
|
|
229
|
+
points.push([-1, a], [0, 0], [1, a]);
|
|
230
|
+
break;
|
|
231
|
+
case 1:
|
|
232
|
+
//type 1 = ax^2 + b, points = [[-1, a+b], [0,b], [1, a+b]]
|
|
233
|
+
a = randint(-5, 6, [0]);
|
|
234
|
+
b = randint(-5, 6, [0]);
|
|
235
|
+
points.push([-1, a + b], [0, b], [1, a + b]);
|
|
236
|
+
break;
|
|
237
|
+
case 2:
|
|
238
|
+
default:
|
|
239
|
+
//type 2 = a(x-x1)(x-x2), points = [[x1,0],[x, y],[x2,0]], avec (x,y) random
|
|
240
|
+
let x1 = randint(-8, 9);
|
|
241
|
+
let x2 = randint(-8, 9, [x1]);
|
|
242
|
+
if (x1 > x2)
|
|
243
|
+
[x1, x2] = [x2, x1];
|
|
244
|
+
// a = randint(-3, 4, [0]);
|
|
245
|
+
const x = randint(-4, 4, [x1, x2]);
|
|
246
|
+
// const y = round(a * (x - x1) * (x - x2), 2);
|
|
247
|
+
const y = randint(-6, 7, [0]);
|
|
248
|
+
points.push([x1, 0], [x, y], [x2, 0]);
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
const identifiers = {
|
|
252
|
+
type,
|
|
253
|
+
points,
|
|
254
|
+
};
|
|
255
|
+
const question = {
|
|
256
|
+
answer: getAnswer(identifiers),
|
|
257
|
+
instruction: getInstruction(identifiers),
|
|
258
|
+
keys: getKeys(identifiers),
|
|
259
|
+
answerFormat: "tex",
|
|
260
|
+
identifiers,
|
|
261
|
+
hint: getHint(identifiers),
|
|
262
|
+
correction: getCorrection(identifiers),
|
|
263
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
264
|
+
};
|
|
265
|
+
return question;
|
|
266
|
+
};
|
|
267
|
+
export const paraboleExpressionReading = {
|
|
268
|
+
id: "paraboleExpressionReading",
|
|
269
|
+
connector: "\\iff",
|
|
270
|
+
label: "Associer une expression algébrique à une parabole",
|
|
271
|
+
isSingleStep: true,
|
|
272
|
+
generator: (nb, opts) => getDistinctQuestions(() => getParaboleExpressionReadingQuestion(opts), nb),
|
|
273
|
+
qcmTimer: 60,
|
|
274
|
+
freeTimer: 60,
|
|
275
|
+
getPropositions,
|
|
276
|
+
isAnswerValid,
|
|
277
|
+
subject: "Mathématiques",
|
|
278
|
+
getHint,
|
|
279
|
+
getCorrection,
|
|
280
|
+
getInstruction,
|
|
281
|
+
getAnswer,
|
|
282
|
+
getGGBOptions,
|
|
283
|
+
hasGeogebra: true,
|
|
284
|
+
hasHintAndCorrection: true,
|
|
285
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
x1: number;
|
|
5
|
+
x2: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const trinomSymetryAxisFromFacto: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=trinomSymetryAxisFromFacto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trinomSymetryAxisFromFacto.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAgGF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAkB5D,CAAC"}
|