math-exercises 2.0.0 → 2.0.1

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.
Files changed (29) hide show
  1. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.d.ts +1 -1
  2. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
  3. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.js +17 -17
  4. package/lib/exercises/combinatory/diceCounting.d.ts.map +1 -1
  5. package/lib/exercises/combinatory/diceCounting.js +4 -0
  6. package/lib/exercises/complex/argumentFromAlgebraicComplex.d.ts +10 -0
  7. package/lib/exercises/complex/argumentFromAlgebraicComplex.d.ts.map +1 -0
  8. package/lib/exercises/complex/argumentFromAlgebraicComplex.js +37 -0
  9. package/lib/exercises/complex/moduloFromAlgebraicComplex.d.ts +10 -0
  10. package/lib/exercises/complex/moduloFromAlgebraicComplex.d.ts.map +1 -0
  11. package/lib/exercises/complex/moduloFromAlgebraicComplex.js +43 -0
  12. package/lib/exercises/exercises.d.ts +1 -1
  13. package/lib/exercises/exercises.d.ts.map +1 -1
  14. package/lib/exercises/exercises.js +4 -0
  15. package/lib/exercises/functions/rationalFraction/rationalFractionForbiddenValue.d.ts +12 -0
  16. package/lib/exercises/functions/rationalFraction/rationalFractionForbiddenValue.d.ts.map +1 -0
  17. package/lib/exercises/functions/rationalFraction/rationalFractionForbiddenValue.js +56 -0
  18. package/lib/exercises/probaStat/stats2var/averagePoint.d.ts.map +1 -1
  19. package/lib/exercises/probaStat/stats2var/averagePoint.js +5 -4
  20. package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.d.ts.map +1 -1
  21. package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.js +1 -2
  22. package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.js +1 -2
  23. package/lib/math/complex/complex.d.ts +7 -2
  24. package/lib/math/complex/complex.d.ts.map +1 -1
  25. package/lib/math/complex/complex.js +41 -7
  26. package/lib/math/numbers/reals/real.d.ts +3 -3
  27. package/lib/math/numbers/reals/real.d.ts.map +1 -1
  28. package/lib/math/numbers/reals/real.js +8 -5
  29. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { MathExercise } from '../../../exercises/exercise';
1
+ import { MathExercise } from "../../../exercises/exercise";
2
2
  type QCMProps = {
3
3
  answer: string;
4
4
  sqrt: number;
@@ -1 +1 @@
1
- {"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAOb,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AA2EnB,eAAO,MAAM,oBAAoB,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAWjE,CAAC"}
1
+ {"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAOb,MAAM,0BAA0B,CAAC;AAelC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AA8EnB,eAAO,MAAM,oBAAoB,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAWjE,CAAC"}
@@ -28,19 +28,19 @@ const getEquationSimpleSquare = () => {
28
28
  const instruction = `Résoudre l'équation : $x^2 = ${randNbr}$`;
29
29
  const sqrt = Math.sqrt(randNbr);
30
30
  if (randNbr < 0)
31
- answer = `S=\\varnothing`;
31
+ answer = `S=\\emptyset`;
32
32
  else if (sqrt === Math.floor(sqrt))
33
33
  answer = `S=\\left\\{-${sqrt};${sqrt}\\right\\}`;
34
34
  else {
35
35
  const factor = higherFactor(randNbr);
36
36
  const radicand = randNbr / factor ** 2;
37
- answer = `S=\\left\\{-${factor === 1 ? '' : factor}\\sqrt{${radicand}};${factor === 1 ? '' : factor}\\sqrt{${radicand}}\\right\\}`;
37
+ answer = `S=\\left\\{-${factor === 1 ? "" : factor}\\sqrt{${radicand}};${factor === 1 ? "" : factor}\\sqrt{${radicand}}\\right\\}`;
38
38
  }
39
39
  const question = {
40
40
  instruction,
41
41
  answer,
42
- keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
43
- answerFormat: 'tex',
42
+ keys: ["x", "S", "equal", "lbrace", "rbrace", "semicolon", "emptyset"],
43
+ answerFormat: "tex",
44
44
  qcmGeneratorProps: { answer, sqrt, randNbr },
45
45
  };
46
46
  return question;
@@ -58,34 +58,34 @@ const getPropositions = (n, { answer, sqrt, randNbr }) => {
58
58
  else if (randNbr >= 0 && sqrt !== Math.floor(sqrt)) {
59
59
  const factor = higherFactor(randNbr);
60
60
  const radicand = randNbr / factor ** 2;
61
- (0, exercise_1.tryToAddWrongProp)(propositions, `${factor}\\sqrt{${radicand}}`);
62
- (0, exercise_1.tryToAddWrongProp)(propositions, `${radicand}\\sqrt{${factor}}`);
63
- (0, exercise_1.tryToAddWrongProp)(propositions, `${Math.floor(sqrt)}`);
61
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=\\left\\{${factor}\\sqrt{${radicand}}\\right\\}`);
62
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=\\left\\{${radicand}\\sqrt{${factor}}\\right\\}`);
63
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=\\left\\{${Math.floor(sqrt)}\\right\\}`);
64
64
  while (propositions.length < n) {
65
65
  const tempFactor = factor + (0, randint_1.randint)(-factor + 1, 7, [0]);
66
66
  const tempRadicand = radicand + (0, randint_1.randint)(-radicand + 1, 7, [0]);
67
67
  (0, exercise_1.tryToAddWrongProp)(propositions, (0, coinFlip_1.coinFlip)()
68
- ? `\\{${tempFactor}\\sqrt{${tempRadicand}}\\ ; -${tempFactor}\\sqrt{${tempRadicand}} \\}`
69
- : `\\emptyset`);
68
+ ? `S=\\left\\{${tempFactor}\\sqrt{${tempRadicand}}\\ ; -${tempFactor}\\sqrt{${tempRadicand}} \\right}`
69
+ : `S=\\emptyset`);
70
70
  }
71
71
  }
72
72
  else {
73
- (0, exercise_1.tryToAddWrongProp)(propositions, `-\\sqrt{${-randNbr}}`);
74
- (0, exercise_1.tryToAddWrongProp)(propositions, `${Math.floor(Math.sqrt(-randNbr))}`);
73
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=\\left\\{-\\sqrt{${-randNbr}}\\right\\}`);
74
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=\\left\\{${Math.floor(Math.sqrt(-randNbr))}\\right\\}`);
75
75
  while (propositions.length < n) {
76
76
  const factor = (0, randint_1.randint)(2, 5);
77
77
  const radicand = (0, randint_1.randint)(2, -randNbr);
78
- (0, exercise_1.tryToAddWrongProp)(propositions, `\\{${factor}\\sqrt{${radicand}}\\ ; -${factor}\\sqrt{${radicand}} \\}`);
78
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=\\left\\{${factor}\\sqrt{${radicand}};-${factor}\\sqrt{${radicand}}\\right\\}`);
79
79
  }
80
80
  }
81
81
  return (0, shuffle_1.shuffle)(propositions);
82
82
  };
83
83
  exports.equationSimpleSquare = {
84
- id: 'equationSimpleSquare',
85
- connector: '=',
86
- label: 'Résoudre une équation du second degré du type $x^2 = a$',
87
- levels: ['2nde', '1reESM', '1reSpé', '1reTech'],
88
- sections: ['Équations'],
84
+ id: "equationSimpleSquare",
85
+ connector: "=",
86
+ label: "Résoudre une équation du second degré du type $x^2 = a$",
87
+ levels: ["2nde", "1reESM", "1reSpé", "1reTech"],
88
+ sections: ["Équations"],
89
89
  isSingleStep: false,
90
90
  generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getEquationSimpleSquare, nb),
91
91
  qcmTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"diceCounting.d.ts","sourceRoot":"","sources":["../../../src/exercises/combinatory/diceCounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAOb,MAAM,0BAA0B,CAAC;AAKlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AAuGnB,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAWzD,CAAC"}
1
+ {"version":3,"file":"diceCounting.d.ts","sourceRoot":"","sources":["../../../src/exercises/combinatory/diceCounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAOb,MAAM,0BAA0B,CAAC;AAKlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AA2GnB,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAWzD,CAAC"}
@@ -46,6 +46,10 @@ const getDiceCountingQuestion = () => {
46
46
  instruction = `dans lesquels toutes les faces sont différentes`;
47
47
  answer = 6 * 5 * 4 + '';
48
48
  break;
49
+ case 7:
50
+ instruction = '';
51
+ answer = 6 * 6 * 6 + '';
52
+ break;
49
53
  }
50
54
  const question = {
51
55
  answer: answer,
@@ -0,0 +1,10 @@
1
+ import { MathExercise } from "../../exercises/exercise";
2
+ type QCMProps = {
3
+ answer: string;
4
+ re: number;
5
+ im: number;
6
+ };
7
+ type VEAProps = {};
8
+ export declare const argumentFromAlgebraicComplex: MathExercise<QCMProps, VEAProps>;
9
+ export {};
10
+ //# sourceMappingURL=argumentFromAlgebraicComplex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"argumentFromAlgebraicComplex.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/argumentFromAlgebraicComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAIlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AAuBnB,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAWzE,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.argumentFromAlgebraicComplex = void 0;
4
+ const exercise_1 = require("../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const complex_1 = require("../../math/complex/complex");
7
+ const getArgumentFromAlgebraicComplexQuestion = () => {
8
+ const z = complex_1.ComplexConstructor.random();
9
+ const zTex = z.toTree().toTex();
10
+ const answer = z.toModuleTree().toTex();
11
+ const question = {
12
+ answer: answer,
13
+ instruction: `Soit $z=${zTex}$. Déterminer le module $|z|$ de $z$.`,
14
+ keys: [],
15
+ answerFormat: "tex",
16
+ qcmGeneratorProps: { answer, re: z.re, im: z.im },
17
+ };
18
+ return question;
19
+ };
20
+ const getPropositions = (n, { answer }) => {
21
+ const propositions = [];
22
+ (0, exercise_1.addValidProp)(propositions, answer);
23
+ while (propositions.length < n) { }
24
+ return (0, exercise_1.shuffleProps)(propositions, n);
25
+ };
26
+ exports.argumentFromAlgebraicComplex = {
27
+ id: "argumentFromAlgebraicComplex",
28
+ connector: "=",
29
+ label: "Déterminer l'argument d'un nombre complexe via sa forme algébrique",
30
+ levels: ["MathExp"],
31
+ isSingleStep: true,
32
+ sections: ["Nombres complexes"],
33
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getArgumentFromAlgebraicComplexQuestion, nb),
34
+ qcmTimer: 60,
35
+ freeTimer: 60,
36
+ getPropositions,
37
+ };
@@ -0,0 +1,10 @@
1
+ import { MathExercise } from "../../exercises/exercise";
2
+ type QCMProps = {
3
+ answer: string;
4
+ re: number;
5
+ im: number;
6
+ };
7
+ type VEAProps = {};
8
+ export declare const moduloFromAlgebraicComplex: MathExercise<QCMProps, VEAProps>;
9
+ export {};
10
+ //# sourceMappingURL=moduloFromAlgebraicComplex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moduloFromAlgebraicComplex.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/moduloFromAlgebraicComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAQlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AA4BnB,eAAO,MAAM,0BAA0B,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAWvE,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.moduloFromAlgebraicComplex = void 0;
4
+ const exercise_1 = require("../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const complex_1 = require("../../math/complex/complex");
7
+ const real_1 = require("../../math/numbers/reals/real");
8
+ const randint_1 = require("../../math/utils/random/randint");
9
+ const getModuloFromAlgebraicComplexQuestion = () => {
10
+ const z = complex_1.ComplexConstructor.random();
11
+ const zTex = z.toTree().toTex();
12
+ const answer = z.toModuleTree().toTex();
13
+ const question = {
14
+ answer: answer,
15
+ instruction: `Soit $z=${zTex}$. Déterminer le module $|z|$ de $z$.`,
16
+ keys: [],
17
+ answerFormat: "tex",
18
+ qcmGeneratorProps: { answer, re: z.re, im: z.im },
19
+ };
20
+ return question;
21
+ };
22
+ const getPropositions = (n, { answer, re, im }) => {
23
+ const propositions = [];
24
+ (0, exercise_1.addValidProp)(propositions, answer);
25
+ (0, exercise_1.tryToAddWrongProp)(propositions, new real_1.SquareRoot(re + im).simplify().toTree().toTex());
26
+ (0, exercise_1.tryToAddWrongProp)(propositions, re ** 2 + im ** 2 + "");
27
+ while (propositions.length < n) {
28
+ (0, exercise_1.tryToAddWrongProp)(propositions, `\\sqrt{${(0, randint_1.randint)(0, 100)}}`);
29
+ }
30
+ return (0, exercise_1.shuffleProps)(propositions, n);
31
+ };
32
+ exports.moduloFromAlgebraicComplex = {
33
+ id: "moduloFromAlgebraicComplex",
34
+ connector: "=",
35
+ label: "Déterminer le module d'un nombre complexe via sa forme algébrique",
36
+ levels: ["MathExp"],
37
+ isSingleStep: true,
38
+ sections: ["Nombres complexes"],
39
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getModuloFromAlgebraicComplexQuestion, nb),
40
+ qcmTimer: 60,
41
+ freeTimer: 60,
42
+ getPropositions,
43
+ };
@@ -1,3 +1,3 @@
1
- import { MathExercise } from './exercise';
1
+ import { MathExercise } from "./exercise";
2
2
  export declare const exercises: MathExercise<any, any>[];
3
3
  //# sourceMappingURL=exercises.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"AAkLA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA8B1C,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EAkS7C,CAAC"}
1
+ {"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"AAkLA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAgC1C,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EAoS7C,CAAC"}
@@ -198,6 +198,8 @@ const productDerivative_1 = require("./derivation/derivative/productDerivative")
198
198
  const quotientDerivative_1 = require("./derivation/derivative/quotientDerivative");
199
199
  const derivativeNumberCalcul_1 = require("./derivation/derivativeNumberCalcul");
200
200
  const averagePoint_1 = require("./probaStat/stats2var/averagePoint");
201
+ const rationalFractionForbiddenValue_1 = require("./functions/rationalFraction/rationalFractionForbiddenValue");
202
+ const moduloFromAlgebraicComplex_1 = require("./complex/moduloFromAlgebraicComplex");
201
203
  exports.exercises = [
202
204
  /**
203
205
  * calcul litteral
@@ -346,6 +348,7 @@ exports.exercises = [
346
348
  inverseImageFunction_1.inverseImageFunction,
347
349
  imageFunctionGeogebra_1.imageFunctionGeogebra,
348
350
  inverseImageFunctionGeogebra_1.inverseImageFunctionGeogebra,
351
+ rationalFractionForbiddenValue_1.rationalFractionForbiddenValue,
349
352
  /**
350
353
  * derivation
351
354
  */
@@ -444,6 +447,7 @@ exports.exercises = [
444
447
  inverseComplex_1.inverseComplex,
445
448
  divideComplex_1.divideComplex,
446
449
  conjugateDivideComplex_1.conjugateDivideComplex,
450
+ moduloFromAlgebraicComplex_1.moduloFromAlgebraicComplex,
447
451
  /**sets */
448
452
  inequalityToInterval_1.inequalityToInterval,
449
453
  setBelonging_1.setBelonging,
@@ -0,0 +1,12 @@
1
+ import { MathExercise } from "../../../exercises/exercise";
2
+ type QCMProps = {
3
+ answer: string;
4
+ a: number;
5
+ b: number;
6
+ c: number;
7
+ d: number;
8
+ };
9
+ type VEAProps = {};
10
+ export declare const rationalFractionForbiddenValue: MathExercise<QCMProps, VEAProps>;
11
+ export {};
12
+ //# sourceMappingURL=rationalFractionForbiddenValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rationalFractionForbiddenValue.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/rationalFraction/rationalFractionForbiddenValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AASlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AAuCnB,eAAO,MAAM,8BAA8B,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAW3E,CAAC"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rationalFractionForbiddenValue = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const rational_1 = require("../../../math/numbers/rationals/rational");
7
+ const affine_1 = require("../../../math/polynomials/affine");
8
+ const randint_1 = require("../../../math/utils/random/randint");
9
+ const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
10
+ const shuffle_1 = require("../../../utils/shuffle");
11
+ const getRationalFractionForbiddenValueQuestion = () => {
12
+ const a = (0, randint_1.randint)(-10, 11, [0]);
13
+ const b = (0, randint_1.randint)(-10, 11);
14
+ //pour éviter affine2 = k*affine1
15
+ let c, d;
16
+ do {
17
+ c = (0, randint_1.randint)(-10, 11, [0]);
18
+ d = (0, randint_1.randint)(-10, 11);
19
+ } while (a * d - b * c === 0);
20
+ const affine1 = new affine_1.Affine(a, b);
21
+ const affine2 = new affine_1.Affine(c, d);
22
+ const fct = new fractionNode_1.FractionNode(affine1.toTree(), affine2.toTree());
23
+ const fctTex = fct.toTex();
24
+ const answerTree = new rational_1.Rational(-d, c).simplify().toTree();
25
+ const answer = answerTree.toTex();
26
+ const question = {
27
+ answer,
28
+ instruction: `Soit $f(x)=${fctTex}$. Quelle est la valeur interdite de la fonction $f$ ?`,
29
+ keys: [],
30
+ answerFormat: "tex",
31
+ qcmGeneratorProps: { answer, a, b, c, d },
32
+ };
33
+ return question;
34
+ };
35
+ const getPropositions = (n, { answer, a, b, c, d }) => {
36
+ const propositions = [];
37
+ (0, exercise_1.addValidProp)(propositions, answer);
38
+ (0, exercise_1.tryToAddWrongProp)(propositions, new rational_1.Rational(-b, a).simplify().toTree().toTex());
39
+ (0, exercise_1.tryToAddWrongProp)(propositions, d + "");
40
+ while (propositions.length < n) {
41
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-10, 11) + "");
42
+ }
43
+ return (0, shuffle_1.shuffle)(propositions);
44
+ };
45
+ exports.rationalFractionForbiddenValue = {
46
+ id: "rationalFractionForbiddenValue",
47
+ connector: "=",
48
+ label: "Déterminer la valeur interdite d'un quotient de polynôme",
49
+ levels: ["2nde", "1reESM", "1reSpé"],
50
+ isSingleStep: true,
51
+ sections: ["Fonctions", "Fractions", "Fonctions affines"],
52
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getRationalFractionForbiddenValueQuestion, nb),
53
+ qcmTimer: 60,
54
+ freeTimer: 60,
55
+ getPropositions,
56
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"averagePoint.d.ts","sourceRoot":"","sources":["../../../../src/exercises/probaStat/stats2var/averagePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAOb,MAAM,0BAA0B,CAAC;AAQlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AAwCnB,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAWzD,CAAC"}
1
+ {"version":3,"file":"averagePoint.d.ts","sourceRoot":"","sources":["../../../../src/exercises/probaStat/stats2var/averagePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAOb,MAAM,0BAA0B,CAAC;AAQlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AAyCnB,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAWzD,CAAC"}
@@ -9,18 +9,19 @@ const randint_1 = require("../../../math/utils/random/randint");
9
9
  const average_1 = require("../../../utils/average");
10
10
  const getAveragePointQuestion = () => {
11
11
  const points = (0, randTupleInt_1.distinctRandTupleInt)(4, 2, { from: -9, to: 10 });
12
+ const sortedPoints = points.sort((a, b) => a[0] - b[0]);
12
13
  const tab = `
13
14
  | | | | | |
14
15
  |-|-|-|-|-|
15
- |x|${points[0][0]}|${points[1][0]}|${points[2][0]}|${points[3][0]}|
16
- |y|${points[0][1]}|${points[1][1]}|${points[2][1]}|${points[3][1]}|
16
+ |x|${sortedPoints[0][0]}|${sortedPoints[1][0]}|${sortedPoints[2][0]}|${sortedPoints[3][0]}|
17
+ |y|${sortedPoints[0][1]}|${sortedPoints[1][1]}|${sortedPoints[2][1]}|${sortedPoints[3][1]}|
17
18
  `;
18
19
  const instruction = `On considère la liste de points suivante : ${tab}
19
20
 
20
21
  Déterminer les coordonnées du point moyen $G$.
21
22
  `;
22
- const xG = (0, frenchify_1.frenchify)((0, average_1.average)(points.map((el) => el[0])) + '');
23
- const yG = (0, frenchify_1.frenchify)((0, average_1.average)(points.map((el) => el[1])) + '');
23
+ const xG = (0, frenchify_1.frenchify)((0, average_1.average)(sortedPoints.map((el) => el[0])) + '');
24
+ const yG = (0, frenchify_1.frenchify)((0, average_1.average)(sortedPoints.map((el) => el[1])) + '');
24
25
  const answer = `\\left(${xG};${yG}\\right)`;
25
26
  const question = {
26
27
  answer,
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAOb,MAAM,0BAA0B,CAAC;AAMlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AAmCnB,eAAO,MAAM,6BAA6B,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAW1E,CAAC"}
1
+ {"version":3,"file":"arithmeticFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAOb,MAAM,0BAA0B,CAAC;AAMlC,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,KAAK,QAAQ,GAAG,EAAE,CAAC;AAkCnB,eAAO,MAAM,6BAA6B,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAW1E,CAAC"}
@@ -14,9 +14,8 @@ const getArithmeticFindExplicitFormula = () => {
14
14
  const answer = formula.toString();
15
15
  const question = {
16
16
  instruction: `$(u_n)$ est une suite arithmétique de premier terme $u_{${firstRank}} = ${firstValue}$ et de raison $r = ${reason}$. $\\\\$ Donner l'expression de $u_n$ en fonction de $n$.`,
17
- startStatement: 'u_n',
18
17
  answer,
19
- keys: ['r', 'n', 'u', 'underscore'],
18
+ keys: ['un', 'equal', 'r', 'n', 'u', 'underscore'],
20
19
  answerFormat: 'tex',
21
20
  qcmGeneratorProps: { answer, firstValue, reason },
22
21
  };
@@ -18,9 +18,8 @@ const getGeometricFindExplicitFormula = () => {
18
18
  const answer = (0, simplify_1.simplifyNode)(formula).toTex();
19
19
  const question = {
20
20
  instruction: `$(u_n)$ est une suite géométrique de premier terme $u_{${firstRank}} = ${firstValue}$ et de raison $q = ${reason}$. $\\\\$ Donner l'expression de $u_n$ en fonction de $n$.`,
21
- startStatement: 'u_n',
22
21
  answer,
23
- keys: ['q', 'n', 'u', 'underscore'],
22
+ keys: ['un', 'equal', 'q', 'n', 'u', 'underscore'],
24
23
  answerFormat: 'tex',
25
24
  qcmGeneratorProps: { answer, reason, firstValue },
26
25
  };
@@ -1,5 +1,8 @@
1
- import { ComplexNode } from '../../tree/nodes/complex/complexNode';
2
- import { AddNode } from '../../tree/nodes/operators/addNode';
1
+ import { ComplexNode } from "../../tree/nodes/complex/complexNode";
2
+ import { OppositeNode } from "../../tree/nodes/functions/oppositeNode";
3
+ import { NumberNode } from "../../tree/nodes/numbers/numberNode";
4
+ import { AddNode } from "../../tree/nodes/operators/addNode";
5
+ import { FractionNode } from "../../tree/nodes/operators/fractionNode";
3
6
  export declare abstract class ComplexConstructor {
4
7
  static random(): Complex;
5
8
  static randomNotReal(): Complex;
@@ -14,6 +17,8 @@ export declare class Complex {
14
17
  multiply(z: Complex): Complex;
15
18
  opposite(): Complex;
16
19
  conjugate(): Complex;
20
+ toArgumentTree(): NumberNode | FractionNode | OppositeNode | import("../../tree/nodes/numbers/constantNode").ConstantNode | undefined;
21
+ toModuleTree(): import("../../tree/nodes/node").Node;
17
22
  toTree(): ComplexNode;
18
23
  }
19
24
  //# sourceMappingURL=complex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"complex.d.ts","sourceRoot":"","sources":["../../../src/math/complex/complex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAO7D,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;IAQb,MAAM,CAAC,aAAa;CAQrB;AACD,qBAAa,OAAO;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;gBACC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAIlC,aAAa;IAIb,WAAW;IAQX,UAAU,CAAC,CAAC,EAAE,OAAO;IAYrB,QAAQ,CAAC,CAAC,EAAE,OAAO;IAGnB,QAAQ;IAGR,SAAS;IAGT,MAAM;CAGP"}
1
+ {"version":3,"file":"complex.d.ts","sourceRoot":"","sources":["../../../src/math/complex/complex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAQvE,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;IAQb,MAAM,CAAC,aAAa;CAQrB;AACD,qBAAa,OAAO;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;gBACC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAIlC,aAAa;IAIb,WAAW;IAQX,UAAU,CAAC,CAAC,EAAE,OAAO;IAYrB,QAAQ,CAAC,CAAC,EAAE,OAAO;IAGnB,QAAQ;IAGR,SAAS;IAGT,cAAc;IAsBd,YAAY;IAGZ,MAAM;CAGP"}
@@ -2,10 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Complex = exports.ComplexConstructor = void 0;
4
4
  const complexNode_1 = require("../../tree/nodes/complex/complexNode");
5
+ const oppositeNode_1 = require("../../tree/nodes/functions/oppositeNode");
6
+ const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
7
+ const piNode_1 = require("../../tree/nodes/numbers/piNode");
5
8
  const addNode_1 = require("../../tree/nodes/operators/addNode");
9
+ const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
6
10
  const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
7
11
  const variableNode_1 = require("../../tree/nodes/variables/variableNode");
8
12
  const rational_1 = require("../numbers/rationals/rational");
13
+ const real_1 = require("../numbers/reals/real");
9
14
  const randint_1 = require("../utils/random/randint");
10
15
  class ComplexConstructor {
11
16
  static random() {
@@ -39,22 +44,22 @@ class Complex {
39
44
  const conj = this.conjugate();
40
45
  const invRe = new rational_1.Rational(conj.re, moduleSq).simplify().toTree();
41
46
  const invIm = new rational_1.Rational(conj.im, moduleSq).simplify().toTree();
42
- return new addNode_1.AddNode(invRe, new multiplyNode_1.MultiplyNode(invIm, new variableNode_1.VariableNode('i')));
47
+ return new addNode_1.AddNode(invRe, new multiplyNode_1.MultiplyNode(invIm, new variableNode_1.VariableNode("i")));
43
48
  }
44
49
  divideNode(z) {
45
50
  const moduleSq = z.moduleSquared();
46
51
  const newRe = new rational_1.Rational(this.re * z.re + this.im * z.im, moduleSq).simplify().toTree();
47
52
  const newIm = new rational_1.Rational(this.im * z.re - z.im * this.re, moduleSq).simplify().toTree();
48
53
  let imNode;
49
- if (newIm.toTex() === '0')
54
+ if (newIm.toTex() === "0")
50
55
  return newRe;
51
- if (newIm.toTex() === '1')
52
- imNode = new variableNode_1.VariableNode('i');
56
+ if (newIm.toTex() === "1")
57
+ imNode = new variableNode_1.VariableNode("i");
53
58
  else
54
- imNode = new multiplyNode_1.MultiplyNode(newIm, new variableNode_1.VariableNode('i'));
55
- if (newRe.toTex() === '0')
59
+ imNode = new multiplyNode_1.MultiplyNode(newIm, new variableNode_1.VariableNode("i"));
60
+ if (newRe.toTex() === "0")
56
61
  return imNode;
57
- return new addNode_1.AddNode(newRe, new multiplyNode_1.MultiplyNode(newIm, new variableNode_1.VariableNode('i')));
62
+ return new addNode_1.AddNode(newRe, new multiplyNode_1.MultiplyNode(newIm, new variableNode_1.VariableNode("i")));
58
63
  }
59
64
  multiply(z) {
60
65
  return new Complex(this.re * z.re - this.im * z.im, this.re * z.im + this.im * z.re);
@@ -65,6 +70,35 @@ class Complex {
65
70
  conjugate() {
66
71
  return new Complex(this.re, -this.im);
67
72
  }
73
+ toArgumentTree() {
74
+ if (this.re === 0 && this.im === 0)
75
+ throw Error("0 n'a pas d'argument");
76
+ if (this.re === 0) {
77
+ const piOver2 = new fractionNode_1.FractionNode(piNode_1.PiNode, new numberNode_1.NumberNode(2));
78
+ if (this.im > 0)
79
+ return piOver2;
80
+ else
81
+ return new oppositeNode_1.OppositeNode(piOver2);
82
+ }
83
+ if (this.im === 0) {
84
+ if (this.re > 0)
85
+ return new numberNode_1.NumberNode(0);
86
+ else
87
+ return piNode_1.PiNode;
88
+ }
89
+ if (this.re > 0) {
90
+ //arctan(b/a)
91
+ }
92
+ if (this.im > 0) {
93
+ //arctan(b/a)+pi
94
+ }
95
+ if (this.im < 0) {
96
+ //arctan(b/a)-pi
97
+ }
98
+ }
99
+ toModuleTree() {
100
+ return new real_1.SquareRoot(this.re ** 2 + this.im ** 2).simplify().toTree();
101
+ }
68
102
  toTree() {
69
103
  return new complexNode_1.ComplexNode(this.re, this.im);
70
104
  }
@@ -1,5 +1,5 @@
1
- import { Node } from '../../../tree/nodes/node';
2
- import { Nombre, NumberType } from '../nombre';
1
+ import { Node } from "../../../tree/nodes/node";
2
+ import { Nombre, NumberType } from "../nombre";
3
3
  export declare abstract class RealConstructor {
4
4
  static random(): Real;
5
5
  }
@@ -24,7 +24,7 @@ export declare class SquareRoot extends Real {
24
24
  operand: number;
25
25
  constructor(operand: number);
26
26
  getSimplifiedCoeffs(): [number, number];
27
- simplify(): Real;
27
+ simplify(): Nombre;
28
28
  toTex(): string;
29
29
  toTree(): Node;
30
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"real.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/reals/real.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAQ7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,8BAAsB,eAAe;IACnC,MAAM,CAAC,MAAM;CAUd;AACD,qBAAa,IAAK,YAAW,MAAM;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;gBACL,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAKtC,MAAM,IAAI,IAAI;CAIf;AAED,8BAAsB,qBAAqB;IACzC;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,EAAE,kBAA0B,EAAE,SAAc,EAAE;;;KAAA,GAAG,UAAU;IASrF,MAAM,CAAC,kBAAkB,CAAC,GAAG,GAAE,MAAW,GAAG,UAAU;CAIxD;AAED,qBAAa,UAAW,SAAQ,IAAI;IAClC,OAAO,EAAE,MAAM,CAAC;gBACJ,OAAO,EAAE,MAAM;IAK3B,mBAAmB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAevC,QAAQ,IAAI,IAAI;IAoBhB,KAAK,IAAI,MAAM;IAIf,MAAM,IAAI,IAAI;CAGf"}
1
+ {"version":3,"file":"real.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/reals/real.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAQ7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,8BAAsB,eAAe;IACnC,MAAM,CAAC,MAAM;CAUd;AACD,qBAAa,IAAK,YAAW,MAAM;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;gBACL,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAKtC,MAAM,IAAI,IAAI;CAIf;AAED,8BAAsB,qBAAqB;IACzC;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,EAAE,kBAA0B,EAAE,SAAc,EAAE;;;KAAA,GAAG,UAAU;IASrF,MAAM,CAAC,kBAAkB,CAAC,GAAG,GAAE,MAAW,GAAG,UAAU;CAIxD;AAED,qBAAa,UAAW,SAAQ,IAAI;IAClC,OAAO,EAAE,MAAM,CAAC;gBACJ,OAAO,EAAE,MAAM;IAK3B,mBAAmB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAevC,QAAQ,IAAI,MAAM;IAqBlB,KAAK,IAAI,MAAM;IAIf,MAAM,IAAI,IAAI;CAGf"}
@@ -10,6 +10,7 @@ const piNode_1 = require("../../../tree/nodes/numbers/piNode");
10
10
  const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
11
11
  const diceFlip_1 = require("../../../utils/diceFlip");
12
12
  const random_1 = require("../../../utils/random");
13
+ const integer_1 = require("../integer/integer");
13
14
  const primes_1 = require("../integer/primes");
14
15
  const nombre_1 = require("../nombre");
15
16
  class RealConstructor {
@@ -17,11 +18,11 @@ class RealConstructor {
17
18
  const dice = (0, diceFlip_1.diceFlip)(2);
18
19
  switch (dice) {
19
20
  case 0:
20
- return new Real(Math.PI, '\\pi');
21
+ return new Real(Math.PI, "\\pi");
21
22
  case 1:
22
23
  return SquareRootConstructor.randomIrreductible();
23
24
  }
24
- return new Real(Math.PI, '\\pi');
25
+ return new Real(Math.PI, "\\pi");
25
26
  }
26
27
  }
27
28
  exports.RealConstructor = RealConstructor;
@@ -32,7 +33,7 @@ class Real {
32
33
  this.type = nombre_1.NumberType.Real;
33
34
  }
34
35
  toTree() {
35
- if (this.tex === '\\pi')
36
+ if (this.tex === "\\pi")
36
37
  return piNode_1.PiNode;
37
38
  return new numberNode_1.NumberNode(this.value);
38
39
  }
@@ -78,10 +79,12 @@ class SquareRoot extends Real {
78
79
  return [outsideSqrt, insideSqrt];
79
80
  }
80
81
  simplify() {
82
+ if (this.operand === 0)
83
+ return new integer_1.Integer(0);
81
84
  const [outsideSqrt, insideSqrt] = this.getSimplifiedCoeffs();
82
85
  const simplified = insideSqrt !== 1
83
- ? new Real(outsideSqrt * Math.sqrt(insideSqrt), `${outsideSqrt === 1 ? '' : `${outsideSqrt}`}\\sqrt{${insideSqrt}}`)
84
- : new Real(outsideSqrt, outsideSqrt + '');
86
+ ? new Real(outsideSqrt * Math.sqrt(insideSqrt), `${outsideSqrt === 1 ? "" : `${outsideSqrt}`}\\sqrt{${insideSqrt}}`)
87
+ : new Real(outsideSqrt, outsideSqrt + "");
85
88
  simplified.toTree = () => {
86
89
  return insideSqrt !== 1
87
90
  ? outsideSqrt === 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [