math-exercises 1.3.47 → 1.3.52
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/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationSimpleSquare.js +21 -21
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +13 -11
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +4 -7
- package/lib/exercises/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/firstDegreeEquation.js +10 -4
- package/lib/exercises/complex/addComplex.d.ts +4 -0
- package/lib/exercises/complex/addComplex.d.ts.map +1 -0
- package/lib/exercises/complex/addComplex.js +70 -0
- package/lib/exercises/complex/conjugateComplex.ts.d.ts +4 -0
- package/lib/exercises/complex/conjugateComplex.ts.d.ts.map +1 -0
- package/lib/exercises/complex/conjugateComplex.ts.js +73 -0
- package/lib/exercises/complex/conjugateDivideComplex.d.ts +4 -0
- package/lib/exercises/complex/conjugateDivideComplex.d.ts.map +1 -0
- package/lib/exercises/complex/conjugateDivideComplex.js +65 -0
- package/lib/exercises/complex/conjugateMultiplyComplex.d.ts +4 -0
- package/lib/exercises/complex/conjugateMultiplyComplex.d.ts.map +1 -0
- package/lib/exercises/complex/conjugateMultiplyComplex.js +69 -0
- package/lib/exercises/complex/divideComplex.d.ts +4 -0
- package/lib/exercises/complex/divideComplex.d.ts.map +1 -0
- package/lib/exercises/complex/divideComplex.js +61 -0
- package/lib/exercises/complex/inverseComplex.d.ts +4 -0
- package/lib/exercises/complex/inverseComplex.d.ts.map +1 -0
- package/lib/exercises/complex/inverseComplex.js +73 -0
- package/lib/exercises/complex/linearCombinaisonComplex.d.ts +4 -0
- package/lib/exercises/complex/linearCombinaisonComplex.d.ts.map +1 -0
- package/lib/exercises/complex/linearCombinaisonComplex.js +67 -0
- package/lib/exercises/complex/mutiplyComplex.d.ts +4 -0
- package/lib/exercises/complex/mutiplyComplex.d.ts.map +1 -0
- package/lib/exercises/complex/mutiplyComplex.js +67 -0
- package/lib/exercises/complex/reAndIm.d.ts +4 -0
- package/lib/exercises/complex/reAndIm.d.ts.map +1 -0
- package/lib/exercises/complex/reAndIm.js +79 -0
- package/lib/exercises/exercise.d.ts +3 -2
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/exercises.d.ts.map +1 -1
- package/lib/exercises/exercises.js +39 -8
- package/lib/exercises/functions/affines/template.d.ts +4 -0
- package/lib/exercises/functions/affines/template.d.ts.map +1 -0
- package/lib/exercises/functions/affines/template.js +51 -0
- package/lib/exercises/functions/basics/inverseImageFunctionGeogebra.js +2 -2
- package/lib/exercises/functions/trinoms/alphaBetaFromDevForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/alphaBetaFromDevForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/alphaBetaFromDevForm.js +63 -0
- package/lib/exercises/functions/trinoms/alphaBetaInCanonicalForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/alphaBetaInCanonicalForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/alphaBetaInCanonicalForm.js +91 -0
- package/lib/exercises/functions/trinoms/canonicalFromDevForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/canonicalFromDevForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/canonicalFromDevForm.js +58 -0
- package/lib/exercises/functions/trinoms/extremumFromCanonicalForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/extremumFromCanonicalForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/extremumFromCanonicalForm.js +84 -0
- package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.js +59 -0
- package/lib/exercises/functions/trinoms/variationsFromAlgebricForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/variationsFromAlgebricForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/variationsFromAlgebricForm.js +59 -0
- package/lib/exercises/probaStat/averageWithTable.d.ts +4 -0
- package/lib/exercises/probaStat/averageWithTable.d.ts.map +1 -0
- package/lib/exercises/probaStat/averageWithTable.js +76 -0
- package/lib/exercises/probaStat/median.d.ts +2 -2
- package/lib/exercises/probaStat/median.d.ts.map +1 -1
- package/lib/exercises/probaStat/median.js +7 -7
- package/lib/exercises/probaStat/medianList.d.ts +2 -2
- package/lib/exercises/probaStat/medianList.d.ts.map +1 -1
- package/lib/exercises/probaStat/medianList.js +7 -7
- package/lib/exercises/probaStat/probabilityTree.js +6 -6
- package/lib/exercises/probaStat/quartiles.js +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticSum.d.ts +1 -0
- package/lib/exercises/sequences/arithmetic/arithmeticSum.d.ts.map +1 -0
- package/lib/exercises/sequences/arithmetic/arithmeticSum.js +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/complex/complex.d.ts +19 -0
- package/lib/math/complex/complex.d.ts.map +1 -0
- package/lib/math/complex/complex.js +63 -0
- package/lib/math/polynomials/trinom.d.ts +24 -0
- package/lib/math/polynomials/trinom.d.ts.map +1 -0
- package/lib/math/polynomials/trinom.js +67 -0
- package/lib/tree/nodes/complex/complexNode.d.ts +15 -0
- package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -0
- package/lib/tree/nodes/complex/complexNode.js +43 -0
- package/lib/tree/nodes/expression/expressionNode.d.ts +1 -0
- package/lib/tree/nodes/expression/expressionNode.d.ts.map +1 -0
- package/lib/tree/nodes/expression/expressionNode.js +1 -0
- package/lib/tree/nodes/functions/cosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +4 -0
- package/lib/tree/nodes/functions/expNode.d.ts +1 -0
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +4 -0
- package/lib/tree/nodes/functions/logNode.d.ts +1 -0
- package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/logNode.js +4 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.js +4 -0
- package/lib/tree/nodes/functions/sinNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +4 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sqrtNode.js +4 -0
- package/lib/tree/nodes/node.d.ts +1 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/constantNode.d.ts +1 -0
- package/lib/tree/nodes/numbers/constantNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/constantNode.js +4 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts +1 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +3 -0
- package/lib/tree/nodes/operators/addNode.d.ts +1 -0
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +4 -0
- package/lib/tree/nodes/operators/divideNode.d.ts +1 -0
- package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/divideNode.js +4 -0
- package/lib/tree/nodes/operators/equalNode.d.ts +1 -0
- package/lib/tree/nodes/operators/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/equalNode.js +4 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts +1 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +4 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +9 -0
- package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +4 -0
- package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +4 -0
- package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +3 -2
- package/lib/tree/parsers/simplify.d.ts +1 -0
- package/lib/tree/parsers/simplify.d.ts.map +1 -1
- package/lib/tree/parsers/simplify.js +10 -1
- package/lib/utils/diceFlip.d.ts +2 -0
- package/lib/utils/diceFlip.d.ts.map +1 -0
- package/lib/utils/diceFlip.js +12 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAOF,wBAAgB,uBAAuB,IAAI,QAAQ,CA2JlD"}
|
|
@@ -4,8 +4,11 @@ exports.getEquationSimpleSquare = exports.equationSimpleSquare = void 0;
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
6
|
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
7
|
+
const diceFlip_1 = require("../../../utils/diceFlip");
|
|
8
|
+
const random_1 = require("../../../utils/random");
|
|
7
9
|
const shuffle_1 = require("../../../utils/shuffle");
|
|
8
10
|
const uuid_1 = require("uuid");
|
|
11
|
+
const squares = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((el) => el ** 2);
|
|
9
12
|
exports.equationSimpleSquare = {
|
|
10
13
|
id: 'equationSimpleSquare',
|
|
11
14
|
connector: '=',
|
|
@@ -24,22 +27,26 @@ const higherFactor = (n) => {
|
|
|
24
27
|
return 1;
|
|
25
28
|
};
|
|
26
29
|
function getEquationSimpleSquare() {
|
|
27
|
-
let randNbr = (0, randint_1.randint)(-20,
|
|
30
|
+
let randNbr = (0, randint_1.randint)(-20, 101);
|
|
28
31
|
let answer;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const rand = (0, diceFlip_1.diceFlip)(3);
|
|
33
|
+
if (rand === 0)
|
|
34
|
+
randNbr = (0, randint_1.randint)(-20, 0);
|
|
35
|
+
else if (rand === 1)
|
|
36
|
+
randNbr = (0, random_1.random)(squares);
|
|
37
|
+
else
|
|
38
|
+
randNbr = (0, randint_1.randint)(2, 100);
|
|
39
|
+
const instruction = `Résoudre l'équation : $x^2 = ${randNbr}$`;
|
|
33
40
|
const ans = Math.sqrt(randNbr);
|
|
34
|
-
if (
|
|
35
|
-
answer =
|
|
41
|
+
if (randNbr < 0)
|
|
42
|
+
answer = `S=\\emptyset`;
|
|
43
|
+
else if (ans === Math.floor(ans))
|
|
44
|
+
answer = `S=\\left\\{${ans}\\ ; -${ans}\\right\\}`;
|
|
36
45
|
else {
|
|
37
46
|
const factor = higherFactor(randNbr);
|
|
38
47
|
const radicand = randNbr / factor ** 2;
|
|
39
|
-
answer =
|
|
48
|
+
answer = `S=\\left\\{${factor === 1 ? '' : factor}\\sqrt{${radicand}}\\ ; -${factor === 1 ? '' : factor}\\sqrt{${radicand}} \\right\\}`;
|
|
40
49
|
}
|
|
41
|
-
if (randNbr < 0)
|
|
42
|
-
answer = `\\emptyset`;
|
|
43
50
|
const getPropositions = (n) => {
|
|
44
51
|
const res = [];
|
|
45
52
|
res.push({
|
|
@@ -51,25 +58,18 @@ function getEquationSimpleSquare() {
|
|
|
51
58
|
if (ans === Math.floor(ans)) {
|
|
52
59
|
res.push({
|
|
53
60
|
id: (0, uuid_1.v4)() + '',
|
|
54
|
-
statement:
|
|
61
|
+
statement: `S=\\left\\{${ans}\\right\\}`,
|
|
55
62
|
isRightAnswer: false,
|
|
56
63
|
format: 'tex',
|
|
57
64
|
});
|
|
58
|
-
|
|
59
|
-
res.push({
|
|
60
|
-
id: (0, uuid_1.v4)() + '',
|
|
61
|
-
statement: `${ans + (0, randint_1.randint)(-ans + 1, 7, [0])}`,
|
|
62
|
-
isRightAnswer: false,
|
|
63
|
-
format: 'tex',
|
|
64
|
-
});
|
|
65
|
-
for (let i = 0; i < n - 3; i++) {
|
|
65
|
+
for (let i = 0; i < n - 2; i++) {
|
|
66
66
|
let isDuplicate;
|
|
67
67
|
let proposition;
|
|
68
68
|
do {
|
|
69
69
|
const tempAns = ans + (0, randint_1.randint)(-ans + 1, 7, [0]);
|
|
70
70
|
proposition = {
|
|
71
71
|
id: (0, uuid_1.v4)() + '',
|
|
72
|
-
statement: (0, coinFlip_1.coinFlip)() ?
|
|
72
|
+
statement: (0, coinFlip_1.coinFlip)() ? `S=\\left\\{${tempAns}\\ ; -${tempAns}\\right\\}` : `S=\\emptyset`,
|
|
73
73
|
isRightAnswer: false,
|
|
74
74
|
format: 'tex',
|
|
75
75
|
};
|
|
@@ -123,7 +123,7 @@ function getEquationSimpleSquare() {
|
|
|
123
123
|
else {
|
|
124
124
|
res.push({
|
|
125
125
|
id: (0, uuid_1.v4)() + '',
|
|
126
|
-
statement: `-\\sqrt${-randNbr}`,
|
|
126
|
+
statement: `-\\sqrt{${-randNbr}}`,
|
|
127
127
|
isRightAnswer: false,
|
|
128
128
|
format: 'tex',
|
|
129
129
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAY3E;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CAoD3D"}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEquationType1ExerciseQuestion = exports.equationType1Exercise = void 0;
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
|
-
const integer_1 = require("../../../math/numbers/integer/integer");
|
|
6
5
|
const affine_1 = require("../../../math/polynomials/affine");
|
|
7
|
-
const discreteSet_1 = require("../../../math/sets/discreteSet");
|
|
8
|
-
const intervals_1 = require("../../../math/sets/intervals/intervals");
|
|
9
6
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
|
+
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
10
8
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
11
9
|
const shuffle_1 = require("../../../utils/shuffle");
|
|
12
10
|
const uuid_1 = require("uuid");
|
|
@@ -25,13 +23,11 @@ exports.equationType1Exercise = {
|
|
|
25
23
|
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
26
24
|
};
|
|
27
25
|
function getEquationType1ExerciseQuestion() {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const affine = new affine_1.Affine(1, a.value).toTree();
|
|
34
|
-
const tree = new equalNode_1.EqualNode(affine, b.toTree());
|
|
26
|
+
const b = (0, randint_1.randint)(-10, 11);
|
|
27
|
+
const a = (0, randint_1.randint)(-10, 11, [0]);
|
|
28
|
+
const solution = b - a;
|
|
29
|
+
const affine = new affine_1.Affine(1, a).toTree();
|
|
30
|
+
const tree = new equalNode_1.EqualNode(affine, new numberNode_1.NumberNode(b));
|
|
35
31
|
const getPropositions = (n) => {
|
|
36
32
|
const res = [];
|
|
37
33
|
res.push({
|
|
@@ -40,7 +36,13 @@ function getEquationType1ExerciseQuestion() {
|
|
|
40
36
|
isRightAnswer: true,
|
|
41
37
|
format: 'tex',
|
|
42
38
|
});
|
|
43
|
-
|
|
39
|
+
res.push({
|
|
40
|
+
id: (0, uuid_1.v4)() + '',
|
|
41
|
+
statement: `x = ${b + a}`,
|
|
42
|
+
isRightAnswer: false,
|
|
43
|
+
format: 'tex',
|
|
44
|
+
});
|
|
45
|
+
for (let i = 0; i < n - 2; i++) {
|
|
44
46
|
let isDuplicate;
|
|
45
47
|
let proposition;
|
|
46
48
|
do {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAa3E;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAa3E;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CAoD3D"}
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEquationType2ExerciseQuestion = exports.equationType2Exercise = void 0;
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
|
-
const integer_1 = require("../../../math/numbers/integer/integer");
|
|
6
5
|
const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
7
6
|
const affine_1 = require("../../../math/polynomials/affine");
|
|
8
|
-
const discreteSet_1 = require("../../../math/sets/discreteSet");
|
|
9
7
|
const intervals_1 = require("../../../math/sets/intervals/intervals");
|
|
10
8
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
11
9
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
@@ -28,11 +26,10 @@ exports.equationType2Exercise = {
|
|
|
28
26
|
};
|
|
29
27
|
function getEquationType2ExerciseQuestion() {
|
|
30
28
|
const interval = new intervals_1.Interval('[[-10; 10]]');
|
|
31
|
-
const intervalStar = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)]));
|
|
32
29
|
const b = interval.getRandomElement();
|
|
33
|
-
const a =
|
|
34
|
-
const solution = new rational_1.Rational(b.value, a
|
|
35
|
-
const affine = new affine_1.Affine(a
|
|
30
|
+
const a = (0, randint_1.randint)(-9, 10, [0, 1]);
|
|
31
|
+
const solution = new rational_1.Rational(b.value, a).simplify();
|
|
32
|
+
const affine = new affine_1.Affine(a, 0).toTree();
|
|
36
33
|
const tree = new equalNode_1.EqualNode(affine, b.toTree());
|
|
37
34
|
const answer = new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), solution.toTree());
|
|
38
35
|
const getPropositions = (n) => {
|
|
@@ -47,7 +44,7 @@ function getEquationType2ExerciseQuestion() {
|
|
|
47
44
|
let isDuplicate;
|
|
48
45
|
let proposition;
|
|
49
46
|
do {
|
|
50
|
-
const wrongAnswer = new rational_1.Rational(b.value + (0, randint_1.randint)(-7, 8, [0, -b.value]), a
|
|
47
|
+
const wrongAnswer = new rational_1.Rational(b.value + (0, randint_1.randint)(-7, 8, [0, -b.value]), a + (0, randint_1.randint)(-7, 8, [-a, 0])).simplify();
|
|
51
48
|
proposition = {
|
|
52
49
|
id: (0, uuid_1.v4)() + '',
|
|
53
50
|
statement: new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), wrongAnswer.toTree()).toTex(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstDegreeEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/firstDegreeEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,mBAAmB,EAAE,QAUjC,CAAC;AAEF,wBAAgB,sBAAsB,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"firstDegreeEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/firstDegreeEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,mBAAmB,EAAE,QAUjC,CAAC;AAEF,wBAAgB,sBAAsB,IAAI,QAAQ,CAoDjD"}
|
|
@@ -25,17 +25,23 @@ function getFirstDegreeEquation() {
|
|
|
25
25
|
const res = [];
|
|
26
26
|
res.push({
|
|
27
27
|
id: (0, uuid_1.v4)() + '',
|
|
28
|
-
statement: (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(a / b)).toTex()
|
|
28
|
+
statement: `x=${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(a / b)).toTex()}`,
|
|
29
29
|
isRightAnswer: true,
|
|
30
30
|
format: 'tex',
|
|
31
31
|
});
|
|
32
|
-
|
|
32
|
+
res.push({
|
|
33
|
+
id: (0, uuid_1.v4)() + '',
|
|
34
|
+
statement: `x=${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(b / a)).toTex()}`,
|
|
35
|
+
isRightAnswer: false,
|
|
36
|
+
format: 'tex',
|
|
37
|
+
});
|
|
38
|
+
for (let i = 0; i < n - 2; i++) {
|
|
33
39
|
let isDuplicate;
|
|
34
40
|
let proposition;
|
|
35
41
|
do {
|
|
36
42
|
proposition = {
|
|
37
43
|
id: (0, uuid_1.v4)() + '',
|
|
38
|
-
statement: (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode((a + (0, randint_1.randint)(-7, 8, [-a])) / (b + (0, randint_1.randint)(-7, 8, [-b])))).toTex()
|
|
44
|
+
statement: `x=${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode((a + (0, randint_1.randint)(-7, 8, [-a])) / (b + (0, randint_1.randint)(-7, 8, [-b])))).toTex()}`,
|
|
39
45
|
isRightAnswer: false,
|
|
40
46
|
format: 'tex',
|
|
41
47
|
};
|
|
@@ -48,7 +54,7 @@ function getFirstDegreeEquation() {
|
|
|
48
54
|
const question = {
|
|
49
55
|
instruction: `Résoudre l'équation suivante : $\\frac{${a}}{x} = ${b}$`,
|
|
50
56
|
startStatement: `x`,
|
|
51
|
-
answer: (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(a / b)).toTex()
|
|
57
|
+
answer: `x=${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(a / b)).toTex()}`,
|
|
52
58
|
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
53
59
|
getPropositions,
|
|
54
60
|
answerFormat: 'tex',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addComplex.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/addComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,UAAU,EAAE,QASxB,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAyDhD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAddComplexQuestion = exports.addComplex = void 0;
|
|
4
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
5
|
+
const complex_1 = require("../../math/complex/complex");
|
|
6
|
+
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
7
|
+
const substractNode_1 = require("../../tree/nodes/operators/substractNode");
|
|
8
|
+
const simplify_1 = require("../../tree/parsers/simplify");
|
|
9
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
11
|
+
exports.addComplex = {
|
|
12
|
+
id: 'addComplex',
|
|
13
|
+
connector: '=',
|
|
14
|
+
instruction: '',
|
|
15
|
+
label: 'Additionner deux nombres complexes',
|
|
16
|
+
levels: ['MathExp'],
|
|
17
|
+
isSingleStep: true,
|
|
18
|
+
sections: ['Nombres complexes'],
|
|
19
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getAddComplexQuestion, nb),
|
|
20
|
+
};
|
|
21
|
+
function getAddComplexQuestion() {
|
|
22
|
+
const z1 = complex_1.ComplexConstructor.random();
|
|
23
|
+
let z2;
|
|
24
|
+
do {
|
|
25
|
+
z2 = complex_1.ComplexConstructor.random();
|
|
26
|
+
} while (z1.im === 0 && z2.im === 0);
|
|
27
|
+
const answer = (0, simplify_1.simplifyComplex)(new addNode_1.AddNode(z1.toTree(), z2.toTree()));
|
|
28
|
+
const getPropositions = (n) => {
|
|
29
|
+
const res = [];
|
|
30
|
+
res.push({
|
|
31
|
+
id: (0, uuid_1.v4)() + '',
|
|
32
|
+
statement: answer.toTex(),
|
|
33
|
+
isRightAnswer: true,
|
|
34
|
+
format: 'tex',
|
|
35
|
+
});
|
|
36
|
+
res.push({
|
|
37
|
+
id: (0, uuid_1.v4)(),
|
|
38
|
+
statement: (0, simplify_1.simplifyComplex)(new substractNode_1.SubstractNode(z1.toTree(), z2.toTree())).toTex(),
|
|
39
|
+
isRightAnswer: false,
|
|
40
|
+
format: 'tex',
|
|
41
|
+
});
|
|
42
|
+
const missing = n - res.length;
|
|
43
|
+
for (let i = 0; i < missing; i++) {
|
|
44
|
+
let isDuplicate;
|
|
45
|
+
let proposition;
|
|
46
|
+
do {
|
|
47
|
+
const wrongAnswer = complex_1.ComplexConstructor.random();
|
|
48
|
+
proposition = {
|
|
49
|
+
id: (0, uuid_1.v4)() + '',
|
|
50
|
+
statement: wrongAnswer.toTree().toTex(),
|
|
51
|
+
isRightAnswer: false,
|
|
52
|
+
format: 'tex',
|
|
53
|
+
};
|
|
54
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
55
|
+
} while (isDuplicate);
|
|
56
|
+
res.push(proposition);
|
|
57
|
+
}
|
|
58
|
+
return (0, shuffle_1.shuffle)(res);
|
|
59
|
+
};
|
|
60
|
+
const question = {
|
|
61
|
+
answer: answer.toTex(),
|
|
62
|
+
instruction: `Soit $z=${z1.toTree().toTex()}$ et $z'=${z2.toTree().toTex()}$. Calculer $z + z'$.`,
|
|
63
|
+
keys: ['i', 'z', 'quote'],
|
|
64
|
+
getPropositions,
|
|
65
|
+
answerFormat: 'tex',
|
|
66
|
+
startStatement: "z+z'",
|
|
67
|
+
};
|
|
68
|
+
return question;
|
|
69
|
+
}
|
|
70
|
+
exports.getAddComplexQuestion = getAddComplexQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conjugateComplex.ts.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/conjugateComplex.ts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,gBAAgB,EAAE,QAS9B,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,QAAQ,CA6DtD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConjugateComplexQuestion = exports.conjugateComplex = void 0;
|
|
4
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
5
|
+
const complex_1 = require("../../math/complex/complex");
|
|
6
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
exports.conjugateComplex = {
|
|
9
|
+
id: 'conjugateComplex',
|
|
10
|
+
connector: '=',
|
|
11
|
+
instruction: '',
|
|
12
|
+
label: "Conjugué d'un nombre complexe",
|
|
13
|
+
levels: ['MathExp'],
|
|
14
|
+
isSingleStep: true,
|
|
15
|
+
sections: ['Nombres complexes'],
|
|
16
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getConjugateComplexQuestion, nb),
|
|
17
|
+
};
|
|
18
|
+
function getConjugateComplexQuestion() {
|
|
19
|
+
const complex = complex_1.ComplexConstructor.random();
|
|
20
|
+
const answer = complex.conjugate().toTree().toTex();
|
|
21
|
+
const getPropositions = (n) => {
|
|
22
|
+
const res = [];
|
|
23
|
+
res.push({
|
|
24
|
+
id: (0, uuid_1.v4)(),
|
|
25
|
+
statement: answer,
|
|
26
|
+
isRightAnswer: true,
|
|
27
|
+
format: 'tex',
|
|
28
|
+
});
|
|
29
|
+
const opposite = complex.opposite().toTree().toTex();
|
|
30
|
+
if (opposite !== answer)
|
|
31
|
+
res.push({
|
|
32
|
+
id: (0, uuid_1.v4)(),
|
|
33
|
+
statement: opposite,
|
|
34
|
+
isRightAnswer: false,
|
|
35
|
+
format: 'tex',
|
|
36
|
+
});
|
|
37
|
+
const conjOpposite = complex.conjugate().opposite().toTree().toTex();
|
|
38
|
+
if (!res.some((prop) => prop.statement === conjOpposite))
|
|
39
|
+
res.push({
|
|
40
|
+
id: (0, uuid_1.v4)(),
|
|
41
|
+
statement: conjOpposite,
|
|
42
|
+
isRightAnswer: false,
|
|
43
|
+
format: 'tex',
|
|
44
|
+
});
|
|
45
|
+
const missing = n - res.length;
|
|
46
|
+
for (let i = 0; i < missing; i++) {
|
|
47
|
+
let isDuplicate;
|
|
48
|
+
let proposition;
|
|
49
|
+
do {
|
|
50
|
+
const wrongAnswer = complex_1.ComplexConstructor.random();
|
|
51
|
+
proposition = {
|
|
52
|
+
id: (0, uuid_1.v4)() + ``,
|
|
53
|
+
statement: wrongAnswer.toTree().toTex(),
|
|
54
|
+
isRightAnswer: false,
|
|
55
|
+
format: 'tex',
|
|
56
|
+
};
|
|
57
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
58
|
+
} while (isDuplicate);
|
|
59
|
+
res.push(proposition);
|
|
60
|
+
}
|
|
61
|
+
return (0, shuffle_1.shuffle)(res);
|
|
62
|
+
};
|
|
63
|
+
const question = {
|
|
64
|
+
answer,
|
|
65
|
+
instruction: `Déterminer le conjugué de $z=${complex.toTree().toTex()}$.`,
|
|
66
|
+
keys: ['i'],
|
|
67
|
+
getPropositions,
|
|
68
|
+
answerFormat: 'tex',
|
|
69
|
+
startStatement: '\\overline z',
|
|
70
|
+
};
|
|
71
|
+
return question;
|
|
72
|
+
}
|
|
73
|
+
exports.getConjugateComplexQuestion = getConjugateComplexQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conjugateDivideComplex.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/conjugateDivideComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,sBAAsB,EAAE,QASpC,CAAC;AAEF,wBAAgB,iCAAiC,IAAI,QAAQ,CAwD5D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConjugateDivideComplexQuestion = exports.conjugateDivideComplex = void 0;
|
|
4
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
5
|
+
const complex_1 = require("../../math/complex/complex");
|
|
6
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
exports.conjugateDivideComplex = {
|
|
9
|
+
id: 'conjugateDivideComplex',
|
|
10
|
+
connector: '=',
|
|
11
|
+
instruction: '',
|
|
12
|
+
label: "Conjugué d'une fraction de nombres complexes",
|
|
13
|
+
levels: ['MathExp'],
|
|
14
|
+
isSingleStep: true,
|
|
15
|
+
sections: ['Nombres complexes'],
|
|
16
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getConjugateDivideComplexQuestion, nb),
|
|
17
|
+
};
|
|
18
|
+
function getConjugateDivideComplexQuestion() {
|
|
19
|
+
const z1 = complex_1.ComplexConstructor.random();
|
|
20
|
+
let z2;
|
|
21
|
+
do {
|
|
22
|
+
z2 = complex_1.ComplexConstructor.random();
|
|
23
|
+
} while (z1.im === 0 && z2.im === 0);
|
|
24
|
+
const conjz1 = z1.conjugate();
|
|
25
|
+
const conjz2 = z2.conjugate();
|
|
26
|
+
const answerTex = conjz1.divideNode(conjz2).toTex();
|
|
27
|
+
const getPropositions = (n) => {
|
|
28
|
+
const res = [];
|
|
29
|
+
res.push({
|
|
30
|
+
id: (0, uuid_1.v4)(),
|
|
31
|
+
statement: answerTex,
|
|
32
|
+
isRightAnswer: true,
|
|
33
|
+
format: 'tex',
|
|
34
|
+
});
|
|
35
|
+
const missing = n - res.length;
|
|
36
|
+
for (let i = 0; i < missing; i++) {
|
|
37
|
+
let isDuplicate;
|
|
38
|
+
let proposition;
|
|
39
|
+
do {
|
|
40
|
+
const wrongAnswer = complex_1.ComplexConstructor.random();
|
|
41
|
+
proposition = {
|
|
42
|
+
id: (0, uuid_1.v4)() + '',
|
|
43
|
+
statement: wrongAnswer.toTree().toTex(),
|
|
44
|
+
isRightAnswer: false,
|
|
45
|
+
format: 'tex',
|
|
46
|
+
};
|
|
47
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
48
|
+
} while (isDuplicate);
|
|
49
|
+
res.push(proposition);
|
|
50
|
+
}
|
|
51
|
+
return (0, shuffle_1.shuffle)(res);
|
|
52
|
+
};
|
|
53
|
+
const question = {
|
|
54
|
+
answer: answerTex,
|
|
55
|
+
instruction: `Soit $z=${z1.toTree().toTex()}$ et $z'=${z2
|
|
56
|
+
.toTree()
|
|
57
|
+
.toTex()}$. Calculer le conjugué de $\\frac{z}{z'}$.`,
|
|
58
|
+
keys: ['i', 'z', 'quote'],
|
|
59
|
+
getPropositions,
|
|
60
|
+
answerFormat: 'tex',
|
|
61
|
+
startStatement: "\\overline{\\frac{z}{z'}}",
|
|
62
|
+
};
|
|
63
|
+
return question;
|
|
64
|
+
}
|
|
65
|
+
exports.getConjugateDivideComplexQuestion = getConjugateDivideComplexQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conjugateMultiplyComplex.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/conjugateMultiplyComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,wBAAwB,EAAE,QAStC,CAAC;AAEF,wBAAgB,mCAAmC,IAAI,QAAQ,CA4D9D"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConjugateMultiplyComplexQuestion = exports.conjugateMultiplyComplex = void 0;
|
|
4
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
5
|
+
const complex_1 = require("../../math/complex/complex");
|
|
6
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
exports.conjugateMultiplyComplex = {
|
|
9
|
+
id: 'conjugateMultiplyComplex',
|
|
10
|
+
connector: '=',
|
|
11
|
+
instruction: '',
|
|
12
|
+
label: "Conjugué d'un produit de nombres complexes",
|
|
13
|
+
levels: ['MathExp'],
|
|
14
|
+
isSingleStep: true,
|
|
15
|
+
sections: ['Nombres complexes'],
|
|
16
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getConjugateMultiplyComplexQuestion, nb),
|
|
17
|
+
};
|
|
18
|
+
function getConjugateMultiplyComplexQuestion() {
|
|
19
|
+
const z1 = complex_1.ComplexConstructor.random();
|
|
20
|
+
let z2;
|
|
21
|
+
do {
|
|
22
|
+
z2 = complex_1.ComplexConstructor.random();
|
|
23
|
+
} while (z1.im === 0 && z2.im === 0);
|
|
24
|
+
const prod = z1.multiply(z2);
|
|
25
|
+
const conj = prod.conjugate();
|
|
26
|
+
const answer = conj.toTree();
|
|
27
|
+
const getPropositions = (n) => {
|
|
28
|
+
const res = [];
|
|
29
|
+
res.push({
|
|
30
|
+
id: (0, uuid_1.v4)(),
|
|
31
|
+
statement: answer.toTex(),
|
|
32
|
+
isRightAnswer: true,
|
|
33
|
+
format: 'tex',
|
|
34
|
+
});
|
|
35
|
+
res.push({
|
|
36
|
+
id: (0, uuid_1.v4)(),
|
|
37
|
+
statement: prod.toTree().toTex(),
|
|
38
|
+
isRightAnswer: true,
|
|
39
|
+
format: 'tex',
|
|
40
|
+
});
|
|
41
|
+
const missing = n - res.length;
|
|
42
|
+
for (let i = 0; i < missing; i++) {
|
|
43
|
+
let isDuplicate;
|
|
44
|
+
let proposition;
|
|
45
|
+
do {
|
|
46
|
+
const wrongAnswer = complex_1.ComplexConstructor.random();
|
|
47
|
+
proposition = {
|
|
48
|
+
id: (0, uuid_1.v4)(),
|
|
49
|
+
statement: wrongAnswer.toTree().toTex(),
|
|
50
|
+
isRightAnswer: false,
|
|
51
|
+
format: 'tex',
|
|
52
|
+
};
|
|
53
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
54
|
+
} while (isDuplicate);
|
|
55
|
+
res.push(proposition);
|
|
56
|
+
}
|
|
57
|
+
return (0, shuffle_1.shuffle)(res);
|
|
58
|
+
};
|
|
59
|
+
const question = {
|
|
60
|
+
answer: answer.toTex(),
|
|
61
|
+
instruction: `Soit $z=${z1.toTree().toTex()}$ et $z'=${z2.toTree().toTex()}$. Calculer $\\overline{z\\times z'}$.`,
|
|
62
|
+
keys: ['i', 'z', 'quote'],
|
|
63
|
+
getPropositions,
|
|
64
|
+
answerFormat: 'tex',
|
|
65
|
+
startStatement: "\\overline{z\\times z'}",
|
|
66
|
+
};
|
|
67
|
+
return question;
|
|
68
|
+
}
|
|
69
|
+
exports.getConjugateMultiplyComplexQuestion = getConjugateMultiplyComplexQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divideComplex.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/divideComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,aAAa,EAAE,QAS3B,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAmDnD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDivideComplexQuestion = exports.divideComplex = void 0;
|
|
4
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
5
|
+
const complex_1 = require("../../math/complex/complex");
|
|
6
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
exports.divideComplex = {
|
|
9
|
+
id: 'divideComplex',
|
|
10
|
+
connector: '=',
|
|
11
|
+
instruction: '',
|
|
12
|
+
label: 'Diviser deux nombres complexes',
|
|
13
|
+
levels: ['MathExp'],
|
|
14
|
+
isSingleStep: true,
|
|
15
|
+
sections: ['Nombres complexes'],
|
|
16
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getDivideComplexQuestion, nb),
|
|
17
|
+
};
|
|
18
|
+
function getDivideComplexQuestion() {
|
|
19
|
+
const z1 = complex_1.ComplexConstructor.random();
|
|
20
|
+
let z2;
|
|
21
|
+
do {
|
|
22
|
+
z2 = complex_1.ComplexConstructor.random();
|
|
23
|
+
} while (z1.im === 0 && z2.im === 0);
|
|
24
|
+
const answerTex = z1.divideNode(z2).toTex();
|
|
25
|
+
const getPropositions = (n) => {
|
|
26
|
+
const res = [];
|
|
27
|
+
res.push({
|
|
28
|
+
id: (0, uuid_1.v4)(),
|
|
29
|
+
statement: answerTex,
|
|
30
|
+
isRightAnswer: true,
|
|
31
|
+
format: 'tex',
|
|
32
|
+
});
|
|
33
|
+
const missing = n - res.length;
|
|
34
|
+
for (let i = 0; i < missing; i++) {
|
|
35
|
+
let isDuplicate;
|
|
36
|
+
let proposition;
|
|
37
|
+
do {
|
|
38
|
+
const wrongAnswer = complex_1.ComplexConstructor.random();
|
|
39
|
+
proposition = {
|
|
40
|
+
id: (0, uuid_1.v4)() + '',
|
|
41
|
+
statement: wrongAnswer.toTree().toTex(),
|
|
42
|
+
isRightAnswer: false,
|
|
43
|
+
format: 'tex',
|
|
44
|
+
};
|
|
45
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
46
|
+
} while (isDuplicate);
|
|
47
|
+
res.push(proposition);
|
|
48
|
+
}
|
|
49
|
+
return (0, shuffle_1.shuffle)(res);
|
|
50
|
+
};
|
|
51
|
+
const question = {
|
|
52
|
+
answer: answerTex,
|
|
53
|
+
instruction: `Soit $z=${z1.toTree().toTex()}$ et $z'=${z2.toTree().toTex()}$. Calculer $\\frac{z}{z'}$.`,
|
|
54
|
+
keys: ['i', 'z', 'quote'],
|
|
55
|
+
getPropositions,
|
|
56
|
+
answerFormat: 'tex',
|
|
57
|
+
startStatement: "\\frac{z}{z'}",
|
|
58
|
+
};
|
|
59
|
+
return question;
|
|
60
|
+
}
|
|
61
|
+
exports.getDivideComplexQuestion = getDivideComplexQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inverseComplex.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/inverseComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,cAAc,EAAE,QAS5B,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CA6DpD"}
|