math-exercises 2.2.68 → 2.2.70
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/divisorsList.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisorsList.js +2 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +2 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +3 -6
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +3 -8
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.js +7 -9
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +6 -19
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.js +146 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts +9 -0
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts.map +1 -0
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +175 -0
- package/lib/exercises/math/functions/absolute/index.d.ts +1 -0
- package/lib/exercises/math/functions/absolute/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/coefficientsIdentification.js +3 -3
- package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts +2 -2
- package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/findSecondRoot.js +5 -5
- package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts +2 -2
- package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/rootsProduct.js +7 -7
- package/lib/exercises/math/functions/trinoms/rootsSum.d.ts +2 -2
- package/lib/exercises/math/functions/trinoms/rootsSum.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/rootsSum.js +9 -10
- package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.js +6 -6
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts +3 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.js +10 -22
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts +6 -1
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.js +34 -48
- package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +4 -1
- package/lib/exercises/math/geometry/index.d.ts +1 -0
- package/lib/exercises/math/geometry/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/index.js +1 -0
- package/lib/exercises/math/geometry/pythagore/isTriangleRight.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.d.ts +0 -3
- package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.js +19 -25
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts +1 -2
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +30 -65
- package/lib/exercises/math/geometry/quadrilaterals/index.d.ts +2 -0
- package/lib/exercises/math/geometry/quadrilaterals/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/quadrilaterals/index.js +17 -0
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts +14 -0
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -0
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.js +221 -0
- package/lib/exercises/math/geometry/thales/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/index.js +0 -1
- package/lib/exercises/math/geometry/thales/thales.js +2 -2
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts +3 -4
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.js +69 -78
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +4 -3
- package/lib/exercises/math/geometry/volumes/sphereVolume.js +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.d.ts +2 -3
- package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.js +32 -31
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts +3 -2
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +18 -28
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts +5 -4
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +60 -56
- package/lib/exercises/pc/index.d.ts +0 -4
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +6 -4
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
- package/lib/exercises/vea/equationVEA.d.ts +2 -0
- package/lib/exercises/vea/equationVEA.d.ts.map +1 -0
- package/lib/exercises/vea/equationVEA.js +24 -0
- package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
- package/lib/exercises/vea/sqrtVEA.d.ts +6 -0
- package/lib/exercises/vea/sqrtVEA.d.ts.map +1 -0
- package/lib/exercises/vea/sqrtVEA.js +30 -0
- package/lib/geogebra/geogebraConstructor.d.ts +2 -0
- package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
- package/lib/geogebra/geogebraConstructor.js +7 -0
- package/lib/index.d.ts +31 -46
- package/lib/index.d.ts.map +1 -1
- package/lib/math/complex/complex.d.ts +1 -1
- package/lib/math/geometry/angle.d.ts +26 -0
- package/lib/math/geometry/angle.d.ts.map +1 -0
- package/lib/math/geometry/angle.js +73 -0
- package/lib/math/geometry/line.d.ts +5 -1
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +17 -0
- package/lib/math/geometry/parallelogram.d.ts +23 -0
- package/lib/math/geometry/parallelogram.d.ts.map +1 -0
- package/lib/math/geometry/parallelogram.js +70 -0
- package/lib/math/geometry/point.d.ts +3 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +16 -0
- package/lib/math/geometry/quadrilateral.d.ts +15 -0
- package/lib/math/geometry/quadrilateral.d.ts.map +1 -0
- package/lib/math/geometry/quadrilateral.js +38 -0
- package/lib/math/geometry/rectangle.d.ts +24 -0
- package/lib/math/geometry/rectangle.d.ts.map +1 -0
- package/lib/math/geometry/rectangle.js +64 -0
- package/lib/math/geometry/rhombus.d.ts +19 -0
- package/lib/math/geometry/rhombus.d.ts.map +1 -0
- package/lib/math/geometry/rhombus.js +46 -0
- package/lib/math/geometry/rightTriangle.d.ts +31 -0
- package/lib/math/geometry/rightTriangle.d.ts.map +1 -0
- package/lib/math/geometry/rightTriangle.js +113 -0
- package/lib/math/geometry/segment.d.ts +24 -6
- package/lib/math/geometry/segment.d.ts.map +1 -1
- package/lib/math/geometry/segment.js +70 -4
- package/lib/math/geometry/square.d.ts +22 -0
- package/lib/math/geometry/square.d.ts.map +1 -0
- package/lib/math/geometry/square.js +43 -0
- package/lib/math/geometry/triangle.d.ts +45 -45
- package/lib/math/geometry/triangle.d.ts.map +1 -1
- package/lib/math/geometry/triangle.js +159 -186
- package/lib/math/geometry/vector.d.ts +2 -2
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +18 -9
- package/lib/math/numbers/nombre.d.ts +5 -0
- package/lib/math/numbers/nombre.d.ts.map +1 -1
- package/lib/math/numbers/nombre.js +12 -0
- package/lib/math/numbers/rationals/rational.d.ts +1 -1
- package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -1
- package/lib/math/numbers/reals/real.d.ts.map +1 -1
- package/lib/math/numbers/reals/real.js +3 -0
- package/lib/math/polynomials/generalAffine.d.ts +13 -0
- package/lib/math/polynomials/generalAffine.d.ts.map +1 -1
- package/lib/math/polynomials/generalAffine.js +25 -1
- package/lib/math/polynomials/polynomial.d.ts +1 -1
- package/lib/math/polynomials/trinom.d.ts +2 -2
- package/lib/math/utils/geometry/pythagoricianTriplets.d.ts +1 -0
- package/lib/math/utils/geometry/pythagoricianTriplets.d.ts.map +1 -1
- package/lib/math/utils/geometry/pythagoricianTriplets.js +14 -1
- package/lib/math/utils/random/randfloat.d.ts +1 -1
- package/lib/math/utils/random/randfloat.d.ts.map +1 -1
- package/lib/math/utils/random/randfloat.js +8 -1
- package/lib/math/utils/random/randint.d.ts +8 -1
- package/lib/math/utils/random/randint.d.ts.map +1 -1
- package/lib/math/utils/random/randint.js +6 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.d.ts +2 -1
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +6 -1
- package/lib/tree/nodes/functions/functionNode.d.ts +2 -2
- package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.d.ts +5 -5
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/node.d.ts +3 -1
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/node.js +1 -0
- package/lib/tree/nodes/nodeConstructor.d.ts +3 -0
- package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.js +9 -1
- package/lib/tree/nodes/numbers/numberNode.d.ts +2 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +6 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +2 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +6 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +3 -3
- package/lib/tree/nodes/polynomials/trinomNode.d.ts +70 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -0
- package/lib/tree/nodes/polynomials/trinomNode.js +156 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +1 -1
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +1 -0
- package/lib/tree/parsers/discreteSetParser.d.ts +3 -0
- package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -0
- package/lib/tree/parsers/discreteSetParser.js +23 -0
- package/lib/tree/parsers/equationSolutionParser.d.ts +1 -1
- package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
- package/lib/tree/parsers/equationSolutionParser.js +15 -4
- package/lib/tree/parsers/latexParser.d.ts +5 -1
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +17 -3
- package/lib/tree/parsers/monomParser.js +2 -2
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
- package/lib/tree/parsers/rationalParser.js +29 -24
- package/lib/tree/parsers/sqrtParser.d.ts +9 -0
- package/lib/tree/parsers/sqrtParser.d.ts.map +1 -0
- package/lib/tree/parsers/sqrtParser.js +52 -0
- package/lib/tree/parsers/trinomParser.d.ts +1 -1
- package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
- package/lib/tree/parsers/trinomParser.js +14 -2
- package/lib/tree/utilities/functionComposition.d.ts +1 -1
- package/lib/tree/utilities/functionComposition.d.ts.map +1 -1
- package/lib/utils/arrays/rotation.d.ts +8 -0
- package/lib/utils/arrays/rotation.d.ts.map +1 -0
- package/lib/utils/arrays/rotation.js +17 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divisorsList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisorsList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgDF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"divisorsList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisorsList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgDF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAc9C,CAAC"}
|
|
@@ -51,10 +51,11 @@ exports.divisorsList = {
|
|
|
51
51
|
levels: ["2nde"],
|
|
52
52
|
isSingleStep: true,
|
|
53
53
|
sections: ["Arithmétique"],
|
|
54
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getDivisorsListQuestion, nb),
|
|
54
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getDivisorsListQuestion, nb, 30),
|
|
55
55
|
qcmTimer: 60,
|
|
56
56
|
freeTimer: 60,
|
|
57
57
|
getPropositions,
|
|
58
58
|
isAnswerValid,
|
|
59
59
|
subject: "Mathématiques",
|
|
60
|
+
maxAllowedQuestions: 30,
|
|
60
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAST,MAAM,mBAAmB,CAAC;AAoD3B,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAsDF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAST,MAAM,mBAAmB,CAAC;AAoD3B,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAsDF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAc9C,CAAC"}
|
|
@@ -96,10 +96,11 @@ exports.primeNumbers = {
|
|
|
96
96
|
levels: ["5ème", "4ème", "3ème", "2nde"],
|
|
97
97
|
sections: ["Arithmétique"],
|
|
98
98
|
isSingleStep: false,
|
|
99
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPrimeNumbers, nb),
|
|
99
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPrimeNumbers, nb, 30),
|
|
100
100
|
qcmTimer: 60,
|
|
101
101
|
freeTimer: 60,
|
|
102
102
|
getPropositions,
|
|
103
103
|
isAnswerValid,
|
|
104
104
|
subject: "Mathématiques",
|
|
105
|
+
maxAllowedQuestions: 30,
|
|
105
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAS1C,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,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAS1C,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,eAAe,CAAC;CACvC,CAAC;AA8EF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAgBrD,CAAC"}
|
|
@@ -20,6 +20,7 @@ const getPropositions = (n, { answer }) => {
|
|
|
20
20
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
21
21
|
};
|
|
22
22
|
const getAnswer = (identifiers) => {
|
|
23
|
+
console.log(identifiers);
|
|
23
24
|
const statement = nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.statementIdentifiers);
|
|
24
25
|
return statement.simplify().toTex();
|
|
25
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAclC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4DF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAevD,CAAC"}
|
|
@@ -6,13 +6,12 @@ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQ
|
|
|
6
6
|
const equationKeys_1 = require("../../../../exercises/utils/keys/equationKeys");
|
|
7
7
|
const affine_1 = require("../../../../math/polynomials/affine");
|
|
8
8
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
|
-
const equationSolutionNode_1 = require("../../../../tree/nodes/equations/equationSolutionNode");
|
|
10
9
|
const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
|
|
11
10
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
12
|
-
const discreteSetNode_1 = require("../../../../tree/nodes/sets/discreteSetNode");
|
|
13
11
|
const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
|
|
14
12
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
15
13
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
14
|
+
const equationVEA_1 = require("../../../../exercises/vea/equationVEA");
|
|
16
15
|
const getEquationType1ExerciseQuestion = () => {
|
|
17
16
|
const b = (0, randint_1.randint)(-10, 11);
|
|
18
17
|
const a = (0, randint_1.randint)(-10, 11, [0]);
|
|
@@ -55,10 +54,8 @@ const getPropositions = (n, { answer, a, b }) => {
|
|
|
55
54
|
return (0, shuffle_1.shuffle)(propositions);
|
|
56
55
|
};
|
|
57
56
|
const isAnswerValid = (ans, { a, b }) => {
|
|
58
|
-
const solution = b - a;
|
|
59
|
-
|
|
60
|
-
const validLatexs = answerTree.toAllValidTexs();
|
|
61
|
-
return validLatexs.includes(ans);
|
|
57
|
+
const solution = (b - a).toTree().toTex();
|
|
58
|
+
return (0, equationVEA_1.equationVEA)(ans, solution);
|
|
62
59
|
};
|
|
63
60
|
exports.equationType1Exercise = {
|
|
64
61
|
id: "equa1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAsBlC,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAsBlC,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAM1C;;GAEG;AAGH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA2GF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAaF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBhE,CAAC"}
|
|
@@ -6,9 +6,7 @@ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQ
|
|
|
6
6
|
const equationKeys_1 = require("../../../../exercises/utils/keys/equationKeys");
|
|
7
7
|
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
8
8
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
|
-
const equationSolutionNode_1 = require("../../../../tree/nodes/equations/equationSolutionNode");
|
|
10
9
|
const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
|
|
11
|
-
const discreteSetNode_1 = require("../../../../tree/nodes/sets/discreteSetNode");
|
|
12
10
|
const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
13
11
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
14
12
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
@@ -19,6 +17,7 @@ const generalAffine_1 = require("../../../../math/polynomials/generalAffine");
|
|
|
19
17
|
const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
|
|
20
18
|
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
21
19
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
20
|
+
const equationVEA_1 = require("../../../../exercises/vea/equationVEA");
|
|
22
21
|
const rebuildIdentifiers = (oldIdentifiers) => {
|
|
23
22
|
if (!!oldIdentifiers.numberType)
|
|
24
23
|
return oldIdentifiers;
|
|
@@ -90,12 +89,8 @@ const getPropositions = (n, { answer, a, b }) => {
|
|
|
90
89
|
const isAnswerValid = (ans, { a, b }) => {
|
|
91
90
|
const aNode = nodeConstructor_1.NodeConstructor.fromIdentifiers(a);
|
|
92
91
|
const bNode = nodeConstructor_1.NodeConstructor.fromIdentifiers(b);
|
|
93
|
-
const solution = (0, fractionNode_1.frac)(bNode, aNode).simplify();
|
|
94
|
-
|
|
95
|
-
opts: { allowFractionToDecimal: true, allowRawRightChildAsSolution: true },
|
|
96
|
-
});
|
|
97
|
-
const validLatexs = answerTree.toAllValidTexs();
|
|
98
|
-
return validLatexs.includes(ans);
|
|
92
|
+
const solution = (0, fractionNode_1.frac)(bNode, aNode).simplify().toTex();
|
|
93
|
+
return (0, equationVEA_1.equationVEA)(ans, solution);
|
|
99
94
|
};
|
|
100
95
|
const options = [
|
|
101
96
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType3Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType3Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"equationType3Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType3Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAsBlC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiEF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
|
|
@@ -7,14 +7,14 @@ const equationKeys_1 = require("../../../../exercises/utils/keys/equationKeys");
|
|
|
7
7
|
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
8
8
|
const affine_1 = require("../../../../math/polynomials/affine");
|
|
9
9
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
10
|
-
const equationSolutionNode_1 = require("../../../../tree/nodes/equations/equationSolutionNode");
|
|
11
10
|
const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
|
|
12
|
-
const discreteSetNode_1 = require("../../../../tree/nodes/sets/discreteSetNode");
|
|
13
11
|
const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
14
12
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
15
13
|
const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
|
|
16
14
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
17
15
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
16
|
+
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
17
|
+
const equationVEA_1 = require("../../../../exercises/vea/equationVEA");
|
|
18
18
|
const getEquationType3ExerciseQuestion = () => {
|
|
19
19
|
const b = (0, randint_1.randint)(-10, 11, [0]);
|
|
20
20
|
const a = (0, randint_1.randint)(-10, 11, [0, 1]);
|
|
@@ -57,13 +57,11 @@ const getPropositions = (n, { answer, a, b, c }) => {
|
|
|
57
57
|
}
|
|
58
58
|
return (0, shuffle_1.shuffle)(propositions);
|
|
59
59
|
};
|
|
60
|
-
const isAnswerValid = (ans, { a, b, c }) => {
|
|
61
|
-
const solution =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const validLatexs = answerTree.toAllValidTexs();
|
|
66
|
-
return validLatexs.includes(ans);
|
|
60
|
+
const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
61
|
+
const solution = (0, fractionNode_1.frac)(c - b, a)
|
|
62
|
+
.simplify()
|
|
63
|
+
.toTex();
|
|
64
|
+
return (0, equationVEA_1.equationVEA)(ans, solution);
|
|
67
65
|
};
|
|
68
66
|
exports.equationType3Exercise = {
|
|
69
67
|
id: "equa3",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAkBlC;;GAEG;AAEH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA0EF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
|
|
@@ -7,11 +7,11 @@ const equationKeys_1 = require("../../../../exercises/utils/keys/equationKeys");
|
|
|
7
7
|
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
8
8
|
const affine_1 = require("../../../../math/polynomials/affine");
|
|
9
9
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
10
|
-
const equationSolutionNode_1 = require("../../../../tree/nodes/equations/equationSolutionNode");
|
|
11
10
|
const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
|
|
12
|
-
const discreteSetNode_1 = require("../../../../tree/nodes/sets/discreteSetNode");
|
|
13
11
|
const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
14
12
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
13
|
+
const equationVEA_1 = require("../../../../exercises/vea/equationVEA");
|
|
14
|
+
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
15
15
|
const getEquationType4ExerciseQuestion = () => {
|
|
16
16
|
const a = (0, randint_1.randint)(-10, 11, [0, 1]);
|
|
17
17
|
const b = (0, randint_1.randint)(-10, 11, [0]);
|
|
@@ -62,23 +62,10 @@ const getPropositions = (n, { answer, a, b, c, d }) => {
|
|
|
62
62
|
return (0, shuffle_1.shuffle)(propositions);
|
|
63
63
|
};
|
|
64
64
|
const isAnswerValid = (ans, { a, b, c, d }) => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// const solutionTex = solution.toTex();
|
|
70
|
-
// const decimal = round(solution.evaluate({}), 12).frenchify();
|
|
71
|
-
// const parsedSolution = parsed.simplify().toTex();
|
|
72
|
-
// return solutionTex === parsedSolution || decimal === parsedSolution;
|
|
73
|
-
// } catch (err) {
|
|
74
|
-
// return false;
|
|
75
|
-
// }
|
|
76
|
-
const solution = new rational_1.Rational(d - b, a - c).simplify().toTree();
|
|
77
|
-
const answerTree = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([solution]), {
|
|
78
|
-
opts: { allowFractionToDecimal: true, allowRawRightChildAsSolution: true },
|
|
79
|
-
});
|
|
80
|
-
const validLatexs = answerTree.toAllValidTexs();
|
|
81
|
-
return validLatexs.includes(ans);
|
|
65
|
+
const solution = (0, fractionNode_1.frac)(d - b, a - c)
|
|
66
|
+
.simplify()
|
|
67
|
+
.toTex();
|
|
68
|
+
return (0, equationVEA_1.equationVEA)(ans, solution);
|
|
82
69
|
};
|
|
83
70
|
exports.equationType4Exercise = {
|
|
84
71
|
id: "equa4",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factoByX.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoByX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqJF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAiB1C,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.factoByX = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const affine_1 = require("../../../../math/polynomials/affine");
|
|
7
|
+
const gcd_1 = require("../../../../math/utils/arithmetic/gcd");
|
|
8
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
|
+
const oppositeNode_1 = require("../../../../tree/nodes/functions/oppositeNode");
|
|
10
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
11
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
12
|
+
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
13
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
14
|
+
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
15
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
16
|
+
const propositions = [];
|
|
17
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
18
|
+
const { a, b } = identifiers;
|
|
19
|
+
let pgcd = (0, gcd_1.gcd)(a, b);
|
|
20
|
+
if (a < 0 && b < 0)
|
|
21
|
+
pgcd = -pgcd;
|
|
22
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, multiplyNode_1.multiply)("x", (0, addNode_1.add)(a, b)).toTex());
|
|
23
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, multiplyNode_1.multiply)("x", (0, addNode_1.add)((0, multiplyNode_1.multiply)(a / pgcd, "x").simplify(), b / pgcd)).toTex());
|
|
24
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, multiplyNode_1.multiply)((0, multiplyNode_1.multiply)(pgcd, "x").simplify(), (0, addNode_1.add)((0, multiplyNode_1.multiply)(a, "x").simplify(), b / pgcd)).toTex());
|
|
25
|
+
while (propositions.length < n) {
|
|
26
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, multiplyNode_1.multiply)("x", affine_1.AffineConstructor.random().toTree()).toTex());
|
|
27
|
+
}
|
|
28
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
const { a, b } = identifiers;
|
|
32
|
+
let pgcd = (0, gcd_1.gcd)(a, b);
|
|
33
|
+
if (a < 0 && b < 0)
|
|
34
|
+
pgcd = -pgcd;
|
|
35
|
+
const affine = (0, addNode_1.add)((0, multiplyNode_1.multiply)(a / pgcd, "x"), b / pgcd);
|
|
36
|
+
return (0, multiplyNode_1.multiply)((0, multiplyNode_1.multiply)(pgcd, "x"), affine).toTex();
|
|
37
|
+
};
|
|
38
|
+
const getStatementNode = (identifiers) => {
|
|
39
|
+
return (0, addNode_1.add)((0, multiplyNode_1.multiply)(identifiers.a, (0, powerNode_1.square)("x")), (0, multiplyNode_1.multiply)(identifiers.b, "x").simplify());
|
|
40
|
+
};
|
|
41
|
+
const getInstruction = (identifiers) => {
|
|
42
|
+
const statement = getStatementNode(identifiers);
|
|
43
|
+
return `Factoriser :
|
|
44
|
+
|
|
45
|
+
$$
|
|
46
|
+
${statement.toTex()}
|
|
47
|
+
$$`;
|
|
48
|
+
};
|
|
49
|
+
const getHint = (identifiers) => {
|
|
50
|
+
const { a, b } = identifiers;
|
|
51
|
+
const aMonom = (0, multiplyNode_1.multiply)(a, (0, powerNode_1.square)("x")).toTex();
|
|
52
|
+
const bMonom = (0, multiplyNode_1.multiply)(b, "x").toTex();
|
|
53
|
+
return `Repère le facteur commun : c'est le terme qui apparaît à la fois dans $${aMonom}$ et dans $${bMonom}$.`;
|
|
54
|
+
};
|
|
55
|
+
const getCorrection = (identifiers) => {
|
|
56
|
+
const { a, b } = identifiers;
|
|
57
|
+
const answer = getAnswer(identifiers);
|
|
58
|
+
const aMonom = (0, multiplyNode_1.multiply)(a, (0, powerNode_1.square)("x"));
|
|
59
|
+
const bMonom = (0, multiplyNode_1.multiply)(b, "x");
|
|
60
|
+
const statement = (0, addNode_1.add)(aMonom, bMonom).toTex();
|
|
61
|
+
let pgcd = (0, gcd_1.gcd)(a, b);
|
|
62
|
+
if (a < 0 && b < 0)
|
|
63
|
+
pgcd = -pgcd;
|
|
64
|
+
// ne renvoit pas des négatifs : devrait ?
|
|
65
|
+
const xMonom = (0, multiplyNode_1.multiply)(pgcd, "x");
|
|
66
|
+
let common = pgcd === -1 ? (0, oppositeNode_1.opposite)("x") : "x".toTree();
|
|
67
|
+
let hasCommon = false;
|
|
68
|
+
if (Math.abs(a) === Math.abs(b)) {
|
|
69
|
+
hasCommon = true;
|
|
70
|
+
if (a === b)
|
|
71
|
+
common = (0, multiplyNode_1.multiply)(a, common);
|
|
72
|
+
else
|
|
73
|
+
common = (0, multiplyNode_1.multiply)(Math.abs(a), common);
|
|
74
|
+
}
|
|
75
|
+
const detailed = (0, addNode_1.add)((0, multiplyNode_1.multiply)(xMonom, (0, multiplyNode_1.multiply)(a / pgcd, "x").simplify(), {
|
|
76
|
+
toTexOptions: { forceTimesSign: true, noPropagation: true },
|
|
77
|
+
}), (0, multiplyNode_1.multiply)(xMonom, b / pgcd)).toTex();
|
|
78
|
+
return `Le terme $${common.toTex()}$ apparaît à la fois dans $${aMonom.toTex()}$ et dans $${bMonom.toTex()}$.
|
|
79
|
+
|
|
80
|
+
${!hasCommon && pgcd !== 1 && pgcd !== -1
|
|
81
|
+
? `D'autre part, on peut factoriser $${a}$ et $${b}$ par $${pgcd}$. En effet,
|
|
82
|
+
|
|
83
|
+
$${a} = ${a / pgcd}\\times ${pgcd}$ et $${b} = ${b / pgcd}\\times ${pgcd}$.`
|
|
84
|
+
: ""}
|
|
85
|
+
|
|
86
|
+
On peut donc factoriser l'expression par $${xMonom.toTex()}$ :
|
|
87
|
+
|
|
88
|
+
${(0, alignTex_1.alignTex)([
|
|
89
|
+
["", "", statement],
|
|
90
|
+
["", "=", detailed],
|
|
91
|
+
["", "=", answer],
|
|
92
|
+
])}
|
|
93
|
+
`;
|
|
94
|
+
};
|
|
95
|
+
const getKeys = (identifiers) => {
|
|
96
|
+
return ["x"];
|
|
97
|
+
};
|
|
98
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
99
|
+
try {
|
|
100
|
+
const statement = getStatementNode(identifiers);
|
|
101
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
102
|
+
if (!parsed || !(0, multiplyNode_1.isMultiplyNode)(parsed))
|
|
103
|
+
return false;
|
|
104
|
+
return (parsed
|
|
105
|
+
.simplify({ forbidFactorize: true, towardsDistribute: true })
|
|
106
|
+
.toTex() === statement.toTex());
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const getFactoByXQuestion = (ops) => {
|
|
113
|
+
const a = (0, randint_1.randint)(-10, 10, [0], { favor: { value: 1, proba: 0.3 } });
|
|
114
|
+
const b = (0, randint_1.randint)(-10, 10, [0], a !== 1 ? { favor: { value: 1, proba: 0.3 } } : undefined);
|
|
115
|
+
const identifiers = {
|
|
116
|
+
a,
|
|
117
|
+
b,
|
|
118
|
+
};
|
|
119
|
+
const question = {
|
|
120
|
+
answer: getAnswer(identifiers),
|
|
121
|
+
instruction: getInstruction(identifiers),
|
|
122
|
+
keys: getKeys(identifiers),
|
|
123
|
+
answerFormat: "tex",
|
|
124
|
+
identifiers,
|
|
125
|
+
hint: getHint(identifiers),
|
|
126
|
+
correction: getCorrection(identifiers),
|
|
127
|
+
};
|
|
128
|
+
return question;
|
|
129
|
+
};
|
|
130
|
+
exports.factoByX = {
|
|
131
|
+
id: "factoByX",
|
|
132
|
+
connector: "=",
|
|
133
|
+
label: "Factorisation du type $ax^2 + bx$",
|
|
134
|
+
isSingleStep: false,
|
|
135
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFactoByXQuestion(opts), nb),
|
|
136
|
+
qcmTimer: 60,
|
|
137
|
+
freeTimer: 60,
|
|
138
|
+
getPropositions,
|
|
139
|
+
isAnswerValid,
|
|
140
|
+
subject: "Mathématiques",
|
|
141
|
+
getInstruction,
|
|
142
|
+
getHint,
|
|
143
|
+
getCorrection,
|
|
144
|
+
getAnswer,
|
|
145
|
+
hasHintAndCorrection: true,
|
|
146
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -21,3 +21,4 @@ __exportStar(require("./factoType1Exercise"), exports);
|
|
|
21
21
|
__exportStar(require("./factorizeCanonicalForm"), exports);
|
|
22
22
|
__exportStar(require("./factorizeCanonicalFormWithSqrt"), exports);
|
|
23
23
|
__exportStar(require("./factoType2"), exports);
|
|
24
|
+
__exportStar(require("./factoByX"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
import { GeneralAffineIdentifiers } from "../../../../math/polynomials/generalAffine";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
firstAffine: GeneralAffineIdentifiers;
|
|
5
|
+
secondAffine: GeneralAffineIdentifiers;
|
|
6
|
+
};
|
|
7
|
+
export declare const absolueValueAffineEquation: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=absolueValueAffineEquation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"absolueValueAffineEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/absolueValueAffineEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAGL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAM9C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,wBAAwB,CAAC;IACtC,YAAY,EAAE,wBAAwB,CAAC;CACxC,CAAC;AAyKF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAiB5D,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.absolueValueAffineEquation = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const integer_1 = require("../../../../math/numbers/integer/integer");
|
|
7
|
+
const nombre_1 = require("../../../../math/numbers/nombre");
|
|
8
|
+
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
9
|
+
const generalAffine_1 = require("../../../../math/polynomials/generalAffine");
|
|
10
|
+
const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
|
|
11
|
+
const absNode_1 = require("../../../../tree/nodes/functions/absNode");
|
|
12
|
+
const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
|
|
13
|
+
const getPropositions = (n, { answer }) => {
|
|
14
|
+
const propositions = [];
|
|
15
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
16
|
+
while (propositions.length < n) {
|
|
17
|
+
const fracs = [
|
|
18
|
+
rational_1.RationalConstructor.randomIrreductibleWithSign().toTree(),
|
|
19
|
+
rational_1.RationalConstructor.randomIrreductibleWithSign().toTree(),
|
|
20
|
+
].sort((a, b) => a.evaluate() - b.evaluate());
|
|
21
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `x=${fracs[0].toTex()}\\text{ ou }${fracs[1].toTex()}`);
|
|
22
|
+
}
|
|
23
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
24
|
+
};
|
|
25
|
+
const getAnswerNode = (identifiers) => {
|
|
26
|
+
const affines = [
|
|
27
|
+
generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.firstAffine),
|
|
28
|
+
generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.secondAffine),
|
|
29
|
+
];
|
|
30
|
+
const firstIntersec = affines[0].xIntersect(affines[1]);
|
|
31
|
+
const oppositeAffine = affines[1].opposite();
|
|
32
|
+
const secondIntersec = oppositeAffine.xIntersect(affines[0]);
|
|
33
|
+
const res = [firstIntersec, secondIntersec]
|
|
34
|
+
.filter(Boolean)
|
|
35
|
+
.sort((a, b) => a.evaluate() - b.evaluate());
|
|
36
|
+
return res;
|
|
37
|
+
};
|
|
38
|
+
const getAnswer = (identifiers) => {
|
|
39
|
+
const nodes = getAnswerNode(identifiers);
|
|
40
|
+
if (nodes.length > 1)
|
|
41
|
+
return `x=${nodes[0].toTex()}\\text{ ou }x=${nodes[1].toTex()}`;
|
|
42
|
+
return `x=${nodes[0]?.toTex() || nodes[1]?.toTex()}`;
|
|
43
|
+
};
|
|
44
|
+
const getInstruction = (identifiers) => {
|
|
45
|
+
const affines = [
|
|
46
|
+
generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.firstAffine),
|
|
47
|
+
generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.secondAffine),
|
|
48
|
+
];
|
|
49
|
+
const node = (0, equalNode_1.equal)((0, absNode_1.abs)(affines[0].toTree()), (0, absNode_1.abs)(affines[1].toTree()));
|
|
50
|
+
return `Résoudre :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
${node.toTex()}
|
|
54
|
+
$$`;
|
|
55
|
+
};
|
|
56
|
+
const getHint = (identifiers) => {
|
|
57
|
+
return `L'égalité $|a|=|b|$ est vraie si et seulement si $a = b$ ou $a = -b$.`;
|
|
58
|
+
};
|
|
59
|
+
const getCorrection = (identifiers) => {
|
|
60
|
+
const affines = [
|
|
61
|
+
generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.firstAffine),
|
|
62
|
+
generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.secondAffine),
|
|
63
|
+
];
|
|
64
|
+
const firstIntersec = affines[0].xIntersect(affines[1]);
|
|
65
|
+
const oppositeAffine = affines[1].opposite();
|
|
66
|
+
const secondIntersec = oppositeAffine.xIntersect(affines[0]);
|
|
67
|
+
const res = [firstIntersec, secondIntersec]
|
|
68
|
+
.filter(Boolean)
|
|
69
|
+
.sort((a, b) => a.evaluate() - b.evaluate());
|
|
70
|
+
return `L'égalité $|a|=|b|$ est vraie si et seulement si $a = b$ ou $a=-b$.
|
|
71
|
+
|
|
72
|
+
On doit donc résoudre deux équations: d'une part,
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
${affines[0].toTree().toTex()} = ${affines[1].toTree().toTex()}
|
|
76
|
+
$$
|
|
77
|
+
|
|
78
|
+
${firstIntersec
|
|
79
|
+
? `ce qui donne :
|
|
80
|
+
|
|
81
|
+
$$
|
|
82
|
+
x=${firstIntersec?.toTex()}
|
|
83
|
+
$$`
|
|
84
|
+
: "qui n'a pas de solution, "}
|
|
85
|
+
|
|
86
|
+
et d'autre part :
|
|
87
|
+
|
|
88
|
+
$$
|
|
89
|
+
${affines[0].toTree().toTex()} = ${oppositeAffine.toTree().toTex()}
|
|
90
|
+
$$
|
|
91
|
+
|
|
92
|
+
${secondIntersec
|
|
93
|
+
? `ce qui donne :
|
|
94
|
+
|
|
95
|
+
$$
|
|
96
|
+
x=${secondIntersec?.toTex()}
|
|
97
|
+
$$`
|
|
98
|
+
: "qui n'a pas de solution."}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
Ainsi, la solution de cette équation est :
|
|
102
|
+
|
|
103
|
+
$$
|
|
104
|
+
${res.length > 1
|
|
105
|
+
? `x=${res[0].toTex()} \\text{ ou } x=${res[1].toTex()}`
|
|
106
|
+
: `x=${res[0]?.toTex() || res[1]?.toTex()}`}
|
|
107
|
+
`;
|
|
108
|
+
};
|
|
109
|
+
const getKeys = (identifiers) => {
|
|
110
|
+
return ["x", "equal", "ou"];
|
|
111
|
+
};
|
|
112
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
113
|
+
const parsedOu = ans.split("\\text{ ou }");
|
|
114
|
+
try {
|
|
115
|
+
const nodes = [];
|
|
116
|
+
parsedOu.forEach((item) => {
|
|
117
|
+
//un eleve qui efface le ou peut se retrouver avec un texte vide
|
|
118
|
+
let formated = item.replaceAll("\\text{ }", "");
|
|
119
|
+
const equalForm = formated.split("=");
|
|
120
|
+
if (equalForm.length > 1 && equalForm[0] !== "x")
|
|
121
|
+
throw Error("wrong answer");
|
|
122
|
+
const nbStr = equalForm.length > 1 ? equalForm[1] : formated;
|
|
123
|
+
const node = (0, rationalParser_1.rationalParser)(nbStr);
|
|
124
|
+
if (!node)
|
|
125
|
+
throw Error("wrong answer");
|
|
126
|
+
nodes.push(node);
|
|
127
|
+
});
|
|
128
|
+
const answerNodes = getAnswerNode(identifiers);
|
|
129
|
+
return answerNodes.every((e) => nodes.some((n) => n.evaluate() === e.evaluate()));
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const getAbsolueValueAffineEquationQuestion = (ops) => {
|
|
136
|
+
const types = [nombre_1.NumberType.Integer];
|
|
137
|
+
const [a, c] = nombre_1.NombreConstructor.manyRandom(4, {
|
|
138
|
+
types,
|
|
139
|
+
excludes: [new integer_1.Integer(0)],
|
|
140
|
+
}).map((e) => e.toTree());
|
|
141
|
+
const [b, d] = nombre_1.NombreConstructor.manyRandom(4, {
|
|
142
|
+
types,
|
|
143
|
+
}).map((e) => e.toTree());
|
|
144
|
+
const identifiers = {
|
|
145
|
+
firstAffine: new generalAffine_1.GeneralAffine(a, b).toIdentifiers(),
|
|
146
|
+
secondAffine: new generalAffine_1.GeneralAffine(c, d).toIdentifiers(),
|
|
147
|
+
};
|
|
148
|
+
const question = {
|
|
149
|
+
answer: getAnswer(identifiers),
|
|
150
|
+
instruction: getInstruction(identifiers),
|
|
151
|
+
keys: getKeys(identifiers),
|
|
152
|
+
answerFormat: "tex",
|
|
153
|
+
identifiers,
|
|
154
|
+
hint: getHint(identifiers),
|
|
155
|
+
correction: getCorrection(identifiers),
|
|
156
|
+
};
|
|
157
|
+
return question;
|
|
158
|
+
};
|
|
159
|
+
exports.absolueValueAffineEquation = {
|
|
160
|
+
id: "absolueValueAffineEquation",
|
|
161
|
+
connector: "\\iff",
|
|
162
|
+
label: "Résoudre une équation avec valeur absolue du type $|ax+b|=|cx+d|$",
|
|
163
|
+
isSingleStep: false,
|
|
164
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getAbsolueValueAffineEquationQuestion(opts), nb),
|
|
165
|
+
qcmTimer: 60,
|
|
166
|
+
freeTimer: 60,
|
|
167
|
+
getPropositions,
|
|
168
|
+
isAnswerValid,
|
|
169
|
+
subject: "Mathématiques",
|
|
170
|
+
getInstruction,
|
|
171
|
+
getHint,
|
|
172
|
+
getCorrection,
|
|
173
|
+
getAnswer,
|
|
174
|
+
hasHintAndCorrection: true,
|
|
175
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./absoluteValueEquations"), exports);
|
|
18
18
|
__exportStar(require("./absoluteValueInequations"), exports);
|
|
19
|
+
__exportStar(require("./absolueValueAffineEquation"), exports);
|
|
@@ -4,7 +4,7 @@ exports.coefficientsIdentification = void 0;
|
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
7
|
-
const
|
|
7
|
+
const trinomNode_1 = require("../../../../tree/nodes/polynomials/trinomNode");
|
|
8
8
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
9
|
const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
|
|
10
10
|
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
@@ -15,7 +15,7 @@ const random_1 = require("../../../../utils/alea/random");
|
|
|
15
15
|
const getPropositions = (n, { answer, aIdentifiers, bIdentifiers, cIdentifiers, isAsking }) => {
|
|
16
16
|
const propositions = [];
|
|
17
17
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
18
|
-
const trinom = new
|
|
18
|
+
const trinom = new trinomNode_1.TrinomNode(nodeConstructor_1.NodeConstructor.fromIdentifiers(aIdentifiers), nodeConstructor_1.NodeConstructor.fromIdentifiers(bIdentifiers), nodeConstructor_1.NodeConstructor.fromIdentifiers(cIdentifiers));
|
|
19
19
|
if (answer === "1") {
|
|
20
20
|
(0, exercise_1.tryToAddWrongProp)(propositions, "0");
|
|
21
21
|
}
|
|
@@ -50,7 +50,7 @@ const getAnswer = (identifiers) => {
|
|
|
50
50
|
: nodeConstructor_1.NodeConstructor.fromIdentifiers(cIdentifiers).toTex();
|
|
51
51
|
};
|
|
52
52
|
const getInstruction = (identifiers) => {
|
|
53
|
-
const trinom = new
|
|
53
|
+
const trinom = new trinomNode_1.TrinomNode(nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.aIdentifiers), nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.bIdentifiers), nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.cIdentifiers));
|
|
54
54
|
return `Soit $f$ la fonction polynôme de degré $2$ définie sur $\\mathbb{R}$ par :
|
|
55
55
|
|
|
56
56
|
$$
|