math-exercises 3.0.48 → 3.0.50
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/addAndSub.d.ts +7 -1
- package/lib/exercises/math/calcul/addAndSub.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSub.js +26 -14
- package/lib/exercises/math/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/expressionNature.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/decimalOrdering.js +0 -2
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +6 -0
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +33 -3
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/index.js +1 -0
- package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/isolate/index.js +2 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateVariable.js +83 -0
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +1 -1
- package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.js +0 -1
- package/lib/exercises/math/functions/affines/index.d.ts +0 -1
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +0 -1
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunction.js +16 -3
- package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +10 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.js +31 -16
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.js +50 -14
- package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts +1 -0
- package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/directionVectorEquation.js +48 -40
- package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts +10 -0
- package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +171 -0
- package/lib/exercises/math/geometry/lines/findPointOnLineWithCartesianEquation.d.ts +9 -0
- package/lib/exercises/math/geometry/lines/findPointOnLineWithCartesianEquation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/findPointOnLineWithCartesianEquation.js +146 -0
- package/lib/exercises/math/geometry/lines/findPointOnLineWithReductEquation.d.ts +8 -0
- package/lib/exercises/math/geometry/lines/findPointOnLineWithReductEquation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/findPointOnLineWithReductEquation.js +99 -0
- package/lib/exercises/math/geometry/lines/index.d.ts +5 -0
- package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/index.js +5 -0
- package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.d.ts +13 -0
- package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.js +118 -0
- package/lib/exercises/math/geometry/lines/isPointOnLine.d.ts +11 -0
- package/lib/exercises/math/geometry/lines/isPointOnLine.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/isPointOnLine.js +94 -0
- package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/linesRelativePositions.js +0 -2
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts +8 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +93 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts +9 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.js +111 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts +3 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.js +3 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts +10 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.js +174 -0
- package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +2 -2
- package/lib/exercises/math/primitive/constantPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/constantPrimitive.js +22 -5
- package/lib/exercises/math/primitive/expUPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/expUPrimitive.js +25 -7
- package/lib/exercises/math/primitive/exponentialPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/exponentialPrimitive.js +23 -5
- package/lib/exercises/math/primitive/index.d.ts +2 -0
- package/lib/exercises/math/primitive/index.d.ts.map +1 -1
- package/lib/exercises/math/primitive/index.js +2 -0
- package/lib/exercises/math/primitive/kexpUPrimitive.d.ts +9 -0
- package/lib/exercises/math/primitive/kexpUPrimitive.d.ts.map +1 -0
- package/lib/exercises/math/primitive/kexpUPrimitive.js +130 -0
- package/lib/exercises/math/primitive/klogUPrimitive.d.ts +9 -0
- package/lib/exercises/math/primitive/klogUPrimitive.d.ts.map +1 -0
- package/lib/exercises/math/primitive/klogUPrimitive.js +120 -0
- package/lib/exercises/math/primitive/logarithmePrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/logarithmePrimitive.js +30 -18
- package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/polynomialPrimitive.js +0 -11
- package/lib/exercises/math/primitive/sinCosPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/sinUCosUPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/sinUCosUPrimitive.js +33 -18
- package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/ballsBasicProbas.js +28 -4
- package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/etendueList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/etendueList.js +46 -14
- package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
- package/lib/index.d.ts +45 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/spaceVector.d.ts +1 -2
- package/lib/math/geometry/spaceVector.d.ts.map +1 -1
- package/lib/math/geometry/vector.d.ts +8 -0
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +12 -1
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/integer/integer.d.ts.map +1 -1
- package/lib/math/numbers/integer/power.d.ts.map +1 -1
- package/lib/math/numbers/nombre.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/numbers/reals/real.d.ts.map +1 -1
- package/lib/math/polynomials/polynomial.d.ts.map +1 -1
- package/lib/math/sequences/geometricSequence.js +2 -2
- package/lib/math/sequences/sequence.d.ts +3 -3
- package/lib/math/sequences/sequence.d.ts.map +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +4 -6
- package/lib/prototypesEnhancement.d.ts.map +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/complex/complexNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +14 -8
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +119 -6
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts +8 -2
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equationSolutionNode.js +14 -0
- package/lib/tree/nodes/equations/multiEqualNode.d.ts +7 -1
- package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/multiEqualNode.js +14 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arccosNode.js +4 -0
- package/lib/tree/nodes/functions/integralNode.d.ts +8 -3
- package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/integralNode.js +14 -0
- package/lib/tree/nodes/geometry/pointNode.d.ts +8 -2
- package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/pointNode.js +14 -0
- package/lib/tree/nodes/geometry/vectorNode.d.ts +8 -2
- package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/vectorNode.js +14 -0
- package/lib/tree/nodes/inequations/inequationNode.d.ts +8 -3
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +14 -0
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +8 -2
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.js +14 -0
- package/lib/tree/nodes/node.d.ts +1 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +4 -1
- package/lib/tree/nodes/numbers/percentNode.d.ts +10 -3
- package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/percentNode.js +17 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +14 -25
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +7 -1
- package/lib/tree/nodes/operators/scalarProductNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +1 -2
- package/lib/tree/nodes/sets/belongsNode.d.ts +11 -5
- package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/belongsNode.js +14 -0
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +0 -1
- package/lib/tree/parsers/equationSolutionParser.d.ts +1 -1
- package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
- package/lib/tree/parsers/pointParser.d.ts +3 -0
- package/lib/tree/parsers/pointParser.d.ts.map +1 -0
- package/lib/tree/parsers/pointParser.js +13 -0
- package/lib/tree/parsers/spacePointParser.d.ts.map +1 -1
- package/lib/tree/parsers/spacePointParser.js +2 -0
- package/lib/tree/parsers/vectorParser.d.ts +3 -0
- package/lib/tree/parsers/vectorParser.d.ts.map +1 -0
- package/lib/tree/parsers/vectorParser.js +13 -0
- package/package.json +1 -1
package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summitAbscissFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"summitAbscissFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoFF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
|
|
@@ -3,19 +3,52 @@ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinct
|
|
|
3
3
|
import { Rational } from "../../../../../math/numbers/rationals/rational.js";
|
|
4
4
|
import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
5
5
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { add } from "../../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.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
|
+
const roots = trinom.getRoots();
|
|
14
|
+
return `Soit $f(x) = ax^2+bx+c$ une fonction polynôme du second degé, dont les racines sont $${roots[0]}$ et $${roots[1]}$.
|
|
15
|
+
|
|
16
|
+
Quelle est l'abscisse du sommet de la parabole représentant $f$ ?`;
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { a, b, c } = identifiers;
|
|
20
|
+
const trinom = new Trinom(a, b, c);
|
|
8
21
|
const roots = trinom.getRoots();
|
|
9
22
|
const answer = new Rational(roots[0] + roots[1], 2)
|
|
10
23
|
.simplify()
|
|
11
24
|
.toTree()
|
|
12
25
|
.toTex();
|
|
26
|
+
return answer;
|
|
27
|
+
};
|
|
28
|
+
const getHint = (identifiers) => {
|
|
29
|
+
return `L'abscisse du sommet d'une parabole admettant deux racines est la moyenne des racines.`;
|
|
30
|
+
};
|
|
31
|
+
const getCorrection = (identifiers) => {
|
|
32
|
+
const { a, b, c } = identifiers;
|
|
33
|
+
const trinom = new Trinom(a, b, c);
|
|
34
|
+
const roots = trinom.getRoots();
|
|
35
|
+
return `L'ascisse $\\alpha$ du sommet de la parabole représentant $f$ est la moyenne des racines de $f$ :
|
|
36
|
+
|
|
37
|
+
$$
|
|
38
|
+
\\alpha = ${frac(add(roots[0], roots[1]), 2).toTex()} = ${getAnswer(identifiers)}
|
|
39
|
+
$$`;
|
|
40
|
+
};
|
|
41
|
+
const getSummitAbscissFromRootsQuestion = () => {
|
|
42
|
+
const trinom = TrinomConstructor.randomNiceRoots(2);
|
|
43
|
+
const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
|
|
13
44
|
const question = {
|
|
14
|
-
answer,
|
|
15
|
-
instruction:
|
|
45
|
+
answer: getAnswer(identifiers),
|
|
46
|
+
instruction: getInstruction(identifiers),
|
|
16
47
|
keys: [],
|
|
17
48
|
answerFormat: "tex",
|
|
18
|
-
identifiers
|
|
49
|
+
identifiers,
|
|
50
|
+
hint: getHint(identifiers),
|
|
51
|
+
correction: getCorrection(identifiers),
|
|
19
52
|
};
|
|
20
53
|
return question;
|
|
21
54
|
};
|
|
@@ -31,25 +64,28 @@ const getPropositions = (n, { answer, a, b, c }) => {
|
|
|
31
64
|
return shuffleProps(propositions, n);
|
|
32
65
|
};
|
|
33
66
|
const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
67
|
+
try {
|
|
68
|
+
const parsed = parseAlgebraic(ans);
|
|
69
|
+
return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
return handleVEAError(err);
|
|
73
|
+
}
|
|
41
74
|
};
|
|
42
75
|
export const summitAbscissFromRoots = {
|
|
43
76
|
id: "summitAbscissFromRoots",
|
|
44
77
|
connector: "=",
|
|
45
78
|
label: "Déterminer l'abscisse du sommet d'une parabole en connaissant ses racines",
|
|
46
|
-
levels: ["1reSpé", "1rePro", "1reTech"],
|
|
47
79
|
isSingleStep: true,
|
|
48
|
-
sections: ["Second degré"],
|
|
49
80
|
generator: (nb) => getDistinctQuestions(getSummitAbscissFromRootsQuestion, nb),
|
|
50
81
|
qcmTimer: 60,
|
|
51
82
|
freeTimer: 60,
|
|
52
83
|
getPropositions,
|
|
53
84
|
isAnswerValid,
|
|
54
85
|
subject: "Mathématiques",
|
|
86
|
+
getInstruction,
|
|
87
|
+
getAnswer,
|
|
88
|
+
getHint,
|
|
89
|
+
getCorrection,
|
|
90
|
+
hasHintAndCorrection: true,
|
|
55
91
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directionVectorEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/directionVectorEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"directionVectorEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/directionVectorEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;CAEX,CAAC;AA+HF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAgBzD,CAAC"}
|
|
@@ -2,48 +2,55 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exer
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Vector } from "../../../../math/geometry/vector.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
-
import {
|
|
5
|
+
import { equal } from "../../../../tree/nodes/equations/equalNode.js";
|
|
6
6
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { vectorParser } from "../../../../tree/parsers/vectorParser.js";
|
|
10
|
+
const rebuildIdentifiers = (oldIds) => {
|
|
11
|
+
if (oldIds.c !== undefined)
|
|
12
|
+
return oldIds;
|
|
13
|
+
return {
|
|
14
|
+
xValue: oldIds.xValue,
|
|
15
|
+
yValue: oldIds.yValue,
|
|
16
|
+
c: randint(-5, 5),
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const getInstruction = (identifiers) => {
|
|
20
|
+
const { xValue, yValue, c } = identifiers;
|
|
21
|
+
const equation = equal(add(add(multiply(yValue.toTree(), "x"), multiply((-xValue).toTree(), "y")).simplify({ forbidFactorize: true }), c.toTree()), new NumberNode(0)).toTex();
|
|
22
|
+
return `Soit une droite $d$ d'équation cartésienne :
|
|
23
|
+
|
|
24
|
+
$$
|
|
25
|
+
${equation}
|
|
26
|
+
$$
|
|
27
|
+
|
|
28
|
+
Déterminez les coordonnées d'un vecteur directeur de $d$.`;
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
const { xValue, yValue, c } = identifiers;
|
|
32
|
+
const vector = new Vector("v", xValue.toTree(), yValue.toTree());
|
|
33
|
+
return vector.toInlineCoordsTex();
|
|
34
|
+
};
|
|
23
35
|
const getDirectionVectorEquationQuestion = () => {
|
|
24
36
|
let x1 = randint(-8, 8);
|
|
25
|
-
let x2 = randint(-8, 8);
|
|
26
|
-
while (x2 === x1) {
|
|
27
|
-
x2 = randint(-8, 8);
|
|
28
|
-
}
|
|
37
|
+
let x2 = randint(-8, 8, [x1]);
|
|
29
38
|
let y1 = randint(-8, 8);
|
|
30
|
-
let y2 = randint(-8, 8);
|
|
31
|
-
while (y2 === y1) {
|
|
32
|
-
y2 = randint(-8, 8);
|
|
33
|
-
}
|
|
39
|
+
let y2 = randint(-8, 8, [y1]);
|
|
34
40
|
const xValue = x2 - x1;
|
|
35
41
|
const yValue = y2 - y1;
|
|
36
42
|
const c = randint(-5, 5);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const identifiers = { xValue, yValue, c };
|
|
44
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
45
|
+
};
|
|
46
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
47
|
+
return {
|
|
48
|
+
answer: getAnswer(identifiers),
|
|
49
|
+
instruction: getInstruction(identifiers),
|
|
42
50
|
keys: ["semicolon", "x", "y"],
|
|
43
51
|
answerFormat: "tex",
|
|
44
|
-
identifiers
|
|
52
|
+
identifiers,
|
|
45
53
|
};
|
|
46
|
-
return question;
|
|
47
54
|
};
|
|
48
55
|
const getPropositions = (n, { answer, xValue, yValue }) => {
|
|
49
56
|
const propositions = [];
|
|
@@ -70,13 +77,12 @@ const getPropositions = (n, { answer, xValue, yValue }) => {
|
|
|
70
77
|
return shuffleProps(propositions, n);
|
|
71
78
|
};
|
|
72
79
|
const isAnswerValid = (ans, { answer, xValue, yValue }) => {
|
|
73
|
-
const parsed =
|
|
74
|
-
if (!parsed)
|
|
80
|
+
const parsed = vectorParser(ans);
|
|
81
|
+
if (!parsed)
|
|
75
82
|
return false;
|
|
76
|
-
}
|
|
77
83
|
const { x, y } = parsed;
|
|
78
|
-
const correctVector = new Vector("
|
|
79
|
-
const studentVector = new Vector("v", x
|
|
84
|
+
const correctVector = new Vector("u", xValue.toTree(), yValue.toTree());
|
|
85
|
+
const studentVector = new Vector("v", x, y);
|
|
80
86
|
if (!studentVector.isColinear(correctVector)) {
|
|
81
87
|
return false;
|
|
82
88
|
}
|
|
@@ -85,13 +91,15 @@ const isAnswerValid = (ans, { answer, xValue, yValue }) => {
|
|
|
85
91
|
export const directionVectorEquation = {
|
|
86
92
|
id: "directionVectorEquation",
|
|
87
93
|
label: "Coordonnées d'un vecteur directeur à partir d'une équation cartésienne",
|
|
88
|
-
levels: ["2nde"],
|
|
89
94
|
isSingleStep: true,
|
|
90
|
-
|
|
91
|
-
generator: (nb) => getDistinctQuestions(getDirectionVectorEquationQuestion, nb),
|
|
95
|
+
generator: (nb, opts) => getDistinctQuestions(getDirectionVectorEquationQuestion, nb),
|
|
92
96
|
qcmTimer: 60,
|
|
93
97
|
freeTimer: 60,
|
|
94
98
|
getPropositions,
|
|
95
99
|
isAnswerValid,
|
|
96
100
|
subject: "Mathématiques",
|
|
101
|
+
getAnswer,
|
|
102
|
+
getInstruction,
|
|
103
|
+
getQuestionFromIdentifiers,
|
|
104
|
+
rebuildIdentifiers,
|
|
97
105
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
c: number;
|
|
6
|
+
toReduced: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const cartesianEquationToReduced: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=cartesianEquationToReduced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cartesianEquationToReduced.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/lines/cartesianEquationToReduced.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAoLF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAiB5D,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { monom } from "../../../../tree/nodes/polynomials/monomNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
12
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
13
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
//ax+by+c = 0 into y = ... (et inversement)
|
|
15
|
+
const getCartesianEquation = (identifiers) => {
|
|
16
|
+
const { a, b, c, toReduced } = identifiers;
|
|
17
|
+
return add(add(monom(a, 1), monom(b, 1, { variable: "y" })), c).simplify({
|
|
18
|
+
forbidFactorize: true,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const getReducedEquation = (identifiers) => {
|
|
22
|
+
const { a, b, c, toReduced } = identifiers;
|
|
23
|
+
return frac(substract(-c, multiply(a, "x")), b).simplify({
|
|
24
|
+
towardsDistribute: true,
|
|
25
|
+
forceDistributeFractions: true,
|
|
26
|
+
forbidFactorize: true,
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
30
|
+
const { a, b, c, toReduced } = identifiers;
|
|
31
|
+
const propositions = [];
|
|
32
|
+
addValidProp(propositions, answer);
|
|
33
|
+
while (propositions.length < n) {
|
|
34
|
+
if (toReduced) {
|
|
35
|
+
const bRand = randint(-9, 10);
|
|
36
|
+
const aRand = coinFlip()
|
|
37
|
+
? RationalConstructor.randomIrreductible().toTree()
|
|
38
|
+
: randint(-9, 10);
|
|
39
|
+
tryToAddWrongProp(propositions, `y=${add(monom(aRand, 1), bRand).toTex()}`);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const bRand = randint(-9, 10);
|
|
43
|
+
const aRand = randint(-9, 10);
|
|
44
|
+
const cRand = randint(-9, 10);
|
|
45
|
+
tryToAddWrongProp(propositions, `${add(monom(aRand, 1), add(monom(bRand, 1, { variable: "y" }), cRand)).toTex()}=0`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return shuffleProps(propositions, n);
|
|
49
|
+
};
|
|
50
|
+
const getAnswer = (identifiers) => {
|
|
51
|
+
const { a, b, c, toReduced } = identifiers;
|
|
52
|
+
const equation = toReduced
|
|
53
|
+
? `y=${getReducedEquation(identifiers).toTex()}`
|
|
54
|
+
: `${getCartesianEquation(identifiers).toTex()}=0`;
|
|
55
|
+
return equation;
|
|
56
|
+
};
|
|
57
|
+
const getInstruction = (identifiers) => {
|
|
58
|
+
const { a, b, c, toReduced } = identifiers;
|
|
59
|
+
const equation = toReduced
|
|
60
|
+
? `${getCartesianEquation(identifiers).toTex()}=0`
|
|
61
|
+
: `y=${getReducedEquation(identifiers).toTex()}`;
|
|
62
|
+
return `Soit $d$ une droite d'équation ${toReduced ? "cartésienne" : "réduite"} :
|
|
63
|
+
|
|
64
|
+
$$
|
|
65
|
+
${equation}
|
|
66
|
+
$$
|
|
67
|
+
|
|
68
|
+
${toReduced
|
|
69
|
+
? `Quelle est l'équation réduite de $d$ ?`
|
|
70
|
+
: `Donner une équation cartésienne de $d$.`}`;
|
|
71
|
+
};
|
|
72
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {
|
|
73
|
+
// return "";
|
|
74
|
+
// };
|
|
75
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
|
|
76
|
+
// return "";
|
|
77
|
+
// };
|
|
78
|
+
const getKeys = (identifiers) => {
|
|
79
|
+
return ["x", "y", "equal"];
|
|
80
|
+
};
|
|
81
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
82
|
+
try {
|
|
83
|
+
const { a, b, c, toReduced } = identifiers;
|
|
84
|
+
if (toReduced) {
|
|
85
|
+
const splitted = ans.split("=");
|
|
86
|
+
if (splitted[0] !== "y" || splitted.length !== 2)
|
|
87
|
+
return false;
|
|
88
|
+
const parsed = parseAlgebraic(splitted[1]);
|
|
89
|
+
return ("y=" +
|
|
90
|
+
parsed
|
|
91
|
+
.simplify({
|
|
92
|
+
towardsDistribute: true,
|
|
93
|
+
forceDistributeFractions: true,
|
|
94
|
+
forbidFactorize: true,
|
|
95
|
+
})
|
|
96
|
+
.toTex() ===
|
|
97
|
+
answer);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
const splitted = ans.split("=");
|
|
101
|
+
if (splitted[1] !== "0" || splitted.length !== 2)
|
|
102
|
+
return false;
|
|
103
|
+
const parsed = parseAlgebraic(splitted[0]);
|
|
104
|
+
if (b === 0) {
|
|
105
|
+
const x = frac(-c, a).simplify();
|
|
106
|
+
return (parsed
|
|
107
|
+
.toDetailedEvaluation({ x: x, y: (0).toTree() })
|
|
108
|
+
.simplify()
|
|
109
|
+
.toTex() === "0" &&
|
|
110
|
+
parsed
|
|
111
|
+
.toDetailedEvaluation({ x: x, y: (1).toTree() })
|
|
112
|
+
.simplify()
|
|
113
|
+
.toTex() === "0");
|
|
114
|
+
}
|
|
115
|
+
const validpoints = [
|
|
116
|
+
[(0).toTree(), frac(-c, b).simplify()],
|
|
117
|
+
[(1).toTree(), frac(-c - a, b).simplify()],
|
|
118
|
+
];
|
|
119
|
+
return (parsed
|
|
120
|
+
.toDetailedEvaluation({ x: validpoints[0][0], y: validpoints[0][1] })
|
|
121
|
+
.simplify()
|
|
122
|
+
.toTex() === "0" &&
|
|
123
|
+
parsed
|
|
124
|
+
.toDetailedEvaluation({ x: validpoints[1][0], y: validpoints[1][1] })
|
|
125
|
+
.simplify()
|
|
126
|
+
.toTex() === "0");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
return handleVEAError(err);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const getCartesianEquationToReducedQuestion = (ops) => {
|
|
134
|
+
let a;
|
|
135
|
+
let b;
|
|
136
|
+
let c;
|
|
137
|
+
do {
|
|
138
|
+
a = randint(-9, 10);
|
|
139
|
+
b = randint(-9, 10, [0]);
|
|
140
|
+
c = randint(-9, 10, (a === 1 && b === 0) || (a === 0 && b === 1) ? [0] : undefined);
|
|
141
|
+
} while (gcd(a, b, c) !== 1 || (a <= 0 && b <= 0 && c <= 0));
|
|
142
|
+
const identifiers = { a, b, c, toReduced: coinFlip() };
|
|
143
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
144
|
+
};
|
|
145
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
146
|
+
return {
|
|
147
|
+
answer: getAnswer(identifiers),
|
|
148
|
+
instruction: getInstruction(identifiers),
|
|
149
|
+
keys: getKeys(identifiers),
|
|
150
|
+
answerFormat: "tex",
|
|
151
|
+
identifiers,
|
|
152
|
+
// hint: getHint(identifiers),
|
|
153
|
+
// correction: getCorrection(identifiers),
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
export const cartesianEquationToReduced = {
|
|
157
|
+
id: "cartesianEquationToReduced",
|
|
158
|
+
label: "Passer d'équation réduite d'une droite à équation cartésienne, et inversement",
|
|
159
|
+
isSingleStep: true,
|
|
160
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCartesianEquationToReducedQuestion(opts), nb),
|
|
161
|
+
qcmTimer: 60,
|
|
162
|
+
freeTimer: 60,
|
|
163
|
+
getPropositions,
|
|
164
|
+
isAnswerValid,
|
|
165
|
+
subject: "Mathématiques",
|
|
166
|
+
getInstruction,
|
|
167
|
+
// getHint,
|
|
168
|
+
// getCorrection,
|
|
169
|
+
getAnswer,
|
|
170
|
+
getQuestionFromIdentifiers,
|
|
171
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
c: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const findPointOnLineWithCartesianEquation: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=findPointOnLineWithCartesianEquation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findPointOnLineWithCartesianEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/lines/findPointOnLineWithCartesianEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4IF,eAAO,MAAM,oCAAoC,EAAE,QAAQ,CAAC,WAAW,CAqBtE,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Point, PointConstructor } from "../../../../math/geometry/point.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
+
import { monom } from "../../../../tree/nodes/polynomials/monomNode.js";
|
|
9
|
+
import { pointParser } from "../../../../tree/parsers/pointParser.js";
|
|
10
|
+
import { doWhile } from "../../../../utils/doWhile.js";
|
|
11
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
13
|
+
//ax+by+c = 0
|
|
14
|
+
const getPropositions = (n, { answer, a, b, c }) => {
|
|
15
|
+
const propositions = [];
|
|
16
|
+
addValidProp(propositions, answer);
|
|
17
|
+
const node = add(add(monom(a, 1), monom(b, 1, { variable: "y" })), c);
|
|
18
|
+
while (propositions.length < n) {
|
|
19
|
+
const point = doWhile(() => PointConstructor.random("A"), (p) => node.toDetailedEvaluation({ x: p.x, y: p.y }).simplify().toTex() ===
|
|
20
|
+
"0");
|
|
21
|
+
tryToAddWrongProp(propositions, point.toCoords());
|
|
22
|
+
}
|
|
23
|
+
return shuffleProps(propositions, n);
|
|
24
|
+
};
|
|
25
|
+
const getAnswer = (identifiers) => {
|
|
26
|
+
const { a, b, c } = identifiers;
|
|
27
|
+
if (b === 0)
|
|
28
|
+
return new Point("A", frac(-c, a).simplify(), 0).toCoords();
|
|
29
|
+
return new Point("A", 0, frac(-c, b).simplify()).toCoords();
|
|
30
|
+
};
|
|
31
|
+
const getInstruction = (identifiers) => {
|
|
32
|
+
const { a, b, c } = identifiers;
|
|
33
|
+
return `Soit $d$ la droite d'équation cartésienne :
|
|
34
|
+
|
|
35
|
+
$$
|
|
36
|
+
${add(add(monom(a, 1), monom(b, 1, { variable: "y" })), c).toTex()} = 0
|
|
37
|
+
$$
|
|
38
|
+
|
|
39
|
+
Donner les coordonnées d'un point appartenant à $d$.`;
|
|
40
|
+
};
|
|
41
|
+
const getHint = (identifiers) => {
|
|
42
|
+
const { a, b, c } = identifiers;
|
|
43
|
+
if (b === 0)
|
|
44
|
+
return `On peut isoler $x$ dans l'équation cartésienne de la droite, puis remarquer que $d$ est une droite verticale.`;
|
|
45
|
+
if (a === 0)
|
|
46
|
+
return `On peut isoler $y$ dans l'équation cartésienne de la droite, puis remarquer que $d$ est une droite horizontale.`;
|
|
47
|
+
return `On peut remplacer $x$ par une valeur quelconque $x_A$ dans l'équation de la droite, puis en déduire une valeur $y_A$ pour $y$. Le point de coordonnées $(x_A;y_A)$ est alors un point appartenant à $d$.`;
|
|
48
|
+
};
|
|
49
|
+
const getCorrection = (identifiers) => {
|
|
50
|
+
const { a, b, c } = identifiers;
|
|
51
|
+
const node = add(add(monom(a, 1), monom(b, 1, { variable: "y" })), c);
|
|
52
|
+
if (b === 0) {
|
|
53
|
+
const x = frac(-c, a).simplify();
|
|
54
|
+
return `On isole $x$ dans l'équation cartésienne de la droite :
|
|
55
|
+
|
|
56
|
+
${alignTex([
|
|
57
|
+
[node.toTex(), "=", "0"],
|
|
58
|
+
["x", "=", x.toTex()],
|
|
59
|
+
])}
|
|
60
|
+
|
|
61
|
+
On en déduit que tout point d'abscisse $${x.toTex()}$ appartient à $d$ (c'est à dire que $d$ est une droite verticale). Par exemple, le point $(${x.toTex()};0)$ appartient à $d$.`;
|
|
62
|
+
}
|
|
63
|
+
if (a === 0) {
|
|
64
|
+
const y = frac(-c, b).simplify();
|
|
65
|
+
return `On isole $y$ dans l'équation cartésienne de la droite :
|
|
66
|
+
|
|
67
|
+
${alignTex([
|
|
68
|
+
[node.toTex(), "=", "0"],
|
|
69
|
+
["y", "=", y.toTex()],
|
|
70
|
+
])}
|
|
71
|
+
|
|
72
|
+
On en déduit que tout point d'ordonnée $${y.toTex()}$ appartient à $d$ (c'est à dire que $d$ est une droite horizontale). Par exemple, le point $(0;${y.toTex()})$ appartient à $d$.`;
|
|
73
|
+
}
|
|
74
|
+
const detailed = node.toDetailedEvaluation({ x: (0).toTree() });
|
|
75
|
+
const simp = detailed.simplify();
|
|
76
|
+
const y = frac(-c, b).simplify();
|
|
77
|
+
return `On peut, par example, remplacer $x$ par $0$ dans l'équation de la droite :
|
|
78
|
+
|
|
79
|
+
$$
|
|
80
|
+
${detailed.toTex()} = ${simp.toTex()}
|
|
81
|
+
$$
|
|
82
|
+
|
|
83
|
+
On résout alors l'équation $${simp.toTex()} = 0$ :
|
|
84
|
+
|
|
85
|
+
${alignTex([
|
|
86
|
+
[simp.toTex(), "=", "0"],
|
|
87
|
+
["y", "=", y.toTex()],
|
|
88
|
+
])}
|
|
89
|
+
$$
|
|
90
|
+
${detailed.toTex()} = ${simp.toTex()}
|
|
91
|
+
$$
|
|
92
|
+
|
|
93
|
+
On en déduit que le point de coordonnées $(0;${y.toTex()})$ appartient à $d$.
|
|
94
|
+
`;
|
|
95
|
+
};
|
|
96
|
+
const getKeys = (identifiers) => {
|
|
97
|
+
return ["semicolon"];
|
|
98
|
+
};
|
|
99
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
100
|
+
try {
|
|
101
|
+
const { a, b, c } = identifiers;
|
|
102
|
+
const parsed = pointParser(ans);
|
|
103
|
+
if (!parsed)
|
|
104
|
+
return false;
|
|
105
|
+
const node = add(add(multiply(a, parsed.x), multiply(b, parsed.y)), c);
|
|
106
|
+
return node.simplify().toTex() === "0";
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
return handleVEAError(err);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const getFindPointOnLineWithCartesianEquationQuestion = (ops) => {
|
|
113
|
+
const a = randint(-9, 10);
|
|
114
|
+
const b = randint(-9, 10, a === 0 ? [0] : undefined);
|
|
115
|
+
const c = randint(-9, 10, (a === 1 && b === 0) || (a === 0 && b === 1) ? [0] : undefined);
|
|
116
|
+
const identifiers = { a, b, c };
|
|
117
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
118
|
+
};
|
|
119
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
120
|
+
return {
|
|
121
|
+
answer: getAnswer(identifiers),
|
|
122
|
+
instruction: getInstruction(identifiers),
|
|
123
|
+
keys: getKeys(identifiers),
|
|
124
|
+
answerFormat: "tex",
|
|
125
|
+
identifiers,
|
|
126
|
+
hint: getHint(identifiers),
|
|
127
|
+
correction: getCorrection(identifiers),
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export const findPointOnLineWithCartesianEquation = {
|
|
131
|
+
id: "findPointOnLineWithCartesianEquation",
|
|
132
|
+
label: "Déterminer les coordonnées d'un point dans l'équation cartésienne d'une droite",
|
|
133
|
+
isSingleStep: true,
|
|
134
|
+
generator: (nb, opts) => getDistinctQuestions(() => getFindPointOnLineWithCartesianEquationQuestion(opts), nb),
|
|
135
|
+
qcmTimer: 60,
|
|
136
|
+
freeTimer: 60,
|
|
137
|
+
getPropositions,
|
|
138
|
+
isAnswerValid,
|
|
139
|
+
subject: "Mathématiques",
|
|
140
|
+
getInstruction,
|
|
141
|
+
getHint,
|
|
142
|
+
getCorrection,
|
|
143
|
+
getAnswer,
|
|
144
|
+
getQuestionFromIdentifiers,
|
|
145
|
+
hasHintAndCorrection: true,
|
|
146
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const findPointOnLineWithReductEquation: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=findPointOnLineWithReductEquation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findPointOnLineWithReductEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/lines/findPointOnLineWithReductEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAyFF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAqBnE,CAAC"}
|