math-exercises 3.0.211 → 3.0.213
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/congruenceBasicEquation.d.ts +9 -0
- package/lib/exercises/math/arithmetic/congruenceBasicEquation.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/congruenceBasicEquation.js +116 -0
- package/lib/exercises/math/arithmetic/diophantianEquationSimpleSolution.d.ts +9 -0
- package/lib/exercises/math/arithmetic/diophantianEquationSimpleSolution.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/diophantianEquationSimpleSolution.js +129 -0
- package/lib/exercises/math/arithmetic/fermatUsageOnBigPowers.d.ts +9 -0
- package/lib/exercises/math/arithmetic/fermatUsageOnBigPowers.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/fermatUsageOnBigPowers.js +140 -0
- package/lib/exercises/math/arithmetic/fillCongruenceTableFirstDegree.d.ts +9 -0
- package/lib/exercises/math/arithmetic/fillCongruenceTableFirstDegree.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/fillCongruenceTableFirstDegree.js +106 -0
- package/lib/exercises/math/arithmetic/findBezoutCoefficients.d.ts +8 -0
- package/lib/exercises/math/arithmetic/findBezoutCoefficients.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/findBezoutCoefficients.js +175 -0
- package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.d.ts +9 -0
- package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.js +105 -0
- package/lib/exercises/math/arithmetic/index.d.ts +8 -0
- package/lib/exercises/math/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/arithmetic/index.js +8 -0
- package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.d.ts +10 -0
- package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/pgcdFromPrimeDecomposition.js +136 -0
- package/lib/exercises/math/arithmetic/pgcdHomogenuity.d.ts +8 -0
- package/lib/exercises/math/arithmetic/pgcdHomogenuity.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/pgcdHomogenuity.js +124 -0
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +2 -2
- 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 +52 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/arithmetic/bezout.d.ts +2 -0
- package/lib/math/utils/arithmetic/bezout.d.ts.map +1 -0
- package/lib/math/utils/arithmetic/bezout.js +10 -0
- 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 +2 -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/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { mainTrigoValues } from "../../../../math/trigonometry/remarkableValues.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
6
|
+
import { exp } from "../../../../tree/nodes/functions/expNode.js";
|
|
7
|
+
import { logn } from "../../../../tree/nodes/functions/logNode.js";
|
|
8
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
9
|
+
import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
|
|
10
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
13
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
14
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
15
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
16
|
+
import { doWhile } from "../../../../utils/doWhile.js";
|
|
17
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
18
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
19
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
20
|
+
const propositions = [];
|
|
21
|
+
addValidProp(propositions, answer);
|
|
22
|
+
const { z1ArgIds, z1ModuleIds, pow } = identifiers;
|
|
23
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
24
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
25
|
+
const module = power(z1Module, pow).simplify();
|
|
26
|
+
const arg = multiply(z1Arg, pow).simplify();
|
|
27
|
+
propWhile(propositions, n, () => {
|
|
28
|
+
const z1ModuleFake = randint(2, 10);
|
|
29
|
+
const z1ArgFake = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0));
|
|
30
|
+
const moduleFake = power(z1ModuleFake, pow).simplify();
|
|
31
|
+
const argFake = multiply(z1ArgFake.angle, pow).simplify();
|
|
32
|
+
if (module.toTex() === moduleFake.toTex() &&
|
|
33
|
+
frac(substract(argFake, arg), PiNode).simplify().evaluate() % 2 === 0)
|
|
34
|
+
return;
|
|
35
|
+
tryToAddWrongProp(propositions, `${moduleFake.toTex()}${getExpTex(argFake)}`);
|
|
36
|
+
});
|
|
37
|
+
return shuffleProps(propositions, n);
|
|
38
|
+
};
|
|
39
|
+
const getExpTex = (theta) => {
|
|
40
|
+
const rawTheta = abs(theta).simplify();
|
|
41
|
+
return `e^{${theta.evaluate() < 0 ? "-" : ""}${multiply("i", rawTheta).toTex({
|
|
42
|
+
forceNoTimesSign: true,
|
|
43
|
+
})}}`;
|
|
44
|
+
};
|
|
45
|
+
const getAnswer = (identifiers) => {
|
|
46
|
+
const { z1ArgIds, z1ModuleIds, pow } = identifiers;
|
|
47
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
48
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
49
|
+
const module = power(z1Module, pow).simplify();
|
|
50
|
+
const arg = multiply(z1Arg, pow).simplify();
|
|
51
|
+
return `${module.toTex()}${getExpTex(arg)}`;
|
|
52
|
+
};
|
|
53
|
+
const getInstruction = (identifiers) => {
|
|
54
|
+
throw new Error("wtf, 9^3e^3 plante, le parsage des puissances doit être tout pété. Aussi 9^3\\cos^3 donne un truc trop chelou. Après investigation : a^bc est mal parsé, que a soit nb ou e : il faut cut à a^b*c mais c'est parsé en a^{bc}...");
|
|
55
|
+
const { z1ArgIds, z1ModuleIds, pow } = identifiers;
|
|
56
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
57
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
58
|
+
return `Écrire sous forme exponentielle :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
\\left(${z1Module.toTex()}${getExpTex(z1Arg)}\\right)^{${pow}}
|
|
62
|
+
$$`;
|
|
63
|
+
};
|
|
64
|
+
const getHint = () => {
|
|
65
|
+
return `Pour tous nombres réels $\\theta$ et $\\theta'$ et tout entier relatif $n$, on a :
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
\\left(e^{i\\theta}\\right)^n = e^{in\\theta}
|
|
69
|
+
$$`;
|
|
70
|
+
};
|
|
71
|
+
const getCorrection = (identifiers) => {
|
|
72
|
+
const { z1ArgIds, z1ModuleIds, pow } = identifiers;
|
|
73
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
74
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
75
|
+
return `On utilise la relation fonctionnelle : pour tous nombres réels $\\theta$ et $\\theta'$ et tout entier relatif $n$, on a
|
|
76
|
+
|
|
77
|
+
$$
|
|
78
|
+
\\left(e^{i\\theta}\\right)^n = e^{in\\theta}
|
|
79
|
+
$$
|
|
80
|
+
|
|
81
|
+
Ici, on a donc :
|
|
82
|
+
|
|
83
|
+
${alignTex([
|
|
84
|
+
["", `\\left(${z1Module.toTex()}${getExpTex(z1Arg)}\\right)^{${pow}}`],
|
|
85
|
+
[
|
|
86
|
+
"=",
|
|
87
|
+
multiply(power(z1Module, pow), exp(multiply("i", multiply(z1Arg, pow)))).toTex(),
|
|
88
|
+
],
|
|
89
|
+
["=", getAnswer(identifiers)],
|
|
90
|
+
])}`;
|
|
91
|
+
};
|
|
92
|
+
const getKeys = () => {
|
|
93
|
+
return ["epower", "i", "pi"];
|
|
94
|
+
};
|
|
95
|
+
const isAnswerValid = (ans, { z1ArgIds, z1ModuleIds, pow }) => {
|
|
96
|
+
try {
|
|
97
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
98
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
99
|
+
const module = power(z1Module, pow).simplify();
|
|
100
|
+
const angle = multiply(z1Arg, pow).simplify();
|
|
101
|
+
const parsed = parseAlgebraic(ans);
|
|
102
|
+
const expForm = multiply(module, exp(multiply("i", angle))).simplify();
|
|
103
|
+
console.log(expForm.toTex());
|
|
104
|
+
console.log(parsed.simplify().toTex());
|
|
105
|
+
const divided = frac(expForm, parsed).simplify();
|
|
106
|
+
return (parsed.simplify().toTex() === expForm.toTex() ||
|
|
107
|
+
frac(logn(divided), multiply(PiNode, "i")).simplify().evaluate() % 2 === 0);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
return handleVEAError(err);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const getComplexExpFormPowerSimplifyQuestion = () => {
|
|
114
|
+
const z1Module = randint(2, 10);
|
|
115
|
+
const z1Arg = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0));
|
|
116
|
+
const pow = doWhile(() => randint(2, 10), (x) => frac(multiply(z1Arg.angle, x), PiNode).simplify().evaluate({}) % 2 === 0);
|
|
117
|
+
const identifiers = {
|
|
118
|
+
z1ArgIds: z1Arg.angle.toIdentifiers(),
|
|
119
|
+
z1ModuleIds: z1Module.toTree().toIdentifiers(),
|
|
120
|
+
pow,
|
|
121
|
+
};
|
|
122
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
123
|
+
};
|
|
124
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
125
|
+
return {
|
|
126
|
+
answer: getAnswer(identifiers),
|
|
127
|
+
instruction: getInstruction(identifiers),
|
|
128
|
+
keys: getKeys(identifiers),
|
|
129
|
+
answerFormat: "tex",
|
|
130
|
+
identifiers,
|
|
131
|
+
hint: getHint(identifiers),
|
|
132
|
+
correction: getCorrection(identifiers),
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
export const complexExpFormPowerSimplify = {
|
|
136
|
+
id: "complexExpFormPowerSimplify",
|
|
137
|
+
connector: "=",
|
|
138
|
+
label: "Simplifier une puissance de formes exponentielles de nombres complexes",
|
|
139
|
+
isSingleStep: true,
|
|
140
|
+
generator: (nb, opts) => getDistinctQuestions(() => getComplexExpFormPowerSimplifyQuestion(opts), nb),
|
|
141
|
+
qcmTimer: 60,
|
|
142
|
+
freeTimer: 60,
|
|
143
|
+
getPropositions,
|
|
144
|
+
isAnswerValid,
|
|
145
|
+
subject: "Mathématiques",
|
|
146
|
+
getInstruction,
|
|
147
|
+
getHint,
|
|
148
|
+
getCorrection,
|
|
149
|
+
getAnswer,
|
|
150
|
+
getQuestionFromIdentifiers,
|
|
151
|
+
hasHintAndCorrection: true,
|
|
152
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
z1ModuleIds: NodeIdentifiers;
|
|
5
|
+
z1ArgIds: NodeIdentifiers;
|
|
6
|
+
z2ModuleIds: NodeIdentifiers;
|
|
7
|
+
z2ArgIds: NodeIdentifiers;
|
|
8
|
+
};
|
|
9
|
+
export declare const complexExpFormProductSimplify: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=complexExpFormProductSimplify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexExpFormProductSimplify.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/complex/exp/complexExpFormProductSimplify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,eAAe,CAAC;IAC7B,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,eAAe,CAAC;IAC7B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAiLF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { mainTrigoValues } from "../../../../math/trigonometry/remarkableValues.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
6
|
+
import { exp } from "../../../../tree/nodes/functions/expNode.js";
|
|
7
|
+
import { logn } from "../../../../tree/nodes/functions/logNode.js";
|
|
8
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
9
|
+
import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
|
|
10
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
11
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
12
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
13
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
14
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
15
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
16
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
17
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
18
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
19
|
+
const propositions = [];
|
|
20
|
+
addValidProp(propositions, answer);
|
|
21
|
+
const { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds } = identifiers;
|
|
22
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
23
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
24
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
25
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
26
|
+
const module = multiply(z1Module, z2Module).simplify();
|
|
27
|
+
const arg = add(z1Arg, z2Arg).simplify();
|
|
28
|
+
propWhile(propositions, n, () => {
|
|
29
|
+
const z1ModuleFake = randint(2, 10);
|
|
30
|
+
const z2ModuleFake = randint(2, 10);
|
|
31
|
+
const z1ArgFake = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0));
|
|
32
|
+
const z2ArgFake = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0 &&
|
|
33
|
+
Math.abs(a.angle.evaluate()) !== Math.abs(z1ArgFake.angle.evaluate())));
|
|
34
|
+
const moduleFake = multiply(z1ModuleFake, z2ModuleFake).simplify();
|
|
35
|
+
const argFake = add(z1ArgFake.angle, z2ArgFake.angle).simplify();
|
|
36
|
+
if (module.toTex() === moduleFake.toTex() &&
|
|
37
|
+
frac(substract(argFake, arg), PiNode).simplify().evaluate() % 2 === 0)
|
|
38
|
+
return;
|
|
39
|
+
tryToAddWrongProp(propositions, `${moduleFake.toTex()}${getExpTex(argFake)}`);
|
|
40
|
+
});
|
|
41
|
+
return shuffleProps(propositions, n);
|
|
42
|
+
};
|
|
43
|
+
const getExpTex = (theta) => {
|
|
44
|
+
const rawTheta = abs(theta).simplify();
|
|
45
|
+
return `e^{${theta.evaluate() < 0 ? "-" : ""}${multiply("i", rawTheta).toTex({
|
|
46
|
+
forceNoTimesSign: true,
|
|
47
|
+
})}}`;
|
|
48
|
+
};
|
|
49
|
+
const getAnswer = (identifiers) => {
|
|
50
|
+
const { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds } = identifiers;
|
|
51
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
52
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
53
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
54
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
55
|
+
const module = multiply(z1Module, z2Module).simplify();
|
|
56
|
+
const arg = add(z1Arg, z2Arg).simplify();
|
|
57
|
+
return `${module.toTex()}${getExpTex(arg)}`;
|
|
58
|
+
};
|
|
59
|
+
const getInstruction = (identifiers) => {
|
|
60
|
+
const { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds } = identifiers;
|
|
61
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
62
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
63
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
64
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
65
|
+
return `Écrire sous forme exponentielle :
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
\\left(${z1Module.toTex()}${getExpTex(z1Arg)}\\right)\\left(${z2Module.toTex()}${getExpTex(z2Arg)}\\right)
|
|
69
|
+
$$`;
|
|
70
|
+
};
|
|
71
|
+
const getHint = () => {
|
|
72
|
+
return `Pour tous nombres réels $\\theta$ et $\\theta'$, on a :
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
e^{i\\theta} \\times e^{i\\theta'} = e^{i\\left(\\theta+\\theta'\\right)}
|
|
76
|
+
$$`;
|
|
77
|
+
};
|
|
78
|
+
const getCorrection = (identifiers) => {
|
|
79
|
+
const { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds } = identifiers;
|
|
80
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
81
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
82
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
83
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
84
|
+
const module = multiply(z1Module, z2Module).simplify();
|
|
85
|
+
return `On utilise la relation fonctionnelle : pour tous nombres réels $\\theta$ et $\\theta'$, on a
|
|
86
|
+
|
|
87
|
+
$$
|
|
88
|
+
e^{i\\theta} \\times e^{i\\theta'} = e^{i\\left(\\theta+\\theta'\\right)}
|
|
89
|
+
$$
|
|
90
|
+
|
|
91
|
+
Ici, on a donc :
|
|
92
|
+
|
|
93
|
+
${alignTex([
|
|
94
|
+
[
|
|
95
|
+
"",
|
|
96
|
+
`\\left(${z1Module.toTex()}${getExpTex(z1Arg)}\\right)\\left(${z2Module.toTex()}${getExpTex(z2Arg)}\\right)`,
|
|
97
|
+
],
|
|
98
|
+
["=", multiply(module, exp(multiply("i", add(z1Arg, z2Arg)))).toTex()],
|
|
99
|
+
["=", getAnswer(identifiers)],
|
|
100
|
+
])}`;
|
|
101
|
+
};
|
|
102
|
+
const getKeys = () => {
|
|
103
|
+
return ["epower", "i", "pi"];
|
|
104
|
+
};
|
|
105
|
+
const isAnswerValid = (ans, { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds }) => {
|
|
106
|
+
try {
|
|
107
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
108
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
109
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
110
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
111
|
+
const module = multiply(z1Module, z2Module).simplify();
|
|
112
|
+
const angle = add(z1Arg, z2Arg).simplify();
|
|
113
|
+
const parsed = parseAlgebraic(ans);
|
|
114
|
+
const expForm = multiply(module, exp(multiply("i", angle))).simplify();
|
|
115
|
+
const divided = frac(expForm, parsed).simplify();
|
|
116
|
+
return (parsed.simplify().toTex() === expForm.toTex() ||
|
|
117
|
+
frac(logn(divided), multiply(PiNode, "i")).simplify().evaluate() % 2 === 0);
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
return handleVEAError(err);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const getComplexExpFormProductSimplifyQuestion = () => {
|
|
124
|
+
const z1Module = randint(2, 10);
|
|
125
|
+
const z2Module = randint(2, 10);
|
|
126
|
+
const z1Arg = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0));
|
|
127
|
+
const z2Arg = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0 &&
|
|
128
|
+
Math.abs(a.angle.evaluate()) !== Math.abs(z1Arg.angle.evaluate())));
|
|
129
|
+
const identifiers = {
|
|
130
|
+
z1ArgIds: z1Arg.angle.toIdentifiers(),
|
|
131
|
+
z1ModuleIds: z1Module.toTree().toIdentifiers(),
|
|
132
|
+
z2ArgIds: z2Arg.angle.toIdentifiers(),
|
|
133
|
+
z2ModuleIds: z2Module.toTree().toIdentifiers(),
|
|
134
|
+
};
|
|
135
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
136
|
+
};
|
|
137
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
138
|
+
return {
|
|
139
|
+
answer: getAnswer(identifiers),
|
|
140
|
+
instruction: getInstruction(identifiers),
|
|
141
|
+
keys: getKeys(identifiers),
|
|
142
|
+
answerFormat: "tex",
|
|
143
|
+
identifiers,
|
|
144
|
+
hint: getHint(identifiers),
|
|
145
|
+
correction: getCorrection(identifiers),
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
export const complexExpFormProductSimplify = {
|
|
149
|
+
id: "complexExpFormProductSimplify",
|
|
150
|
+
connector: "=",
|
|
151
|
+
label: "Simplifier un produit de formes exponentielles de nombres complexes",
|
|
152
|
+
isSingleStep: true,
|
|
153
|
+
generator: (nb, opts) => getDistinctQuestions(() => getComplexExpFormProductSimplifyQuestion(opts), nb),
|
|
154
|
+
qcmTimer: 60,
|
|
155
|
+
freeTimer: 60,
|
|
156
|
+
getPropositions,
|
|
157
|
+
isAnswerValid,
|
|
158
|
+
subject: "Mathématiques",
|
|
159
|
+
getInstruction,
|
|
160
|
+
getHint,
|
|
161
|
+
getCorrection,
|
|
162
|
+
getAnswer,
|
|
163
|
+
getQuestionFromIdentifiers,
|
|
164
|
+
hasHintAndCorrection: true,
|
|
165
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
z1ModuleIds: NodeIdentifiers;
|
|
5
|
+
z1ArgIds: NodeIdentifiers;
|
|
6
|
+
z2ModuleIds: NodeIdentifiers;
|
|
7
|
+
z2ArgIds: NodeIdentifiers;
|
|
8
|
+
};
|
|
9
|
+
export declare const complexExpFormQuotientSimplify: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=complexExpFormQuotientSimplify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexExpFormQuotientSimplify.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/complex/exp/complexExpFormQuotientSimplify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAU7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,eAAe,CAAC;IAC7B,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,eAAe,CAAC;IAC7B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAiLF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAqBhE,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { mainTrigoValues } from "../../../../math/trigonometry/remarkableValues.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
6
|
+
import { exp } from "../../../../tree/nodes/functions/expNode.js";
|
|
7
|
+
import { logn } from "../../../../tree/nodes/functions/logNode.js";
|
|
8
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
9
|
+
import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
|
|
10
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
13
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
14
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
15
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
16
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
17
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
18
|
+
const propositions = [];
|
|
19
|
+
addValidProp(propositions, answer);
|
|
20
|
+
const { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds } = identifiers;
|
|
21
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
22
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
23
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
24
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
25
|
+
const module = frac(z1Module, z2Module).simplify();
|
|
26
|
+
const arg = substract(z1Arg, z2Arg).simplify();
|
|
27
|
+
propWhile(propositions, n, () => {
|
|
28
|
+
const z1ModuleFake = randint(2, 10);
|
|
29
|
+
const z2ModuleFake = randint(2, 10, [z1ModuleFake]);
|
|
30
|
+
const z1ArgFake = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0));
|
|
31
|
+
const z2ArgFake = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0 &&
|
|
32
|
+
Math.abs(a.angle.evaluate()) !== Math.abs(z1ArgFake.angle.evaluate())));
|
|
33
|
+
const moduleFake = frac(z1ModuleFake, z2ModuleFake).simplify();
|
|
34
|
+
const argFake = substract(z1ArgFake.angle, z2ArgFake.angle).simplify();
|
|
35
|
+
if (module.toTex() === moduleFake.toTex() &&
|
|
36
|
+
frac(substract(argFake, arg), PiNode).simplify().evaluate() % 2 === 0)
|
|
37
|
+
return;
|
|
38
|
+
tryToAddWrongProp(propositions, `${moduleFake.toTex()}${getExpTex(argFake)}`);
|
|
39
|
+
});
|
|
40
|
+
return shuffleProps(propositions, n);
|
|
41
|
+
};
|
|
42
|
+
const getExpTex = (theta) => {
|
|
43
|
+
const rawTheta = abs(theta).simplify();
|
|
44
|
+
return `e^{${theta.evaluate() < 0 ? "-" : ""}${multiply("i", rawTheta).toTex({
|
|
45
|
+
forceNoTimesSign: true,
|
|
46
|
+
})}}`;
|
|
47
|
+
};
|
|
48
|
+
const getAnswer = (identifiers) => {
|
|
49
|
+
const { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds } = identifiers;
|
|
50
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
51
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
52
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
53
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
54
|
+
const module = frac(z1Module, z2Module).simplify();
|
|
55
|
+
const arg = substract(z1Arg, z2Arg).simplify();
|
|
56
|
+
return `${module.toTex()}${getExpTex(arg)}`;
|
|
57
|
+
};
|
|
58
|
+
const getInstruction = (identifiers) => {
|
|
59
|
+
const { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds } = identifiers;
|
|
60
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
61
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
62
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
63
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
64
|
+
return `Écrire sous forme exponentielle :
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
\\frac{${z1Module.toTex()}${getExpTex(z1Arg)}}{${z2Module.toTex()}${getExpTex(z2Arg)}}
|
|
68
|
+
$$`;
|
|
69
|
+
};
|
|
70
|
+
const getHint = () => {
|
|
71
|
+
return `Pour tous nombres réels $\\theta$ et $\\theta'$, on a :
|
|
72
|
+
|
|
73
|
+
$$
|
|
74
|
+
\\frac{e^{i\\theta}}{e^{i\\theta'}} = e^{i\\left(\\theta-\\theta'\\right)}
|
|
75
|
+
$$`;
|
|
76
|
+
};
|
|
77
|
+
const getCorrection = (identifiers) => {
|
|
78
|
+
const { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds } = identifiers;
|
|
79
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
80
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
81
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
82
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
83
|
+
const module = frac(z1Module, z2Module).simplify();
|
|
84
|
+
return `On utilise la relation fonctionnelle : pour tous nombres réels $\\theta$ et $\\theta'$, on a
|
|
85
|
+
|
|
86
|
+
$$
|
|
87
|
+
\\frac{e^{i\\theta}}{e^{i\\theta'}} = e^{i\\left(\\theta-\\theta'\\right)}
|
|
88
|
+
$$
|
|
89
|
+
|
|
90
|
+
Ici, on a donc :
|
|
91
|
+
|
|
92
|
+
${alignTex([
|
|
93
|
+
[
|
|
94
|
+
"",
|
|
95
|
+
`\\frac{${z1Module.toTex()}${getExpTex(z1Arg)}}{${z2Module.toTex()}${getExpTex(z2Arg)}}`,
|
|
96
|
+
],
|
|
97
|
+
["=", multiply(module, exp(multiply("i", substract(z1Arg, z2Arg)))).toTex()],
|
|
98
|
+
["=", getAnswer(identifiers)],
|
|
99
|
+
])}`;
|
|
100
|
+
};
|
|
101
|
+
const getKeys = () => {
|
|
102
|
+
return ["epower", "i", "pi"];
|
|
103
|
+
};
|
|
104
|
+
const isAnswerValid = (ans, { z1ArgIds, z1ModuleIds, z2ArgIds, z2ModuleIds }) => {
|
|
105
|
+
try {
|
|
106
|
+
const z1Arg = reifyAlgebraic(z1ArgIds);
|
|
107
|
+
const z1Module = reifyAlgebraic(z1ModuleIds);
|
|
108
|
+
const z2Arg = reifyAlgebraic(z2ArgIds);
|
|
109
|
+
const z2Module = reifyAlgebraic(z2ModuleIds);
|
|
110
|
+
const module = frac(z1Module, z2Module).simplify();
|
|
111
|
+
const angle = substract(z1Arg, z2Arg).simplify();
|
|
112
|
+
const parsed = parseAlgebraic(ans);
|
|
113
|
+
const expForm = multiply(module, exp(multiply("i", angle))).simplify();
|
|
114
|
+
const divided = frac(expForm, parsed).simplify();
|
|
115
|
+
return (parsed.simplify().toTex() === expForm.toTex() ||
|
|
116
|
+
frac(logn(divided), multiply(PiNode, "i")).simplify().evaluate() % 2 === 0);
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
return handleVEAError(err);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const getComplexExpFormQuotientSimplifyQuestion = () => {
|
|
123
|
+
const z1Module = randint(2, 10);
|
|
124
|
+
const z2Module = randint(2, 10, [z1Module]);
|
|
125
|
+
const z1Arg = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0));
|
|
126
|
+
const z2Arg = random(mainTrigoValues.filter((a) => a.angle.evaluate({}) !== 0 &&
|
|
127
|
+
Math.abs(a.angle.evaluate()) !== Math.abs(z1Arg.angle.evaluate())));
|
|
128
|
+
const identifiers = {
|
|
129
|
+
z1ArgIds: z1Arg.angle.toIdentifiers(),
|
|
130
|
+
z1ModuleIds: z1Module.toTree().toIdentifiers(),
|
|
131
|
+
z2ArgIds: z2Arg.angle.toIdentifiers(),
|
|
132
|
+
z2ModuleIds: z2Module.toTree().toIdentifiers(),
|
|
133
|
+
};
|
|
134
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
135
|
+
};
|
|
136
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
137
|
+
return {
|
|
138
|
+
answer: getAnswer(identifiers),
|
|
139
|
+
instruction: getInstruction(identifiers),
|
|
140
|
+
keys: getKeys(identifiers),
|
|
141
|
+
answerFormat: "tex",
|
|
142
|
+
identifiers,
|
|
143
|
+
hint: getHint(identifiers),
|
|
144
|
+
correction: getCorrection(identifiers),
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export const complexExpFormQuotientSimplify = {
|
|
148
|
+
id: "complexExpFormQuotientSimplify",
|
|
149
|
+
connector: "=",
|
|
150
|
+
label: "Simplifier un quotient de formes exponentielles de nombres complexes",
|
|
151
|
+
isSingleStep: true,
|
|
152
|
+
generator: (nb, opts) => getDistinctQuestions(() => getComplexExpFormQuotientSimplifyQuestion(opts), nb),
|
|
153
|
+
qcmTimer: 60,
|
|
154
|
+
freeTimer: 60,
|
|
155
|
+
getPropositions,
|
|
156
|
+
isAnswerValid,
|
|
157
|
+
subject: "Mathématiques",
|
|
158
|
+
getInstruction,
|
|
159
|
+
getHint,
|
|
160
|
+
getCorrection,
|
|
161
|
+
getAnswer,
|
|
162
|
+
getQuestionFromIdentifiers,
|
|
163
|
+
hasHintAndCorrection: true,
|
|
164
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
reIds: NodeIdentifiers;
|
|
5
|
+
imIds: NodeIdentifiers;
|
|
6
|
+
};
|
|
7
|
+
export declare const complexExpFromAlgebraicForm: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=complexExpFromAlgebraicForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexExpFromAlgebraicForm.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/complex/exp/complexExpFromAlgebraicForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAcrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AA2KF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAsB7D,CAAC"}
|