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,11 @@
|
|
|
1
|
+
import { Exercise, QCMGenerator, QuestionGenerator, VEA } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
affine1Coeffs: number[];
|
|
4
|
+
affine2Coeffs: number[];
|
|
5
|
+
};
|
|
6
|
+
export declare const getThirdIdentityQuestion: QuestionGenerator<Identifiers>;
|
|
7
|
+
export declare const getThirdIdentityPropositions: QCMGenerator<Identifiers>;
|
|
8
|
+
export declare const isThirdIdentityAnswerValid: VEA<Identifiers>;
|
|
9
|
+
export declare const thirdIdentity: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=idRmq3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idRmq3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/idRmq3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAoEF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,WAAW,CAkBnE,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CA2BlE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,GAAG,CAAC,WAAW,CAgBvD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAiB/C,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.js";
|
|
4
|
+
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
5
|
+
import { SquareNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
6
|
+
import { SubstractNode, isSubstractNode, } from "../../../../tree/nodes/operators/substractNode.js";
|
|
7
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
8
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
10
|
+
import { isAddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
11
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
const getStatementNode = (identifiers) => {
|
|
13
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
14
|
+
const affine = new Affine(affine1Coeffs[1], affine1Coeffs[0]);
|
|
15
|
+
const affine2 = new Affine(affine2Coeffs[1], affine2Coeffs[0]);
|
|
16
|
+
const statementTree = new MultiplyNode(affine.toTree(), affine2.toTree());
|
|
17
|
+
return statementTree;
|
|
18
|
+
};
|
|
19
|
+
const getStartStatement = (identifiers) => {
|
|
20
|
+
return getStatementNode(identifiers).toTex();
|
|
21
|
+
};
|
|
22
|
+
const getInstruction = (identifiers) => {
|
|
23
|
+
return `Développer et réduire :
|
|
24
|
+
|
|
25
|
+
$$
|
|
26
|
+
${getStartStatement(identifiers)}
|
|
27
|
+
$$`;
|
|
28
|
+
};
|
|
29
|
+
const getAnswer = (identifiers) => {
|
|
30
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
31
|
+
const affine = new Affine(affine1Coeffs[1], affine1Coeffs[0]);
|
|
32
|
+
const affine2 = new Affine(affine2Coeffs[1], affine2Coeffs[0]);
|
|
33
|
+
const answer = affine.multiply(affine2).toTree().toTex();
|
|
34
|
+
return answer;
|
|
35
|
+
};
|
|
36
|
+
const getHint = (identifiers) => {
|
|
37
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
38
|
+
const affine = new Affine(affine1Coeffs[1], affine1Coeffs[0]);
|
|
39
|
+
const aMonom = new MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
40
|
+
const bPositive = Math.abs(affine.b);
|
|
41
|
+
return `Utilise l'identité remarquable
|
|
42
|
+
|
|
43
|
+
$$
|
|
44
|
+
(a-b)(a+b) = a^2 - b^2
|
|
45
|
+
$$
|
|
46
|
+
|
|
47
|
+
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$`;
|
|
48
|
+
};
|
|
49
|
+
const getCorrection = (identifiers) => {
|
|
50
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
51
|
+
const affine = new Affine(affine1Coeffs[1], affine1Coeffs[0]);
|
|
52
|
+
const aMonom = new MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
53
|
+
const bPositive = Math.abs(affine.b);
|
|
54
|
+
const statementTex = getStartStatement(identifiers);
|
|
55
|
+
const answer = getAnswer(identifiers);
|
|
56
|
+
return `
|
|
57
|
+
On utilise l'identité remarquable
|
|
58
|
+
|
|
59
|
+
$$
|
|
60
|
+
(a-b)(a+b) = a^2 - b^2
|
|
61
|
+
$$
|
|
62
|
+
|
|
63
|
+
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$.
|
|
64
|
+
|
|
65
|
+
${alignTex([
|
|
66
|
+
[
|
|
67
|
+
statementTex,
|
|
68
|
+
"=",
|
|
69
|
+
new SubstractNode(new SquareNode(aMonom), new SquareNode(bPositive.toTree())).toTex(),
|
|
70
|
+
],
|
|
71
|
+
["", "=", answer],
|
|
72
|
+
])}`;
|
|
73
|
+
};
|
|
74
|
+
export const getThirdIdentityQuestion = () => {
|
|
75
|
+
const affine = AffineConstructor.random(undefined, { excludes: [0] });
|
|
76
|
+
const affine2 = new Affine(affine.a, -affine.b);
|
|
77
|
+
const identifiers = {
|
|
78
|
+
affine1Coeffs: affine.coefficients,
|
|
79
|
+
affine2Coeffs: affine2.coefficients,
|
|
80
|
+
};
|
|
81
|
+
const question = {
|
|
82
|
+
instruction: getInstruction(identifiers),
|
|
83
|
+
startStatement: getStartStatement(identifiers),
|
|
84
|
+
answer: getAnswer(identifiers),
|
|
85
|
+
keys: ["x"],
|
|
86
|
+
answerFormat: "tex",
|
|
87
|
+
identifiers,
|
|
88
|
+
hint: getHint(identifiers),
|
|
89
|
+
correction: getCorrection(identifiers),
|
|
90
|
+
};
|
|
91
|
+
return question;
|
|
92
|
+
};
|
|
93
|
+
export const getThirdIdentityPropositions = (n, { answer, affine1Coeffs, affine2Coeffs }) => {
|
|
94
|
+
const propositions = [];
|
|
95
|
+
addValidProp(propositions, answer);
|
|
96
|
+
const affine = new Affine(affine1Coeffs[1], affine1Coeffs[0]);
|
|
97
|
+
const affine2 = new Affine(affine2Coeffs[1], affine2Coeffs[0]);
|
|
98
|
+
tryToAddWrongProp(propositions, affine.multiply(affine2.opposite()).toTree().toTex());
|
|
99
|
+
tryToAddWrongProp(propositions, affine.multiply(affine).toTree().toTex());
|
|
100
|
+
tryToAddWrongProp(propositions, affine2.multiply(affine2.opposite()).toTree().toTex());
|
|
101
|
+
while (propositions.length < n) {
|
|
102
|
+
const affineTemp = AffineConstructor.random(undefined, {
|
|
103
|
+
excludes: [0],
|
|
104
|
+
});
|
|
105
|
+
const affineTemp2 = new Affine(affineTemp.a, -affineTemp.b);
|
|
106
|
+
const wrongAnswer = affineTemp.multiply(affineTemp2).toTree();
|
|
107
|
+
tryToAddWrongProp(propositions, wrongAnswer.toTex());
|
|
108
|
+
}
|
|
109
|
+
return shuffle(propositions);
|
|
110
|
+
};
|
|
111
|
+
export const isThirdIdentityAnswerValid = (ans, { answer, affine1Coeffs, affine2Coeffs }) => {
|
|
112
|
+
try {
|
|
113
|
+
const parsed = parseAlgebraic(ans);
|
|
114
|
+
if (!parsed)
|
|
115
|
+
return false;
|
|
116
|
+
if (!isAddNode(parsed) && !isSubstractNode(parsed))
|
|
117
|
+
return false;
|
|
118
|
+
return (parsed
|
|
119
|
+
.simplify({ forbidFactorize: true, towardsDistribute: true })
|
|
120
|
+
.toTex() === answer);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
return handleVEAError(err);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
export const thirdIdentity = {
|
|
127
|
+
id: "idRmq3",
|
|
128
|
+
connector: "=",
|
|
129
|
+
label: "Identité remarquable $(a+b)(a-b)$",
|
|
130
|
+
isSingleStep: false,
|
|
131
|
+
generator: (nb) => getDistinctQuestions(getThirdIdentityQuestion, nb),
|
|
132
|
+
getPropositions: getThirdIdentityPropositions,
|
|
133
|
+
isAnswerValid: isThirdIdentityAnswerValid,
|
|
134
|
+
qcmTimer: 60,
|
|
135
|
+
freeTimer: 60,
|
|
136
|
+
subject: "Mathématiques",
|
|
137
|
+
hasHintAndCorrection: true,
|
|
138
|
+
getInstruction,
|
|
139
|
+
getCorrection,
|
|
140
|
+
getHint,
|
|
141
|
+
getAnswer,
|
|
142
|
+
getStartStatement,
|
|
143
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from "./allIdentities.js";
|
|
2
|
-
export * from "./
|
|
3
|
-
export { firstIdentity } from "./
|
|
4
|
-
export { secondIdentity } from "./
|
|
2
|
+
export * from "./doubleDistri.js";
|
|
3
|
+
export { firstIdentity } from "./idRmq1.js";
|
|
4
|
+
export { secondIdentity } from "./idRmq2.js";
|
|
5
5
|
export * from "./simpleDistri.js";
|
|
6
|
-
export { thirdIdentity } from "./
|
|
6
|
+
export { thirdIdentity } from "./idRmq3.js";
|
|
7
7
|
export * from "./doubleDistributivityWithCoeff.js";
|
|
8
8
|
export * from "./canonicalFormDevelopment.js";
|
|
9
9
|
export * from "./simpleDistriXCoeff.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from "./allIdentities.js";
|
|
2
|
-
export * from "./
|
|
3
|
-
export { firstIdentity } from "./
|
|
4
|
-
export { secondIdentity } from "./
|
|
2
|
+
export * from "./doubleDistri.js";
|
|
3
|
+
export { firstIdentity } from "./idRmq1.js";
|
|
4
|
+
export { secondIdentity } from "./idRmq2.js";
|
|
5
5
|
export * from "./simpleDistri.js";
|
|
6
|
-
export { thirdIdentity } from "./
|
|
6
|
+
export { thirdIdentity } from "./idRmq3.js";
|
|
7
7
|
export * from "./doubleDistributivityWithCoeff.js";
|
|
8
8
|
export * from "./canonicalFormDevelopment.js";
|
|
9
9
|
export * from "./simpleDistriXCoeff.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleDistriXCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"simpleDistriXCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
/**
|
|
3
|
+
* type x+a=b
|
|
4
|
+
*/
|
|
5
|
+
type Identifiers = {
|
|
6
|
+
a: number;
|
|
7
|
+
b: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const equationType1Exercise: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=equa1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equa1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equa1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAqBvD,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
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 { Affine } from "../../../../math/polynomials/affine.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
7
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
8
|
+
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
9
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
10
|
+
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
11
|
+
import { equationVEA } from "../../../../exercises/vea/equationVEA.js";
|
|
12
|
+
const getInstruction = (identifiers) => {
|
|
13
|
+
const { a, b } = identifiers;
|
|
14
|
+
const affine = new Affine(1, a).toTree();
|
|
15
|
+
const tree = new EqualNode(affine, new NumberNode(b));
|
|
16
|
+
const statementTree = tree.toTex();
|
|
17
|
+
return `Résoudre :
|
|
18
|
+
|
|
19
|
+
$$
|
|
20
|
+
${statementTree}
|
|
21
|
+
$$`;
|
|
22
|
+
};
|
|
23
|
+
const getAnswer = (identifiers) => {
|
|
24
|
+
const { a, b } = identifiers;
|
|
25
|
+
const solution = b - a;
|
|
26
|
+
const answer = `x=${solution}`;
|
|
27
|
+
return answer;
|
|
28
|
+
};
|
|
29
|
+
const getHint = (identifiers) => {
|
|
30
|
+
const { a, b } = identifiers;
|
|
31
|
+
return `Il faut isoler $x$ à gauche. Pour cela, effectue l'opération des deux côtés de l'équation qui permet de supprimer le terme $${a < 0 ? "" : "+"}${a}$.`;
|
|
32
|
+
};
|
|
33
|
+
const getCorrection = (identifiers) => {
|
|
34
|
+
const { a, b } = identifiers;
|
|
35
|
+
const affine = new Affine(1, a).toTree();
|
|
36
|
+
const tree = new EqualNode(affine, new NumberNode(b));
|
|
37
|
+
const statementTree = tree.toTex();
|
|
38
|
+
const answer = getAnswer(identifiers);
|
|
39
|
+
return `Pour isoler $x$ à gauche, on effectue l'opération $${a > 0 ? `-${a}` : `+${Math.abs(a)}`}$ des deux côtés de l'équation :
|
|
40
|
+
|
|
41
|
+
${alignTex([
|
|
42
|
+
[
|
|
43
|
+
`${statementTree}`,
|
|
44
|
+
"\\iff",
|
|
45
|
+
new EqualNode(new AddNode(affine, new NumberNode(-a)), new AddNode(b.toTree(), new NumberNode(-a))).toTex(),
|
|
46
|
+
],
|
|
47
|
+
["", "\\iff", answer],
|
|
48
|
+
])}`;
|
|
49
|
+
};
|
|
50
|
+
const getStartStatement = (identifiers) => {
|
|
51
|
+
const { a, b } = identifiers;
|
|
52
|
+
const affine = new Affine(1, a).toTree();
|
|
53
|
+
const tree = new EqualNode(affine, new NumberNode(b));
|
|
54
|
+
const statementTree = tree.toTex();
|
|
55
|
+
return statementTree;
|
|
56
|
+
};
|
|
57
|
+
const getEquationType1ExerciseQuestion = () => {
|
|
58
|
+
const b = randint(-10, 11);
|
|
59
|
+
const a = randint(-10, 11, [0]);
|
|
60
|
+
const identifiers = { a, b };
|
|
61
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
62
|
+
};
|
|
63
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
64
|
+
const question = {
|
|
65
|
+
instruction: getInstruction(identifiers),
|
|
66
|
+
startStatement: getStartStatement(identifiers),
|
|
67
|
+
answer: getAnswer(identifiers),
|
|
68
|
+
keys: equationKeys,
|
|
69
|
+
answerFormat: "tex",
|
|
70
|
+
identifiers,
|
|
71
|
+
hint: getHint(identifiers),
|
|
72
|
+
correction: getCorrection(identifiers),
|
|
73
|
+
};
|
|
74
|
+
return question;
|
|
75
|
+
};
|
|
76
|
+
const getPropositions = (n, { answer, a, b }) => {
|
|
77
|
+
const propositions = [];
|
|
78
|
+
addValidProp(propositions, answer);
|
|
79
|
+
const solution = b - a;
|
|
80
|
+
tryToAddWrongProp(propositions, `x=${b + a}`);
|
|
81
|
+
while (propositions.length < n) {
|
|
82
|
+
const wrongAnswer = solution + randint(-3, 4, [0]);
|
|
83
|
+
tryToAddWrongProp(propositions, `x=${wrongAnswer}`);
|
|
84
|
+
}
|
|
85
|
+
return shuffle(propositions);
|
|
86
|
+
};
|
|
87
|
+
const isAnswerValid = (ans, { a, b }) => {
|
|
88
|
+
const solution = (b - a).toTree().toTex();
|
|
89
|
+
return equationVEA(ans, solution);
|
|
90
|
+
};
|
|
91
|
+
export const equationType1Exercise = {
|
|
92
|
+
id: "equa1",
|
|
93
|
+
connector: "\\iff",
|
|
94
|
+
label: "Résoudre une équation du type $x+a = b$",
|
|
95
|
+
levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
|
|
96
|
+
sections: ["Équations"],
|
|
97
|
+
isSingleStep: true,
|
|
98
|
+
generator: (nb) => getDistinctQuestions(getEquationType1ExerciseQuestion, nb),
|
|
99
|
+
getPropositions,
|
|
100
|
+
qcmTimer: 60,
|
|
101
|
+
freeTimer: 60,
|
|
102
|
+
isAnswerValid,
|
|
103
|
+
subject: "Mathématiques",
|
|
104
|
+
hasHintAndCorrection: true,
|
|
105
|
+
getCorrection,
|
|
106
|
+
getHint,
|
|
107
|
+
getInstruction,
|
|
108
|
+
getAnswer,
|
|
109
|
+
getStartStatement,
|
|
110
|
+
getQuestionFromIdentifiers,
|
|
111
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
/**
|
|
4
|
+
* type ax=b
|
|
5
|
+
*/
|
|
6
|
+
type Identifiers = {
|
|
7
|
+
a: NodeIdentifiers;
|
|
8
|
+
b: NodeIdentifiers;
|
|
9
|
+
isXRight: boolean;
|
|
10
|
+
aNumberType: string;
|
|
11
|
+
};
|
|
12
|
+
type Options = {
|
|
13
|
+
aNumberType: string[];
|
|
14
|
+
};
|
|
15
|
+
export declare const equationType2Exercise: Exercise<Identifiers, Options>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=equa2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equa2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equa2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAsBrC,OAAO,EAEL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C;;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;AA0JF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAaF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAuBhE,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, 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 { RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { EqualNode, equal } from "../../../../tree/nodes/equations/equalNode.js";
|
|
7
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
8
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
10
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
12
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
13
|
+
import { GeneralAffine } from "../../../../math/polynomials/generalAffine.js";
|
|
14
|
+
import { NodeConstructor, reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
15
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
16
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
17
|
+
import { equationVEA } from "../../../../exercises/vea/equationVEA.js";
|
|
18
|
+
const rebuildIdentifiers = (oldIdentifiers) => {
|
|
19
|
+
if (!!oldIdentifiers.aNumberType)
|
|
20
|
+
return oldIdentifiers;
|
|
21
|
+
return {
|
|
22
|
+
a: oldIdentifiers.a.toTree().toIdentifiers(),
|
|
23
|
+
b: oldIdentifiers.b.toTree().toIdentifiers(),
|
|
24
|
+
isXRight: false,
|
|
25
|
+
aNumberType: "Entier",
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
return `Résoudre :
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
${getStatementNode(identifiers).toTex()}
|
|
33
|
+
$$`;
|
|
34
|
+
};
|
|
35
|
+
const getAnswer = (identifiers) => {
|
|
36
|
+
const { a, b, isXRight, aNumberType } = identifiers;
|
|
37
|
+
const aTree = reifyAlgebraic(a);
|
|
38
|
+
const bTree = reifyAlgebraic(b);
|
|
39
|
+
const solution = frac(bTree, aTree).simplify();
|
|
40
|
+
const answer = new EqualNode(new VariableNode("x"), solution).toTex();
|
|
41
|
+
return answer;
|
|
42
|
+
};
|
|
43
|
+
const getHint = (identifiers) => {
|
|
44
|
+
const { a, b, isXRight, aNumberType } = identifiers;
|
|
45
|
+
const aTree = reifyAlgebraic(a);
|
|
46
|
+
const bTree = reifyAlgebraic(b);
|
|
47
|
+
return `Il faut isoler $x$ à ${isXRight ? "droite" : "gauche"}. Pour cela, effectue l'opération des deux côtés de l'équation qui permet de supprimer la multiplication par $${aTree.toTex()}$.`;
|
|
48
|
+
};
|
|
49
|
+
const getCorrection = (identifiers) => {
|
|
50
|
+
const { a, b, isXRight, aNumberType } = identifiers;
|
|
51
|
+
const aTree = reifyAlgebraic(a);
|
|
52
|
+
const bTree = reifyAlgebraic(b);
|
|
53
|
+
const affine = new GeneralAffine(aTree, 0).toTree();
|
|
54
|
+
const equalTree = new EqualNode(affine, bTree);
|
|
55
|
+
const tree = isXRight ? equalTree.reverse() : equalTree;
|
|
56
|
+
const answer = getAnswer(identifiers);
|
|
57
|
+
return `Pour isoler $x$ à ${isXRight ? "droite" : "gauche"}, on divise les deux côtés de l'équation par $${aTree.toTex()}$ :
|
|
58
|
+
|
|
59
|
+
${alignTex([
|
|
60
|
+
[
|
|
61
|
+
`${tree.toTex()}`,
|
|
62
|
+
"\\iff",
|
|
63
|
+
isXRight
|
|
64
|
+
? equal(frac(bTree, aTree), frac(affine, aTree)).toTex()
|
|
65
|
+
: equal(frac(affine, aTree), frac(bTree, aTree)).toTex(),
|
|
66
|
+
],
|
|
67
|
+
["", "\\iff", answer],
|
|
68
|
+
])}
|
|
69
|
+
`;
|
|
70
|
+
};
|
|
71
|
+
const getStatementNode = (identifiers) => {
|
|
72
|
+
const { a, b, isXRight, aNumberType } = identifiers;
|
|
73
|
+
const aTree = reifyAlgebraic(a);
|
|
74
|
+
const bTree = reifyAlgebraic(b);
|
|
75
|
+
const affine = new GeneralAffine(aTree, 0).toTree();
|
|
76
|
+
const equalTree = new EqualNode(affine, bTree);
|
|
77
|
+
const tree = isXRight ? equalTree.reverse() : equalTree;
|
|
78
|
+
return tree;
|
|
79
|
+
};
|
|
80
|
+
const getStartStatement = (identifiers) => {
|
|
81
|
+
return getStatementNode(identifiers).toTex();
|
|
82
|
+
};
|
|
83
|
+
const getEquationType2ExerciseQuestion = (opts) => {
|
|
84
|
+
const types = opts?.aNumberType ?? ["Entier"];
|
|
85
|
+
const b = randint(-10, 11).toTree();
|
|
86
|
+
const type = random(types);
|
|
87
|
+
const a = type === "Entier"
|
|
88
|
+
? randint(-9, 10, [0, 1]).toTree()
|
|
89
|
+
: RationalConstructor.randomIrreductibleWithSign().toTree();
|
|
90
|
+
const isXRight = coinFlip();
|
|
91
|
+
const identifiers = {
|
|
92
|
+
a: a.toIdentifiers(),
|
|
93
|
+
b: b.toIdentifiers(),
|
|
94
|
+
isXRight,
|
|
95
|
+
aNumberType: type,
|
|
96
|
+
};
|
|
97
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
98
|
+
};
|
|
99
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
100
|
+
const question = {
|
|
101
|
+
instruction: getInstruction(identifiers, opts),
|
|
102
|
+
startStatement: getStartStatement(identifiers, opts),
|
|
103
|
+
answer: getAnswer(identifiers, opts),
|
|
104
|
+
keys: equationKeys,
|
|
105
|
+
answerFormat: "tex",
|
|
106
|
+
identifiers,
|
|
107
|
+
hint: getHint(identifiers, opts),
|
|
108
|
+
correction: getCorrection(identifiers, opts),
|
|
109
|
+
};
|
|
110
|
+
return question;
|
|
111
|
+
};
|
|
112
|
+
const getPropositions = (n, { answer, a, b }) => {
|
|
113
|
+
const aNode = NodeConstructor.fromIdentifiers(a);
|
|
114
|
+
const bNode = NodeConstructor.fromIdentifiers(b);
|
|
115
|
+
const propositions = [];
|
|
116
|
+
addValidProp(propositions, answer);
|
|
117
|
+
tryToAddWrongProp(propositions, substract(bNode, aNode).simplify().toTex());
|
|
118
|
+
while (propositions.length < n) {
|
|
119
|
+
const bEv = randint(-7, 8, [0, -bNode.evaluate()]);
|
|
120
|
+
const a = add(aNode, randint(-7, 8, [-aNode.evaluate(), 0]));
|
|
121
|
+
const wrongAnswer = frac(bEv, a).simplify();
|
|
122
|
+
tryToAddWrongProp(propositions, new EqualNode(new VariableNode("x"), wrongAnswer).toTex());
|
|
123
|
+
}
|
|
124
|
+
return shuffle(propositions);
|
|
125
|
+
};
|
|
126
|
+
const isAnswerValid = (ans, { a, b }) => {
|
|
127
|
+
const aNode = NodeConstructor.fromIdentifiers(a);
|
|
128
|
+
const bNode = NodeConstructor.fromIdentifiers(b);
|
|
129
|
+
const solution = frac(bNode, aNode).simplify().toTex();
|
|
130
|
+
return equationVEA(ans, solution);
|
|
131
|
+
};
|
|
132
|
+
const options = [
|
|
133
|
+
{
|
|
134
|
+
id: "aNumberType",
|
|
135
|
+
label: "Type du coefficient $a$",
|
|
136
|
+
target: GeneratorOptionTarget.generation,
|
|
137
|
+
type: GeneratorOptionType.multiselect,
|
|
138
|
+
defaultValue: ["Entier"],
|
|
139
|
+
values: ["Entier", "Rationnel"],
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
export const equationType2Exercise = {
|
|
143
|
+
id: "equa2",
|
|
144
|
+
connector: "\\iff",
|
|
145
|
+
label: "Résoudre une équation du type $ax=b$",
|
|
146
|
+
levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
|
|
147
|
+
sections: ["Équations"],
|
|
148
|
+
isSingleStep: true,
|
|
149
|
+
generator: (nb, opts) => getDistinctQuestions(() => getEquationType2ExerciseQuestion(opts), nb),
|
|
150
|
+
qcmTimer: 60,
|
|
151
|
+
freeTimer: 60,
|
|
152
|
+
getPropositions,
|
|
153
|
+
isAnswerValid,
|
|
154
|
+
subject: "Mathématiques",
|
|
155
|
+
hasHintAndCorrection: true,
|
|
156
|
+
options,
|
|
157
|
+
getCorrection,
|
|
158
|
+
getHint,
|
|
159
|
+
getInstruction,
|
|
160
|
+
getAnswer,
|
|
161
|
+
getStartStatement,
|
|
162
|
+
rebuildIdentifiers,
|
|
163
|
+
getQuestionFromIdentifiers,
|
|
164
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
/**
|
|
3
|
+
* type ax+b=c
|
|
4
|
+
*/
|
|
5
|
+
type Identifiers = {
|
|
6
|
+
a: number;
|
|
7
|
+
b: number;
|
|
8
|
+
c: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const equationType3Exercise: Exercise<Identifiers>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=equa3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equa3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equa3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAerC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAsBvD,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
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 } 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 { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
11
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
12
|
+
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
13
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
14
|
+
import { equationVEA } from "../../../../exercises/vea/equationVEA.js";
|
|
15
|
+
const getStatementNode = (identifiers) => {
|
|
16
|
+
const { a, b, c } = identifiers;
|
|
17
|
+
const affine = new Affine(a, b).toTree();
|
|
18
|
+
const statementTree = new EqualNode(affine, new NumberNode(c));
|
|
19
|
+
return statementTree;
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers) => {
|
|
22
|
+
return `Résoudre :
|
|
23
|
+
|
|
24
|
+
$$
|
|
25
|
+
${getStatementNode(identifiers).toTex()}
|
|
26
|
+
$$`;
|
|
27
|
+
};
|
|
28
|
+
const getHint = (identifiers) => {
|
|
29
|
+
return "Isolez le terme $x$ dans la partie gauche de l'équation.";
|
|
30
|
+
};
|
|
31
|
+
const getCorrection = (identifiers) => {
|
|
32
|
+
const { a, b, c } = identifiers;
|
|
33
|
+
const statementTex = getStatementNode(identifiers).toTex();
|
|
34
|
+
const answer = getAnswer(identifiers);
|
|
35
|
+
return `Commencer par soustraire $${b}$ des deux côtés de l'équation pour
|
|
36
|
+
l'éliminer du côté gauche. Ensuite, diviser les deux côtés de l'équation par
|
|
37
|
+
$${a}$ pour isoler $x$, ce qui donne :
|
|
38
|
+
|
|
39
|
+
${alignTex([
|
|
40
|
+
[
|
|
41
|
+
statementTex,
|
|
42
|
+
"\\iff",
|
|
43
|
+
new EqualNode(new MultiplyNode(a.toTree(), new VariableNode("x")), (c - b).toTree()).toTex(),
|
|
44
|
+
],
|
|
45
|
+
["", "\\iff", answer],
|
|
46
|
+
])}`;
|
|
47
|
+
};
|
|
48
|
+
const getStartStatement = (identifiers) => {
|
|
49
|
+
return getStatementNode(identifiers).toTex();
|
|
50
|
+
};
|
|
51
|
+
const getAnswer = (identifiers) => {
|
|
52
|
+
const { a, b, c } = identifiers;
|
|
53
|
+
const solution = new Rational(c - b, a).simplify();
|
|
54
|
+
const answerTree = new EqualNode(new VariableNode("x"), solution.toTree());
|
|
55
|
+
const answer = answerTree.toTex();
|
|
56
|
+
return answer;
|
|
57
|
+
};
|
|
58
|
+
const getEquationType3ExerciseQuestion = () => {
|
|
59
|
+
const b = randint(-10, 11, [0]);
|
|
60
|
+
const a = randint(-10, 11, [0, 1]);
|
|
61
|
+
const c = randint(-10, 11);
|
|
62
|
+
const identifiers = { a, b, c };
|
|
63
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
64
|
+
};
|
|
65
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
66
|
+
const question = {
|
|
67
|
+
instruction: getInstruction(identifiers),
|
|
68
|
+
hint: getHint(identifiers),
|
|
69
|
+
correction: getCorrection(identifiers),
|
|
70
|
+
startStatement: getStartStatement(identifiers),
|
|
71
|
+
answer: getAnswer(identifiers),
|
|
72
|
+
keys: equationKeys,
|
|
73
|
+
answerFormat: "tex",
|
|
74
|
+
identifiers,
|
|
75
|
+
};
|
|
76
|
+
return question;
|
|
77
|
+
};
|
|
78
|
+
const getPropositions = (n, { answer, a, b, c }) => {
|
|
79
|
+
const propositions = [];
|
|
80
|
+
addValidProp(propositions, answer);
|
|
81
|
+
while (propositions.length < n) {
|
|
82
|
+
const wrongAnswer = new Rational(c - b + randint(-7, 8, [0, -c + b]), a + randint(-7, 8, [-a, 0])).simplify();
|
|
83
|
+
tryToAddWrongProp(propositions, new EqualNode(new VariableNode("x"), wrongAnswer.toTree()).toTex());
|
|
84
|
+
}
|
|
85
|
+
return shuffle(propositions);
|
|
86
|
+
};
|
|
87
|
+
const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
88
|
+
const solution = frac(c - b, a)
|
|
89
|
+
.simplify()
|
|
90
|
+
.toTex();
|
|
91
|
+
return equationVEA(ans, solution);
|
|
92
|
+
};
|
|
93
|
+
export const equationType3Exercise = {
|
|
94
|
+
id: "equa3",
|
|
95
|
+
connector: "\\iff",
|
|
96
|
+
label: "Résoudre une équation du type $ax+b=c$",
|
|
97
|
+
levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
|
|
98
|
+
sections: ["Équations"],
|
|
99
|
+
isSingleStep: false,
|
|
100
|
+
generator: (nb) => getDistinctQuestions(getEquationType3ExerciseQuestion, nb),
|
|
101
|
+
qcmTimer: 60,
|
|
102
|
+
freeTimer: 60,
|
|
103
|
+
getPropositions,
|
|
104
|
+
isAnswerValid,
|
|
105
|
+
subject: "Mathématiques",
|
|
106
|
+
hasHintAndCorrection: true,
|
|
107
|
+
getAnswer,
|
|
108
|
+
getInstruction,
|
|
109
|
+
getCorrection,
|
|
110
|
+
getHint,
|
|
111
|
+
getStartStatement,
|
|
112
|
+
getQuestionFromIdentifiers,
|
|
113
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
/**
|
|
3
|
+
* type ax+b=cx+d
|
|
4
|
+
*/
|
|
5
|
+
type Identifiers = {
|
|
6
|
+
a: number;
|
|
7
|
+
b: number;
|
|
8
|
+
c: number;
|
|
9
|
+
d: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const equationType4Exercise: Exercise<Identifiers>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=equa4.d.ts.map
|