math-exercises 3.0.31 → 3.0.33
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/exercise.d.ts +1 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/exercise.js +9 -2
- package/lib/exercises/math/calcul/arithmetics/commonDivisorsList.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/commonDivisorsList.js +35 -13
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.js +1 -4
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts +5 -2
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +125 -48
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.js +57 -20
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts +4 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +21 -7
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV1.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV1.js +63 -18
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV2.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV2.js +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/parity/parityFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/parity/parityFromGraph.js +0 -4
- 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/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/triangles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/index.js +1 -1
- package/lib/exercises/math/geometry/triangles/triangleNature.d.ts +1 -0
- package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/triangleNature.js +57 -18
- 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/trigonometry/mainAngleMeasure.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/mainAngleMeasure.js +0 -1
- package/lib/index.d.ts +11 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/angle.d.ts +1 -0
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/spaceVector.d.ts.map +1 -1
- package/lib/math/geometry/spaceVector.js +2 -2
- package/lib/math/geometry/triangles/equilateralTriangle.d.ts +1 -0
- package/lib/math/geometry/triangles/equilateralTriangle.d.ts.map +1 -1
- package/lib/math/geometry/triangles/equilateralTriangle.js +6 -0
- package/lib/math/geometry/triangles/isoceleTriangle.d.ts +3 -1
- package/lib/math/geometry/triangles/isoceleTriangle.d.ts.map +1 -1
- package/lib/math/geometry/triangles/isoceleTriangle.js +7 -2
- 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/playground.d.ts.map +1 -1
- package/lib/playground.js +3 -1
- package/lib/tests/megaExosTest.d.ts +3 -0
- package/lib/tests/megaExosTest.d.ts.map +1 -0
- package/lib/tests/megaExosTest.js +6 -0
- package/lib/tests/megaml.test.d.ts +2 -0
- package/lib/tests/megaml.test.d.ts.map +1 -0
- package/lib/tests/megaml.test.js +10 -0
- package/lib/tests/questionTest.js +1 -1
- 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/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +10 -4
- package/package.json +2 -1
|
@@ -1,24 +1,56 @@
|
|
|
1
|
-
import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
6
|
-
const
|
|
7
|
-
const
|
|
7
|
+
const getInstruction = (identifiers, opts) => {
|
|
8
|
+
const { xA, yA, xB, yB } = identifiers;
|
|
9
|
+
const usePoints = opts?.usePoints;
|
|
10
|
+
const useLinear = opts?.useLinear;
|
|
11
|
+
const fctTex = `Soit $f$ une fonction ${useLinear ? "linéaire" : "affine"}`;
|
|
12
|
+
// const values = usePoints ?
|
|
13
|
+
const pointA = usePoints
|
|
14
|
+
? `$A\\left(${xA},${yA}\\right)$`
|
|
15
|
+
: `$f\\left(${xA}\\right) = ${yA}$`;
|
|
16
|
+
const pointB = usePoints
|
|
17
|
+
? `$B\\left(${xB},${yB}\\right)$`
|
|
18
|
+
: `$f\\left(${xB}\\right) = ${yB}$`;
|
|
19
|
+
if (opts?.useLinear) {
|
|
20
|
+
return `${fctTex} telle que ${usePoints
|
|
21
|
+
? `le point ${pointB} appartient à la droite représentant $f$`
|
|
22
|
+
: pointB}.
|
|
23
|
+
|
|
24
|
+
Quel est le coefficient directeur de $f$ ?`;
|
|
25
|
+
}
|
|
26
|
+
return `${fctTex} telle que ${usePoints
|
|
27
|
+
? `les points ${pointA} et ${pointB} appartiennent à la droite représentant $f$`
|
|
28
|
+
: `${pointA} et ${pointB}`}.
|
|
29
|
+
|
|
30
|
+
Quel est le coefficient directeur de $f$ ?`;
|
|
31
|
+
};
|
|
32
|
+
const getAnswer = (identifiers) => {
|
|
33
|
+
const { xA, yA, xB, yB } = identifiers;
|
|
34
|
+
const answer = new Rational(yB - yA, xB - xA).simplify().toTree().toTex();
|
|
35
|
+
return answer;
|
|
36
|
+
};
|
|
37
|
+
const getLeadingCoefficientCalculV1Question = (opts) => {
|
|
38
|
+
const useLinear = opts?.useLinear;
|
|
39
|
+
const [xA, yA] = useLinear ? [0, 0] : [1, 2].map((el) => randint(-9, 10));
|
|
8
40
|
const xB = randint(-9, 10, [xA]);
|
|
9
41
|
const yB = randint(-9, 10);
|
|
10
|
-
const
|
|
42
|
+
const identifiers = { xA, xB, yA, yB };
|
|
11
43
|
const question = {
|
|
12
|
-
instruction:
|
|
44
|
+
instruction: getInstruction(identifiers, opts),
|
|
13
45
|
startStatement: "a",
|
|
14
|
-
answer,
|
|
46
|
+
answer: getAnswer(identifiers, opts),
|
|
15
47
|
answerFormat: "tex",
|
|
16
48
|
keys: [],
|
|
17
|
-
identifiers
|
|
49
|
+
identifiers,
|
|
18
50
|
};
|
|
19
51
|
return question;
|
|
20
52
|
};
|
|
21
|
-
const getPropositions = (n, { answer, xA, xB, yA, yB }) => {
|
|
53
|
+
const getPropositions = (n, { answer, xA, xB, yA, yB }, opts) => {
|
|
22
54
|
const propositions = [];
|
|
23
55
|
addValidProp(propositions, answer);
|
|
24
56
|
while (propositions.length < n) {
|
|
@@ -30,24 +62,37 @@ const getPropositions = (n, { answer, xA, xB, yA, yB }) => {
|
|
|
30
62
|
}
|
|
31
63
|
return shuffle(propositions);
|
|
32
64
|
};
|
|
33
|
-
const isAnswerValid = (ans, { xA, xB, yA, yB }) => {
|
|
34
|
-
|
|
35
|
-
.simplify()
|
|
36
|
-
.toTree({ allowFractionToDecimal: true });
|
|
37
|
-
const texs = answer.toAllValidTexs();
|
|
38
|
-
return texs.includes(ans);
|
|
65
|
+
const isAnswerValid = (ans, { answer, xA, xB, yA, yB }) => {
|
|
66
|
+
return rationalVEA(ans, answer);
|
|
39
67
|
};
|
|
68
|
+
const options = [
|
|
69
|
+
{
|
|
70
|
+
id: "useLinear",
|
|
71
|
+
label: "Utiliser des fonctions linéaires",
|
|
72
|
+
target: GeneratorOptionTarget.generation,
|
|
73
|
+
type: GeneratorOptionType.checkbox,
|
|
74
|
+
defaultValue: false,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "usePoints",
|
|
78
|
+
label: "Utiliser des points plutôt que des images",
|
|
79
|
+
target: GeneratorOptionTarget.instruction,
|
|
80
|
+
type: GeneratorOptionType.checkbox,
|
|
81
|
+
defaultValue: false,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
40
84
|
export const leadingCoefficientCalculV1 = {
|
|
41
85
|
id: "leadingCoefficientCalculV1",
|
|
42
86
|
connector: "=",
|
|
43
|
-
label: "Calculer le coefficient directeur d'
|
|
44
|
-
levels: ["3ème", "2nde", "2ndPro", "1rePro", "1reTech"],
|
|
87
|
+
label: "Calculer le coefficient directeur à l'aide d'images/de points",
|
|
45
88
|
isSingleStep: true,
|
|
46
|
-
|
|
47
|
-
generator: (nb) => getDistinctQuestions(getLeadingCoefficientCalculV1Question, nb),
|
|
89
|
+
generator: (nb, opts) => getDistinctQuestions(() => getLeadingCoefficientCalculV1Question(opts), nb),
|
|
48
90
|
qcmTimer: 60,
|
|
49
91
|
freeTimer: 60,
|
|
50
92
|
getPropositions,
|
|
51
93
|
isAnswerValid,
|
|
52
94
|
subject: "Mathématiques",
|
|
95
|
+
options,
|
|
96
|
+
getInstruction,
|
|
97
|
+
getAnswer,
|
|
53
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leadingCoefficientCalculV2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficientCalculV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"leadingCoefficientCalculV2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficientCalculV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAUrC,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;AAgDF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAe5D,CAAC"}
|
|
@@ -39,7 +39,7 @@ const isAnswerValid = (ans, { xA, xB, yA, yB }) => {
|
|
|
39
39
|
export const leadingCoefficientCalculV2 = {
|
|
40
40
|
id: "leadingCoefficientCalculV2",
|
|
41
41
|
connector: "=",
|
|
42
|
-
label: "
|
|
42
|
+
label: "Calculer le coefficient directeur d'une fonction affine à l'aide de deux points",
|
|
43
43
|
levels: ["3ème", "2nde", "2ndPro", "1rePro", "1reTech"],
|
|
44
44
|
isSingleStep: false,
|
|
45
45
|
sections: ["Droites", "Fonctions affines"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IAEjB,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CACpB,CAAC;AAmNF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAoB9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parityFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/parity/parityFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;
|
|
1
|
+
{"version":3,"file":"parityFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/parity/parityFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAyGF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
|
|
@@ -106,9 +106,6 @@ const getPropositions = (n, { answer }) => {
|
|
|
106
106
|
tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
|
|
107
107
|
return shuffleProps(propositions, n);
|
|
108
108
|
};
|
|
109
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
110
|
-
return ans === answer;
|
|
111
|
-
};
|
|
112
109
|
export const parityFromGraph = {
|
|
113
110
|
id: "parityFromGraph",
|
|
114
111
|
label: "Reconnaître graphiquement la parité d'une fonction",
|
|
@@ -119,7 +116,6 @@ export const parityFromGraph = {
|
|
|
119
116
|
qcmTimer: 60,
|
|
120
117
|
freeTimer: 60,
|
|
121
118
|
getPropositions,
|
|
122
|
-
isAnswerValid,
|
|
123
119
|
answerType: "QCU",
|
|
124
120
|
hasGeogebra: true,
|
|
125
121
|
subject: "Mathématiques",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineProductSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAejD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AA8IF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAaF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"affineProductSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAejD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AA8IF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAaF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solveSecondDegreeEquationByFactorisation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"solveSecondDegreeEquationByFactorisation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAiHF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAiB1E,CAAC"}
|
package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { equationKeys } from "../../../../../exercises/utils/keys/equationKeys.js";
|
|
4
|
-
import { Rational } from "../../../../../math/numbers/rationals/rational.js";
|
|
5
4
|
import { Trinom } from "../../../../../math/polynomials/trinom.js";
|
|
6
5
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { equal } from "../../../../../tree/nodes/equations/equalNode.js";
|
|
7
7
|
import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
8
|
-
import {
|
|
8
|
+
import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { DiscreteSetNode, set } from "../../../../../tree/nodes/sets/discreteSetNode.js";
|
|
10
|
+
import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
|
|
9
11
|
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
12
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
10
13
|
/**
|
|
11
14
|
* Equation donnée sous forme ax^2 + bx ou bien forme développée d'une identité remarquable
|
|
12
15
|
* type 1 ax^2 + bx
|
|
@@ -14,61 +17,69 @@ import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
|
14
17
|
* type 3 (ax-b)^2
|
|
15
18
|
* type 4 (ax+b)(ax-b)
|
|
16
19
|
*/
|
|
17
|
-
const
|
|
18
|
-
const type =
|
|
19
|
-
let statement
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const getStatementNode = (identifiers) => {
|
|
21
|
+
const { a, b, type } = identifiers;
|
|
22
|
+
let statement;
|
|
23
|
+
switch (type) {
|
|
24
|
+
case 1:
|
|
25
|
+
//ax^2 + bx
|
|
26
|
+
const trinom = new Trinom(a, b, 0);
|
|
27
|
+
return trinom.toTex();
|
|
28
|
+
case 2:
|
|
29
|
+
//(ax+b)^2
|
|
30
|
+
return new Trinom(a ** 2, 2 * a * b, b ** 2).toTex();
|
|
31
|
+
case 3:
|
|
32
|
+
//(ax-b)^2
|
|
33
|
+
return new Trinom(a ** 2, -2 * a * b, b ** 2).toTex();
|
|
34
|
+
case 4:
|
|
35
|
+
default:
|
|
36
|
+
//(ax+b)(ax-b)
|
|
37
|
+
return new Trinom(a ** 2, 0, -(b ** 2)).toTex();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const getInstruction = (identifiers) => {
|
|
41
|
+
const instruction = `Soit $f$ la fonction définie par :
|
|
42
|
+
|
|
43
|
+
$$
|
|
44
|
+
f(x) = ${getStatementNode(identifiers)}
|
|
45
|
+
$$
|
|
46
|
+
|
|
47
|
+
Factoriser $f(x)$, puis résoudre l'équation $f(x) = 0$.`;
|
|
48
|
+
return instruction;
|
|
49
|
+
};
|
|
50
|
+
const getAnswer = (identifiers) => {
|
|
51
|
+
const { a, b, type } = identifiers;
|
|
52
|
+
let roots;
|
|
24
53
|
switch (type) {
|
|
25
54
|
case 1:
|
|
26
|
-
|
|
27
|
-
//ax^2 + bx
|
|
28
|
-
const trinom = new Trinom(randint(-9, 10, [0]), randint(-9, 10), 0);
|
|
29
|
-
a = trinom.a;
|
|
30
|
-
b = trinom.b;
|
|
31
|
-
statement = trinom.toTex();
|
|
32
|
-
roots = trinom.getRootsNode();
|
|
33
|
-
}
|
|
55
|
+
roots = set([(0).toTree(), frac(-b, a)]).simplify();
|
|
34
56
|
break;
|
|
35
57
|
case 2:
|
|
36
|
-
|
|
37
|
-
//(ax+b)^2
|
|
38
|
-
a = randint(-9, 10, [0]);
|
|
39
|
-
b = randint(1, 10);
|
|
40
|
-
statement = new Trinom(a ** 2, 2 * a * b, b ** 2).toTex();
|
|
41
|
-
roots = [new Rational(-b, a).simplify().toTree()];
|
|
42
|
-
}
|
|
58
|
+
roots = set([frac(-b, a).simplify()]);
|
|
43
59
|
break;
|
|
44
60
|
case 3:
|
|
45
|
-
|
|
46
|
-
//(ax-b)^2
|
|
47
|
-
a = randint(-9, 10, [0]);
|
|
48
|
-
b = randint(-9, 0, [0]);
|
|
49
|
-
statement = new Trinom(a ** 2, -2 * a * b, b ** 2).toTex();
|
|
50
|
-
roots = [new Rational(b, a).simplify().toTree()];
|
|
51
|
-
}
|
|
61
|
+
roots = set([frac(b, a)]).simplify();
|
|
52
62
|
break;
|
|
53
63
|
case 4:
|
|
54
64
|
default:
|
|
55
|
-
|
|
56
|
-
//(ax+b)(ax-b)
|
|
57
|
-
a = randint(-9, 10, [0]);
|
|
58
|
-
b = randint(1, 10);
|
|
59
|
-
statement = new Trinom(a ** 2, 0, -(b ** 2)).toTex();
|
|
60
|
-
roots = [b, -b].sort((a, b) => a - b).map((x) => x.toTree());
|
|
61
|
-
}
|
|
65
|
+
roots = set([frac(-b, a), frac(b, a)]).simplify();
|
|
62
66
|
break;
|
|
63
67
|
}
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
return equal("S", roots).toTex();
|
|
69
|
+
};
|
|
70
|
+
const getSolveSecondDegreeEquationByFactorisationQuestion = () => {
|
|
71
|
+
const type = randint(1, 4);
|
|
72
|
+
let a;
|
|
73
|
+
let b;
|
|
74
|
+
a = randint(-9, 10, [0]);
|
|
75
|
+
b = randint([2, 4].includes(type) ? 1 : -9, 10, [0]);
|
|
76
|
+
const identifiers = { a, b, type };
|
|
66
77
|
const question = {
|
|
67
|
-
answer,
|
|
68
|
-
instruction,
|
|
78
|
+
answer: getAnswer(identifiers),
|
|
79
|
+
instruction: getInstruction(identifiers),
|
|
69
80
|
keys: [...equationKeys],
|
|
70
81
|
answerFormat: "tex",
|
|
71
|
-
identifiers
|
|
82
|
+
identifiers,
|
|
72
83
|
};
|
|
73
84
|
return question;
|
|
74
85
|
};
|
|
@@ -86,46 +97,27 @@ const getPropositions = (n, { answer }) => {
|
|
|
86
97
|
return shuffleProps(propositions, n);
|
|
87
98
|
};
|
|
88
99
|
const isAnswerValid = (ans, { answer, type, a, b }) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
case 2:
|
|
98
|
-
{
|
|
99
|
-
roots = [new Rational(-b, a).simplify().toTree()];
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
case 3:
|
|
103
|
-
{
|
|
104
|
-
roots = [new Rational(b, a).simplify().toTree()];
|
|
105
|
-
}
|
|
106
|
-
break;
|
|
107
|
-
case 4:
|
|
108
|
-
{
|
|
109
|
-
roots = [b, -b].sort((a, b) => a - b).map((x) => x.toTree());
|
|
110
|
-
}
|
|
111
|
-
break;
|
|
100
|
+
try {
|
|
101
|
+
const parsed = discreteSetParser(ans);
|
|
102
|
+
if (!parsed)
|
|
103
|
+
return false;
|
|
104
|
+
return ("S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return handleVEAError(err);
|
|
112
108
|
}
|
|
113
|
-
const answerTree = new EquationSolutionNode(new DiscreteSetNode(roots), {
|
|
114
|
-
opts: { allowFractionToDecimal: true, allowRawRightChildAsSolution: true },
|
|
115
|
-
});
|
|
116
|
-
return answerTree.toAllValidTexs().includes(ans);
|
|
117
109
|
};
|
|
118
110
|
export const solveSecondDegreeEquationByFactorisation = {
|
|
119
111
|
id: "solveSecondDegreeEquationByFactorisation",
|
|
120
112
|
connector: "\\iff",
|
|
121
113
|
label: "Résoudre une équation du second degré par factorisation",
|
|
122
|
-
levels: [],
|
|
123
114
|
isSingleStep: true,
|
|
124
|
-
sections: [],
|
|
125
115
|
generator: (nb) => getDistinctQuestions(getSolveSecondDegreeEquationByFactorisationQuestion, nb),
|
|
126
116
|
qcmTimer: 60,
|
|
127
117
|
freeTimer: 60,
|
|
128
118
|
getPropositions,
|
|
129
119
|
isAnswerValid,
|
|
130
120
|
subject: "Mathématiques",
|
|
121
|
+
getAnswer,
|
|
122
|
+
getInstruction,
|
|
131
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paraboleExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CAIpB,CAAC;
|
|
1
|
+
{"version":3,"file":"paraboleExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CAIpB,CAAC;AAuSF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAmB3D,CAAC"}
|
|
@@ -29,7 +29,7 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
29
29
|
let x2 = randint(-8, 9, [0]);
|
|
30
30
|
if (x1 > x2)
|
|
31
31
|
[x1, x2] = [x2, x1];
|
|
32
|
-
tryToAddWrongProp(propositions, multiply(randint(-5, 6, [0]), multiply(substract("x", x1), substract("x", x2))).toTex());
|
|
32
|
+
tryToAddWrongProp(propositions, multiply(randint(-5, 6, [0]), multiply(substract("x", x1).simplify(), substract("x", x2).simplify())).toTex());
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA6FF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAgBzD,CAAC"}
|
|
@@ -2,22 +2,33 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../../exercises/exerc
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
4
4
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
5
|
-
import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
6
5
|
import { OppositeNode } from "../../../../../tree/nodes/functions/oppositeNode.js";
|
|
7
6
|
import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
|
|
8
|
-
import {
|
|
7
|
+
import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
|
|
9
8
|
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { a, b, c } = identifiers;
|
|
12
|
+
const trinom = new Trinom(a, b, c);
|
|
13
|
+
return `Soit $f(x) = ${trinom
|
|
14
|
+
.toFactorized()
|
|
15
|
+
.toTex()}$. Résoudre l'équation $f(x) = 0$.`;
|
|
16
|
+
};
|
|
17
|
+
const getAnswer = (identifiers) => {
|
|
18
|
+
const { a, b, c } = identifiers;
|
|
19
|
+
const trinom = new Trinom(a, b, c);
|
|
20
|
+
const answer = trinom.getRootsEquationSolutionTex();
|
|
21
|
+
return answer;
|
|
22
|
+
};
|
|
10
23
|
const getRootsFromFactorizedFormQuestion = () => {
|
|
11
24
|
const trinom = TrinomConstructor.randomFactorized();
|
|
12
|
-
const
|
|
25
|
+
const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
|
|
13
26
|
const question = {
|
|
14
|
-
answer:
|
|
15
|
-
instruction:
|
|
16
|
-
.getFactorizedForm()
|
|
17
|
-
.toTex()}$. Résoudre l'équation $f(x) = 0$.`,
|
|
27
|
+
answer: getAnswer(identifiers),
|
|
28
|
+
instruction: getInstruction(identifiers),
|
|
18
29
|
keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
|
|
19
30
|
answerFormat: "tex",
|
|
20
|
-
identifiers
|
|
31
|
+
identifiers,
|
|
21
32
|
};
|
|
22
33
|
return question;
|
|
23
34
|
};
|
|
@@ -44,12 +55,16 @@ const getPropositions = (n, { answer, a, b, c }) => {
|
|
|
44
55
|
}
|
|
45
56
|
return shuffle(propositions);
|
|
46
57
|
};
|
|
47
|
-
const isAnswerValid = (ans, { a, b, c }) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
59
|
+
try {
|
|
60
|
+
const parsed = discreteSetParser(ans);
|
|
61
|
+
if (!parsed)
|
|
62
|
+
return false;
|
|
63
|
+
return ("S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
return handleVEAError(err);
|
|
67
|
+
}
|
|
53
68
|
};
|
|
54
69
|
export const rootsFromFactorizedForm = {
|
|
55
70
|
id: "rootsFromFactorizedForm",
|
|
@@ -64,4 +79,6 @@ export const rootsFromFactorizedForm = {
|
|
|
64
79
|
getPropositions,
|
|
65
80
|
isAnswerValid,
|
|
66
81
|
subject: "Mathématiques",
|
|
82
|
+
getInstruction,
|
|
83
|
+
getAnswer,
|
|
67
84
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootsReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"rootsReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAc9C,CAAC"}
|
|
@@ -54,6 +54,7 @@ const getPropositions = (n, { answer }) => {
|
|
|
54
54
|
const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
55
55
|
const roots = new Trinom(a, b, c).getRoots();
|
|
56
56
|
const studentNumbers = ans
|
|
57
|
+
.replaceAll("\\text{ }", "")
|
|
57
58
|
.split("\\text{ et }")
|
|
58
59
|
.map((n) => Number(n.replace(",", ".")))
|
|
59
60
|
.filter((n) => !isNaN(n))
|
|
@@ -64,9 +65,7 @@ const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
|
64
65
|
export const rootsReading = {
|
|
65
66
|
id: "rootsReading",
|
|
66
67
|
label: "Lire graphiquement les racines d'un trinôme",
|
|
67
|
-
levels: ["1reSpé", "1rePro"],
|
|
68
68
|
isSingleStep: true,
|
|
69
|
-
sections: ["Second degré"],
|
|
70
69
|
generator: (nb) => getDistinctQuestions(getRootsReadingQuestion, nb),
|
|
71
70
|
qcmTimer: 60,
|
|
72
71
|
freeTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinomSignFromFacto.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/sign/trinomSignFromFacto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAwHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"trinomSignFromFacto.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/sign/trinomSignFromFacto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAwHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAoBrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinomSignFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/sign/trinomSignFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAuHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"trinomSignFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/sign/trinomSignFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAuHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAoBrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"midpoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/midpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"midpoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/midpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAmFF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAa1C,CAAC"}
|
|
@@ -5,18 +5,31 @@ import { distinctRandTupleInt } from "../../../../math/utils/random/randTupleInt
|
|
|
5
5
|
import { PointNode } from "../../../../tree/nodes/geometry/pointNode.js";
|
|
6
6
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
7
7
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
8
|
+
const getPoints = (identifiers) => {
|
|
9
|
+
const { coordsA, coordsB } = identifiers;
|
|
10
|
+
const A = new Point("A", new NumberNode(coordsA[0]), new NumberNode(coordsA[1]));
|
|
11
|
+
const B = new Point("B", new NumberNode(coordsB[0]), new NumberNode(coordsB[1]));
|
|
12
|
+
return [A, B];
|
|
13
|
+
};
|
|
14
|
+
const getInstruction = (identifiers) => {
|
|
15
|
+
const [A, B] = getPoints(identifiers);
|
|
16
|
+
return `Soit $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$. Quelles sont les coordonnées du milieu $I$ de $[AB]$ ?`;
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const [A, B] = getPoints(identifiers);
|
|
20
|
+
const answer = A.midpoint(B).toTexWithCoords();
|
|
21
|
+
return answer;
|
|
22
|
+
};
|
|
8
23
|
const getMidpointQuestion = () => {
|
|
9
24
|
const [coords1, coords2] = distinctRandTupleInt(2, 2, { from: -9, to: 10 });
|
|
10
|
-
const
|
|
11
|
-
const B = new Point("B", new NumberNode(coords2[0]), new NumberNode(coords2[1]));
|
|
12
|
-
const answer = A.midpoint(B).toTexWithCoords();
|
|
25
|
+
const identifiers = { coordsA: coords1, coordsB: coords2 };
|
|
13
26
|
const question = {
|
|
14
|
-
instruction:
|
|
27
|
+
instruction: getInstruction(identifiers),
|
|
15
28
|
startStatement: "I",
|
|
16
|
-
answer,
|
|
29
|
+
answer: getAnswer(identifiers),
|
|
17
30
|
keys: ["I", "semicolon"],
|
|
18
31
|
answerFormat: "tex",
|
|
19
|
-
identifiers
|
|
32
|
+
identifiers,
|
|
20
33
|
};
|
|
21
34
|
return question;
|
|
22
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointCoordinates.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/pointCoordinates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"pointCoordinates.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/pointCoordinates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiFF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointCoordinatesNoAxisNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"pointCoordinatesNoAxisNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA6HF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAc/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointCoordinatesNoOrthonorm.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"pointCoordinatesNoOrthonorm.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2GF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAc7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triangleNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/triangleNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"triangleNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/triangleNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAKnD,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAqJF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}
|