math-exercises 3.0.212 → 3.0.214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.js +4 -4
- package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.d.ts.map +1 -1
- package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.js +11 -9
- package/lib/exercises/math/complex/argumentFromAlgebraicComplex.d.ts +3 -0
- package/lib/exercises/math/complex/argumentFromAlgebraicComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/argumentFromAlgebraicComplex.js +92 -3
- package/lib/exercises/math/complex/conjugateDivideComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/conjugateDivideComplex.js +67 -6
- package/lib/exercises/math/complex/conjugateMultiplyComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/conjugateMultiplyComplex.js +54 -15
- package/lib/exercises/math/complex/divideComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/divideComplex.js +60 -6
- package/lib/exercises/math/complex/exp/complexAlgebraicFromExpForm.d.ts +9 -0
- package/lib/exercises/math/complex/exp/complexAlgebraicFromExpForm.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexAlgebraicFromExpForm.js +178 -0
- package/lib/exercises/math/complex/exp/complexExpFormPowerSimplify.d.ts +10 -0
- package/lib/exercises/math/complex/exp/complexExpFormPowerSimplify.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexExpFormPowerSimplify.js +152 -0
- package/lib/exercises/math/complex/exp/complexExpFormProductSimplify.d.ts +11 -0
- package/lib/exercises/math/complex/exp/complexExpFormProductSimplify.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexExpFormProductSimplify.js +165 -0
- package/lib/exercises/math/complex/exp/complexExpFormQuotientSimplify.d.ts +11 -0
- package/lib/exercises/math/complex/exp/complexExpFormQuotientSimplify.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexExpFormQuotientSimplify.js +164 -0
- package/lib/exercises/math/complex/exp/complexExpFromAlgebraicForm.d.ts +9 -0
- package/lib/exercises/math/complex/exp/complexExpFromAlgebraicForm.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/complexExpFromAlgebraicForm.js +175 -0
- package/lib/exercises/math/complex/exp/index.d.ts +5 -0
- package/lib/exercises/math/complex/exp/index.d.ts.map +1 -0
- package/lib/exercises/math/complex/exp/index.js +5 -0
- package/lib/exercises/math/complex/index.d.ts +1 -0
- package/lib/exercises/math/complex/index.d.ts.map +1 -1
- package/lib/exercises/math/complex/index.js +1 -0
- package/lib/exercises/math/complex/inverseComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/inverseComplex.js +35 -2
- package/lib/exercises/math/complex/linearCombinaisonComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/linearCombinaisonComplex.js +36 -5
- package/lib/exercises/math/complex/moduloFromAlgebraicComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/moduloFromAlgebraicComplex.js +38 -9
- package/lib/exercises/math/derivation/problems/index.d.ts +0 -1
- package/lib/exercises/math/derivation/problems/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/index.js +1 -1
- package/lib/exercises/math/trigonometry/formulas/index.d.ts +2 -0
- package/lib/exercises/math/trigonometry/formulas/index.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/formulas/index.js +1 -0
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts +8 -0
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +217 -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/index.d.ts +21 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/playground.d.ts +0 -5
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +3 -9
- package/lib/tree/nodes/algebraicNode.d.ts +2 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.d.ts +3 -0
- package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.js +8 -0
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +6 -1
- package/lib/tree/nodes/functions/expNode.d.ts +2 -2
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +2 -2
- package/lib/tree/nodes/node.d.ts +1 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +6 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +11 -6
- package/package.json +1 -1
|
@@ -10,10 +10,10 @@ import { random } from "../../../utils/alea/random.js";
|
|
|
10
10
|
import { doWhile } from "../../../utils/doWhile.js";
|
|
11
11
|
const getPropositions = (n, { answer }) => {
|
|
12
12
|
const propositions = [];
|
|
13
|
-
addValidProp(propositions, answer);
|
|
14
|
-
tryToAddWrongProp(propositions, "Oui");
|
|
15
|
-
tryToAddWrongProp(propositions, "Non");
|
|
16
|
-
tryToAddWrongProp(propositions, "On ne peut pas savoir");
|
|
13
|
+
addValidProp(propositions, answer, "raw");
|
|
14
|
+
tryToAddWrongProp(propositions, "Oui", "raw");
|
|
15
|
+
tryToAddWrongProp(propositions, "Non", "raw");
|
|
16
|
+
tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
|
|
17
17
|
return shuffleProps(propositions, n);
|
|
18
18
|
};
|
|
19
19
|
const getAnswer = (identifiers) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgcdFromPrimeDecomposition.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/arithmetic/pgcdFromPrimeDecomposition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"pgcdFromPrimeDecomposition.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/arithmetic/pgcdFromPrimeDecomposition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAsJF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAmB5D,CAAC"}
|
|
@@ -6,6 +6,8 @@ import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
|
6
6
|
import { power } from "../../../tree/nodes/operators/powerNode.js";
|
|
7
7
|
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
8
8
|
import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
|
|
9
|
+
import { randomMany } from "../../../utils/alea/random.js";
|
|
10
|
+
import { doWhile } from "../../../utils/doWhile.js";
|
|
9
11
|
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
10
12
|
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
11
13
|
const propositions = [];
|
|
@@ -83,23 +85,23 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
83
85
|
}
|
|
84
86
|
};
|
|
85
87
|
const getPgcdFromPrimeDecompositionQuestion = () => {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
+
const primes = [2, 3, 5, 7, 11, 13];
|
|
89
|
+
const aPrimes = randomMany(primes, randint(3, 6)).sort((a, b) => a - b);
|
|
90
|
+
const bPrimes = doWhile(() => randomMany(primes, randint(3, 6)), (list) => list.every((p) => !aPrimes.includes(p))).sort((a, b) => a - b);
|
|
91
|
+
const aPowers = randTupleInt(aPrimes.length, {
|
|
92
|
+
from: 1,
|
|
88
93
|
to: 7,
|
|
89
94
|
});
|
|
90
|
-
const bPowers = randTupleInt(
|
|
91
|
-
from:
|
|
95
|
+
const bPowers = randTupleInt(bPrimes.length, {
|
|
96
|
+
from: 1,
|
|
92
97
|
to: 7,
|
|
93
98
|
excludes: [aPowers],
|
|
94
99
|
});
|
|
95
|
-
const primes = [2, 3, 5, 7, 11, 13, 17];
|
|
96
|
-
const aPrimes = primes.filter((_p, i) => aPowers[i] > 0);
|
|
97
|
-
const bPrimes = primes.filter((_p, i) => bPowers[i] > 0);
|
|
98
100
|
const identifiers = {
|
|
99
101
|
aPrimes,
|
|
100
102
|
bPrimes,
|
|
101
|
-
aPowers
|
|
102
|
-
bPowers
|
|
103
|
+
aPowers,
|
|
104
|
+
bPowers,
|
|
103
105
|
};
|
|
104
106
|
return getQuestionFromIdentifiers(identifiers);
|
|
105
107
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
2
3
|
type Identifiers = {
|
|
3
4
|
arg: number;
|
|
4
5
|
zTex: string;
|
|
6
|
+
reIds: NodeIdentifiers;
|
|
7
|
+
imIds: NodeIdentifiers;
|
|
5
8
|
};
|
|
6
9
|
export declare const argumentFromAlgebraicComplex: Exercise<Identifiers>;
|
|
7
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argumentFromAlgebraicComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/argumentFromAlgebraicComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"argumentFromAlgebraicComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/argumentFromAlgebraicComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAS7C,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAoJF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAc9D,CAAC"}
|
|
@@ -5,13 +5,22 @@ import { RationalConstructor } from "../../../math/numbers/rationals/rational.js
|
|
|
5
5
|
import { mainTrigoValues } from "../../../math/trigonometry/remarkableValues.js";
|
|
6
6
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
7
7
|
import { ComplexNode } from "../../../tree/nodes/complex/complexNode.js";
|
|
8
|
-
import { SqrtNode } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
8
|
+
import { sqrt, SqrtNode } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
9
|
+
import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
|
|
9
10
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
11
|
+
import { add } from "../../../tree/nodes/operators/addNode.js";
|
|
12
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
10
13
|
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
14
|
+
import { square } from "../../../tree/nodes/operators/powerNode.js";
|
|
11
15
|
import { random } from "../../../utils/alea/random.js";
|
|
16
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
12
17
|
const getInstruction = (identifiers) => {
|
|
13
18
|
const zTex = identifiers.zTex;
|
|
14
|
-
return `Soit
|
|
19
|
+
return `Soit le nombre complexe :
|
|
20
|
+
|
|
21
|
+
$$
|
|
22
|
+
z=${zTex}
|
|
23
|
+
$$
|
|
15
24
|
|
|
16
25
|
Déterminer l'argument principal de $z$.`;
|
|
17
26
|
};
|
|
@@ -20,6 +29,78 @@ const getAnswer = (identifiers) => {
|
|
|
20
29
|
const answer = arg.angle.toTex();
|
|
21
30
|
return answer;
|
|
22
31
|
};
|
|
32
|
+
const getHint = () => {
|
|
33
|
+
return `Soit $z$ un nombre complexe non nul.
|
|
34
|
+
|
|
35
|
+
- Si la partie réelle de $z$ est nulle, alors tout argument de $z$ est congru à $0$ modulo $\\pi$.
|
|
36
|
+
- Si la partie imaginaire de $z$ est nulle, alors tout argument de $z$ est congru à $\\frac{\\pi}{2}$ modulo $\\pi$.
|
|
37
|
+
- Dans les autres cas, on peut déterminer un argument $\\theta$ de $z$ en calculant $|z|$, puis en résolvant le système :
|
|
38
|
+
|
|
39
|
+
$$
|
|
40
|
+
\\left\\{\\begin{matrix}
|
|
41
|
+
\\cos(\\theta) = \\frac{x}{|z|} \\\\
|
|
42
|
+
\\sin(\\theta) = \\frac{y}{|z|}
|
|
43
|
+
\\end{matrix}\\right.
|
|
44
|
+
$$
|
|
45
|
+
`;
|
|
46
|
+
};
|
|
47
|
+
const getCorrection = (identifiers) => {
|
|
48
|
+
const { reIds, imIds } = identifiers;
|
|
49
|
+
const re = reifyAlgebraic(reIds);
|
|
50
|
+
const im = reifyAlgebraic(imIds);
|
|
51
|
+
const answer = getAnswer(identifiers);
|
|
52
|
+
const module = sqrt(add(square(re), square(im))).simplify();
|
|
53
|
+
const arg = mainTrigoValues.find((point) => point.angle.evaluate({}) === identifiers.arg);
|
|
54
|
+
const argCos = arg.cos.toTex();
|
|
55
|
+
const argSin = arg.sin.toTex();
|
|
56
|
+
const cosinus = frac(re, module).simplify();
|
|
57
|
+
const sinus = frac(im, module).simplify();
|
|
58
|
+
const cosSimp = frac(re, module).toSimplificationTex();
|
|
59
|
+
const sinSimp = frac(im, module).toSimplificationTex();
|
|
60
|
+
if (re.evaluate() === 0) {
|
|
61
|
+
const sign = im.evaluate() > 0 ? "positive" : "négative";
|
|
62
|
+
return `$z$ est un imaginaire pur dont la partie imaginaire est strictement ${sign}, donc l'argument principal de $z$ est :
|
|
63
|
+
|
|
64
|
+
$$
|
|
65
|
+
${answer}
|
|
66
|
+
$$`;
|
|
67
|
+
}
|
|
68
|
+
else if (im.evaluate() === 0) {
|
|
69
|
+
const sign = re.evaluate() > 0 ? "positive" : "négative";
|
|
70
|
+
return `$z$ est un réel strictement ${sign}, donc l'argument principal de $z$ est :
|
|
71
|
+
|
|
72
|
+
$$
|
|
73
|
+
${answer}
|
|
74
|
+
$$`;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return `On commence par calculer le module de $z$ :
|
|
78
|
+
|
|
79
|
+
${alignTex([
|
|
80
|
+
["|z|", "=", sqrt(add(square(re), square(im))).toTex()],
|
|
81
|
+
["", "=", sqrt(add(square(re), square(im)).simplify()).toTex()],
|
|
82
|
+
["", "=", module.toTex()],
|
|
83
|
+
])}
|
|
84
|
+
|
|
85
|
+
Tout argument $\\theta$ de $z$ vérifie alors :
|
|
86
|
+
|
|
87
|
+
$$
|
|
88
|
+
\\cos(\\theta) = ${cosSimp} ${argCos !== cosinus.toTex() ? `= ${argCos}` : ""}
|
|
89
|
+
$$
|
|
90
|
+
|
|
91
|
+
et
|
|
92
|
+
|
|
93
|
+
$$
|
|
94
|
+
\\sin(\\theta) = ${sinSimp} ${argSin !== sinus.toTex() ? `= ${argSin}` : ""}
|
|
95
|
+
$$
|
|
96
|
+
|
|
97
|
+
On en déduit que l'argument principal de $z$ est :
|
|
98
|
+
|
|
99
|
+
$$
|
|
100
|
+
${answer}
|
|
101
|
+
$$`;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
23
104
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
24
105
|
const question = {
|
|
25
106
|
answer: getAnswer(identifiers),
|
|
@@ -27,6 +108,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
27
108
|
keys: ["pi"],
|
|
28
109
|
answerFormat: "tex",
|
|
29
110
|
identifiers,
|
|
111
|
+
hint: getHint(identifiers),
|
|
112
|
+
correction: getCorrection(identifiers),
|
|
30
113
|
};
|
|
31
114
|
return question;
|
|
32
115
|
};
|
|
@@ -41,7 +124,12 @@ const getArgumentFromAlgebraicComplexQuestion = () => {
|
|
|
41
124
|
const im = new MultiplyNode(factor, arg.sin).simplify();
|
|
42
125
|
const z = new ComplexNode(re, im);
|
|
43
126
|
const zTex = z.toTex();
|
|
44
|
-
const identifiers = {
|
|
127
|
+
const identifiers = {
|
|
128
|
+
arg: arg.angle.evaluate({}),
|
|
129
|
+
zTex,
|
|
130
|
+
reIds: re.toIdentifiers(),
|
|
131
|
+
imIds: im.toIdentifiers(),
|
|
132
|
+
};
|
|
45
133
|
return getQuestionFromIdentifiers(identifiers);
|
|
46
134
|
};
|
|
47
135
|
const getPropositions = (n, { answer }) => {
|
|
@@ -70,4 +158,5 @@ export const argumentFromAlgebraicComplex = {
|
|
|
70
158
|
isAnswerValid,
|
|
71
159
|
subject: "Mathématiques",
|
|
72
160
|
getQuestionFromIdentifiers,
|
|
161
|
+
hasHintAndCorrection: true,
|
|
73
162
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conjugateDivideComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/conjugateDivideComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"conjugateDivideComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/conjugateDivideComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;CACd,CAAC;AAyIF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Complex, ComplexConstructor } from "../../../math/complex/complex.js";
|
|
4
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
4
6
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
7
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
5
8
|
const getInstruction = (identifiers) => {
|
|
6
9
|
const z1 = new Complex(identifiers.z1[0], identifiers.z1[1]);
|
|
7
10
|
const z2 = new Complex(identifiers.z2[0], identifiers.z2[1]);
|
|
@@ -17,19 +20,75 @@ const getAnswer = (identifiers) => {
|
|
|
17
20
|
const answerTex = conjz1.divideNode(conjz2).toTex();
|
|
18
21
|
return answerTex;
|
|
19
22
|
};
|
|
23
|
+
const getHint = () => {
|
|
24
|
+
return `Pour calculer un quotient dans $\\mathbb{C}$, on multiplie le numérateur et le dénominateur par le conjugué du dénominateur.
|
|
25
|
+
|
|
26
|
+
On rappelle que le conjugué d'un nombre complexe $z$ est le nombre complexe de même partie réelle et de partie imaginaire opposée.
|
|
27
|
+
`;
|
|
28
|
+
};
|
|
29
|
+
const getCorrection = (identifiers) => {
|
|
30
|
+
const z1 = new Complex(identifiers.z1[0], identifiers.z1[1]);
|
|
31
|
+
const z2 = new Complex(identifiers.z2[0], identifiers.z2[1]);
|
|
32
|
+
const z1Tree = z1.toTree();
|
|
33
|
+
const z2Tree = z2.toTree();
|
|
34
|
+
const conj = z2.conjugate().toTree();
|
|
35
|
+
const num = z1.multiply(z2.conjugate()).toTree();
|
|
36
|
+
const denum = z2.multiply(z2.conjugate()).toTree();
|
|
37
|
+
// const zTree = z.toTree();
|
|
38
|
+
// const conj = z.conjugate().toTree();
|
|
39
|
+
return `On a
|
|
40
|
+
|
|
41
|
+
$$
|
|
42
|
+
z = ${z1Tree.toTex()}
|
|
43
|
+
$$
|
|
44
|
+
|
|
45
|
+
$$
|
|
46
|
+
z' = ${z2Tree.toTex()}
|
|
47
|
+
$$
|
|
48
|
+
|
|
49
|
+
et on veut calculer le conjugué de $\\frac{z}{z'}$.
|
|
50
|
+
|
|
51
|
+
On commence par calculer $\\frac{z}{z'}$. Pour cela, on multiplie le numérateur et le dénominateur par le conjugué de $z'$, c'est à dire par :
|
|
52
|
+
|
|
53
|
+
$$
|
|
54
|
+
${conj.toTex()}
|
|
55
|
+
$$
|
|
56
|
+
|
|
57
|
+
Cela donne :
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
${alignTex([
|
|
61
|
+
["", ` \\frac{${z1Tree.toTex()}}{${z2Tree.toTex()}} `],
|
|
62
|
+
[
|
|
63
|
+
"=",
|
|
64
|
+
`\\frac{(${z1Tree.toTex()})(${conj.toTex()})}{(${z2Tree.toTex()})(${conj.toTex()})}`,
|
|
65
|
+
],
|
|
66
|
+
["=", frac(num, denum).toTex()],
|
|
67
|
+
["=", z1.divideNode(z2).toTex()],
|
|
68
|
+
])}
|
|
69
|
+
|
|
70
|
+
Il suffit maintenant de prendre le conjugué de ce résultat : on obtient
|
|
71
|
+
|
|
72
|
+
$$
|
|
73
|
+
${getAnswer(identifiers)}
|
|
74
|
+
$$
|
|
75
|
+
`;
|
|
76
|
+
};
|
|
20
77
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
21
78
|
const question = {
|
|
22
79
|
answer: getAnswer(identifiers),
|
|
23
80
|
instruction: getInstruction(identifiers),
|
|
24
|
-
keys: ["i"
|
|
81
|
+
keys: ["i"],
|
|
25
82
|
answerFormat: "tex",
|
|
26
83
|
startStatement: "\\overline{\\frac{z}{z'}}",
|
|
27
84
|
identifiers,
|
|
85
|
+
hint: getHint(identifiers),
|
|
86
|
+
correction: getCorrection(identifiers),
|
|
28
87
|
};
|
|
29
88
|
return question;
|
|
30
89
|
};
|
|
31
90
|
const getConjugateDivideComplexQuestion = () => {
|
|
32
|
-
|
|
91
|
+
let z1;
|
|
33
92
|
let z2;
|
|
34
93
|
let counter = 0;
|
|
35
94
|
do {
|
|
@@ -37,11 +96,12 @@ const getConjugateDivideComplexQuestion = () => {
|
|
|
37
96
|
if (counter > 1000) {
|
|
38
97
|
throw new Error("conjugate divide complex too many iterations");
|
|
39
98
|
}
|
|
40
|
-
|
|
41
|
-
|
|
99
|
+
z1 = [randint(-10, 11, [0]), randint(-10, 11, [0])];
|
|
100
|
+
z2 = [randint(-10, 11, [0]), randint(-10, 11, [0])];
|
|
101
|
+
} while (z1[0] / z2[0] === z1[1] / z2[1]);
|
|
42
102
|
const identifiers = {
|
|
43
|
-
z1
|
|
44
|
-
z2
|
|
103
|
+
z1,
|
|
104
|
+
z2,
|
|
45
105
|
};
|
|
46
106
|
return getQuestionFromIdentifiers(identifiers);
|
|
47
107
|
};
|
|
@@ -73,4 +133,5 @@ export const conjugateDivideComplex = {
|
|
|
73
133
|
isAnswerValid,
|
|
74
134
|
subject: "Mathématiques",
|
|
75
135
|
getQuestionFromIdentifiers,
|
|
136
|
+
hasHintAndCorrection: true,
|
|
76
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conjugateMultiplyComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/conjugateMultiplyComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"conjugateMultiplyComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/conjugateMultiplyComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;CACd,CAAC;AA4HF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Complex, ComplexConstructor } from "../../../math/complex/complex.js";
|
|
4
|
+
import { randTupleInt } from "../../../math/utils/random/randTupleInt.js";
|
|
5
|
+
import { add } from "../../../tree/nodes/operators/addNode.js";
|
|
6
|
+
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
4
7
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
8
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
5
9
|
const getInstruction = (identifiers) => {
|
|
6
10
|
const z1 = new Complex(identifiers.z1[0], identifiers.z1[1]);
|
|
7
11
|
const z2 = new Complex(identifiers.z2[0], identifiers.z2[1]);
|
|
8
|
-
return `Soit $z=${z1.toTree().toTex()}$ et $z'=${z2
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
return `Soit $z=${z1.toTree().toTex()}$ et $z'=${z2.toTree().toTex()}$.
|
|
13
|
+
|
|
14
|
+
Calculer $\\overline{z\\times z'}$.`;
|
|
11
15
|
};
|
|
12
16
|
const getAnswer = (identifiers) => {
|
|
13
17
|
const z1 = new Complex(identifiers.z1[0], identifiers.z1[1]);
|
|
@@ -17,29 +21,63 @@ const getAnswer = (identifiers) => {
|
|
|
17
21
|
const answer = conj.toTree().toTex();
|
|
18
22
|
return answer;
|
|
19
23
|
};
|
|
24
|
+
const getHint = () => {
|
|
25
|
+
return `Pour multiplier deux nombres complexes, on utilise la distributivité double, ainsi que le fait que $i^2 = -1$.
|
|
26
|
+
|
|
27
|
+
On rappelle que le conjugué $\\overline{z}$ d'un nombre complexe $z$ est le nombre complexe de même partie réelle et de partie imaginaire opposée.`;
|
|
28
|
+
};
|
|
29
|
+
const getCorrection = (identifiers) => {
|
|
30
|
+
const { z1, z2 } = identifiers;
|
|
31
|
+
const [a, b] = z1;
|
|
32
|
+
const [c, d] = z2;
|
|
33
|
+
const zA = add(a, multiply(b, "i"));
|
|
34
|
+
const zB = add(c, multiply(d, "i"));
|
|
35
|
+
return `On distribue comme pour des nombres réels, puis on utilise le fait que $i^2=-1$ :
|
|
36
|
+
|
|
37
|
+
${alignTex([
|
|
38
|
+
["z\\times z'", "=", multiply(zA, zB).toTex()],
|
|
39
|
+
[
|
|
40
|
+
"",
|
|
41
|
+
"=",
|
|
42
|
+
add(add(multiply(a, c), multiply(a, multiply(d, "i"))), add(multiply(multiply(b, "i"), c), multiply(multiply(b, "i"), multiply(d, "i")))).toTex(),
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
"",
|
|
46
|
+
"=",
|
|
47
|
+
add(add(multiply(a, c).simplify(), multiply(a * d + b * c, "i")), multiply(multiply(b, d).simplify(), -1)).toTex(),
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"",
|
|
51
|
+
"=",
|
|
52
|
+
add(add(multiply(a, c), multiply(a * d + b * c, "i")), multiply(multiply(b, d), -1))
|
|
53
|
+
.simplify({ noAddOrder: true })
|
|
54
|
+
.toTex(),
|
|
55
|
+
],
|
|
56
|
+
])}
|
|
57
|
+
|
|
58
|
+
Il suffit alors de prendre le conjugué de ce résultat, on obtient :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
${getAnswer(identifiers)}
|
|
62
|
+
$$
|
|
63
|
+
`;
|
|
64
|
+
};
|
|
20
65
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
21
66
|
const question = {
|
|
22
67
|
answer: getAnswer(identifiers),
|
|
23
68
|
instruction: getInstruction(identifiers),
|
|
24
|
-
keys: ["i"
|
|
69
|
+
keys: ["i"],
|
|
25
70
|
answerFormat: "tex",
|
|
26
71
|
startStatement: "\\overline{z\\times z'}",
|
|
27
72
|
identifiers,
|
|
73
|
+
hint: getHint(identifiers),
|
|
74
|
+
correction: getCorrection(identifiers),
|
|
28
75
|
};
|
|
29
76
|
return question;
|
|
30
77
|
};
|
|
31
78
|
const getConjugateMultiplyComplexQuestion = () => {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
let counter = 0;
|
|
35
|
-
do {
|
|
36
|
-
counter++;
|
|
37
|
-
if (counter > 1000) {
|
|
38
|
-
throw new Error("conjugate multiply complex too many iterations");
|
|
39
|
-
}
|
|
40
|
-
z2 = ComplexConstructor.random();
|
|
41
|
-
} while (z1.im === 0 && z2.im === 0);
|
|
42
|
-
const identifiers = { z1: [z1.re, z1.im], z2: [z2.re, z2.im] };
|
|
79
|
+
const [a, b, c, d] = randTupleInt(4, { from: -9, to: 10, elExcludes: [0] });
|
|
80
|
+
const identifiers = { z1: [a, b], z2: [c, d] };
|
|
43
81
|
return getQuestionFromIdentifiers(identifiers);
|
|
44
82
|
};
|
|
45
83
|
const getPropositions = (n, { answer, z1, z2 }) => {
|
|
@@ -74,4 +112,5 @@ export const conjugateMultiplyComplex = {
|
|
|
74
112
|
isAnswerValid,
|
|
75
113
|
subject: "Mathématiques",
|
|
76
114
|
getQuestionFromIdentifiers,
|
|
115
|
+
hasHintAndCorrection: true,
|
|
77
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divideComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/divideComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"divideComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/divideComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;CACd,CAAC;AAyHF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAa/C,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Complex, ComplexConstructor } from "../../../math/complex/complex.js";
|
|
4
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
4
6
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
7
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
5
8
|
const getInstruction = (identifiers) => {
|
|
6
9
|
const z1 = new Complex(identifiers.z1[0], identifiers.z1[1]);
|
|
7
10
|
const z2 = new Complex(identifiers.z2[0], identifiers.z2[1]);
|
|
@@ -15,19 +18,68 @@ const getAnswer = (identifiers) => {
|
|
|
15
18
|
const answerTex = z1.divideNode(z2).toTex();
|
|
16
19
|
return answerTex;
|
|
17
20
|
};
|
|
21
|
+
const getHint = () => {
|
|
22
|
+
return `Pour calculer un quotient dans $\\mathbb{C}$, on multiplie le numérateur et le dénominateur par le conjugué du dénominateur.
|
|
23
|
+
|
|
24
|
+
On rappelle que le conjugué d'un nombre complexe $z$ est le nombre complexe de même partie réelle et de partie imaginaire opposée.
|
|
25
|
+
`;
|
|
26
|
+
};
|
|
27
|
+
const getCorrection = (identifiers) => {
|
|
28
|
+
const z1 = new Complex(identifiers.z1[0], identifiers.z1[1]);
|
|
29
|
+
const z2 = new Complex(identifiers.z2[0], identifiers.z2[1]);
|
|
30
|
+
const z1Tree = z1.toTree();
|
|
31
|
+
const z2Tree = z2.toTree();
|
|
32
|
+
const conj = z2.conjugate().toTree();
|
|
33
|
+
const num = z1.multiply(z2.conjugate()).toTree();
|
|
34
|
+
const denum = z2.multiply(z2.conjugate()).toTree();
|
|
35
|
+
// const zTree = z.toTree();
|
|
36
|
+
// const conj = z.conjugate().toTree();
|
|
37
|
+
return `On a
|
|
38
|
+
|
|
39
|
+
$$
|
|
40
|
+
z = ${z1Tree.toTex()}
|
|
41
|
+
$$
|
|
42
|
+
|
|
43
|
+
$$
|
|
44
|
+
z' = ${z2Tree.toTex()}
|
|
45
|
+
$$
|
|
46
|
+
|
|
47
|
+
et on veut calculer $\\frac{z}{z'}$.
|
|
48
|
+
|
|
49
|
+
Pour cela, on multiplie le numérateur et le dénominateur par le conjugué de $z'$, c'est à dire par :
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
${conj.toTex()}
|
|
53
|
+
$$
|
|
54
|
+
|
|
55
|
+
Cela donne :
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
${alignTex([
|
|
59
|
+
["", ` \\frac{${z1Tree.toTex()}}{${z2Tree.toTex()}} `],
|
|
60
|
+
[
|
|
61
|
+
"=",
|
|
62
|
+
`\\frac{(${z1Tree.toTex()})(${conj.toTex()})}{(${z2Tree.toTex()})(${conj.toTex()})}`,
|
|
63
|
+
],
|
|
64
|
+
["=", frac(num, denum).toTex()],
|
|
65
|
+
["=", getAnswer(identifiers)],
|
|
66
|
+
])}`;
|
|
67
|
+
};
|
|
18
68
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
19
69
|
const question = {
|
|
20
70
|
answer: getAnswer(identifiers),
|
|
21
71
|
instruction: getInstruction(identifiers),
|
|
22
|
-
keys: ["i"
|
|
72
|
+
keys: ["i"],
|
|
23
73
|
answerFormat: "tex",
|
|
24
74
|
startStatement: "\\frac{z}{z'}",
|
|
25
75
|
identifiers,
|
|
76
|
+
hint: getHint(identifiers),
|
|
77
|
+
correction: getCorrection(identifiers),
|
|
26
78
|
};
|
|
27
79
|
return question;
|
|
28
80
|
};
|
|
29
81
|
const getDivideComplexQuestion = () => {
|
|
30
|
-
|
|
82
|
+
let z1;
|
|
31
83
|
let z2;
|
|
32
84
|
let counter = 0;
|
|
33
85
|
do {
|
|
@@ -35,11 +87,12 @@ const getDivideComplexQuestion = () => {
|
|
|
35
87
|
if (counter > 1000) {
|
|
36
88
|
throw new Error("divide complex too many iterations");
|
|
37
89
|
}
|
|
38
|
-
|
|
39
|
-
|
|
90
|
+
z1 = [randint(-10, 11, [0]), randint(-10, 11, [0])];
|
|
91
|
+
z2 = [randint(-10, 11, [0]), randint(-10, 11, [0])];
|
|
92
|
+
} while (z1[0] / z2[0] === z1[1] / z2[1]);
|
|
40
93
|
const identifiers = {
|
|
41
|
-
z1
|
|
42
|
-
z2
|
|
94
|
+
z1,
|
|
95
|
+
z2,
|
|
43
96
|
};
|
|
44
97
|
return getQuestionFromIdentifiers(identifiers);
|
|
45
98
|
};
|
|
@@ -71,4 +124,5 @@ export const divideComplex = {
|
|
|
71
124
|
isAnswerValid,
|
|
72
125
|
subject: "Mathématiques",
|
|
73
126
|
getQuestionFromIdentifiers,
|
|
127
|
+
hasHintAndCorrection: true,
|
|
74
128
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
rIds: NodeIdentifiers;
|
|
5
|
+
thetaIds: NodeIdentifiers;
|
|
6
|
+
};
|
|
7
|
+
export declare const complexAlgebraicFromExpForm: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=complexAlgebraicFromExpForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexAlgebraicFromExpForm.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/complex/exp/complexAlgebraicFromExpForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAiLF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAsB7D,CAAC"}
|