math-exercises 3.0.30 → 3.0.32
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/euclideanDivision.js +2 -2
- package/lib/exercises/math/calcul/fractions/fractionsProduct.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsProduct.js +1 -3
- package/lib/exercises/math/calcul/fractions/fractionsSubstraction.js +2 -2
- package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +1 -1
- package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +1 -1
- package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/simplifyFraction.js +19 -10
- package/lib/exercises/math/calculLitteral/distributivity/allIdentities.js +3 -3
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.js +155 -0
- package/lib/exercises/math/calculLitteral/distributivity/idRmq1.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/distributivity/idRmq1.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/idRmq1.js +147 -0
- package/lib/exercises/math/calculLitteral/distributivity/idRmq2.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/distributivity/idRmq2.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/idRmq2.js +150 -0
- package/lib/exercises/math/calculLitteral/distributivity/idRmq3.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/distributivity/idRmq3.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/idRmq3.js +143 -0
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +4 -4
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/index.js +4 -4
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.js +1 -0
- package/lib/exercises/math/calculLitteral/equation/equa1.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/equation/equa1.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equa1.js +111 -0
- package/lib/exercises/math/calculLitteral/equation/equa2.d.ts +17 -0
- package/lib/exercises/math/calculLitteral/equation/equa2.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equa2.js +164 -0
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts +12 -0
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equa3.js +113 -0
- package/lib/exercises/math/calculLitteral/equation/equa4.d.ts +13 -0
- package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equa4.js +106 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +4 -4
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +4 -4
- package/lib/exercises/math/derivation/derivative/expDerivativeOne.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeOne.js +0 -6
- package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.js +30 -0
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +26 -11
- package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logSimplifiying.js +1 -1
- package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/affineProductSign.js +3 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.js +64 -72
- package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.js +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +31 -14
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +1 -2
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.js +3 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.js +3 -0
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts +1 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.js +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.js +1 -1
- package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/midpoint.js +19 -6
- package/lib/exercises/math/geometry/cartesian/pointCoordinates.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +2 -2
- 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 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.d.ts +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.js +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +1 -1
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts +4 -4
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -1
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.js +4 -4
- package/lib/exercises/math/geometry/thales/thales.d.ts +1 -1
- package/lib/exercises/math/geometry/thales/thales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/thales.js +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.js +1 -1
- package/lib/exercises/math/geometry/triangles/index.d.ts +1 -1
- package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/index.js +2 -1
- package/lib/exercises/math/geometry/triangles/triangleNature.d.ts +9 -0
- package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/triangleNature.js +121 -0
- package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.d.ts +9 -0
- package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.js +134 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaNorms.d.ts +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaNorms.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaNorms.js +1 -1
- package/lib/exercises/math/percent/percentToDecimal.js +2 -2
- package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/ballsBasicProbas.js +29 -16
- package/lib/exercises/math/probaStat/cardBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/cardBasicProbas.js +44 -32
- package/lib/exercises/math/probaStat/stats1var/median.js +2 -2
- package/lib/exercises/math/probaStat/stats1var/medianList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianList.js +28 -12
- package/lib/exercises/math/squareRoots/simpifySquareRoot.js +1 -1
- package/lib/exercises/math/squareRoots/squareRootsProducts.js +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.d.ts +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.js +1 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts +1 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +1 -1
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts +1 -1
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +2 -2
- package/lib/exercises/pc/index.d.ts +4 -4
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +4 -4
- package/lib/index.d.ts +18 -15
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/angle.d.ts +6 -0
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/angle.js +20 -7
- package/lib/math/geometry/quadrilaterals/parallelogram.d.ts +23 -0
- package/lib/math/geometry/quadrilaterals/parallelogram.d.ts.map +1 -0
- package/lib/math/geometry/quadrilaterals/parallelogram.js +65 -0
- package/lib/math/geometry/quadrilaterals/quadrilateral.d.ts +15 -0
- package/lib/math/geometry/quadrilaterals/quadrilateral.d.ts.map +1 -0
- package/lib/math/geometry/quadrilaterals/quadrilateral.js +38 -0
- package/lib/math/geometry/quadrilaterals/rectangle.d.ts +24 -0
- package/lib/math/geometry/quadrilaterals/rectangle.d.ts.map +1 -0
- package/lib/math/geometry/quadrilaterals/rectangle.js +59 -0
- package/lib/math/geometry/quadrilaterals/rhombus.d.ts +19 -0
- package/lib/math/geometry/quadrilaterals/rhombus.d.ts.map +1 -0
- package/lib/math/geometry/quadrilaterals/rhombus.js +41 -0
- package/lib/math/geometry/quadrilaterals/square.d.ts +22 -0
- package/lib/math/geometry/quadrilaterals/square.d.ts.map +1 -0
- package/lib/math/geometry/quadrilaterals/square.js +38 -0
- package/lib/math/geometry/triangles/equilateralTriangle.d.ts +21 -0
- package/lib/math/geometry/triangles/equilateralTriangle.d.ts.map +1 -0
- package/lib/math/geometry/triangles/equilateralTriangle.js +52 -0
- package/lib/math/geometry/triangles/isoceleTriangle.d.ts +23 -0
- package/lib/math/geometry/triangles/isoceleTriangle.d.ts.map +1 -0
- package/lib/math/geometry/triangles/isoceleTriangle.js +66 -0
- package/lib/math/geometry/triangles/rightTriangle.d.ts +31 -0
- package/lib/math/geometry/triangles/rightTriangle.d.ts.map +1 -0
- package/lib/math/geometry/triangles/rightTriangle.js +108 -0
- package/lib/math/geometry/triangles/triangle.d.ts +68 -0
- package/lib/math/geometry/triangles/triangle.d.ts.map +1 -0
- package/lib/math/geometry/triangles/triangle.js +240 -0
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +0 -11
- package/lib/math/polynomials/trinom.d.ts +1 -1
- package/lib/math/polynomials/trinom.d.ts.map +1 -1
- package/lib/math/polynomials/trinom.js +7 -17
- package/lib/tree/nodes/complex/complexNode.d.ts +9 -3
- package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.js +18 -1
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/node.d.ts +2 -1
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/node.js +1 -0
- package/lib/tree/nodes/sets/belongsNode.d.ts +0 -1
- package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/belongsNode.js +0 -3
- package/lib/tree/nodes/sets/discreteSetNode.d.ts +8 -2
- package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/discreteSetNode.js +20 -2
- package/lib/tree/nodes/sets/intervalNode.d.ts +6 -2
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +15 -1
- package/lib/tree/nodes/sets/setNode.d.ts +3 -1
- package/lib/tree/nodes/sets/setNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts +8 -2
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +16 -0
- package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
- package/lib/tree/parsers/discreteSetParser.js +0 -2
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equa4.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equa4.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAkBrC;;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;AAkGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAoBvD,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { addValidProp, 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 { Affine } from "../../../../math/polynomials/affine.js";
|
|
6
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
+
import { EqualNode, equationResolutionTex, } from "../../../../tree/nodes/equations/equalNode.js";
|
|
8
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
9
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
10
|
+
import { equationVEA } from "../../../../exercises/vea/equationVEA.js";
|
|
11
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
12
|
+
const getStatementNode = (identifiers) => {
|
|
13
|
+
const { a, b, c, d } = identifiers;
|
|
14
|
+
const affines = [new Affine(a, b), new Affine(c, d)];
|
|
15
|
+
const statementTree = new EqualNode(affines[0].toTree(), affines[1].toTree());
|
|
16
|
+
return statementTree;
|
|
17
|
+
};
|
|
18
|
+
const getInstruction = (identifiers) => {
|
|
19
|
+
return `Résoudre :
|
|
20
|
+
|
|
21
|
+
$$
|
|
22
|
+
${getStatementNode(identifiers).toTex()}
|
|
23
|
+
$$`;
|
|
24
|
+
};
|
|
25
|
+
const getStartStatement = (identifiers) => {
|
|
26
|
+
return getStatementNode(identifiers).toTex();
|
|
27
|
+
};
|
|
28
|
+
const getAnswer = (identifiers) => {
|
|
29
|
+
const { a, b, c, d } = identifiers;
|
|
30
|
+
const solution = new Rational(d - b, a - c).simplify();
|
|
31
|
+
const answerTree = new EqualNode(new VariableNode("x"), solution.toTree());
|
|
32
|
+
const answer = answerTree.toTex();
|
|
33
|
+
return answer;
|
|
34
|
+
};
|
|
35
|
+
const getEquationType4ExerciseQuestion = () => {
|
|
36
|
+
const a = randint(-10, 11, [0, 1]);
|
|
37
|
+
const b = randint(-10, 11, [0]);
|
|
38
|
+
const c = randint(-10, 11, [0, a]);
|
|
39
|
+
const d = randint(-10, 11, [0]);
|
|
40
|
+
const identifiers = {
|
|
41
|
+
a,
|
|
42
|
+
b,
|
|
43
|
+
c,
|
|
44
|
+
d,
|
|
45
|
+
};
|
|
46
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
47
|
+
};
|
|
48
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
49
|
+
const question = {
|
|
50
|
+
instruction: getInstruction(identifiers),
|
|
51
|
+
startStatement: getStartStatement(identifiers),
|
|
52
|
+
answer: getAnswer(identifiers),
|
|
53
|
+
keys: equationKeys,
|
|
54
|
+
answerFormat: "tex",
|
|
55
|
+
identifiers,
|
|
56
|
+
hint: getHint(identifiers),
|
|
57
|
+
correction: getCorrection(identifiers),
|
|
58
|
+
};
|
|
59
|
+
return question;
|
|
60
|
+
};
|
|
61
|
+
const getHint = (identifiers) => {
|
|
62
|
+
return `Commence par regrouper les termes en $x$ d'un même côté de l'équation. Puis, isole $x$ en effectuant les bonnes opérations.`;
|
|
63
|
+
};
|
|
64
|
+
const getCorrection = (identifiers) => {
|
|
65
|
+
const { a, b, c, d } = identifiers;
|
|
66
|
+
return `On regroupe les nombres d'un côté, et les termes en $x$ de l'autre :
|
|
67
|
+
|
|
68
|
+
$$
|
|
69
|
+
${equationResolutionTex(a.toTree(), b.toTree(), c.toTree(), d.toTree())}
|
|
70
|
+
$$`;
|
|
71
|
+
};
|
|
72
|
+
const getPropositions = (n, { answer, a, b, c, d }) => {
|
|
73
|
+
const propositions = [];
|
|
74
|
+
addValidProp(propositions, answer);
|
|
75
|
+
while (propositions.length < n) {
|
|
76
|
+
const wrongAnswer = new Rational(d - b + randint(-7, 8, [0, -d + b]), a - c + randint(-7, 8, [-a + c, 0])).simplify();
|
|
77
|
+
tryToAddWrongProp(propositions, new EqualNode(new VariableNode("x"), wrongAnswer.toTree()).toTex());
|
|
78
|
+
}
|
|
79
|
+
return shuffle(propositions);
|
|
80
|
+
};
|
|
81
|
+
const isAnswerValid = (ans, { a, b, c, d }) => {
|
|
82
|
+
const solution = frac(d - b, a - c)
|
|
83
|
+
.simplify()
|
|
84
|
+
.toTex();
|
|
85
|
+
return equationVEA(ans, solution);
|
|
86
|
+
};
|
|
87
|
+
export const equationType4Exercise = {
|
|
88
|
+
id: "equa4",
|
|
89
|
+
connector: "\\iff",
|
|
90
|
+
label: "Résoudre une équation du type $ax+b=cx+d$",
|
|
91
|
+
levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
|
|
92
|
+
sections: ["Équations"],
|
|
93
|
+
isSingleStep: false,
|
|
94
|
+
generator: (nb) => getDistinctQuestions(getEquationType4ExerciseQuestion, nb),
|
|
95
|
+
qcmTimer: 60,
|
|
96
|
+
freeTimer: 60,
|
|
97
|
+
getPropositions,
|
|
98
|
+
isAnswerValid,
|
|
99
|
+
subject: "Mathématiques",
|
|
100
|
+
getInstruction,
|
|
101
|
+
getAnswer,
|
|
102
|
+
getQuestionFromIdentifiers,
|
|
103
|
+
getHint,
|
|
104
|
+
getCorrection,
|
|
105
|
+
hasHintAndCorrection: true,
|
|
106
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from "./equationSimpleSquare.js";
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
2
|
+
export * from "./equa1.js";
|
|
3
|
+
export * from "./equa2.js";
|
|
4
|
+
export * from "./equa3.js";
|
|
5
|
+
export * from "./equa4.js";
|
|
6
6
|
export * from "./fractionEquation.js";
|
|
7
7
|
export * from "./multiplicationEquation.js";
|
|
8
8
|
export * from "./firstDegreeEquation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from "./equationSimpleSquare.js";
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
2
|
+
export * from "./equa1.js";
|
|
3
|
+
export * from "./equa2.js";
|
|
4
|
+
export * from "./equa3.js";
|
|
5
|
+
export * from "./equa4.js";
|
|
6
6
|
export * from "./fractionEquation.js";
|
|
7
7
|
export * from "./multiplicationEquation.js";
|
|
8
8
|
export * from "./firstDegreeEquation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expDerivativeOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/expDerivativeOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"expDerivativeOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/expDerivativeOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+EF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
|
|
@@ -58,12 +58,6 @@ const isAnswerValid = (ans, { answer, a, b }) => {
|
|
|
58
58
|
const parsed = parseAlgebraic(ans);
|
|
59
59
|
if (!parsed)
|
|
60
60
|
return false;
|
|
61
|
-
console.log(parsed
|
|
62
|
-
.simplify({
|
|
63
|
-
towardsDistribute: true,
|
|
64
|
-
forbidFactorize: true,
|
|
65
|
-
})
|
|
66
|
-
.toTex());
|
|
67
61
|
return (parsed
|
|
68
62
|
.simplify({
|
|
69
63
|
towardsDistribute: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/powerFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"powerFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/powerFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAsJF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAiBzD,CAAC"}
|
|
@@ -7,6 +7,31 @@ import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
|
7
7
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
8
8
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
9
9
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
11
|
+
const getHint = (identifiers) => {
|
|
12
|
+
return `On rappelle que la dérivée de la fonction $kx^n$ est :
|
|
13
|
+
|
|
14
|
+
$$
|
|
15
|
+
k\\times n \\times x^{n-1}
|
|
16
|
+
$$`;
|
|
17
|
+
};
|
|
18
|
+
const getCorrection = (identifiers) => {
|
|
19
|
+
const { a, power } = identifiers;
|
|
20
|
+
return `La dérivée de la fonction $kx^n$ est :
|
|
21
|
+
|
|
22
|
+
$$
|
|
23
|
+
k\\times n \\times x^{n-1}
|
|
24
|
+
$$
|
|
25
|
+
|
|
26
|
+
Ici, on a $k = ${a}$ et $n = ${power}$.
|
|
27
|
+
|
|
28
|
+
On obtient donc :
|
|
29
|
+
|
|
30
|
+
${alignTex([
|
|
31
|
+
["f'(x)", "=", `${a} \\times ${power} \\times x^{${power}-1}`],
|
|
32
|
+
["", "=", getAnswer(identifiers)],
|
|
33
|
+
])}`;
|
|
34
|
+
};
|
|
10
35
|
const getInstruction = (identifiers) => {
|
|
11
36
|
const { a, power } = identifiers;
|
|
12
37
|
const statement = new MultiplyNode(new NumberNode(a), new PowerNode(new VariableNode("x"), new NumberNode(power)));
|
|
@@ -35,6 +60,8 @@ const getPowerFunctionDerivative = () => {
|
|
|
35
60
|
keys: ["x"],
|
|
36
61
|
answerFormat: "tex",
|
|
37
62
|
identifiers,
|
|
63
|
+
hint: getHint(identifiers),
|
|
64
|
+
correction: getCorrection(identifiers),
|
|
38
65
|
};
|
|
39
66
|
return question;
|
|
40
67
|
};
|
|
@@ -85,4 +112,7 @@ export const powerFunctionDerivative = {
|
|
|
85
112
|
subject: "Mathématiques",
|
|
86
113
|
getInstruction,
|
|
87
114
|
getAnswer,
|
|
115
|
+
getHint,
|
|
116
|
+
getCorrection,
|
|
117
|
+
hasHintAndCorrection: true,
|
|
88
118
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA4EF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
|
|
@@ -8,13 +8,17 @@ import { randint } from "../../../../math/utils/random/randint.js";
|
|
|
8
8
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
9
9
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
10
10
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
return "Déterminer le coefficient directeur de la droite représentée ci-dessous : ";
|
|
13
|
+
};
|
|
14
|
+
const getAnswer = (identifiers) => {
|
|
15
|
+
const { xA, yA, xB, yB } = identifiers;
|
|
16
16
|
const a = frac(yB - yA, xB - xA).simplify();
|
|
17
17
|
const answer = a.toTex();
|
|
18
|
+
return answer;
|
|
19
|
+
};
|
|
20
|
+
const getGGBOptions = (identifiers) => {
|
|
21
|
+
const { xA, yA, xB, yB } = identifiers;
|
|
18
22
|
const xMin = Math.min(xA, xB);
|
|
19
23
|
const xMax = Math.max(xA, xB);
|
|
20
24
|
const yMin = Math.min(yA, yB);
|
|
@@ -27,15 +31,23 @@ const getLeadingCoefficientQuestion = () => {
|
|
|
27
31
|
const ggb = new GeogebraConstructor({
|
|
28
32
|
commands,
|
|
29
33
|
});
|
|
34
|
+
return ggb.getOptions({
|
|
35
|
+
coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const getLeadingCoefficientQuestion = () => {
|
|
39
|
+
let xA, yA, xB, yB;
|
|
40
|
+
[xA, yA] = [1, 2].map((el) => randint(-5, 6));
|
|
41
|
+
xB = xA > 0 ? randint(xA - 4, 6, [xA]) : randint(-4, xA + 5, [xA]); // l'écart entre les deux points ne soit pas grand
|
|
42
|
+
yB = yA > 0 ? randint(yA - 4, 6) : randint(-4, yA + 5);
|
|
43
|
+
const identifiers = { xA, xB, yA, yB };
|
|
30
44
|
const question = {
|
|
31
|
-
instruction:
|
|
32
|
-
answer,
|
|
45
|
+
instruction: getInstruction(identifiers),
|
|
46
|
+
answer: getAnswer(identifiers),
|
|
33
47
|
keys: [],
|
|
34
|
-
ggbOptions:
|
|
35
|
-
coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
|
|
36
|
-
}),
|
|
48
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
37
49
|
answerFormat: "tex",
|
|
38
|
-
identifiers
|
|
50
|
+
identifiers,
|
|
39
51
|
};
|
|
40
52
|
return question;
|
|
41
53
|
};
|
|
@@ -67,4 +79,7 @@ export const leadingCoefficient = {
|
|
|
67
79
|
isAnswerValid,
|
|
68
80
|
hasGeogebra: true,
|
|
69
81
|
subject: "Mathématiques",
|
|
82
|
+
getAnswer,
|
|
83
|
+
getInstruction,
|
|
84
|
+
getGGBOptions,
|
|
70
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IAEjB,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CACpB,CAAC;AAmNF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAoB9D,CAAC"}
|
|
@@ -21,7 +21,7 @@ const getStatementNode = (identifiers) => {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
const getInstruction = (identifiers) => {
|
|
24
|
-
return
|
|
24
|
+
return `Écrire le nombre suivant sous la forme $\\ln\\left(a\\right)$ :
|
|
25
25
|
|
|
26
26
|
$$
|
|
27
27
|
${getStatementNode(identifiers).toTex()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineProductSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAejD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AA8IF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAaF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"affineProductSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAejD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AA8IF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAaF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solveSecondDegreeEquationByFactorisation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"solveSecondDegreeEquationByFactorisation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAiHF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAiB1E,CAAC"}
|
package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { equationKeys } from "../../../../../exercises/utils/keys/equationKeys.js";
|
|
4
|
-
import { Rational } from "../../../../../math/numbers/rationals/rational.js";
|
|
5
4
|
import { Trinom } from "../../../../../math/polynomials/trinom.js";
|
|
6
5
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { equal } from "../../../../../tree/nodes/equations/equalNode.js";
|
|
7
7
|
import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
8
|
-
import {
|
|
8
|
+
import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { DiscreteSetNode, set } from "../../../../../tree/nodes/sets/discreteSetNode.js";
|
|
10
|
+
import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
|
|
9
11
|
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
12
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
10
13
|
/**
|
|
11
14
|
* Equation donnée sous forme ax^2 + bx ou bien forme développée d'une identité remarquable
|
|
12
15
|
* type 1 ax^2 + bx
|
|
@@ -14,61 +17,69 @@ import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
|
14
17
|
* type 3 (ax-b)^2
|
|
15
18
|
* type 4 (ax+b)(ax-b)
|
|
16
19
|
*/
|
|
17
|
-
const
|
|
18
|
-
const type =
|
|
19
|
-
let statement
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const getStatementNode = (identifiers) => {
|
|
21
|
+
const { a, b, type } = identifiers;
|
|
22
|
+
let statement;
|
|
23
|
+
switch (type) {
|
|
24
|
+
case 1:
|
|
25
|
+
//ax^2 + bx
|
|
26
|
+
const trinom = new Trinom(a, b, 0);
|
|
27
|
+
return trinom.toTex();
|
|
28
|
+
case 2:
|
|
29
|
+
//(ax+b)^2
|
|
30
|
+
return new Trinom(a ** 2, 2 * a * b, b ** 2).toTex();
|
|
31
|
+
case 3:
|
|
32
|
+
//(ax-b)^2
|
|
33
|
+
return new Trinom(a ** 2, -2 * a * b, b ** 2).toTex();
|
|
34
|
+
case 4:
|
|
35
|
+
default:
|
|
36
|
+
//(ax+b)(ax-b)
|
|
37
|
+
return new Trinom(a ** 2, 0, -(b ** 2)).toTex();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const getInstruction = (identifiers) => {
|
|
41
|
+
const instruction = `Soit $f$ la fonction définie par :
|
|
42
|
+
|
|
43
|
+
$$
|
|
44
|
+
f(x) = ${getStatementNode(identifiers)}
|
|
45
|
+
$$
|
|
46
|
+
|
|
47
|
+
Factoriser $f(x)$, puis résoudre l'équation $f(x) = 0$.`;
|
|
48
|
+
return instruction;
|
|
49
|
+
};
|
|
50
|
+
const getAnswer = (identifiers) => {
|
|
51
|
+
const { a, b, type } = identifiers;
|
|
52
|
+
let roots;
|
|
24
53
|
switch (type) {
|
|
25
54
|
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
|
-
}
|
|
55
|
+
roots = set([(0).toTree(), frac(-b, a)]).simplify();
|
|
34
56
|
break;
|
|
35
57
|
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
|
-
}
|
|
58
|
+
roots = set([frac(-b, a).simplify()]);
|
|
43
59
|
break;
|
|
44
60
|
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
|
-
}
|
|
61
|
+
roots = set([frac(b, a)]).simplify();
|
|
52
62
|
break;
|
|
53
63
|
case 4:
|
|
54
64
|
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
|
-
}
|
|
65
|
+
roots = set([frac(-b, a), frac(b, a)]).simplify();
|
|
62
66
|
break;
|
|
63
67
|
}
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
return equal("S", roots).toTex();
|
|
69
|
+
};
|
|
70
|
+
const getSolveSecondDegreeEquationByFactorisationQuestion = () => {
|
|
71
|
+
const type = randint(1, 4);
|
|
72
|
+
let a;
|
|
73
|
+
let b;
|
|
74
|
+
a = randint(-9, 10, [0]);
|
|
75
|
+
b = randint([2, 4].includes(type) ? 1 : -9, 10, [0]);
|
|
76
|
+
const identifiers = { a, b, type };
|
|
66
77
|
const question = {
|
|
67
|
-
answer,
|
|
68
|
-
instruction,
|
|
78
|
+
answer: getAnswer(identifiers),
|
|
79
|
+
instruction: getInstruction(identifiers),
|
|
69
80
|
keys: [...equationKeys],
|
|
70
81
|
answerFormat: "tex",
|
|
71
|
-
identifiers
|
|
82
|
+
identifiers,
|
|
72
83
|
};
|
|
73
84
|
return question;
|
|
74
85
|
};
|
|
@@ -86,46 +97,27 @@ const getPropositions = (n, { answer }) => {
|
|
|
86
97
|
return shuffleProps(propositions, n);
|
|
87
98
|
};
|
|
88
99
|
const isAnswerValid = (ans, { answer, type, a, b }) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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;
|
|
100
|
+
try {
|
|
101
|
+
const parsed = discreteSetParser(ans);
|
|
102
|
+
if (!parsed)
|
|
103
|
+
return false;
|
|
104
|
+
return ("S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return handleVEAError(err);
|
|
112
108
|
}
|
|
113
|
-
const answerTree = new EquationSolutionNode(new DiscreteSetNode(roots), {
|
|
114
|
-
opts: { allowFractionToDecimal: true, allowRawRightChildAsSolution: true },
|
|
115
|
-
});
|
|
116
|
-
return answerTree.toAllValidTexs().includes(ans);
|
|
117
109
|
};
|
|
118
110
|
export const solveSecondDegreeEquationByFactorisation = {
|
|
119
111
|
id: "solveSecondDegreeEquationByFactorisation",
|
|
120
112
|
connector: "\\iff",
|
|
121
113
|
label: "Résoudre une équation du second degré par factorisation",
|
|
122
|
-
levels: [],
|
|
123
114
|
isSingleStep: true,
|
|
124
|
-
sections: [],
|
|
125
115
|
generator: (nb) => getDistinctQuestions(getSolveSecondDegreeEquationByFactorisationQuestion, nb),
|
|
126
116
|
qcmTimer: 60,
|
|
127
117
|
freeTimer: 60,
|
|
128
118
|
getPropositions,
|
|
129
119
|
isAnswerValid,
|
|
130
120
|
subject: "Mathématiques",
|
|
121
|
+
getAnswer,
|
|
122
|
+
getInstruction,
|
|
131
123
|
};
|
|
@@ -1 +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;
|
|
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;AAuSF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAmB3D,CAAC"}
|
|
@@ -29,7 +29,7 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
29
29
|
let x2 = randint(-8, 9, [0]);
|
|
30
30
|
if (x1 > x2)
|
|
31
31
|
[x1, x2] = [x2, x1];
|
|
32
|
-
tryToAddWrongProp(propositions, multiply(randint(-5, 6, [0]), multiply(substract("x", x1), substract("x", x2))).toTex());
|
|
32
|
+
tryToAddWrongProp(propositions, multiply(randint(-5, 6, [0]), multiply(substract("x", x1).simplify(), substract("x", x2).simplify())).toTex());
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA6FF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAgBzD,CAAC"}
|
|
@@ -2,22 +2,33 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../../exercises/exerc
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
4
4
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
5
|
-
import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
6
5
|
import { OppositeNode } from "../../../../../tree/nodes/functions/oppositeNode.js";
|
|
7
6
|
import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
|
|
8
|
-
import {
|
|
7
|
+
import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
|
|
9
8
|
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { a, b, c } = identifiers;
|
|
12
|
+
const trinom = new Trinom(a, b, c);
|
|
13
|
+
return `Soit $f(x) = ${trinom
|
|
14
|
+
.toFactorized()
|
|
15
|
+
.toTex()}$. Résoudre l'équation $f(x) = 0$.`;
|
|
16
|
+
};
|
|
17
|
+
const getAnswer = (identifiers) => {
|
|
18
|
+
const { a, b, c } = identifiers;
|
|
19
|
+
const trinom = new Trinom(a, b, c);
|
|
20
|
+
const answer = trinom.getRootsEquationSolutionTex();
|
|
21
|
+
return answer;
|
|
22
|
+
};
|
|
10
23
|
const getRootsFromFactorizedFormQuestion = () => {
|
|
11
24
|
const trinom = TrinomConstructor.randomFactorized();
|
|
12
|
-
const
|
|
25
|
+
const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
|
|
13
26
|
const question = {
|
|
14
|
-
answer:
|
|
15
|
-
instruction:
|
|
16
|
-
.getFactorizedForm()
|
|
17
|
-
.toTex()}$. Résoudre l'équation $f(x) = 0$.`,
|
|
27
|
+
answer: getAnswer(identifiers),
|
|
28
|
+
instruction: getInstruction(identifiers),
|
|
18
29
|
keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
|
|
19
30
|
answerFormat: "tex",
|
|
20
|
-
identifiers
|
|
31
|
+
identifiers,
|
|
21
32
|
};
|
|
22
33
|
return question;
|
|
23
34
|
};
|
|
@@ -44,12 +55,16 @@ const getPropositions = (n, { answer, a, b, c }) => {
|
|
|
44
55
|
}
|
|
45
56
|
return shuffle(propositions);
|
|
46
57
|
};
|
|
47
|
-
const isAnswerValid = (ans, { a, b, c }) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
59
|
+
try {
|
|
60
|
+
const parsed = discreteSetParser(ans);
|
|
61
|
+
if (!parsed)
|
|
62
|
+
return false;
|
|
63
|
+
return ("S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
return handleVEAError(err);
|
|
67
|
+
}
|
|
53
68
|
};
|
|
54
69
|
export const rootsFromFactorizedForm = {
|
|
55
70
|
id: "rootsFromFactorizedForm",
|
|
@@ -64,4 +79,6 @@ export const rootsFromFactorizedForm = {
|
|
|
64
79
|
getPropositions,
|
|
65
80
|
isAnswerValid,
|
|
66
81
|
subject: "Mathématiques",
|
|
82
|
+
getInstruction,
|
|
83
|
+
getAnswer,
|
|
67
84
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootsReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"rootsReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAc9C,CAAC"}
|
|
@@ -54,6 +54,7 @@ const getPropositions = (n, { answer }) => {
|
|
|
54
54
|
const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
55
55
|
const roots = new Trinom(a, b, c).getRoots();
|
|
56
56
|
const studentNumbers = ans
|
|
57
|
+
.replaceAll("\\text{ }", "")
|
|
57
58
|
.split("\\text{ et }")
|
|
58
59
|
.map((n) => Number(n.replace(",", ".")))
|
|
59
60
|
.filter((n) => !isNaN(n))
|
|
@@ -64,9 +65,7 @@ const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
|
64
65
|
export const rootsReading = {
|
|
65
66
|
id: "rootsReading",
|
|
66
67
|
label: "Lire graphiquement les racines d'un trinôme",
|
|
67
|
-
levels: ["1reSpé", "1rePro"],
|
|
68
68
|
isSingleStep: true,
|
|
69
|
-
sections: ["Second degré"],
|
|
70
69
|
generator: (nb) => getDistinctQuestions(getRootsReadingQuestion, nb),
|
|
71
70
|
qcmTimer: 60,
|
|
72
71
|
freeTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinomSignFromFacto.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/sign/trinomSignFromFacto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAwHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"trinomSignFromFacto.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/sign/trinomSignFromFacto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAwHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAoBrD,CAAC"}
|