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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,eAAe,CAAC;CACvC,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,eAAe,CAAC;CACvC,CAAC;AA2FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
|
|
@@ -17,7 +17,6 @@ const getPropositions = (n, { answer }) => {
|
|
|
17
17
|
return shuffleProps(propositions, n);
|
|
18
18
|
};
|
|
19
19
|
const getAnswer = (identifiers) => {
|
|
20
|
-
console.log("ans", identifiers);
|
|
21
20
|
const statement = NodeConstructor.fromIdentifiers(identifiers.statementIdentifiers, true);
|
|
22
21
|
return statement.simplify().toTex();
|
|
23
22
|
};
|
|
@@ -45,7 +45,7 @@ const getHint = (identifiers) => {
|
|
|
45
45
|
return `Il faut isoler $x$ à gauche. Pour cela, effectue l'opération des deux côtés de l'équation qui permet de supprimer la multiplication par $${a}$.`;
|
|
46
46
|
};
|
|
47
47
|
const getFirstDegreeEquationIntQuestion = () => {
|
|
48
|
-
const a = randint(-15, 15, [0]);
|
|
48
|
+
const a = randint(-15, 15, [0, 1]);
|
|
49
49
|
const x = randint(-15, 15, [0]);
|
|
50
50
|
const b = a * x;
|
|
51
51
|
const identifiers = { a: a, x: x, b: b };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAuBrC;;;GAGG;AACH,KAAK,WAAW,GAAG;IAEjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAoKF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.j
|
|
|
7
7
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
8
8
|
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
9
9
|
import { MultiplyNode, isMultiplyNode, multiply, } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { isPowerNode, isSquareNode, } from "../../../../tree/nodes/operators/powerNode.js";
|
|
10
11
|
import { substract, } from "../../../../tree/nodes/operators/substractNode.js";
|
|
11
12
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
12
13
|
import { random } from "../../../../utils/alea/random.js";
|
|
@@ -48,7 +49,7 @@ const getAnswer = (identifiers) => {
|
|
|
48
49
|
const getFactoType1Question = () => {
|
|
49
50
|
const a = randint(-9, 10, [0]);
|
|
50
51
|
const b = randint(-9, 10, [0]);
|
|
51
|
-
|
|
52
|
+
let operation = random(["add", "substract"]);
|
|
52
53
|
let c, d;
|
|
53
54
|
let e, f;
|
|
54
55
|
do {
|
|
@@ -104,7 +105,10 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
104
105
|
const parsed = parseAlgebraic(ans);
|
|
105
106
|
if (!parsed)
|
|
106
107
|
return false;
|
|
107
|
-
if (answer !== "0" &&
|
|
108
|
+
if (answer !== "0" &&
|
|
109
|
+
!isMultiplyNode(parsed) &&
|
|
110
|
+
!isSquareNode(parsed) &&
|
|
111
|
+
!isPowerNode(parsed))
|
|
108
112
|
return false;
|
|
109
113
|
const simp = parsed.simplify({
|
|
110
114
|
forbidFactorize: true,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
aIdentifiers: NodeIdentifiers;
|
|
5
|
+
bIdentifiers: NodeIdentifiers;
|
|
6
|
+
cIdentifiers: NodeIdentifiers;
|
|
7
|
+
isAsking: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const coefficientsIdentification: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=coefficientsIdentification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coefficientsIdentification.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/devForm/coefficientsIdentification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,YAAY,EAAE,eAAe,CAAC;IAC9B,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAuIF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAgB5D,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { RationalConstructor } from "../../../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { TrinomNode } from "../../../../../tree/nodes/polynomials/trinomNode.js";
|
|
5
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { NodeConstructor, } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
7
|
+
import { isFractionNode } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { square } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
10
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
11
|
+
import { random } from "../../../../../utils/alea/random.js";
|
|
12
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
13
|
+
const getPropositions = (n, { answer, aIdentifiers, bIdentifiers, cIdentifiers, isAsking }) => {
|
|
14
|
+
const propositions = [];
|
|
15
|
+
addValidProp(propositions, answer);
|
|
16
|
+
const trinom = new TrinomNode(NodeConstructor.fromIdentifiers(aIdentifiers), NodeConstructor.fromIdentifiers(bIdentifiers), NodeConstructor.fromIdentifiers(cIdentifiers));
|
|
17
|
+
if (answer === "1") {
|
|
18
|
+
tryToAddWrongProp(propositions, "0");
|
|
19
|
+
}
|
|
20
|
+
if (answer === "0") {
|
|
21
|
+
tryToAddWrongProp(propositions, "1");
|
|
22
|
+
}
|
|
23
|
+
if (answer === "-1") {
|
|
24
|
+
tryToAddWrongProp(propositions, "-");
|
|
25
|
+
}
|
|
26
|
+
const askedNode = isAsking === "a" ? trinom.a : isAsking === "b" ? trinom.b : trinom.c;
|
|
27
|
+
if (isFractionNode(askedNode)) {
|
|
28
|
+
tryToAddWrongProp(propositions, askedNode.leftChild.toTex());
|
|
29
|
+
}
|
|
30
|
+
// si frac ajouter que le num
|
|
31
|
+
const monom = isAsking === "a"
|
|
32
|
+
? multiply(trinom.a, square("x")).simplify()
|
|
33
|
+
: isAsking === "b"
|
|
34
|
+
? multiply(trinom.b, "x").simplify()
|
|
35
|
+
: trinom.c;
|
|
36
|
+
tryToAddWrongProp(propositions, monom.toTex());
|
|
37
|
+
while (propositions.length < n) {
|
|
38
|
+
tryToAddWrongProp(propositions, randint(-10, 10) + "");
|
|
39
|
+
}
|
|
40
|
+
return shuffleProps(propositions, n);
|
|
41
|
+
};
|
|
42
|
+
const getAnswer = (identifiers) => {
|
|
43
|
+
const { aIdentifiers, bIdentifiers, cIdentifiers, isAsking } = identifiers;
|
|
44
|
+
return isAsking === "a"
|
|
45
|
+
? NodeConstructor.fromIdentifiers(aIdentifiers).toTex()
|
|
46
|
+
: isAsking === "b"
|
|
47
|
+
? NodeConstructor.fromIdentifiers(bIdentifiers).toTex()
|
|
48
|
+
: NodeConstructor.fromIdentifiers(cIdentifiers).toTex();
|
|
49
|
+
};
|
|
50
|
+
const getInstruction = (identifiers) => {
|
|
51
|
+
const trinom = new TrinomNode(NodeConstructor.fromIdentifiers(identifiers.aIdentifiers), NodeConstructor.fromIdentifiers(identifiers.bIdentifiers), NodeConstructor.fromIdentifiers(identifiers.cIdentifiers));
|
|
52
|
+
return `Soit $f$ la fonction polynôme de degré $2$ définie sur $\\mathbb{R}$ par :
|
|
53
|
+
|
|
54
|
+
$$
|
|
55
|
+
f(x)=${trinom
|
|
56
|
+
.toTree()
|
|
57
|
+
.simplify({
|
|
58
|
+
// forceDistributeFractions: true,
|
|
59
|
+
forbidFactorize: true,
|
|
60
|
+
towardsDistribute: true,
|
|
61
|
+
})
|
|
62
|
+
.toTex()}
|
|
63
|
+
$$
|
|
64
|
+
|
|
65
|
+
Quelle est la valeur du coefficient $${identifiers.isAsking}$ de $f$ ?`;
|
|
66
|
+
};
|
|
67
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
68
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
69
|
+
const getKeys = (identifiers) => {
|
|
70
|
+
return [];
|
|
71
|
+
};
|
|
72
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
73
|
+
try {
|
|
74
|
+
const parsed = parseAlgebraic(ans);
|
|
75
|
+
if (!parsed)
|
|
76
|
+
return false;
|
|
77
|
+
return parsed.simplify().toTex() === answer;
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return handleVEAError(err);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const getCoefficientsIdentificationQuestion = () => {
|
|
84
|
+
const a = random([
|
|
85
|
+
(-1).toTree(),
|
|
86
|
+
(1).toTree(),
|
|
87
|
+
randint(-10, 11, [-1, 0, 1]).toTree(),
|
|
88
|
+
RationalConstructor.randomIrreductible().toTree(),
|
|
89
|
+
]);
|
|
90
|
+
const b = random([
|
|
91
|
+
(-1).toTree(),
|
|
92
|
+
(1).toTree(),
|
|
93
|
+
(0).toTree(),
|
|
94
|
+
randint(-10, 10, [-1, 1, 0]).toTree(),
|
|
95
|
+
RationalConstructor.randomIrreductible().toTree(),
|
|
96
|
+
]);
|
|
97
|
+
const c = random([
|
|
98
|
+
(0).toTree(),
|
|
99
|
+
randint(-10, 11, [0]).toTree(),
|
|
100
|
+
RationalConstructor.randomIrreductible().toTree(),
|
|
101
|
+
]);
|
|
102
|
+
const isAsking = random(["a", "b", "c"]);
|
|
103
|
+
const identifiers = {
|
|
104
|
+
aIdentifiers: a.toIdentifiers(),
|
|
105
|
+
bIdentifiers: b.toIdentifiers(),
|
|
106
|
+
cIdentifiers: c.toIdentifiers(),
|
|
107
|
+
isAsking,
|
|
108
|
+
};
|
|
109
|
+
const question = {
|
|
110
|
+
answer: getAnswer(identifiers),
|
|
111
|
+
instruction: getInstruction(identifiers),
|
|
112
|
+
keys: getKeys(identifiers),
|
|
113
|
+
answerFormat: "tex",
|
|
114
|
+
identifiers,
|
|
115
|
+
// hint: getHint(identifiers),
|
|
116
|
+
// correction: getCorrection(identifiers),
|
|
117
|
+
};
|
|
118
|
+
return question;
|
|
119
|
+
};
|
|
120
|
+
export const coefficientsIdentification = {
|
|
121
|
+
id: "coefficientsIdentification",
|
|
122
|
+
connector: "=",
|
|
123
|
+
label: "Reconnaître les coefficients $a$, $b$ et $c$ d'un trinôme exprimé sous forme développée",
|
|
124
|
+
isSingleStep: true,
|
|
125
|
+
generator: (nb) => getDistinctQuestions(getCoefficientsIdentificationQuestion, nb),
|
|
126
|
+
qcmTimer: 60,
|
|
127
|
+
freeTimer: 60,
|
|
128
|
+
getPropositions,
|
|
129
|
+
isAnswerValid,
|
|
130
|
+
subject: "Mathématiques",
|
|
131
|
+
// getHint,
|
|
132
|
+
// getCorrection,
|
|
133
|
+
getAnswer,
|
|
134
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/devForm/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
c: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const variationsFromAlgebricForm: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=variationsFromAlgebricForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variationsFromAlgebricForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwCF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAc5D,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { addValidProp, addWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
4
|
+
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
5
|
+
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
6
|
+
const getVariationsFromAlgebricFormQuestion = () => {
|
|
7
|
+
const isDevForm = coinFlip();
|
|
8
|
+
const trinom = isDevForm
|
|
9
|
+
? TrinomConstructor.random()
|
|
10
|
+
: TrinomConstructor.randomCanonical();
|
|
11
|
+
const answer = trinom.a > 0
|
|
12
|
+
? "Décroissante puis croissante"
|
|
13
|
+
: "Croissante puis décroissante";
|
|
14
|
+
const question = {
|
|
15
|
+
answer: answer,
|
|
16
|
+
instruction: `Quelles sont les variations de la fonction $f$ définie par $f(x) = ${isDevForm ? trinom.toTree().toTex() : trinom.getCanonicalForm().toTex()}$ ?`,
|
|
17
|
+
answerFormat: "raw",
|
|
18
|
+
identifiers: { a: trinom.a, b: trinom.b, c: trinom.c },
|
|
19
|
+
};
|
|
20
|
+
return question;
|
|
21
|
+
};
|
|
22
|
+
const getPropositions = (n, { answer, a }) => {
|
|
23
|
+
const propositions = [];
|
|
24
|
+
addValidProp(propositions, answer, "raw");
|
|
25
|
+
addWrongProp(propositions, a < 0 ? "Décroissante puis croissante" : "Croissante puis décroissante", "raw");
|
|
26
|
+
addWrongProp(propositions, "Constante", "raw");
|
|
27
|
+
addWrongProp(propositions, "On ne peut pas savoir", "raw");
|
|
28
|
+
return shuffle(propositions);
|
|
29
|
+
};
|
|
30
|
+
export const variationsFromAlgebricForm = {
|
|
31
|
+
id: "variationsFromAlgebricForm",
|
|
32
|
+
label: "Déterminer les variations d'une fonction du second degré via sa forme algébrique",
|
|
33
|
+
levels: ["1reSpé"],
|
|
34
|
+
isSingleStep: true,
|
|
35
|
+
sections: ["Second degré"],
|
|
36
|
+
generator: (nb) => getDistinctQuestions(getVariationsFromAlgebricFormQuestion, nb),
|
|
37
|
+
answerType: "QCU",
|
|
38
|
+
qcmTimer: 60,
|
|
39
|
+
freeTimer: 60,
|
|
40
|
+
getPropositions,
|
|
41
|
+
subject: "Mathématiques",
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deltaTrinom.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/deltaTrinom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwCF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAc7C,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
4
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
5
|
+
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
6
|
+
const getDeltaTrinomQuestion = () => {
|
|
7
|
+
const trinom = TrinomConstructor.random();
|
|
8
|
+
const answer = trinom.getDelta() + "";
|
|
9
|
+
const question = {
|
|
10
|
+
answer: answer,
|
|
11
|
+
instruction: `Soit $f(x) = ${trinom
|
|
12
|
+
.toTree()
|
|
13
|
+
.toTex()}$. Calculer le discriminant $\\Delta$.`,
|
|
14
|
+
keys: [],
|
|
15
|
+
answerFormat: "tex",
|
|
16
|
+
identifiers: { a: trinom.a, b: trinom.b, c: trinom.c },
|
|
17
|
+
};
|
|
18
|
+
return question;
|
|
19
|
+
};
|
|
20
|
+
const getPropositions = (n, { answer, a, b, c }) => {
|
|
21
|
+
const propositions = [];
|
|
22
|
+
addValidProp(propositions, answer);
|
|
23
|
+
const bMinus4ac = b - 4 * a * c;
|
|
24
|
+
tryToAddWrongProp(propositions, bMinus4ac + "");
|
|
25
|
+
const bSquarePlus4ac = b ** 2 + a * c;
|
|
26
|
+
tryToAddWrongProp(propositions, bSquarePlus4ac + "");
|
|
27
|
+
while (propositions.length < n) {
|
|
28
|
+
const wrongAnswer = randint(-100, 100) + "";
|
|
29
|
+
tryToAddWrongProp(propositions, wrongAnswer);
|
|
30
|
+
}
|
|
31
|
+
return shuffle(propositions);
|
|
32
|
+
};
|
|
33
|
+
const isAnswerValid = (ans, { a, b, c }) => {
|
|
34
|
+
const delta = b ** 2 - 4 * a * c;
|
|
35
|
+
return ans === delta.toString();
|
|
36
|
+
};
|
|
37
|
+
export const deltaTrinom = {
|
|
38
|
+
id: "deltaTrinom",
|
|
39
|
+
connector: "=",
|
|
40
|
+
getPropositions,
|
|
41
|
+
label: "Calculer le discriminant d'un trinôme",
|
|
42
|
+
levels: ["1reSpé", "TermSpé", "MathComp"],
|
|
43
|
+
isSingleStep: true,
|
|
44
|
+
sections: ["Second degré"],
|
|
45
|
+
generator: (nb) => getDistinctQuestions(getDeltaTrinomQuestion, nb),
|
|
46
|
+
qcmTimer: 60,
|
|
47
|
+
freeTimer: 60,
|
|
48
|
+
isAnswerValid,
|
|
49
|
+
subject: "Mathématiques",
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { InegalitySymbols } from "../../../../../math/inequations/inequation.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
a: number;
|
|
5
|
+
b: number;
|
|
6
|
+
c: number;
|
|
7
|
+
ineqType: InegalitySymbols;
|
|
8
|
+
};
|
|
9
|
+
export declare const secondDegreeInequation: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=secondDegreeInequation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAiB9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAwHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { InequationSymbol, InequationSymbolConstructor, } from "../../../../../math/inequations/inequation.js";
|
|
4
|
+
import { Trinom } from "../../../../../math/polynomials/trinom.js";
|
|
5
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { InequationSolutionNode } from "../../../../../tree/nodes/inequations/inequationSolutionNode.js";
|
|
7
|
+
import { MinusInfinityNode, PlusInfinityNode, } from "../../../../../tree/nodes/numbers/infiniteNode.js";
|
|
8
|
+
import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
|
|
9
|
+
import { ClosureType } from "../../../../../tree/nodes/sets/closure.js";
|
|
10
|
+
import { IntervalNode } from "../../../../../tree/nodes/sets/intervalNode.js";
|
|
11
|
+
import { UnionIntervalNode } from "../../../../../tree/nodes/sets/unionIntervalNode.js";
|
|
12
|
+
import { unionIntervalParser } from "../../../../../tree/parsers/unionIntervalParser.js";
|
|
13
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
const getAnswer = ({ a, roots, ineqType }) => {
|
|
15
|
+
const aPositive = a > 0;
|
|
16
|
+
const insideInterval = new IntervalNode(roots[0], roots[1], ineqType.isStrict ? ClosureType.OO : ClosureType.FF);
|
|
17
|
+
const outsideUnion = new UnionIntervalNode([
|
|
18
|
+
new IntervalNode(MinusInfinityNode, roots[0], ineqType.isStrict ? ClosureType.OO : ClosureType.OF),
|
|
19
|
+
new IntervalNode(roots[1], PlusInfinityNode, ineqType.isStrict ? ClosureType.OO : ClosureType.FO),
|
|
20
|
+
]);
|
|
21
|
+
const tree = ineqType.isSup
|
|
22
|
+
? aPositive
|
|
23
|
+
? outsideUnion
|
|
24
|
+
: insideInterval
|
|
25
|
+
: aPositive
|
|
26
|
+
? insideInterval
|
|
27
|
+
: outsideUnion;
|
|
28
|
+
return new InequationSolutionNode(tree);
|
|
29
|
+
};
|
|
30
|
+
const getSecondDegreeInequationQuestion = () => {
|
|
31
|
+
const a = randint(-5, 6, [0]);
|
|
32
|
+
const x1 = randint(-5, 6);
|
|
33
|
+
const x2 = randint(-5, 6, [x1]);
|
|
34
|
+
const roots = x1 < x2
|
|
35
|
+
? [new NumberNode(x1), new NumberNode(x2)]
|
|
36
|
+
: [new NumberNode(x2), new NumberNode(x1)];
|
|
37
|
+
const c = a * x1 * x2;
|
|
38
|
+
const b = -a * x2 - a * x1;
|
|
39
|
+
const trinom = new Trinom(a, b, c);
|
|
40
|
+
const ineqType = InequationSymbolConstructor.random();
|
|
41
|
+
const answer = getAnswer({ a: trinom.a, roots, ineqType }).toTex();
|
|
42
|
+
const question = {
|
|
43
|
+
answer,
|
|
44
|
+
instruction: `Soit $f(x) = ${trinom
|
|
45
|
+
.toTree()
|
|
46
|
+
.toTex()}$. Résoudre l'inéquation $f(x) ${ineqType.symbol} 0$.`,
|
|
47
|
+
keys: [
|
|
48
|
+
"S",
|
|
49
|
+
"equal",
|
|
50
|
+
"lbracket",
|
|
51
|
+
"semicolon",
|
|
52
|
+
"rbracket",
|
|
53
|
+
"cup",
|
|
54
|
+
"infty",
|
|
55
|
+
"varnothing",
|
|
56
|
+
],
|
|
57
|
+
answerFormat: "tex",
|
|
58
|
+
identifiers: {
|
|
59
|
+
a: trinom.a,
|
|
60
|
+
b: trinom.b,
|
|
61
|
+
c: trinom.c,
|
|
62
|
+
ineqType: ineqType.symbol,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
return question;
|
|
66
|
+
};
|
|
67
|
+
const getPropositions = (n, { answer, a, b, c, ineqType }) => {
|
|
68
|
+
const propositions = [];
|
|
69
|
+
addValidProp(propositions, answer);
|
|
70
|
+
const roots = new Trinom(a, b, c).getRootsNode();
|
|
71
|
+
const ineq = new InequationSymbol(ineqType);
|
|
72
|
+
tryToAddWrongProp(propositions, getAnswer({ a: -a, ineqType: ineq, roots }).toTex());
|
|
73
|
+
tryToAddWrongProp(propositions, getAnswer({ a, ineqType: ineq.toStrictnessToggled(), roots }).toTex());
|
|
74
|
+
tryToAddWrongProp(propositions, getAnswer({ a: -a, ineqType: ineq.toStrictnessToggled(), roots }).toTex());
|
|
75
|
+
return shuffleProps(propositions, n);
|
|
76
|
+
};
|
|
77
|
+
const isAnswerValid = (ans, { answer, a, b, c, ineqType }) => {
|
|
78
|
+
try {
|
|
79
|
+
const parsed = unionIntervalParser(ans.replaceAll("S", "").replaceAll("=", ""));
|
|
80
|
+
if (!parsed)
|
|
81
|
+
return false;
|
|
82
|
+
return "S=\\ " + parsed.simplify().toTex() === answer;
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
return handleVEAError(err);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
export const secondDegreeInequation = {
|
|
89
|
+
id: "secondDegreeInequation",
|
|
90
|
+
connector: "\\iff",
|
|
91
|
+
label: "Résoudre une inéquation du second degré",
|
|
92
|
+
levels: ["1reSpé"],
|
|
93
|
+
isSingleStep: true,
|
|
94
|
+
sections: ["Inéquations", "Second degré"],
|
|
95
|
+
generator: (nb) => getDistinctQuestions(getSecondDegreeInequationQuestion, nb),
|
|
96
|
+
qcmTimer: 60,
|
|
97
|
+
freeTimer: 60,
|
|
98
|
+
getPropositions,
|
|
99
|
+
isAnswerValid,
|
|
100
|
+
subject: "Mathématiques",
|
|
101
|
+
pdfOptions: { shouldSpreadPropositions: true },
|
|
102
|
+
};
|
package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
type: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const solveSecondDegreeEquationByFactorisation: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=solveSecondDegreeEquationByFactorisation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solveSecondDegreeEquationByFactorisation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAgIF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAiB1E,CAAC"}
|
package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
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 { Rational } from "../../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { Trinom } from "../../../../../math/polynomials/trinom.js";
|
|
6
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
7
|
+
import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
8
|
+
import { DiscreteSetNode } from "../../../../../tree/nodes/sets/discreteSetNode.js";
|
|
9
|
+
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
10
|
+
/**
|
|
11
|
+
* Equation donnée sous forme ax^2 + bx ou bien forme développée d'une identité remarquable
|
|
12
|
+
* type 1 ax^2 + bx
|
|
13
|
+
* type 2 (ax+b)^2
|
|
14
|
+
* type 3 (ax-b)^2
|
|
15
|
+
* type 4 (ax+b)(ax-b)
|
|
16
|
+
*/
|
|
17
|
+
const getSolveSecondDegreeEquationByFactorisationQuestion = () => {
|
|
18
|
+
const type = randint(1, 4);
|
|
19
|
+
let statement = "";
|
|
20
|
+
let roots = [];
|
|
21
|
+
let answer = "";
|
|
22
|
+
let a;
|
|
23
|
+
let b;
|
|
24
|
+
switch (type) {
|
|
25
|
+
case 1:
|
|
26
|
+
{
|
|
27
|
+
//ax^2 + bx
|
|
28
|
+
const trinom = new Trinom(randint(-9, 10, [0]), randint(-9, 10), 0);
|
|
29
|
+
a = trinom.a;
|
|
30
|
+
b = trinom.b;
|
|
31
|
+
statement = trinom.toTex();
|
|
32
|
+
roots = trinom.getRootsNode();
|
|
33
|
+
}
|
|
34
|
+
break;
|
|
35
|
+
case 2:
|
|
36
|
+
{
|
|
37
|
+
//(ax+b)^2
|
|
38
|
+
a = randint(-9, 10, [0]);
|
|
39
|
+
b = randint(1, 10);
|
|
40
|
+
statement = new Trinom(a ** 2, 2 * a * b, b ** 2).toTex();
|
|
41
|
+
roots = [new Rational(-b, a).simplify().toTree()];
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case 3:
|
|
45
|
+
{
|
|
46
|
+
//(ax-b)^2
|
|
47
|
+
a = randint(-9, 10, [0]);
|
|
48
|
+
b = randint(-9, 0, [0]);
|
|
49
|
+
statement = new Trinom(a ** 2, -2 * a * b, b ** 2).toTex();
|
|
50
|
+
roots = [new Rational(b, a).simplify().toTree()];
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
case 4:
|
|
54
|
+
default:
|
|
55
|
+
{
|
|
56
|
+
//(ax+b)(ax-b)
|
|
57
|
+
a = randint(-9, 10, [0]);
|
|
58
|
+
b = randint(1, 10);
|
|
59
|
+
statement = new Trinom(a ** 2, 0, -(b ** 2)).toTex();
|
|
60
|
+
roots = [b, -b].sort((a, b) => a - b).map((x) => x.toTree());
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
const instruction = `Soit $f(x) = ${statement}$. Factoriser $f(x)$, puis résoudre l'équation $f(x) = 0$.`;
|
|
65
|
+
answer = new EquationSolutionNode(new DiscreteSetNode(roots)).toTex();
|
|
66
|
+
const question = {
|
|
67
|
+
answer,
|
|
68
|
+
instruction,
|
|
69
|
+
keys: [...equationKeys],
|
|
70
|
+
answerFormat: "tex",
|
|
71
|
+
identifiers: { a, b, type },
|
|
72
|
+
};
|
|
73
|
+
return question;
|
|
74
|
+
};
|
|
75
|
+
const getPropositions = (n, { answer }) => {
|
|
76
|
+
const propositions = [];
|
|
77
|
+
addValidProp(propositions, answer);
|
|
78
|
+
while (propositions.length < n) {
|
|
79
|
+
const firstRoot = randint(-10, 10);
|
|
80
|
+
tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode(coinFlip()
|
|
81
|
+
? [firstRoot.toTree()]
|
|
82
|
+
: [firstRoot, randint(-10, 10, [firstRoot])]
|
|
83
|
+
.sort((a, b) => a - b)
|
|
84
|
+
.map((x) => x.toTree()))).toTex());
|
|
85
|
+
}
|
|
86
|
+
return shuffleProps(propositions, n);
|
|
87
|
+
};
|
|
88
|
+
const isAnswerValid = (ans, { answer, type, a, b }) => {
|
|
89
|
+
let roots = [];
|
|
90
|
+
switch (type) {
|
|
91
|
+
case 1:
|
|
92
|
+
{
|
|
93
|
+
const trinom = new Trinom(a, b, 0);
|
|
94
|
+
roots = trinom.getRootsNode();
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
case 2:
|
|
98
|
+
{
|
|
99
|
+
roots = [new Rational(-b, a).simplify().toTree()];
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
case 3:
|
|
103
|
+
{
|
|
104
|
+
roots = [new Rational(b, a).simplify().toTree()];
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case 4:
|
|
108
|
+
{
|
|
109
|
+
roots = [b, -b].sort((a, b) => a - b).map((x) => x.toTree());
|
|
110
|
+
}
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
const answerTree = new EquationSolutionNode(new DiscreteSetNode(roots), {
|
|
114
|
+
opts: { allowFractionToDecimal: true, allowRawRightChildAsSolution: true },
|
|
115
|
+
});
|
|
116
|
+
return answerTree.toAllValidTexs().includes(ans);
|
|
117
|
+
};
|
|
118
|
+
export const solveSecondDegreeEquationByFactorisation = {
|
|
119
|
+
id: "solveSecondDegreeEquationByFactorisation",
|
|
120
|
+
connector: "\\iff",
|
|
121
|
+
label: "Résoudre une équation du second degré par factorisation",
|
|
122
|
+
levels: [],
|
|
123
|
+
isSingleStep: true,
|
|
124
|
+
sections: [],
|
|
125
|
+
generator: (nb) => getDistinctQuestions(getSolveSecondDegreeEquationByFactorisationQuestion, nb),
|
|
126
|
+
qcmTimer: 60,
|
|
127
|
+
freeTimer: 60,
|
|
128
|
+
getPropositions,
|
|
129
|
+
isAnswerValid,
|
|
130
|
+
subject: "Mathématiques",
|
|
131
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
coeffs: number[];
|
|
4
|
+
};
|
|
5
|
+
export declare const solveSecondDegreeEquationFromCano: Exercise<Identifiers>;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=solveSecondDegreeEquationFromCano.d.ts.map
|
package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solveSecondDegreeEquationFromCano.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAkEF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAcnE,CAAC"}
|