math-exercises 3.0.52 → 3.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.js +0 -2
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.js +0 -2
- package/lib/exercises/math/calcul/fractions/fractionsDivision.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsDivision.js +0 -2
- package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSum.js +0 -2
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +3 -17
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.js +0 -12
- package/lib/exercises/math/calcul/mentalCaluls/mentalPercentage.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalPercentage.js +0 -13
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.js +0 -2
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts +8 -3
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +53 -30
- package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa4.js +0 -2
- package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +3 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.js +4 -4
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +0 -2
- package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.js +0 -2
- package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts +2 -2
- package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.js +52 -25
- package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts +2 -2
- package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.js +50 -33
- package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts +2 -1
- package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +37 -17
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +0 -2
- package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.js +3 -2
- package/lib/exercises/math/functions/affines/interceptReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/interceptReading.js +47 -18
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV2.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV2.js +46 -13
- package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/recognizeAngleType.js +33 -12
- package/lib/exercises/math/geometry/areas/circleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/circleArea.js +45 -2
- package/lib/exercises/math/geometry/areas/squareArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/squareArea.js +40 -7
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +52 -7
- package/lib/exercises/math/geometry/cartesian/cartesianFromTwoPoints.d.ts +9 -0
- package/lib/exercises/math/geometry/cartesian/cartesianFromTwoPoints.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/cartesianFromTwoPoints.js +162 -0
- package/lib/exercises/math/geometry/cartesian/cartesianFromVectorAndPoint.d.ts +10 -0
- package/lib/exercises/math/geometry/cartesian/cartesianFromVectorAndPoint.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/cartesianFromVectorAndPoint.js +161 -0
- package/lib/exercises/math/geometry/cartesian/directionVector.d.ts +4 -2
- package/lib/exercises/math/geometry/cartesian/directionVector.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/directionVector.js +110 -79
- package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/directionVectorEquation.js +55 -11
- package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.js +18 -2
- package/lib/exercises/math/geometry/cartesian/index.d.ts +2 -0
- package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/index.js +2 -0
- package/lib/exercises/math/geometry/cartesian/pointCoordinates.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/pointCoordinates.js +0 -2
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.js +0 -2
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.js +0 -2
- package/lib/exercises/math/geometry/lines/aAndBFromReductEquation.d.ts +9 -0
- package/lib/exercises/math/geometry/lines/aAndBFromReductEquation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/aAndBFromReductEquation.js +108 -0
- package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +20 -1
- package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts +9 -0
- package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.js +115 -0
- package/lib/exercises/math/geometry/lines/directorVectorFromAnother.d.ts +9 -0
- package/lib/exercises/math/geometry/lines/directorVectorFromAnother.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/directorVectorFromAnother.js +122 -0
- package/lib/exercises/math/geometry/lines/directorVectorFromReductEquation.d.ts +9 -0
- package/lib/exercises/math/geometry/lines/directorVectorFromReductEquation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/directorVectorFromReductEquation.js +121 -0
- package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts +10 -0
- package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.js +124 -0
- package/lib/exercises/math/geometry/lines/drawLineFromPointAndVector.d.ts +10 -0
- package/lib/exercises/math/geometry/lines/drawLineFromPointAndVector.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/drawLineFromPointAndVector.js +123 -0
- package/lib/exercises/math/geometry/lines/findParallelLineFromCartesianEquation.d.ts +12 -0
- package/lib/exercises/math/geometry/lines/findParallelLineFromCartesianEquation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/findParallelLineFromCartesianEquation.js +130 -0
- package/lib/exercises/math/geometry/lines/findParallelLineFromReductEquation.d.ts +10 -0
- package/lib/exercises/math/geometry/lines/findParallelLineFromReductEquation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/findParallelLineFromReductEquation.js +109 -0
- package/lib/exercises/math/geometry/lines/index.d.ts +10 -0
- package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/index.js +10 -0
- package/lib/exercises/math/geometry/lines/reductEquationFindY.d.ts +10 -0
- package/lib/exercises/math/geometry/lines/reductEquationFindY.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/reductEquationFindY.js +105 -0
- package/lib/exercises/math/geometry/lines/reductEquationFromTwoPoints.d.ts +10 -0
- package/lib/exercises/math/geometry/lines/reductEquationFromTwoPoints.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/reductEquationFromTwoPoints.js +149 -0
- package/lib/exercises/math/geometry/lines/reductEquationReading.d.ts +8 -0
- package/lib/exercises/math/geometry/lines/reductEquationReading.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/reductEquationReading.js +142 -0
- package/lib/exercises/math/geometry/perimeters/circleCircumference.d.ts.map +1 -1
- package/lib/exercises/math/geometry/perimeters/circleCircumference.js +58 -9
- package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.d.ts.map +1 -1
- package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.js +39 -6
- package/lib/exercises/math/geometry/perimeters/squarePerimeter.d.ts.map +1 -1
- package/lib/exercises/math/geometry/perimeters/squarePerimeter.js +40 -7
- package/lib/exercises/math/geometry/perimeters/trianglePerimeter.d.ts.map +1 -1
- package/lib/exercises/math/geometry/perimeters/trianglePerimeter.js +34 -7
- package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.js +51 -15
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +109 -19
- package/lib/exercises/math/geometry/thales/thales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/thales.js +36 -5
- package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/triangleNature.js +45 -14
- package/lib/exercises/math/geometry/vectors/alignementViaColinearity.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/alignementViaColinearity.js +78 -15
- package/lib/exercises/math/geometry/vectors/colinearity.d.ts +5 -4
- package/lib/exercises/math/geometry/vectors/colinearity.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/colinearity.js +82 -21
- package/lib/exercises/math/geometry/vectors/determinant.js +1 -1
- package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts +2 -0
- package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/findCoordForAligment.js +92 -0
- package/lib/exercises/math/geometry/vectors/lineFromDirectorVector.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/lineFromDirectorVector.js +117 -76
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.js +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +0 -2
- package/lib/exercises/math/powers/calculatePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculatePower.js +63 -8
- package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
- package/lib/exercises/math/powers/decimalToScientific.js +0 -15
- package/lib/exercises/math/powers/powerDefinition.d.ts.map +1 -1
- package/lib/exercises/math/powers/powerDefinition.js +39 -8
- package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersOfTenToDecimal.js +2 -1
- package/lib/exercises/math/powers/powersPower.d.ts +5 -2
- package/lib/exercises/math/powers/powersPower.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersPower.js +59 -28
- package/lib/exercises/math/powers/scientificToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/powers/scientificToDecimal.js +0 -15
- package/lib/exercises/math/primitive/logarithmePrimitive.js +1 -1
- package/lib/exercises/math/probaStat/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +1 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts +5 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/index.js +4 -0
- package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.d.ts +10 -0
- package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.js +81 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableAverage.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableAverage.js +95 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.js +106 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableVariance.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableVariance.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableVariance.js +105 -0
- package/lib/exercises/math/trigonometry/calculateCosSinAndTan.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/calculateCosSinAndTan.js +21 -0
- package/lib/exercises/math/trigonometry/mainRemarkableValues.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/mainRemarkableValues.js +1 -1
- package/lib/exercises/math/trigonometry/remarkableValues.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/remarkableValues.js +3 -0
- package/lib/index.d.ts +76 -15
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/angle.js +12 -7
- package/lib/math/geometry/line.d.ts +5 -10
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +71 -37
- package/lib/math/geometry/point.d.ts +2 -1
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +3 -0
- package/lib/math/geometry/segment.js +1 -1
- package/lib/math/geometry/triangles/triangle.d.ts.map +1 -1
- package/lib/math/geometry/triangles/triangle.js +11 -11
- package/lib/math/geometry/vector.d.ts +6 -0
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +30 -4
- package/lib/math/probability/randomVariable.d.ts +15 -0
- package/lib/math/probability/randomVariable.d.ts.map +1 -0
- package/lib/math/probability/randomVariable.js +56 -0
- package/lib/math/systems/generalSystem.d.ts +12 -1
- package/lib/math/systems/generalSystem.d.ts.map +1 -1
- package/lib/math/systems/generalSystem.js +92 -55
- package/lib/math/trigonometry/remarkableValue.d.ts.map +1 -1
- package/lib/math/trigonometry/remarkableValue.js +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +1 -8
- package/lib/server.js +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +0 -1
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +3 -3
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +3 -3
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +11 -5
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +11 -5
- package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/tanNode.js +11 -5
- package/lib/tree/nodes/node.d.ts +9 -8
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.js +1 -1
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +6 -2
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +2 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.js +7 -2
- package/lib/tree/nodes/operators/fractionNode.js +2 -2
- package/lib/tree/nodes/operators/multiplyNode.js +1 -1
- package/lib/tree/nodes/operators/powerNode.d.ts +4 -4
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +5 -5
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +6 -0
- package/package.json +1 -1
|
@@ -2,19 +2,52 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
5
|
-
const
|
|
6
|
-
const side =
|
|
5
|
+
const getInstruction = (identifiers) => {
|
|
6
|
+
const { side } = identifiers;
|
|
7
|
+
return `Calculer l'aire d'un carré de $${side}$ cm de côté.`;
|
|
8
|
+
};
|
|
9
|
+
const getAnswer = (identifiers) => {
|
|
10
|
+
const { side } = identifiers;
|
|
7
11
|
const answer = side ** 2 + "";
|
|
8
12
|
const answerTex = answer + "\\text{cm}^2";
|
|
13
|
+
return answerTex;
|
|
14
|
+
};
|
|
15
|
+
const getHint = (identifiers) => {
|
|
16
|
+
return `L'aire d'un carré s'obtient en multipliant la longueur d'un côté par elle-même.`;
|
|
17
|
+
};
|
|
18
|
+
const getCorrection = (identifiers) => {
|
|
19
|
+
const { side } = identifiers;
|
|
20
|
+
return `L'aire d'un carré de côté $c$ est :
|
|
21
|
+
|
|
22
|
+
$$
|
|
23
|
+
A = c\\times c
|
|
24
|
+
$$
|
|
25
|
+
|
|
26
|
+
Ici, on a $c = ${side}$ cm.
|
|
27
|
+
|
|
28
|
+
L'aire du carré vaut donc :
|
|
29
|
+
|
|
30
|
+
$$
|
|
31
|
+
A = ${side}\\times${side} = ${getAnswer(identifiers)}
|
|
32
|
+
$$`;
|
|
33
|
+
};
|
|
34
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
9
35
|
const question = {
|
|
10
|
-
instruction:
|
|
11
|
-
answer:
|
|
36
|
+
instruction: getInstruction(identifiers),
|
|
37
|
+
answer: getAnswer(identifiers),
|
|
12
38
|
answerFormat: "tex",
|
|
13
39
|
keys: ["cm", "cm2"],
|
|
14
|
-
identifiers
|
|
40
|
+
identifiers,
|
|
41
|
+
hint: getHint(identifiers),
|
|
42
|
+
correction: getCorrection(identifiers),
|
|
15
43
|
};
|
|
16
44
|
return question;
|
|
17
45
|
};
|
|
46
|
+
const getSquareArea = () => {
|
|
47
|
+
const side = randint(1, 21);
|
|
48
|
+
const identifiers = { side };
|
|
49
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
50
|
+
};
|
|
18
51
|
const getPropositions = (n, { answer }) => {
|
|
19
52
|
const propositions = [];
|
|
20
53
|
addValidProp(propositions, answer);
|
|
@@ -31,9 +64,7 @@ export const squareArea = {
|
|
|
31
64
|
id: "squareArea",
|
|
32
65
|
connector: "=",
|
|
33
66
|
label: "Calculer l'aire d'un carré",
|
|
34
|
-
levels: ["4ème", "3ème", "2nde"],
|
|
35
67
|
isSingleStep: false,
|
|
36
|
-
sections: ["Aires", "Géométrie euclidienne"],
|
|
37
68
|
generator: (nb) => getDistinctQuestions(getSquareArea, nb, 20),
|
|
38
69
|
qcmTimer: 60,
|
|
39
70
|
freeTimer: 60,
|
|
@@ -41,4 +72,6 @@ export const squareArea = {
|
|
|
41
72
|
getPropositions,
|
|
42
73
|
isAnswerValid,
|
|
43
74
|
subject: "Mathématiques",
|
|
75
|
+
getQuestionFromIdentifiers,
|
|
76
|
+
hasHintAndCorrection: true,
|
|
44
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/triangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"triangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/triangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAOnD,OAAO,EAGL,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAKxC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA4GF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAiB9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cartesianEquationOfLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/cartesianEquationOfLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"cartesianEquationOfLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/cartesianEquationOfLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAqBrC,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;AAyNF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
|
|
@@ -3,12 +3,13 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
3
3
|
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
4
4
|
import { Line } from "../../../../math/geometry/line.js";
|
|
5
5
|
import { Point } from "../../../../math/geometry/point.js";
|
|
6
|
-
import { Vector } from "../../../../math/geometry/vector.js";
|
|
6
|
+
import { Vector, VectorConstructor } from "../../../../math/geometry/vector.js";
|
|
7
7
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
8
8
|
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
9
|
+
import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
9
10
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
10
|
-
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
11
|
-
import { MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
11
|
+
import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
12
|
+
import { multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
13
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
13
14
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
14
15
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
@@ -24,6 +25,43 @@ const getAnswer = (identifiers) => {
|
|
|
24
25
|
const correctAnswer = line.getCartesianEquation();
|
|
25
26
|
return correctAnswer.toTex();
|
|
26
27
|
};
|
|
28
|
+
const getHint = (identifiers) => {
|
|
29
|
+
return `Détermine un vecteur directeur de $d$. Cela permet de trouver les coefficients $a$ et $b$ dans l'équation cartésienne $ax+by+c=0$. Puis, utilise un point appartenant à $d$ pour obtenir $c$. `;
|
|
30
|
+
};
|
|
31
|
+
const getCorrection = (identifiers) => {
|
|
32
|
+
const { aX, aY, bX, bY } = identifiers;
|
|
33
|
+
const A = new Point("A", aX, aY);
|
|
34
|
+
const B = new Point("B", bX, bY);
|
|
35
|
+
const vec = VectorConstructor.fromPoints(A, B);
|
|
36
|
+
const partial = add(multiply(opposite(vec.y), "x"), multiply(vec.x, "y")).simplify({
|
|
37
|
+
forbidFactorize: true,
|
|
38
|
+
});
|
|
39
|
+
const partialEv = partial.toDetailedEvaluation({ x: A.x, y: A.y });
|
|
40
|
+
const partialEvSimp = partialEv.simplify();
|
|
41
|
+
const c = opposite(partialEvSimp).simplify();
|
|
42
|
+
return `On lit graphiquement que la droite passe par les points $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$. On en déduit qu'un vecteur directeur de $d$ est $${vec.toTexWithCoords()}$.
|
|
43
|
+
|
|
44
|
+
Une équation cartésienne de $d$ est donc de la forme :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
${partial.toTex()}+c = 0
|
|
48
|
+
$$
|
|
49
|
+
|
|
50
|
+
Pour déterminer $c$, on utilise le fait que le point $${A.toTexWithCoords()}$ appartient à $d$ :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
${partialEv.toTex()}+c = 0
|
|
54
|
+
$$
|
|
55
|
+
|
|
56
|
+
ce qui donne $c=${c.toTex()}$.
|
|
57
|
+
|
|
58
|
+
Ainsi, une équation cartésienne de $d$ est :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
${getAnswer(identifiers)}
|
|
62
|
+
$$
|
|
63
|
+
`;
|
|
64
|
+
};
|
|
27
65
|
const getGGBOptions = (identifiers) => {
|
|
28
66
|
const { aX, aY, bX, bY } = identifiers;
|
|
29
67
|
const a = new Point("a", aX, aY);
|
|
@@ -40,10 +78,14 @@ const getGGBOptions = (identifiers) => {
|
|
|
40
78
|
});
|
|
41
79
|
};
|
|
42
80
|
const getCartesianEquationOfLineQuestion = () => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
81
|
+
let aX = randint(-5, 6);
|
|
82
|
+
let aY = randint(-5, 6);
|
|
83
|
+
let bX = randint(-5, 6, [aX]);
|
|
84
|
+
let bY = randint(-5, 6, [aY]);
|
|
85
|
+
if (aX > bX) {
|
|
86
|
+
[aX, bX] = [bX, aX];
|
|
87
|
+
[aY, bY] = [bY, aY];
|
|
88
|
+
}
|
|
47
89
|
const identifiers = { aX, aY, bX, bY };
|
|
48
90
|
return getQuestionFromIdentifiers(identifiers);
|
|
49
91
|
};
|
|
@@ -55,6 +97,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
55
97
|
keys: ["x", "y", "equal"],
|
|
56
98
|
answerFormat: "tex",
|
|
57
99
|
identifiers,
|
|
100
|
+
// hint: getHint(identifiers),
|
|
101
|
+
// correction: getCorrection(identifiers),
|
|
58
102
|
};
|
|
59
103
|
return question;
|
|
60
104
|
};
|
|
@@ -135,5 +179,6 @@ export const cartesianEquationOfLine = {
|
|
|
135
179
|
isAnswerValid,
|
|
136
180
|
hasGeogebra: true,
|
|
137
181
|
subject: "Mathématiques",
|
|
182
|
+
// hasHintAndCorrection: true,
|
|
138
183
|
getQuestionFromIdentifiers,
|
|
139
184
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { PointIdentifiers } from "../../../../math/geometry/point.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
pointIdentifiers: PointIdentifiers;
|
|
5
|
+
pointBIdentifiers: PointIdentifiers;
|
|
6
|
+
};
|
|
7
|
+
export declare const cartesianFromTwoPoints: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=cartesianFromTwoPoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cartesianFromTwoPoints.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/cartesianFromTwoPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAoBtC,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,iBAAiB,EAAE,gBAAgB,CAAC;CACrC,CAAC;AA2JF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Line, LineConstructor } from "../../../../math/geometry/line.js";
|
|
4
|
+
import { PointConstructor, } from "../../../../math/geometry/point.js";
|
|
5
|
+
import { Vector, VectorConstructor, } from "../../../../math/geometry/vector.js";
|
|
6
|
+
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
7
|
+
import { isEqualNode, } from "../../../../tree/nodes/equations/equalNode.js";
|
|
8
|
+
import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
9
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
10
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
11
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
12
|
+
import { parseLatex } from "../../../../tree/parsers/latexParser.js";
|
|
13
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
const getPropositions = (n, { answer }) => {
|
|
15
|
+
const propositions = [];
|
|
16
|
+
addValidProp(propositions, answer);
|
|
17
|
+
while (propositions.length < n) {
|
|
18
|
+
const line = LineConstructor.random();
|
|
19
|
+
tryToAddWrongProp(propositions, line.getCartesianEquation().toTex());
|
|
20
|
+
}
|
|
21
|
+
return shuffleProps(propositions, n);
|
|
22
|
+
};
|
|
23
|
+
const getAnswer = (identifiers) => {
|
|
24
|
+
const { pointBIdentifiers, pointIdentifiers } = identifiers;
|
|
25
|
+
const point = PointConstructor.fromIdentifiers(pointIdentifiers);
|
|
26
|
+
const pointB = PointConstructor.fromIdentifiers(pointBIdentifiers);
|
|
27
|
+
const line = new Line(point, pointB);
|
|
28
|
+
return line.getCartesianEquation().toTex();
|
|
29
|
+
};
|
|
30
|
+
const getInstruction = (identifiers) => {
|
|
31
|
+
const { pointBIdentifiers, pointIdentifiers } = identifiers;
|
|
32
|
+
const point = PointConstructor.fromIdentifiers(pointIdentifiers);
|
|
33
|
+
const pointB = PointConstructor.fromIdentifiers(pointBIdentifiers);
|
|
34
|
+
return `Soit $d$ une droite passant par les points $${point.toTexWithCoords()}$ et $${pointB.toTexWithCoords()}$.
|
|
35
|
+
|
|
36
|
+
Déterminer une équation cartésienne de $d$.`;
|
|
37
|
+
};
|
|
38
|
+
const getHint = (identifiers) => {
|
|
39
|
+
const genVec = new Vector("u", opposite("b"), new VariableNode("a"));
|
|
40
|
+
return `Une droite de vecteur directeur $${genVec.toTexWithCoords()}$ admet une équation cartésienne de la forme :
|
|
41
|
+
|
|
42
|
+
$$
|
|
43
|
+
ax+by+c = 0
|
|
44
|
+
$$
|
|
45
|
+
|
|
46
|
+
On remarque que $\\overrightarrow{AB}$ est un vecteur directeur de $d$.
|
|
47
|
+
|
|
48
|
+
Puis, on peut ensuite utiliser les coordonnées d'un point de la droite pour déterminer $c$.`;
|
|
49
|
+
};
|
|
50
|
+
const getCorrection = (identifiers) => {
|
|
51
|
+
const { pointBIdentifiers, pointIdentifiers } = identifiers;
|
|
52
|
+
const point = PointConstructor.fromIdentifiers(pointIdentifiers);
|
|
53
|
+
const pointB = PointConstructor.fromIdentifiers(pointBIdentifiers);
|
|
54
|
+
const vector = VectorConstructor.fromPoints(point, pointB);
|
|
55
|
+
const nonCEq = add(add(multiply(vector.y, "x"), multiply(opposite(vector.x), "y")), "c").simplify({
|
|
56
|
+
forbidFactorize: true,
|
|
57
|
+
});
|
|
58
|
+
const line = LineConstructor.fromPointAndVector(point, vector);
|
|
59
|
+
const [a, b, c] = line.toCartesianCoeffs();
|
|
60
|
+
const [aEv, bEv, cEv] = [a.evaluate(), b.evaluate(), c.evaluate()];
|
|
61
|
+
const allNeg = aEv < 0 && bEv < 0 && cEv < 0;
|
|
62
|
+
const pgcd = gcd(aEv, bEv, cEv);
|
|
63
|
+
const hasSimplified = allNeg || pgcd !== 1;
|
|
64
|
+
return `Puisque $${vector.toTexWithCoords()}$ est un vecteur directeur de $d$, cette dernière admet une équation cartésienne de la forme :
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
${nonCEq.toTex()}=0
|
|
68
|
+
$$
|
|
69
|
+
|
|
70
|
+
Pour déterminer $c$, on peut ensuite utiliser le fait que le point $${point.toTexWithCoords()}$ appartient à $d$ :
|
|
71
|
+
|
|
72
|
+
$$
|
|
73
|
+
${nonCEq.toDetailedEvaluation({ x: point.x, y: point.y }).toTex()}=0
|
|
74
|
+
$$
|
|
75
|
+
|
|
76
|
+
On en déduit que $c=${c.simplify().toTex()}$.
|
|
77
|
+
|
|
78
|
+
Ainsi, une équation cartésienne de $d$ est :
|
|
79
|
+
|
|
80
|
+
$$
|
|
81
|
+
${add(add(multiply(a, "x"), multiply(b, "y")), c)
|
|
82
|
+
.simplify({
|
|
83
|
+
forbidFactorize: true,
|
|
84
|
+
})
|
|
85
|
+
.toTex()}=0
|
|
86
|
+
$$
|
|
87
|
+
|
|
88
|
+
${hasSimplified
|
|
89
|
+
? `On peut alors simplifier cette équation en la divisant par $${allNeg ? opposite(pgcd).toTex() : pgcd}$ :
|
|
90
|
+
|
|
91
|
+
$$
|
|
92
|
+
${getAnswer(identifiers)}
|
|
93
|
+
$$`
|
|
94
|
+
: ""}
|
|
95
|
+
`;
|
|
96
|
+
};
|
|
97
|
+
const getKeys = (identifiers) => {
|
|
98
|
+
return ["x", "y", "equal"];
|
|
99
|
+
};
|
|
100
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
101
|
+
try {
|
|
102
|
+
const parsed = parseLatex(ans);
|
|
103
|
+
if (!isEqualNode(parsed))
|
|
104
|
+
return false;
|
|
105
|
+
const { pointBIdentifiers, pointIdentifiers } = identifiers;
|
|
106
|
+
const point = PointConstructor.fromIdentifiers(pointIdentifiers);
|
|
107
|
+
const pointB = PointConstructor.fromIdentifiers(pointBIdentifiers);
|
|
108
|
+
return (parsed.leftChild
|
|
109
|
+
.toDetailedEvaluation({
|
|
110
|
+
x: point.x,
|
|
111
|
+
y: point.y,
|
|
112
|
+
})
|
|
113
|
+
.simplify()
|
|
114
|
+
.toTex() === "0" &&
|
|
115
|
+
parsed.leftChild
|
|
116
|
+
.toDetailedEvaluation({
|
|
117
|
+
x: pointB.x,
|
|
118
|
+
y: pointB.y,
|
|
119
|
+
})
|
|
120
|
+
.simplify()
|
|
121
|
+
.toTex() === "0");
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
return handleVEAError(err);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const getCartesianFromTwoPointsQuestion = (ops) => {
|
|
128
|
+
const points = PointConstructor.randomDifferent(2, { names: ["A", "B"] });
|
|
129
|
+
const identifiers = {
|
|
130
|
+
pointIdentifiers: points[0].toIdentifiers(),
|
|
131
|
+
pointBIdentifiers: points[1].toIdentifiers(),
|
|
132
|
+
};
|
|
133
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
134
|
+
};
|
|
135
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
136
|
+
return {
|
|
137
|
+
answer: getAnswer(identifiers),
|
|
138
|
+
instruction: getInstruction(identifiers),
|
|
139
|
+
keys: getKeys(identifiers),
|
|
140
|
+
answerFormat: "tex",
|
|
141
|
+
identifiers,
|
|
142
|
+
hint: getHint(identifiers),
|
|
143
|
+
correction: getCorrection(identifiers),
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
export const cartesianFromTwoPoints = {
|
|
147
|
+
id: "cartesianFromTwoPoints",
|
|
148
|
+
label: "Déterminer l'équation cartésienne d'une droite en connaissant deux points",
|
|
149
|
+
isSingleStep: true,
|
|
150
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCartesianFromTwoPointsQuestion(opts), nb),
|
|
151
|
+
qcmTimer: 60,
|
|
152
|
+
freeTimer: 60,
|
|
153
|
+
getPropositions,
|
|
154
|
+
isAnswerValid,
|
|
155
|
+
subject: "Mathématiques",
|
|
156
|
+
getInstruction,
|
|
157
|
+
getHint,
|
|
158
|
+
getCorrection,
|
|
159
|
+
getAnswer,
|
|
160
|
+
getQuestionFromIdentifiers,
|
|
161
|
+
hasHintAndCorrection: true,
|
|
162
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { PointIdentifiers } from "../../../../math/geometry/point.js";
|
|
3
|
+
import { VectorIdentifiers } from "../../../../math/geometry/vector.js";
|
|
4
|
+
type Identifiers = {
|
|
5
|
+
vectorIdentifiers: VectorIdentifiers;
|
|
6
|
+
pointIdentifiers: PointIdentifiers;
|
|
7
|
+
};
|
|
8
|
+
export declare const cartesianFromVectorAndPoint: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=cartesianFromVectorAndPoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cartesianFromVectorAndPoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/cartesianFromVectorAndPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAevC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAuJF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAqB7D,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { LineConstructor } from "../../../../math/geometry/line.js";
|
|
4
|
+
import { PointConstructor, } from "../../../../math/geometry/point.js";
|
|
5
|
+
import { Vector, VectorConstructor, } from "../../../../math/geometry/vector.js";
|
|
6
|
+
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
7
|
+
import { isEqualNode, } from "../../../../tree/nodes/equations/equalNode.js";
|
|
8
|
+
import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
9
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
10
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
11
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
12
|
+
import { parseLatex } from "../../../../tree/parsers/latexParser.js";
|
|
13
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
const getPropositions = (n, { answer }) => {
|
|
15
|
+
const propositions = [];
|
|
16
|
+
addValidProp(propositions, answer);
|
|
17
|
+
while (propositions.length < n) {
|
|
18
|
+
const line = LineConstructor.random();
|
|
19
|
+
tryToAddWrongProp(propositions, line.getCartesianEquation().toTex());
|
|
20
|
+
}
|
|
21
|
+
return shuffleProps(propositions, n);
|
|
22
|
+
};
|
|
23
|
+
const getAnswer = (identifiers) => {
|
|
24
|
+
const { vectorIdentifiers, pointIdentifiers } = identifiers;
|
|
25
|
+
const point = PointConstructor.fromIdentifiers(pointIdentifiers);
|
|
26
|
+
const vector = VectorConstructor.fromIdentifiers(vectorIdentifiers);
|
|
27
|
+
const line = LineConstructor.fromPointAndVector(point, vector);
|
|
28
|
+
return line.getCartesianEquation().toTex();
|
|
29
|
+
};
|
|
30
|
+
const getInstruction = (identifiers) => {
|
|
31
|
+
const { vectorIdentifiers, pointIdentifiers } = identifiers;
|
|
32
|
+
const point = PointConstructor.fromIdentifiers(pointIdentifiers);
|
|
33
|
+
const vector = VectorConstructor.fromIdentifiers(vectorIdentifiers);
|
|
34
|
+
return `Soit $d$ une droite de vecteur directeur $${vector.toTexWithCoords()}$ et passant par le point $${point.toTexWithCoords()}$.
|
|
35
|
+
|
|
36
|
+
Déterminer une équation cartésienne de $d$.`;
|
|
37
|
+
};
|
|
38
|
+
const getHint = (identifiers) => {
|
|
39
|
+
const genVec = new Vector("u", opposite("b"), new VariableNode("a"));
|
|
40
|
+
return `Une droite de vecteur directeur $${genVec.toTexWithCoords()}$ admet une équation cartésienne de la forme :
|
|
41
|
+
|
|
42
|
+
$$
|
|
43
|
+
ax+by+c = 0
|
|
44
|
+
$$
|
|
45
|
+
|
|
46
|
+
On peut ensuite utiliser les coordonnées d'un point de la droite pour déterminer $c$.`;
|
|
47
|
+
};
|
|
48
|
+
const getCorrection = (identifiers) => {
|
|
49
|
+
const { vectorIdentifiers, pointIdentifiers } = identifiers;
|
|
50
|
+
const point = PointConstructor.fromIdentifiers(pointIdentifiers);
|
|
51
|
+
const vector = VectorConstructor.fromIdentifiers(vectorIdentifiers);
|
|
52
|
+
const nonCEq = add(add(multiply(vector.y, "x"), multiply(opposite(vector.x), "y")), "c").simplify({
|
|
53
|
+
forbidFactorize: true,
|
|
54
|
+
});
|
|
55
|
+
const line = LineConstructor.fromPointAndVector(point, vector);
|
|
56
|
+
const [a, b, c] = line.toCartesianCoeffs();
|
|
57
|
+
const [aEv, bEv, cEv] = [a.evaluate(), b.evaluate(), c.evaluate()];
|
|
58
|
+
const allNeg = aEv < 0 && bEv < 0 && cEv < 0;
|
|
59
|
+
const pgcd = gcd(aEv, bEv, cEv);
|
|
60
|
+
const hasSimplified = allNeg || pgcd !== 1;
|
|
61
|
+
return `Puisque $${vector.toTexWithCoords()}$ est un vecteur directeur de $d$, cette dernière admet une équation cartésienne de la forme :
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
${nonCEq.toTex()}=0
|
|
65
|
+
$$
|
|
66
|
+
|
|
67
|
+
Pour déterminer $c$, on peut ensuite utiliser le fait que le point $${point.toTexWithCoords()}$ appartient à $d$ :
|
|
68
|
+
|
|
69
|
+
$$
|
|
70
|
+
${nonCEq.toDetailedEvaluation({ x: point.x, y: point.y }).toTex()}=0
|
|
71
|
+
$$
|
|
72
|
+
|
|
73
|
+
On en déduit que $c=${c.simplify().toTex()}$.
|
|
74
|
+
|
|
75
|
+
Ainsi, une équation cartésienne de $d$ est :
|
|
76
|
+
|
|
77
|
+
$$
|
|
78
|
+
${add(add(multiply(a, "x"), multiply(b, "y")), c)
|
|
79
|
+
.simplify({
|
|
80
|
+
forbidFactorize: true,
|
|
81
|
+
})
|
|
82
|
+
.toTex()}=0
|
|
83
|
+
$$
|
|
84
|
+
|
|
85
|
+
${hasSimplified
|
|
86
|
+
? `On peut alors simplifier cette équation en la divisant par $${allNeg ? opposite(pgcd).toTex() : pgcd}$ :
|
|
87
|
+
|
|
88
|
+
$$
|
|
89
|
+
${getAnswer(identifiers)}
|
|
90
|
+
$$`
|
|
91
|
+
: ""}
|
|
92
|
+
`;
|
|
93
|
+
};
|
|
94
|
+
const getKeys = (identifiers) => {
|
|
95
|
+
return ["x", "y", "equal"];
|
|
96
|
+
};
|
|
97
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
98
|
+
try {
|
|
99
|
+
const parsed = parseLatex(ans);
|
|
100
|
+
if (!isEqualNode(parsed))
|
|
101
|
+
return false;
|
|
102
|
+
const { vectorIdentifiers, pointIdentifiers } = identifiers;
|
|
103
|
+
const point = PointConstructor.fromIdentifiers(pointIdentifiers);
|
|
104
|
+
const vector = VectorConstructor.fromIdentifiers(vectorIdentifiers);
|
|
105
|
+
const secondPoint = vector.getEndPoint(point);
|
|
106
|
+
return (parsed.leftChild
|
|
107
|
+
.toDetailedEvaluation({
|
|
108
|
+
x: point.x,
|
|
109
|
+
y: point.y,
|
|
110
|
+
})
|
|
111
|
+
.simplify()
|
|
112
|
+
.toTex() === "0" &&
|
|
113
|
+
parsed.leftChild
|
|
114
|
+
.toDetailedEvaluation({
|
|
115
|
+
x: secondPoint.x,
|
|
116
|
+
y: secondPoint.y,
|
|
117
|
+
})
|
|
118
|
+
.simplify()
|
|
119
|
+
.toTex() === "0");
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
return handleVEAError(err);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const getCartesianFromVectorAndPointQuestion = (ops) => {
|
|
126
|
+
const point = PointConstructor.random("A");
|
|
127
|
+
const vector = VectorConstructor.random("u");
|
|
128
|
+
const identifiers = {
|
|
129
|
+
pointIdentifiers: point.toIdentifiers(),
|
|
130
|
+
vectorIdentifiers: vector.toIdentifiers(),
|
|
131
|
+
};
|
|
132
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
133
|
+
};
|
|
134
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
135
|
+
return {
|
|
136
|
+
answer: getAnswer(identifiers),
|
|
137
|
+
instruction: getInstruction(identifiers),
|
|
138
|
+
keys: getKeys(identifiers),
|
|
139
|
+
answerFormat: "tex",
|
|
140
|
+
identifiers,
|
|
141
|
+
hint: getHint(identifiers),
|
|
142
|
+
correction: getCorrection(identifiers),
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
export const cartesianFromVectorAndPoint = {
|
|
146
|
+
id: "cartesianFromVectorAndPoint",
|
|
147
|
+
label: "Déterminer l'équation cartésienne d'une droite en connaissant un point et un vecteur directeur",
|
|
148
|
+
isSingleStep: true,
|
|
149
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCartesianFromVectorAndPointQuestion(opts), nb),
|
|
150
|
+
qcmTimer: 60,
|
|
151
|
+
freeTimer: 60,
|
|
152
|
+
getPropositions,
|
|
153
|
+
isAnswerValid,
|
|
154
|
+
subject: "Mathématiques",
|
|
155
|
+
getInstruction,
|
|
156
|
+
getHint,
|
|
157
|
+
getCorrection,
|
|
158
|
+
getAnswer,
|
|
159
|
+
getQuestionFromIdentifiers,
|
|
160
|
+
hasHintAndCorrection: true,
|
|
161
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directionVector.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/directionVector.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"directionVector.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/directionVector.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IAIjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAkJF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC"}
|