math-exercises 3.0.88 → 3.0.90
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/math/calcul/arithmetics/findZeroesProductQuotient.d.ts +11 -0
- package/lib/exercises/math/calcul/arithmetics/findZeroesProductQuotient.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/findZeroesProductQuotient.js +213 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +1 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.js +2 -2
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +1 -1
- package/lib/exercises/math/functions/affines/affineFromExercise.d.ts +9 -0
- package/lib/exercises/math/functions/affines/affineFromExercise.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineFromExercise.js +111 -0
- package/lib/exercises/math/functions/affines/index.d.ts +1 -0
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +2 -0
- package/lib/exercises/math/functions/basics/signOfFunction.d.ts +8 -0
- package/lib/exercises/math/functions/basics/signOfFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/signOfFunction.js +122 -0
- package/lib/exercises/math/functions/parity/finishParityFunctionGraph.d.ts +9 -0
- package/lib/exercises/math/functions/parity/finishParityFunctionGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/parity/finishParityFunctionGraph.js +154 -0
- package/lib/exercises/math/functions/parity/index.d.ts +1 -0
- package/lib/exercises/math/functions/parity/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/parity/index.js +1 -0
- package/lib/exercises/math/functions/sign/affineProductSignTable.d.ts +9 -0
- package/lib/exercises/math/functions/sign/affineProductSignTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/affineProductSignTable.js +201 -0
- package/lib/exercises/math/functions/sign/affineSignTable.d.ts +8 -0
- package/lib/exercises/math/functions/sign/affineSignTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/affineSignTable.js +111 -0
- package/lib/exercises/math/functions/sign/index.d.ts +4 -0
- package/lib/exercises/math/functions/sign/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/index.js +4 -0
- package/lib/exercises/math/functions/sign/readSignTable.d.ts +10 -0
- package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/readSignTable.js +124 -0
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +11 -0
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/signTableFromGraph.js +141 -0
- package/lib/exercises/math/functions/square/squareImageInterval.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/squareImageInterval.js +7 -1
- package/lib/exercises/math/functions/variations/compareImagesInVarTable.d.ts +11 -0
- package/lib/exercises/math/functions/variations/compareImagesInVarTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/variations/compareImagesInVarTable.js +153 -0
- package/lib/exercises/math/functions/variations/index.d.ts +2 -0
- package/lib/exercises/math/functions/variations/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/index.js +2 -0
- package/lib/exercises/math/functions/variations/varTableFromGraph.d.ts +9 -0
- package/lib/exercises/math/functions/variations/varTableFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/variations/varTableFromGraph.js +184 -0
- package/lib/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.d.ts +12 -0
- package/lib/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.js +127 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearity.d.ts +11 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearity.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearity.js +118 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.d.ts +11 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.js +158 -0
- package/lib/exercises/math/geometry/vectors/colinearity/index.d.ts +4 -0
- package/lib/exercises/math/geometry/vectors/colinearity/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/colinearity/index.js +3 -0
- package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.d.ts +9 -0
- package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.js +174 -0
- package/lib/exercises/math/geometry/vectors/index.d.ts +2 -2
- package/lib/exercises/math/geometry/vectors/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/index.js +2 -2
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/polynomialPrimitive.js +10 -1
- package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.js +1 -1
- package/lib/exercises/math/python/variableAffectation.js +2 -2
- package/lib/exercises/math/tests/index.d.ts +2 -0
- package/lib/exercises/math/tests/index.d.ts.map +1 -0
- package/lib/exercises/math/tests/index.js +1 -0
- package/lib/exercises/math/tests/testMultiLineSignTable.d.ts +9 -0
- package/lib/exercises/math/tests/testMultiLineSignTable.d.ts.map +1 -0
- package/lib/exercises/math/tests/testMultiLineSignTable.js +156 -0
- package/lib/exercises/math/tests/testSignTable.d.ts +8 -0
- package/lib/exercises/math/tests/testSignTable.d.ts.map +1 -0
- package/lib/exercises/math/tests/testSignTable.js +90 -0
- package/lib/exercises/math/tests/testVarTable.d.ts +11 -0
- package/lib/exercises/math/tests/testVarTable.d.ts.map +1 -0
- package/lib/exercises/math/tests/testVarTable.js +147 -0
- package/lib/exercises/math/trigonometry/index.d.ts +1 -0
- package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/index.js +1 -0
- package/lib/exercises/math/trigonometry/trigoFundamentalEquation.d.ts +9 -0
- package/lib/exercises/math/trigonometry/trigoFundamentalEquation.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/trigoFundamentalEquation.js +151 -0
- package/lib/geogebra/parsers/ggbPointsToPoints.d.ts +3 -0
- package/lib/geogebra/parsers/ggbPointsToPoints.d.ts.map +1 -0
- package/lib/geogebra/parsers/ggbPointsToPoints.js +12 -0
- package/lib/index.d.ts +73 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +2 -0
- package/lib/math/numbers/reals/real.d.ts.map +1 -1
- package/lib/math/numbers/reals/real.js +7 -2
- package/lib/playground.d.ts.map +1 -1
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +9 -3
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +19 -10
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +3 -1
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +10 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
2
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
3
|
+
import { Polynomial } from "../../../../math/polynomials/polynomial.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
6
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
|
+
const getFunc = (identifiers) => {
|
|
8
|
+
const { coeffs } = identifiers;
|
|
9
|
+
const poly = new Polynomial(coeffs);
|
|
10
|
+
return (x) => coeffs;
|
|
11
|
+
};
|
|
12
|
+
const getRoots = (identifiers) => {
|
|
13
|
+
const { coeffs } = identifiers;
|
|
14
|
+
const [d, c, b, a] = coeffs;
|
|
15
|
+
const sqrtDelta = 2 * Math.sqrt(b ** 2 - 3 * a * c);
|
|
16
|
+
const x1 = (-2 * b - sqrtDelta) / (6 * a);
|
|
17
|
+
const x2 = (-2 * b + sqrtDelta) / (6 * a);
|
|
18
|
+
return [x1, x2].sort((a, b) => a - b);
|
|
19
|
+
};
|
|
20
|
+
const getGGBOptions = (identifiers) => {
|
|
21
|
+
const { coeffs } = identifiers;
|
|
22
|
+
const poly = new Polynomial(coeffs);
|
|
23
|
+
const commands = [`f(x) =${poly.toMathString()}`];
|
|
24
|
+
const ggb = new GeogebraConstructor({
|
|
25
|
+
commands,
|
|
26
|
+
lockedAxesRatio: false,
|
|
27
|
+
});
|
|
28
|
+
const [x1, x2] = getRoots(identifiers);
|
|
29
|
+
const fx1 = poly.calculate(x1);
|
|
30
|
+
const fx2 = poly.calculate(x2);
|
|
31
|
+
return ggb.getOptions({
|
|
32
|
+
coords: ggb.getAdaptedCoords({
|
|
33
|
+
xMin: x1 - 2,
|
|
34
|
+
xMax: x2 + 2,
|
|
35
|
+
yMin: Math.min(fx1, fx2) - 2,
|
|
36
|
+
yMax: Math.max(fx1, fx2) + 2,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const getAnswerTable = (identifiers) => {
|
|
41
|
+
const { coeffs } = identifiers;
|
|
42
|
+
const [d, c, b, a] = coeffs;
|
|
43
|
+
const poly = new Polynomial(coeffs);
|
|
44
|
+
const [x1, x2] = getRoots(identifiers);
|
|
45
|
+
const fx1 = poly.calculate(x1);
|
|
46
|
+
const fx2 = poly.calculate(x2);
|
|
47
|
+
const vars = coeffs[3] > 0
|
|
48
|
+
? ["\\nearrow", "\\searrow", "\\nearrow"]
|
|
49
|
+
: ["\\searrow", "\\nearrow", "\\searrow"];
|
|
50
|
+
return [
|
|
51
|
+
[
|
|
52
|
+
"$x$",
|
|
53
|
+
"-\\infty",
|
|
54
|
+
"\\ ",
|
|
55
|
+
x1.toTree().toTex(),
|
|
56
|
+
"\\ ",
|
|
57
|
+
x2.toTree().toTex(),
|
|
58
|
+
"\\ ",
|
|
59
|
+
"+\\infty",
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
"$\\ $",
|
|
63
|
+
"\\ ",
|
|
64
|
+
"\\ ",
|
|
65
|
+
a > 0 ? fx1.toTree().toTex() : "\\ ",
|
|
66
|
+
"\\ ",
|
|
67
|
+
a > 0 ? "\\ " : fx1.toTree().toTex(),
|
|
68
|
+
"\\ ",
|
|
69
|
+
"\\ ",
|
|
70
|
+
],
|
|
71
|
+
["$f(x)$", "\\ ", vars[0], "\\ ", vars[1], "\\ ", vars[2], "\\ "],
|
|
72
|
+
[
|
|
73
|
+
"$\\ $",
|
|
74
|
+
"\\ ",
|
|
75
|
+
"\\ ",
|
|
76
|
+
a > 0 ? "\\ " : fx2.toTree().toTex(),
|
|
77
|
+
"\\ ",
|
|
78
|
+
a > 0 ? fx2.toTree().toTex() : "\\ ",
|
|
79
|
+
"\\ ",
|
|
80
|
+
"\\ ",
|
|
81
|
+
],
|
|
82
|
+
];
|
|
83
|
+
};
|
|
84
|
+
const getInstruction = (identifiers) => {
|
|
85
|
+
return `Dresser le tableau de variations de la fonction $f$ définie sur $\\mathbb{R}$ dont la courbe représentative est donnée ci-dessous :`;
|
|
86
|
+
};
|
|
87
|
+
const getHint = (identifiers) => {
|
|
88
|
+
return `La fonction est définie sur $\\mathbb{R}$, donc les valeurs de $x$ vont de $-\\infty$ à $+\\infty$.
|
|
89
|
+
|
|
90
|
+
Repère ensuite les points de la courbe auxquels le sens de variation change. Dans la première ligne du tableau, il faut mettre les abscisses de ces points, et dans la deuxième ligne, les ordonnées.`;
|
|
91
|
+
};
|
|
92
|
+
const getCorrection = (identifiers) => {
|
|
93
|
+
const { coeffs } = identifiers;
|
|
94
|
+
const [d, c, b, a] = coeffs;
|
|
95
|
+
const poly = new Polynomial(coeffs);
|
|
96
|
+
const [x1, x2] = getRoots(identifiers);
|
|
97
|
+
const fx1 = poly.calculate(x1);
|
|
98
|
+
const fx2 = poly.calculate(x2);
|
|
99
|
+
const words = a > 0
|
|
100
|
+
? ["croissante", "décroissante", "croissante"]
|
|
101
|
+
: ["décroissante", "croissante", "décroissante"];
|
|
102
|
+
return `D'après le graphique, la fonction $f$ est ${words[0]} sur $]-\\infty; ${x1}]$, puis ${words[1]} sur $[${x1}; ${x2}]$, puis ${words[2]} sur $[${x2}; +\\infty[$.
|
|
103
|
+
|
|
104
|
+
De plus, on lit graphiquement que l'image de $${x1}$ est $${fx1}$, et celle de $${x2}$ est $${fx2}$.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
`;
|
|
108
|
+
};
|
|
109
|
+
const getKeys = (identifiers) => {
|
|
110
|
+
return ["infty"];
|
|
111
|
+
};
|
|
112
|
+
const isAnswerTableValid = (ans, { answerTable }) => {
|
|
113
|
+
try {
|
|
114
|
+
return ans.every((row, i) => row.every((cell, j) => cell === answerTable[i][j]));
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
return handleVEAError(err);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
// const lists = [
|
|
121
|
+
// "x^3 - 3x",
|
|
122
|
+
// "x^3 -6x^2 + 9x",
|
|
123
|
+
// "-x^3 + 3x^2 + 9x",
|
|
124
|
+
// "2x^3 - 9x^2 + 12x",
|
|
125
|
+
// "-x^3+6x^2-9x",
|
|
126
|
+
// "4x^3 -24x^2 + 36x",
|
|
127
|
+
// ];
|
|
128
|
+
const poly3Coeffs = [
|
|
129
|
+
[0, -3, 0, 1],
|
|
130
|
+
[0, 9, -6, 1],
|
|
131
|
+
// [0, 9, 3, -1],
|
|
132
|
+
[0, 12, -9, 2],
|
|
133
|
+
[0, -9, 6, -1],
|
|
134
|
+
// [0, 36, -24, 4],
|
|
135
|
+
];
|
|
136
|
+
const getTestSignTableQuestion = (ops) => {
|
|
137
|
+
const index = randint(0, 4);
|
|
138
|
+
const coeffs = coinFlip()
|
|
139
|
+
? poly3Coeffs[index]
|
|
140
|
+
: poly3Coeffs[index].map((x) => -x);
|
|
141
|
+
const initTable = [
|
|
142
|
+
["$x$", "", "\\ ", "", "\\ ", "", "\\ ", ""],
|
|
143
|
+
["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
|
|
144
|
+
["$f(x)$", "\\ ", "", "", "", "", "", "\\ "],
|
|
145
|
+
["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
|
|
146
|
+
];
|
|
147
|
+
const identifiers = {
|
|
148
|
+
type: 0,
|
|
149
|
+
coeffs: [coeffs[0] + randint(-10, 10), ...coeffs.slice(1)],
|
|
150
|
+
initTable,
|
|
151
|
+
};
|
|
152
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
153
|
+
};
|
|
154
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
155
|
+
return {
|
|
156
|
+
answerTable: getAnswerTable(identifiers),
|
|
157
|
+
instruction: getInstruction(identifiers),
|
|
158
|
+
keys: getKeys(identifiers),
|
|
159
|
+
answerFormat: "tex",
|
|
160
|
+
identifiers,
|
|
161
|
+
hint: getHint(identifiers),
|
|
162
|
+
correction: getCorrection(identifiers),
|
|
163
|
+
initTable: identifiers.initTable,
|
|
164
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
export const varTableFromGraph = {
|
|
168
|
+
id: "varTableFromGraph",
|
|
169
|
+
label: "Dresser le tableau de variations d'une fonction à partir de sa représentation graphique",
|
|
170
|
+
isSingleStep: true,
|
|
171
|
+
generator: (nb, opts) => getDistinctQuestions(() => getTestSignTableQuestion(opts), nb),
|
|
172
|
+
qcmTimer: 60,
|
|
173
|
+
freeTimer: 60,
|
|
174
|
+
isAnswerTableValid,
|
|
175
|
+
subject: "Mathématiques",
|
|
176
|
+
getInstruction,
|
|
177
|
+
getHint,
|
|
178
|
+
getCorrection,
|
|
179
|
+
getAnswerTable,
|
|
180
|
+
getQuestionFromIdentifiers,
|
|
181
|
+
hasHintAndCorrection: true,
|
|
182
|
+
answerType: "varTable",
|
|
183
|
+
hasGeogebra: true,
|
|
184
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
xA: number;
|
|
4
|
+
xB: number;
|
|
5
|
+
xC: number;
|
|
6
|
+
yA: number;
|
|
7
|
+
yB: number;
|
|
8
|
+
yC: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const alignementViaColinearity: Exercise<Identifiers>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=alignementViaColinearity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignementViaColinearity.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA8HF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAa1D,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Point, PointConstructor } from "../../../../../math/geometry/point.js";
|
|
4
|
+
import { Vector, VectorConstructor } from "../../../../../math/geometry/vector.js";
|
|
5
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
|
|
7
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
8
|
+
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
9
|
+
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
10
|
+
const getPoints = (identifiers) => {
|
|
11
|
+
const { xA, xB, xC, yA, yB, yC } = identifiers;
|
|
12
|
+
return [
|
|
13
|
+
new Point("A", xA, yA),
|
|
14
|
+
new Point("B", xB, yB),
|
|
15
|
+
new Point("C", xC, yC),
|
|
16
|
+
];
|
|
17
|
+
};
|
|
18
|
+
const getInstruction = (identifiers) => {
|
|
19
|
+
const points = getPoints(identifiers);
|
|
20
|
+
return `Soient trois points $${points[0].toTexWithCoords()}$, $${points[1].toTexWithCoords()}$ et $${points[2].toTexWithCoords()}$ dans un repère orthonormé.
|
|
21
|
+
|
|
22
|
+
Les points $A$, $B$ et $C$ sont-ils alignés ?`;
|
|
23
|
+
};
|
|
24
|
+
const getAnswer = (identifiers) => {
|
|
25
|
+
const points = getPoints(identifiers);
|
|
26
|
+
const vec1 = VectorConstructor.fromPoints(points[0], points[1]);
|
|
27
|
+
const vec2 = VectorConstructor.fromPoints(points[0], points[2]);
|
|
28
|
+
const isAligned = vec1.isColinear(vec2);
|
|
29
|
+
const answer = isAligned ? "Oui" : "Non";
|
|
30
|
+
return answer;
|
|
31
|
+
};
|
|
32
|
+
const getHint = (identifiers) => {
|
|
33
|
+
return `Les points $A$, $B$ et $C$ sont alignés si et seulement si les vecteurs $\\overrightarrow{AB}$ et $\\overrightarrow{AC}$ sont colinéaires.`;
|
|
34
|
+
};
|
|
35
|
+
const getCorrection = (identifiers) => {
|
|
36
|
+
const points = getPoints(identifiers);
|
|
37
|
+
const vec1 = new Vector("AB", substract(points[1].x, points[0].x), substract(points[1].y, points[0].y));
|
|
38
|
+
const vec1Simp = vec1.simplify();
|
|
39
|
+
const vec2 = new Vector("AC", substract(points[2].x, points[0].x), substract(points[2].y, points[0].y));
|
|
40
|
+
const vec2Simp = vec2.simplify();
|
|
41
|
+
const det = vec1Simp.determinant(vec2Simp);
|
|
42
|
+
const isAligned = vec1.isColinear(vec2);
|
|
43
|
+
return `Les points $A$, $B$ et $C$ sont alignés si et seulement si les vecteurs $\\overrightarrow{AB}$ et $\\overrightarrow{AC}$ sont colinéaires.
|
|
44
|
+
|
|
45
|
+
On calcule les coordonnées de ces vecteurs :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
${vec1.toTexWithCoords()}=${vec1Simp.toBinomCoords().toTex()}
|
|
49
|
+
$$
|
|
50
|
+
|
|
51
|
+
et
|
|
52
|
+
|
|
53
|
+
$$
|
|
54
|
+
${vec2.toTexWithCoords()}=${vec2Simp.toBinomCoords().toTex()}
|
|
55
|
+
$$
|
|
56
|
+
|
|
57
|
+
On calcule ensuite le déterminant des deux vecteurs :
|
|
58
|
+
|
|
59
|
+
$$
|
|
60
|
+
\\det(${vec1.toTex()};${vec2.toTex()})=${det.toTex()}=${det.simplify().toTex()}
|
|
61
|
+
$$
|
|
62
|
+
|
|
63
|
+
${isAligned
|
|
64
|
+
? `Puisque le déterminant est nul, les vecteurs sont colinéaires. Les points $A$, $B$ et $C$ sont donc alignés.`
|
|
65
|
+
: `Puisque le déterminant n'est pas nul, les vecteurs ne sont pas colinéaires. Les points $A$, $B$ et $C$ ne sont donc pas alignés.`}`;
|
|
66
|
+
};
|
|
67
|
+
const getAlignementViaColinearityQuestion = () => {
|
|
68
|
+
const xA = randint(-10, 11);
|
|
69
|
+
const yA = randint(-10, 11);
|
|
70
|
+
const xB = randint(-10, 11, [xA]);
|
|
71
|
+
const yB = randint(-10, 11, [yA]);
|
|
72
|
+
const points = [new Point("A", xA, yA), new Point("B", xB, yB)];
|
|
73
|
+
const AB = VectorConstructor.fromPoints(points[0], points[1]);
|
|
74
|
+
let C;
|
|
75
|
+
const isAligned = coinFlip();
|
|
76
|
+
const coeff = new NumberNode(randint(-4, 4, [0, 1]));
|
|
77
|
+
if (isAligned) {
|
|
78
|
+
C = AB.times(coeff).getEndPoint(points[0], "C");
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
do {
|
|
82
|
+
C = PointConstructor.random("C");
|
|
83
|
+
} while (AB.isColinear(VectorConstructor.fromPoints(points[0], C)));
|
|
84
|
+
}
|
|
85
|
+
const identifiers = {
|
|
86
|
+
xA,
|
|
87
|
+
xB,
|
|
88
|
+
xC: C.x.evaluate({}),
|
|
89
|
+
yA,
|
|
90
|
+
yB,
|
|
91
|
+
yC: C.y.evaluate({}),
|
|
92
|
+
};
|
|
93
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
94
|
+
};
|
|
95
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
96
|
+
const question = {
|
|
97
|
+
answer: getAnswer(identifiers),
|
|
98
|
+
instruction: getInstruction(identifiers),
|
|
99
|
+
keys: [],
|
|
100
|
+
answerFormat: "raw",
|
|
101
|
+
identifiers,
|
|
102
|
+
hint: getHint(identifiers),
|
|
103
|
+
correction: getCorrection(identifiers),
|
|
104
|
+
};
|
|
105
|
+
return question;
|
|
106
|
+
};
|
|
107
|
+
const getPropositions = (n, { answer }) => {
|
|
108
|
+
const propositions = [];
|
|
109
|
+
addValidProp(propositions, answer, "raw");
|
|
110
|
+
tryToAddWrongProp(propositions, "Oui", "raw");
|
|
111
|
+
tryToAddWrongProp(propositions, "Non", "raw");
|
|
112
|
+
tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
|
|
113
|
+
return shuffle(propositions);
|
|
114
|
+
};
|
|
115
|
+
export const alignementViaColinearity = {
|
|
116
|
+
id: "alignementViaColinearity",
|
|
117
|
+
label: "Utiliser la colinéarité pour déterminer un alignement",
|
|
118
|
+
isSingleStep: true,
|
|
119
|
+
generator: (nb) => getDistinctQuestions(getAlignementViaColinearityQuestion, nb),
|
|
120
|
+
qcmTimer: 60,
|
|
121
|
+
freeTimer: 60,
|
|
122
|
+
getPropositions,
|
|
123
|
+
answerType: "QCU",
|
|
124
|
+
subject: "Mathématiques",
|
|
125
|
+
getQuestionFromIdentifiers,
|
|
126
|
+
hasHintAndCorrection: true,
|
|
127
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
xu: NodeIdentifiers;
|
|
5
|
+
yu: NodeIdentifiers;
|
|
6
|
+
xv: NodeIdentifiers;
|
|
7
|
+
yv: NodeIdentifiers;
|
|
8
|
+
};
|
|
9
|
+
export declare const colinearity: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=colinearity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colinearity.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/colinearity/colinearity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;CACrB,CAAC;AA4GF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAa7C,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Vector, VectorConstructor } from "../../../../../math/geometry/vector.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { reifyAlgebraic, } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
7
|
+
import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
|
|
8
|
+
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
9
|
+
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
10
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
11
|
+
const rebuildIdentifiers = (oldIds) => {
|
|
12
|
+
if (oldIds.xu?.id)
|
|
13
|
+
return oldIds;
|
|
14
|
+
return {
|
|
15
|
+
xu: oldIds.xu.toTree().toIdentifiers(),
|
|
16
|
+
yu: oldIds.yu.toTree().toIdentifiers(),
|
|
17
|
+
xv: oldIds.xv.toTree().toIdentifiers(),
|
|
18
|
+
yv: oldIds.yv.toTree().toIdentifiers(),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers) => {
|
|
22
|
+
const { xu, yu, xv, yv } = identifiers;
|
|
23
|
+
const u = new Vector("u", reifyAlgebraic(xu), reifyAlgebraic(yu));
|
|
24
|
+
const v = new Vector("v", reifyAlgebraic(xv), reifyAlgebraic(yv));
|
|
25
|
+
return `Soit deux vecteurs $${u.toTexWithCoords()}$ et $${v.toTexWithCoords()}$.
|
|
26
|
+
|
|
27
|
+
Les vecteurs $${u.toTex()}$ et $${v.toTex()}$ sont-ils colinéaires ?`;
|
|
28
|
+
};
|
|
29
|
+
const getHint = (identifiers) => {
|
|
30
|
+
const u = new Vector("u", "x".toTree(), "y".toTree());
|
|
31
|
+
const v = new Vector("v", "x'".toTree(), "y'".toTree());
|
|
32
|
+
return `Deux vecteurs sont colinéaires si et seulement si leur déterminant est nul.
|
|
33
|
+
|
|
34
|
+
Le déterminant de deux vecteurs $${u.toTexWithCoords()}$ et $${v.toTexWithCoords()}$ est :
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
\\det(${u.toTex()}, ${v.toTex()}) = ${u.determinant(v).simplify().toTex()}
|
|
38
|
+
$$`;
|
|
39
|
+
};
|
|
40
|
+
const getCorrection = (identifiers) => {
|
|
41
|
+
const { xu, yu, xv, yv } = identifiers;
|
|
42
|
+
const u = new Vector("u", reifyAlgebraic(xu), reifyAlgebraic(yu));
|
|
43
|
+
const v = new Vector("v", reifyAlgebraic(xv), reifyAlgebraic(yv));
|
|
44
|
+
const det = u.determinant(v);
|
|
45
|
+
const detSimp = det.simplify();
|
|
46
|
+
const isCol = detSimp.evaluate() === 0;
|
|
47
|
+
return `On calcule le déterminant de $${u.toTex()}$ et $${v.toTex()}$ :
|
|
48
|
+
|
|
49
|
+
${alignTex([
|
|
50
|
+
["", `\\det(${u.toTex()}, ${v.toTex()})`],
|
|
51
|
+
["=", det.toTex()],
|
|
52
|
+
["=", detSimp.toTex()],
|
|
53
|
+
])}
|
|
54
|
+
|
|
55
|
+
${isCol
|
|
56
|
+
? `Puisque le déterminant est nul, les vecteurs sont bien colinéaires.`
|
|
57
|
+
: `Puisque le déterminant n'est pas nul, les vecteurs ne sont pas colinéaires.`}`;
|
|
58
|
+
};
|
|
59
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
60
|
+
const question = {
|
|
61
|
+
instruction: getInstruction(identifiers),
|
|
62
|
+
answerFormat: "raw",
|
|
63
|
+
identifiers,
|
|
64
|
+
hint: getHint(identifiers),
|
|
65
|
+
correction: getCorrection(identifiers),
|
|
66
|
+
};
|
|
67
|
+
return question;
|
|
68
|
+
};
|
|
69
|
+
const getColinearityQuestion = () => {
|
|
70
|
+
const u = VectorConstructor.random("u", false);
|
|
71
|
+
const isColinear = coinFlip();
|
|
72
|
+
let v;
|
|
73
|
+
if (isColinear) {
|
|
74
|
+
const coeff = coinFlip()
|
|
75
|
+
? new NumberNode(randint(-5, 5, [0, 1]))
|
|
76
|
+
: RationalConstructor.randomIrreductible(5).toTree();
|
|
77
|
+
v = u.times(coeff, "v");
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
do {
|
|
81
|
+
v = VectorConstructor.random("v", false);
|
|
82
|
+
} while (u.isColinear(v));
|
|
83
|
+
}
|
|
84
|
+
const identifiers = {
|
|
85
|
+
xu: u.x.toIdentifiers(),
|
|
86
|
+
xv: v.x.toIdentifiers(),
|
|
87
|
+
yu: u.y.toIdentifiers(),
|
|
88
|
+
yv: v.y.toIdentifiers(),
|
|
89
|
+
};
|
|
90
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
91
|
+
};
|
|
92
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
93
|
+
const propositions = [];
|
|
94
|
+
// addValidProp(propositions, answer, "raw");
|
|
95
|
+
const { xu, yu, xv, yv } = identifiers;
|
|
96
|
+
const u = new Vector("u", reifyAlgebraic(xu), reifyAlgebraic(yu));
|
|
97
|
+
const v = new Vector("v", reifyAlgebraic(xv), reifyAlgebraic(yv));
|
|
98
|
+
const isCol = u.isColinear(v);
|
|
99
|
+
addValidProp(propositions, isCol ? "Oui" : "Non", "raw");
|
|
100
|
+
tryToAddWrongProp(propositions, "Oui", "raw");
|
|
101
|
+
tryToAddWrongProp(propositions, "Non", "raw");
|
|
102
|
+
tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
|
|
103
|
+
return shuffle(propositions);
|
|
104
|
+
};
|
|
105
|
+
export const colinearity = {
|
|
106
|
+
id: "colinearity",
|
|
107
|
+
label: "Déterminer si deux vecteurs sont colinéaires (par les coordonnées)",
|
|
108
|
+
isSingleStep: true,
|
|
109
|
+
generator: (nb) => getDistinctQuestions(getColinearityQuestion, nb),
|
|
110
|
+
qcmTimer: 60,
|
|
111
|
+
freeTimer: 60,
|
|
112
|
+
getPropositions,
|
|
113
|
+
answerType: "QCU",
|
|
114
|
+
subject: "Mathématiques",
|
|
115
|
+
getQuestionFromIdentifiers,
|
|
116
|
+
hasHintAndCorrection: true,
|
|
117
|
+
rebuildIdentifiers,
|
|
118
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
a: NodeIdentifiers;
|
|
5
|
+
b: NodeIdentifiers;
|
|
6
|
+
c: NodeIdentifiers;
|
|
7
|
+
d: NodeIdentifiers;
|
|
8
|
+
};
|
|
9
|
+
export declare const colinearityFromBasis: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=colinearityFromBasis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colinearityFromBasis.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IAEjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AAgKF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAmBtD,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
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 { randint } from "../../../../../math/utils/random/randint.js";
|
|
5
|
+
import { reifyAlgebraic, } from "../../../../../tree/nodes/nodeConstructor.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 { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
const getPropositions = (n, { answer }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
addValidProp(propositions, answer, "raw");
|
|
15
|
+
tryToAddWrongProp(propositions, "Oui", "raw");
|
|
16
|
+
tryToAddWrongProp(propositions, "Non", "raw");
|
|
17
|
+
tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
|
|
18
|
+
return shuffleProps(propositions, n);
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { a, b, c, d } = identifiers;
|
|
22
|
+
const coeffs = [a, b, c, d].map((e) => reifyAlgebraic(e));
|
|
23
|
+
const det = substract(multiply(coeffs[0], coeffs[3]), multiply(coeffs[1], coeffs[2])).simplify({ forceDistributeFractions: true, forbidFactorize: true });
|
|
24
|
+
return Math.abs(det.evaluate()) < 0.001 ? "Oui" : "Non";
|
|
25
|
+
};
|
|
26
|
+
const getUNode = (identifiers) => {
|
|
27
|
+
const { a, b } = identifiers;
|
|
28
|
+
const coeffs = [a, b].map((e) => reifyAlgebraic(e));
|
|
29
|
+
return add(multiply(coeffs[0], "\\overrightarrow{AB}"), multiply(coeffs[1], "\\overrightarrow{AC}")).simplify({ forceDistributeFractions: true, forbidFactorize: true });
|
|
30
|
+
};
|
|
31
|
+
const getVNode = (identifiers) => {
|
|
32
|
+
const { c, d } = identifiers;
|
|
33
|
+
const coeffs = [c, d].map((e) => reifyAlgebraic(e));
|
|
34
|
+
return add(multiply(coeffs[0], "\\overrightarrow{AB}"), multiply(coeffs[1], "\\overrightarrow{AC}")).simplify({ forceDistributeFractions: true, forbidFactorize: true });
|
|
35
|
+
};
|
|
36
|
+
const getInstruction = (identifiers) => {
|
|
37
|
+
return `$A$, $B$ et $C$ sont trois points distincts et non alignés.
|
|
38
|
+
|
|
39
|
+
On considère les vecteurs :
|
|
40
|
+
|
|
41
|
+
$$
|
|
42
|
+
\\overrightarrow{u} = ${getUNode(identifiers).toTex()}
|
|
43
|
+
$$
|
|
44
|
+
|
|
45
|
+
et
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
\\overrightarrow{v} = ${getVNode(identifiers).toTex()}
|
|
49
|
+
$$
|
|
50
|
+
|
|
51
|
+
Les vecteurs $\\overrightarrow{u}$ et $\\overrightarrow{v}$ sont-ils colinéaires ?`;
|
|
52
|
+
};
|
|
53
|
+
const getHint = (identifiers) => {
|
|
54
|
+
return `Peux-tu trouver un nombre $k$ tel que $\\overrightarrow{u} = k \\overrightarrow{v}$ ?`;
|
|
55
|
+
};
|
|
56
|
+
const getCorrection = (identifiers) => {
|
|
57
|
+
const { a, b, c, d } = identifiers;
|
|
58
|
+
const coeffs = [a, b, c, d].map((e) => reifyAlgebraic(e));
|
|
59
|
+
const det = substract(multiply(coeffs[0], coeffs[3]), multiply(coeffs[1], coeffs[2])).simplify({ forceDistributeFractions: true, forbidFactorize: true });
|
|
60
|
+
const isColinear = Math.abs(det.evaluate()) < 0.001;
|
|
61
|
+
const k = frac(coeffs[2], coeffs[0]).simplify();
|
|
62
|
+
const k2 = frac(coeffs[3], coeffs[1]).simplify();
|
|
63
|
+
return `On cherche un nombre $k$ tel que $\\overrightarrow{u} = k \\overrightarrow{v}$.
|
|
64
|
+
|
|
65
|
+
Puisque les vecteurs $\\overrightarrow{AB}$ et $\\overrightarrow{AC}$ ne sont pas colinéaires, ce nombre $k$ doit vérifier :
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
${multiply(coeffs[0], "\\overrightarrow{AB}").toTex()} \\times k = ${multiply(coeffs[2], "\\overrightarrow{AB}").toTex()}
|
|
69
|
+
$$
|
|
70
|
+
|
|
71
|
+
ce qui donne $k = ${k.toTex()}$, et :
|
|
72
|
+
|
|
73
|
+
$$
|
|
74
|
+
${multiply(coeffs[1], "\\overrightarrow{AC}").toTex()} \\times k = ${multiply(coeffs[3], "\\overrightarrow{AC}").toTex()}
|
|
75
|
+
$$
|
|
76
|
+
|
|
77
|
+
ce qui donne $k = ${k2.toTex()}$.
|
|
78
|
+
|
|
79
|
+
${isColinear
|
|
80
|
+
? `Les vecteurs $\\overrightarrow{u}$ et $\\overrightarrow{v}$ sont donc colinéaires.
|
|
81
|
+
`
|
|
82
|
+
: `
|
|
83
|
+
On en conclut que les vecteurs $\\overrightarrow{u}$ et $\\overrightarrow{v}$ ne sont pas colinéaires.`}
|
|
84
|
+
|
|
85
|
+
`;
|
|
86
|
+
};
|
|
87
|
+
const getKeys = (identifiers) => {
|
|
88
|
+
return [];
|
|
89
|
+
};
|
|
90
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
91
|
+
try {
|
|
92
|
+
throw Error("VEA not implemented");
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return handleVEAError(err);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const getColinearityFromBasisQuestion = (ops) => {
|
|
99
|
+
const isColinear = coinFlip();
|
|
100
|
+
let a;
|
|
101
|
+
let b;
|
|
102
|
+
let c;
|
|
103
|
+
let d;
|
|
104
|
+
if (isColinear) {
|
|
105
|
+
const k = coinFlip()
|
|
106
|
+
? randint(-5, 5, [0, 1]).toTree()
|
|
107
|
+
: RationalConstructor.randomIrreductible().toTree();
|
|
108
|
+
a = randint(-8, 8, [0]).toTree();
|
|
109
|
+
b = randint(-8, 8, [0]).toTree();
|
|
110
|
+
c = multiply(a, k).simplify();
|
|
111
|
+
d = multiply(b, k).simplify();
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
do {
|
|
115
|
+
a = randint(-8, 8, [0]).toTree();
|
|
116
|
+
b = randint(-8, 8, [0]).toTree();
|
|
117
|
+
c = randint(-8, 8, [0]).toTree();
|
|
118
|
+
d = randint(-8, 8, [0]).toTree();
|
|
119
|
+
} while (substract(multiply(a, d), multiply(b, c)).evaluate() === 0);
|
|
120
|
+
}
|
|
121
|
+
const identifiers = {
|
|
122
|
+
a: a.toIdentifiers(),
|
|
123
|
+
b: b.toIdentifiers(),
|
|
124
|
+
c: c.toIdentifiers(),
|
|
125
|
+
d: d.toIdentifiers(),
|
|
126
|
+
};
|
|
127
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
128
|
+
};
|
|
129
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
130
|
+
return {
|
|
131
|
+
answer: getAnswer(identifiers),
|
|
132
|
+
instruction: getInstruction(identifiers),
|
|
133
|
+
keys: getKeys(identifiers),
|
|
134
|
+
answerFormat: "tex",
|
|
135
|
+
identifiers,
|
|
136
|
+
hint: getHint(identifiers),
|
|
137
|
+
correction: getCorrection(identifiers),
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
export const colinearityFromBasis = {
|
|
141
|
+
id: "colinearityFromBasis",
|
|
142
|
+
connector: "=",
|
|
143
|
+
label: "Reconnaître des vecteurs colinéaires (à partir d'expressions)",
|
|
144
|
+
isSingleStep: true,
|
|
145
|
+
generator: (nb, opts) => getDistinctQuestions(() => getColinearityFromBasisQuestion(opts), nb),
|
|
146
|
+
qcmTimer: 60,
|
|
147
|
+
freeTimer: 60,
|
|
148
|
+
getPropositions,
|
|
149
|
+
isAnswerValid,
|
|
150
|
+
subject: "Mathématiques",
|
|
151
|
+
getInstruction,
|
|
152
|
+
getHint,
|
|
153
|
+
getCorrection,
|
|
154
|
+
getAnswer,
|
|
155
|
+
getQuestionFromIdentifiers,
|
|
156
|
+
hasHintAndCorrection: true,
|
|
157
|
+
answerType: "QCU",
|
|
158
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/colinearity/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
expression: NodeIdentifiers;
|
|
5
|
+
type: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const distributeAndReduceVectors: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=distributeAndReduceVectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distributeAndReduceVectors.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/distributeAndReduceVectors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,eAAe,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA+MF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAkB5D,CAAC"}
|