math-exercises 1.3.46 → 1.3.50

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 (114) hide show
  1. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
  2. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.js +21 -21
  3. package/lib/exercises/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
  4. package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +13 -11
  5. package/lib/exercises/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
  6. package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +4 -7
  7. package/lib/exercises/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
  8. package/lib/exercises/calculLitteral/equation/firstDegreeEquation.js +10 -4
  9. package/lib/exercises/complex/addComplex.d.ts +4 -0
  10. package/lib/exercises/complex/addComplex.d.ts.map +1 -0
  11. package/lib/exercises/complex/addComplex.js +66 -0
  12. package/lib/exercises/complex/mutiplyComplex.d.ts +4 -0
  13. package/lib/exercises/complex/mutiplyComplex.d.ts.map +1 -0
  14. package/lib/exercises/complex/mutiplyComplex.js +65 -0
  15. package/lib/exercises/complex/reAndIm.d.ts +4 -0
  16. package/lib/exercises/complex/reAndIm.d.ts.map +1 -0
  17. package/lib/exercises/complex/reAndIm.js +79 -0
  18. package/lib/exercises/exercise.d.ts +3 -2
  19. package/lib/exercises/exercise.d.ts.map +1 -1
  20. package/lib/exercises/exercise.js +0 -5
  21. package/lib/exercises/exercises.d.ts.map +1 -1
  22. package/lib/exercises/exercises.js +20 -0
  23. package/lib/exercises/functions/affines/signFunction.js +1 -1
  24. package/lib/exercises/functions/affines/template.d.ts +4 -0
  25. package/lib/exercises/functions/affines/template.d.ts.map +1 -0
  26. package/lib/exercises/functions/affines/template.js +51 -0
  27. package/lib/exercises/functions/basics/inverseImageFunctionGeogebra.js +2 -2
  28. package/lib/exercises/functions/trinoms/alphaBetaFromDevForm.d.ts +4 -0
  29. package/lib/exercises/functions/trinoms/alphaBetaFromDevForm.d.ts.map +1 -0
  30. package/lib/exercises/functions/trinoms/alphaBetaFromDevForm.js +63 -0
  31. package/lib/exercises/functions/trinoms/alphaBetaInCanonicalForm.d.ts +4 -0
  32. package/lib/exercises/functions/trinoms/alphaBetaInCanonicalForm.d.ts.map +1 -0
  33. package/lib/exercises/functions/trinoms/alphaBetaInCanonicalForm.js +91 -0
  34. package/lib/exercises/functions/trinoms/canonicalFromDevForm.d.ts +4 -0
  35. package/lib/exercises/functions/trinoms/canonicalFromDevForm.d.ts.map +1 -0
  36. package/lib/exercises/functions/trinoms/canonicalFromDevForm.js +58 -0
  37. package/lib/exercises/functions/trinoms/extremumFromCanonicalForm.d.ts +4 -0
  38. package/lib/exercises/functions/trinoms/extremumFromCanonicalForm.d.ts.map +1 -0
  39. package/lib/exercises/functions/trinoms/extremumFromCanonicalForm.js +84 -0
  40. package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.d.ts +4 -0
  41. package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.d.ts.map +1 -0
  42. package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.js +59 -0
  43. package/lib/exercises/functions/trinoms/variationsFromAlgebricForm.d.ts +4 -0
  44. package/lib/exercises/functions/trinoms/variationsFromAlgebricForm.d.ts.map +1 -0
  45. package/lib/exercises/functions/trinoms/variationsFromAlgebricForm.js +59 -0
  46. package/lib/exercises/probaStat/medianList.js +1 -1
  47. package/lib/exercises/probaStat/probabilityTree.js +6 -6
  48. package/lib/index.d.ts.map +1 -1
  49. package/lib/math/complex/complex.d.ts +12 -0
  50. package/lib/math/complex/complex.d.ts.map +1 -0
  51. package/lib/math/complex/complex.js +24 -0
  52. package/lib/math/polynomials/trinom.d.ts +24 -0
  53. package/lib/math/polynomials/trinom.d.ts.map +1 -0
  54. package/lib/math/polynomials/trinom.js +67 -0
  55. package/lib/tree/nodes/complex/complexNode.d.ts +15 -0
  56. package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -0
  57. package/lib/tree/nodes/complex/complexNode.js +43 -0
  58. package/lib/tree/nodes/functions/cosNode.d.ts +1 -0
  59. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  60. package/lib/tree/nodes/functions/cosNode.js +4 -0
  61. package/lib/tree/nodes/functions/expNode.d.ts +1 -0
  62. package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
  63. package/lib/tree/nodes/functions/expNode.js +4 -0
  64. package/lib/tree/nodes/functions/logNode.d.ts +1 -0
  65. package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
  66. package/lib/tree/nodes/functions/logNode.js +4 -0
  67. package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
  68. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  69. package/lib/tree/nodes/functions/oppositeNode.js +4 -0
  70. package/lib/tree/nodes/functions/sinNode.d.ts +1 -0
  71. package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
  72. package/lib/tree/nodes/functions/sinNode.js +4 -0
  73. package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -0
  74. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  75. package/lib/tree/nodes/functions/sqrtNode.js +4 -0
  76. package/lib/tree/nodes/node.d.ts +1 -0
  77. package/lib/tree/nodes/node.d.ts.map +1 -1
  78. package/lib/tree/nodes/numbers/constantNode.d.ts +1 -0
  79. package/lib/tree/nodes/numbers/constantNode.d.ts.map +1 -1
  80. package/lib/tree/nodes/numbers/constantNode.js +4 -0
  81. package/lib/tree/nodes/numbers/numberNode.d.ts +1 -0
  82. package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
  83. package/lib/tree/nodes/numbers/numberNode.js +4 -0
  84. package/lib/tree/nodes/operators/addNode.d.ts +1 -0
  85. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  86. package/lib/tree/nodes/operators/addNode.js +4 -0
  87. package/lib/tree/nodes/operators/divideNode.d.ts +1 -0
  88. package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
  89. package/lib/tree/nodes/operators/divideNode.js +4 -0
  90. package/lib/tree/nodes/operators/equalNode.d.ts +1 -0
  91. package/lib/tree/nodes/operators/equalNode.d.ts.map +1 -1
  92. package/lib/tree/nodes/operators/equalNode.js +4 -0
  93. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -0
  94. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  95. package/lib/tree/nodes/operators/fractionNode.js +4 -0
  96. package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
  97. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  98. package/lib/tree/nodes/operators/multiplyNode.js +4 -0
  99. package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
  100. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  101. package/lib/tree/nodes/operators/powerNode.js +4 -0
  102. package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
  103. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  104. package/lib/tree/nodes/operators/substractNode.js +4 -0
  105. package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
  106. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  107. package/lib/tree/nodes/variables/variableNode.js +4 -0
  108. package/lib/tree/parsers/simplify.d.ts +1 -0
  109. package/lib/tree/parsers/simplify.d.ts.map +1 -1
  110. package/lib/tree/parsers/simplify.js +9 -1
  111. package/lib/utils/diceFlip.d.ts +2 -0
  112. package/lib/utils/diceFlip.d.ts.map +1 -0
  113. package/lib/utils/diceFlip.js +12 -0
  114. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alphaBetaFromDevForm.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/trinoms/alphaBetaFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,oBAAoB,EAAE,QASlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAmD1D"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAlphaBetaFromDevFormQuestion = exports.alphaBetaFromDevForm = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const trinom_1 = require("../../../math/polynomials/trinom");
6
+ const randint_1 = require("../../../math/utils/random/randint");
7
+ const coinFlip_1 = require("../../../utils/coinFlip");
8
+ const shuffle_1 = require("../../../utils/shuffle");
9
+ const uuid_1 = require("uuid");
10
+ exports.alphaBetaFromDevForm = {
11
+ id: 'alphaBetaFromDevForm',
12
+ connector: '=',
13
+ instruction: '',
14
+ label: 'Déterminer $\\alpha$ ou $\\beta$ à partir de la forme développée',
15
+ levels: ['1reSpé'],
16
+ isSingleStep: false,
17
+ sections: ['Second degré'],
18
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getAlphaBetaFromDevFormQuestion, nb),
19
+ };
20
+ function getAlphaBetaFromDevFormQuestion() {
21
+ const trinom = trinom_1.TrinomConstructor.randomCanonical();
22
+ const param = (0, coinFlip_1.coinFlip)() ? '\\alpha' : '\\beta';
23
+ const alpha = trinom.getAlpha();
24
+ const beta = trinom.getBeta();
25
+ const alphaTex = trinom.getAlphaNode().toTex();
26
+ const betaTex = trinom.getBetaNode().toTex();
27
+ const answer = param === '\\alpha' ? alphaTex : betaTex;
28
+ const getPropositions = (n) => {
29
+ const res = [];
30
+ res.push({
31
+ id: (0, uuid_1.v4)() + '',
32
+ statement: answer,
33
+ isRightAnswer: true,
34
+ format: 'tex',
35
+ });
36
+ const missing = n - res.length;
37
+ for (let i = 0; i < missing; i++) {
38
+ let isDuplicate;
39
+ let proposition;
40
+ do {
41
+ proposition = {
42
+ id: (0, uuid_1.v4)() + '',
43
+ statement: (0, randint_1.randint)(-10, 11).toString(),
44
+ isRightAnswer: false,
45
+ format: 'tex',
46
+ };
47
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
48
+ } while (isDuplicate);
49
+ res.push(proposition);
50
+ }
51
+ return (0, shuffle_1.shuffle)(res);
52
+ };
53
+ const question = {
54
+ answer: answer,
55
+ keys: ['x', '\\alpha', '\\beta'],
56
+ instruction: `Soit $f$ la fonction définie par $f(x) = ${trinom.toTree().toTex()}$. Que vaut $${param}$ ?`,
57
+ getPropositions,
58
+ answerFormat: 'tex',
59
+ startStatement: param,
60
+ };
61
+ return question;
62
+ }
63
+ exports.getAlphaBetaFromDevFormQuestion = getAlphaBetaFromDevFormQuestion;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const alphaBetaInCanonicalForm: Exercise;
3
+ export declare function getAlphaBetaInCanonicalFormQuestion(): Question;
4
+ //# sourceMappingURL=alphaBetaInCanonicalForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alphaBetaInCanonicalForm.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/trinoms/alphaBetaInCanonicalForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E,eAAO,MAAM,wBAAwB,EAAE,QAStC,CAAC;AAEF,wBAAgB,mCAAmC,IAAI,QAAQ,CA4E9D"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAlphaBetaInCanonicalFormQuestion = exports.alphaBetaInCanonicalForm = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const trinom_1 = require("../../../math/polynomials/trinom");
6
+ const randint_1 = require("../../../math/utils/random/randint");
7
+ const oppositeNode_1 = require("../../../tree/nodes/functions/oppositeNode");
8
+ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
9
+ const simplify_1 = require("../../../tree/parsers/simplify");
10
+ const coinFlip_1 = require("../../../utils/coinFlip");
11
+ const shuffle_1 = require("../../../utils/shuffle");
12
+ const uuid_1 = require("uuid");
13
+ exports.alphaBetaInCanonicalForm = {
14
+ id: 'alphaInCanonicalForm',
15
+ connector: '=',
16
+ instruction: '',
17
+ label: 'Identifier $\\alpha$ et $\\beta$ dans la forme canonique',
18
+ levels: ['1reSpé'],
19
+ isSingleStep: true,
20
+ sections: ['Second degré'],
21
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getAlphaBetaInCanonicalFormQuestion, nb),
22
+ };
23
+ function getAlphaBetaInCanonicalFormQuestion() {
24
+ const trinom = trinom_1.TrinomConstructor.randomCanonical();
25
+ const param = (0, coinFlip_1.coinFlip)() ? '\\alpha' : '\\beta';
26
+ const alpha = trinom.getAlpha();
27
+ const beta = trinom.getBeta();
28
+ const alphaTex = trinom.getAlphaNode().toTex();
29
+ const betaTex = trinom.getBetaNode().toTex();
30
+ const answer = param === '\\alpha' ? alphaTex : betaTex;
31
+ const getPropositions = (n) => {
32
+ const res = [];
33
+ res.push({
34
+ id: (0, uuid_1.v4)() + '',
35
+ statement: answer,
36
+ isRightAnswer: true,
37
+ format: 'tex',
38
+ });
39
+ if (beta !== alpha)
40
+ res.push({
41
+ id: (0, uuid_1.v4)() + '',
42
+ statement: param === '\\alpha' ? betaTex : alphaTex,
43
+ isRightAnswer: false,
44
+ format: 'tex',
45
+ });
46
+ if (alpha !== 0 && (param === '\\alpha' || beta !== -alpha))
47
+ res.push({
48
+ id: (0, uuid_1.v4)() + '',
49
+ statement: (0, simplify_1.simplifyNode)(new oppositeNode_1.OppositeNode(new numberNode_1.NumberNode(alpha))).toTex(),
50
+ isRightAnswer: false,
51
+ format: 'tex',
52
+ });
53
+ if (!res.some((prop) => prop.statement === trinom.a.toString())) {
54
+ res.push({
55
+ id: (0, uuid_1.v4)() + '',
56
+ statement: trinom.a.toString(),
57
+ isRightAnswer: false,
58
+ format: 'tex',
59
+ });
60
+ }
61
+ const missing = n - res.length;
62
+ for (let i = 0; i < missing; i++) {
63
+ let isDuplicate;
64
+ let proposition;
65
+ do {
66
+ const wrongAnswer = (0, randint_1.randint)(-10, 11);
67
+ proposition = {
68
+ id: (0, uuid_1.v4)() + '',
69
+ statement: wrongAnswer.toString(),
70
+ isRightAnswer: false,
71
+ format: 'tex',
72
+ };
73
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
74
+ } while (isDuplicate);
75
+ res.push(proposition);
76
+ }
77
+ return (0, shuffle_1.shuffle)(res);
78
+ };
79
+ const question = {
80
+ instruction: `Soit $f$ la fonction définie par $f(x) = ${trinom
81
+ .getCanonicalForm()
82
+ .toTex()}$. Que vaut $${param}$ ?`,
83
+ answer: answer,
84
+ keys: ['x', '\\alpha', '\\beta'],
85
+ getPropositions,
86
+ answerFormat: 'tex',
87
+ startStatement: param,
88
+ };
89
+ return question;
90
+ }
91
+ exports.getAlphaBetaInCanonicalFormQuestion = getAlphaBetaInCanonicalFormQuestion;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const canonicalFromDevForm: Exercise;
3
+ export declare function getCanonicalFromDevFormQuestion(): Question;
4
+ //# sourceMappingURL=canonicalFromDevForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalFromDevForm.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/trinoms/canonicalFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,oBAAoB,EAAE,QASlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CA8C1D"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCanonicalFromDevFormQuestion = exports.canonicalFromDevForm = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const integer_1 = require("../../../math/numbers/integer/integer");
6
+ const trinom_1 = require("../../../math/polynomials/trinom");
7
+ const discreteSet_1 = require("../../../math/sets/discreteSet");
8
+ const shuffle_1 = require("../../../utils/shuffle");
9
+ const uuid_1 = require("uuid");
10
+ exports.canonicalFromDevForm = {
11
+ id: 'canonicalFromDevForm',
12
+ connector: '\\iff',
13
+ instruction: '',
14
+ label: 'Déterminer la forme canonique à partir de la forme développée',
15
+ levels: ['1reSpé'],
16
+ isSingleStep: false,
17
+ sections: ['Second degré'],
18
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getCanonicalFromDevFormQuestion, nb),
19
+ };
20
+ function getCanonicalFromDevFormQuestion() {
21
+ const trinom = trinom_1.TrinomConstructor.randomCanonical();
22
+ const getPropositions = (n) => {
23
+ const res = [];
24
+ res.push({
25
+ id: (0, uuid_1.v4)() + '',
26
+ statement: trinom.getCanonicalForm().toTex(),
27
+ isRightAnswer: true,
28
+ format: 'tex',
29
+ });
30
+ const missing = n - res.length;
31
+ for (let i = 0; i < missing; i++) {
32
+ let isDuplicate;
33
+ let proposition;
34
+ do {
35
+ proposition = {
36
+ id: (0, uuid_1.v4)() + '',
37
+ statement: trinom_1.TrinomConstructor.randomCanonical(new discreteSet_1.DiscreteSet([new integer_1.Integer(trinom.a), new integer_1.Integer(-trinom.a)]))
38
+ .getCanonicalForm()
39
+ .toTex(),
40
+ isRightAnswer: false,
41
+ format: 'tex',
42
+ };
43
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
44
+ } while (isDuplicate);
45
+ res.push(proposition);
46
+ }
47
+ return (0, shuffle_1.shuffle)(res);
48
+ };
49
+ const question = {
50
+ answer: trinom.getCanonicalForm().toTex(),
51
+ keys: ['x', '=', '\\alpha', '\\beta'],
52
+ instruction: `Déterminer la forme canonique de la fonction $f$ définie par $f(x) = ${trinom.toTree().toTex()}$`,
53
+ getPropositions,
54
+ answerFormat: 'tex',
55
+ };
56
+ return question;
57
+ }
58
+ exports.getCanonicalFromDevFormQuestion = getCanonicalFromDevFormQuestion;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const extremumFromCanonicalForm: Exercise;
3
+ export declare function getExtremumFromCanonicalFormQuestion(): Question;
4
+ //# sourceMappingURL=extremumFromCanonicalForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extremumFromCanonicalForm.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/trinoms/extremumFromCanonicalForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,yBAAyB,EAAE,QASvC,CAAC;AAEF,wBAAgB,oCAAoC,IAAI,QAAQ,CAmE/D"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExtremumFromCanonicalFormQuestion = exports.extremumFromCanonicalForm = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const trinom_1 = require("../../../math/polynomials/trinom");
6
+ const randint_1 = require("../../../math/utils/random/randint");
7
+ const shuffle_1 = require("../../../utils/shuffle");
8
+ const uuid_1 = require("uuid");
9
+ exports.extremumFromCanonicalForm = {
10
+ id: 'extremumFromCanonicalForm',
11
+ connector: '=',
12
+ instruction: '',
13
+ label: "Déterminer les coordonnées du sommet d'une parabole à partir de la forme canonique",
14
+ levels: ['1reSpé'],
15
+ isSingleStep: true,
16
+ sections: ['Second degré'],
17
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getExtremumFromCanonicalFormQuestion, nb),
18
+ };
19
+ function getExtremumFromCanonicalFormQuestion() {
20
+ const trinom = trinom_1.TrinomConstructor.randomCanonical();
21
+ const answer = trinom.getSommet();
22
+ const getPropositions = (n) => {
23
+ const res = [];
24
+ res.push({
25
+ id: (0, uuid_1.v4)() + '',
26
+ statement: answer,
27
+ isRightAnswer: true,
28
+ format: 'tex',
29
+ });
30
+ const alpha = trinom.getAlpha();
31
+ const beta = trinom.getBeta();
32
+ if (alpha !== beta) {
33
+ res.push({
34
+ id: (0, uuid_1.v4)(),
35
+ statement: `S\\left(${beta}; ${alpha}\\right)`,
36
+ isRightAnswer: false,
37
+ format: 'tex',
38
+ });
39
+ }
40
+ if (alpha !== 0) {
41
+ res.push({
42
+ id: (0, uuid_1.v4)(),
43
+ statement: `S\\left(${-alpha}; ${beta}\\right)`,
44
+ isRightAnswer: false,
45
+ format: 'tex',
46
+ });
47
+ }
48
+ if (beta !== 0) {
49
+ res.push({
50
+ id: (0, uuid_1.v4)(),
51
+ statement: `S\\left(${alpha}; ${-beta}\\right)`,
52
+ isRightAnswer: false,
53
+ format: 'tex',
54
+ });
55
+ }
56
+ const missing = n - res.length;
57
+ for (let i = 0; i < missing; i++) {
58
+ let isDuplicate;
59
+ let proposition;
60
+ do {
61
+ proposition = {
62
+ id: (0, uuid_1.v4)() + '',
63
+ statement: `S\\left(${(0, randint_1.randint)(-10, 11)}; ${(0, randint_1.randint)(-10, 11)} \\right)`,
64
+ isRightAnswer: false,
65
+ format: 'tex',
66
+ };
67
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
68
+ } while (isDuplicate);
69
+ res.push(proposition);
70
+ }
71
+ return (0, shuffle_1.shuffle)(res);
72
+ };
73
+ const question = {
74
+ answer: answer,
75
+ instruction: `Soit $f$ la fonction définie par $${trinom
76
+ .getCanonicalForm()
77
+ .toTex()}$. Quelles sont les coordonnées du sommet $S$ de la parabole représentative de $f$ ?`,
78
+ keys: ['S', '=', 'semicolon'],
79
+ getPropositions,
80
+ answerFormat: 'tex',
81
+ };
82
+ return question;
83
+ }
84
+ exports.getExtremumFromCanonicalFormQuestion = getExtremumFromCanonicalFormQuestion;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const extremumTypeFromAlgebricForm: Exercise;
3
+ export declare function getExtremumTypeFromAlgebricFormQuestion(): Question;
4
+ //# sourceMappingURL=extremumTypeFromAlgebricForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extremumTypeFromAlgebricForm.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/trinoms/extremumTypeFromAlgebricForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,4BAA4B,EAAE,QAQ1C,CAAC;AAEF,wBAAgB,uCAAuC,IAAI,QAAQ,CA6ClE"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExtremumTypeFromAlgebricFormQuestion = exports.extremumTypeFromAlgebricForm = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const trinom_1 = require("../../../math/polynomials/trinom");
6
+ const coinFlip_1 = require("../../../utils/coinFlip");
7
+ const shuffle_1 = require("../../../utils/shuffle");
8
+ const uuid_1 = require("uuid");
9
+ exports.extremumTypeFromAlgebricForm = {
10
+ id: 'extremumTypeFromAlgebricForm',
11
+ instruction: '',
12
+ label: "Déterminer le type d'extremum d'une fonction du second degré via sa forme algébrique",
13
+ levels: ['1reSpé'],
14
+ isSingleStep: true,
15
+ sections: ['Second degré'],
16
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getExtremumTypeFromAlgebricFormQuestion, nb),
17
+ };
18
+ function getExtremumTypeFromAlgebricFormQuestion() {
19
+ const isDevForm = (0, coinFlip_1.coinFlip)();
20
+ const trinom = isDevForm ? trinom_1.TrinomConstructor.random() : trinom_1.TrinomConstructor.randomCanonical();
21
+ const answer = trinom.a > 0 ? 'Un minimum' : 'Un maximum';
22
+ const getPropositions = (n) => {
23
+ const res = [];
24
+ res.push({
25
+ id: (0, uuid_1.v4)(),
26
+ statement: answer,
27
+ isRightAnswer: true,
28
+ format: 'raw',
29
+ });
30
+ res.push({
31
+ id: (0, uuid_1.v4)(),
32
+ statement: trinom.a < 0 ? 'Un minimum' : 'Un maximum',
33
+ isRightAnswer: false,
34
+ format: 'raw',
35
+ });
36
+ res.push({
37
+ id: (0, uuid_1.v4)(),
38
+ statement: "Ni l'un ni l'autre",
39
+ isRightAnswer: false,
40
+ format: 'raw',
41
+ });
42
+ res.push({
43
+ id: (0, uuid_1.v4)(),
44
+ statement: 'On ne peut pas savoir',
45
+ isRightAnswer: false,
46
+ format: 'raw',
47
+ });
48
+ return (0, shuffle_1.shuffle)(res);
49
+ };
50
+ const question = {
51
+ answer: answer,
52
+ instruction: `La fonction $f$ définie par $f(x) = ${isDevForm ? trinom.toTree().toTex() : trinom.getCanonicalForm().toTex()}$ admet-elle un maximum ou un minimum ?`,
53
+ questionType: 'QCM',
54
+ getPropositions,
55
+ answerFormat: 'raw',
56
+ };
57
+ return question;
58
+ }
59
+ exports.getExtremumTypeFromAlgebricFormQuestion = getExtremumTypeFromAlgebricFormQuestion;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const variationsFromAlgebricForm: Exercise;
3
+ export declare function getVariationsFromAlgebricFormQuestion(): Question;
4
+ //# sourceMappingURL=variationsFromAlgebricForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variationsFromAlgebricForm.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/trinoms/variationsFromAlgebricForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,0BAA0B,EAAE,QAQxC,CAAC;AAEF,wBAAgB,qCAAqC,IAAI,QAAQ,CA6ChE"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getVariationsFromAlgebricFormQuestion = exports.variationsFromAlgebricForm = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const trinom_1 = require("../../../math/polynomials/trinom");
6
+ const coinFlip_1 = require("../../../utils/coinFlip");
7
+ const shuffle_1 = require("../../../utils/shuffle");
8
+ const uuid_1 = require("uuid");
9
+ exports.variationsFromAlgebricForm = {
10
+ id: 'variationsFromAlgebricForm',
11
+ instruction: '',
12
+ label: "Déterminer les variations d'une fonction du second degré via sa forme algébrique",
13
+ levels: ['1reSpé'],
14
+ isSingleStep: true,
15
+ sections: ['Second degré'],
16
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getVariationsFromAlgebricFormQuestion, nb),
17
+ };
18
+ function getVariationsFromAlgebricFormQuestion() {
19
+ const isDevForm = (0, coinFlip_1.coinFlip)();
20
+ const trinom = isDevForm ? trinom_1.TrinomConstructor.random() : trinom_1.TrinomConstructor.randomCanonical();
21
+ const answer = trinom.a > 0 ? 'Décroissante puis croissante' : 'Croissante puis décroissante';
22
+ const getPropositions = (n) => {
23
+ const res = [];
24
+ res.push({
25
+ id: (0, uuid_1.v4)(),
26
+ statement: answer,
27
+ isRightAnswer: true,
28
+ format: 'raw',
29
+ });
30
+ res.push({
31
+ id: (0, uuid_1.v4)(),
32
+ statement: trinom.a < 0 ? 'Décroissante puis croissante' : 'Croissante puis décroissante',
33
+ isRightAnswer: false,
34
+ format: 'raw',
35
+ });
36
+ res.push({
37
+ id: (0, uuid_1.v4)(),
38
+ statement: 'Constante',
39
+ isRightAnswer: false,
40
+ format: 'raw',
41
+ });
42
+ res.push({
43
+ id: (0, uuid_1.v4)(),
44
+ statement: 'On ne peut pas savoir',
45
+ isRightAnswer: false,
46
+ format: 'raw',
47
+ });
48
+ return (0, shuffle_1.shuffle)(res);
49
+ };
50
+ const question = {
51
+ answer: answer,
52
+ instruction: `Quelles sont les variations de la fonction $f$ définie par $f(x) = ${isDevForm ? trinom.toTree().toTex() : trinom.getCanonicalForm().toTex()}$ ?`,
53
+ questionType: 'QCM',
54
+ getPropositions,
55
+ answerFormat: 'raw',
56
+ };
57
+ return question;
58
+ }
59
+ exports.getVariationsFromAlgebricFormQuestion = getVariationsFromAlgebricFormQuestion;
@@ -12,7 +12,7 @@ exports.medianList = {
12
12
  label: "Calcul de la médiane d'une liste de valeurs",
13
13
  levels: ['3ème', '2nde'],
14
14
  isSingleStep: false,
15
- sections: ['Probabilités'],
15
+ sections: ['Statistiques'],
16
16
  generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getMedian, nb),
17
17
  keys: ['f', 'cap', 'underscore'],
18
18
  };
@@ -83,12 +83,12 @@ function getProbabilityTree() {
83
83
  'Segment(B,BD)',
84
84
  'ShowAxes(false)',
85
85
  'ShowGrid(false)',
86
- `Text("\\scriptsize${A / pgcd(A, A + B)}/${(A + B) / pgcd(A, A + B)}", (0.3, 2.1), true, true)`,
87
- `Text("\\scriptsize${AC / pgcd(AC, AC + AD)}/${(AC + AD) / pgcd(AC, AC + AD)}", (2.8, 3.5), true, true)`,
88
- `Text("\\scriptsize${AD / pgcd(AD, AC + AD)}/${(AC + AD) / pgcd(AD, AC + AD)}", (2.8, 1.4), true, true)`,
89
- `Text("\\scriptsize${B / pgcd(B, A + B)}/${(A + B) / pgcd(B, A + B)}", (0.3, -1.2), true, true)`,
90
- `Text("\\scriptsize${BC / pgcd(BC, BC + BD)}/${(BC + BD) / pgcd(BC, BC + BD)}", (2.8, -0.6), true, true)`,
91
- `Text("\\scriptsize${BD / pgcd(BD, BC + BD)}/${(BC + BD) / pgcd(BD, BC + BD)}", (2.8, -2.5), true, true)`,
86
+ `Text("\\scriptsize ${A / pgcd(A, A + B)}/${(A + B) / pgcd(A, A + B)}", (0.3, 2.1), true, true)`,
87
+ `Text("\\scriptsize ${AC / pgcd(AC, AC + AD)}/${(AC + AD) / pgcd(AC, AC + AD)}", (2.8, 3.5), true, true)`,
88
+ `Text("\\scriptsize ${AD / pgcd(AD, AC + AD)}/${(AC + AD) / pgcd(AD, AC + AD)}", (2.8, 1.4), true, true)`,
89
+ `Text("\\scriptsize ${B / pgcd(B, A + B)}/${(A + B) / pgcd(B, A + B)}", (0.3, -1.2), true, true)`,
90
+ `Text("\\scriptsize ${BC / pgcd(BC, BC + BD)}/${(BC + BD) / pgcd(BC, BC + BD)}", (2.8, -0.6), true, true)`,
91
+ `Text("\\scriptsize ${BD / pgcd(BD, BC + BD)}/${(BC + BD) / pgcd(BD, BC + BD)}", (2.8, -2.5), true, true)`,
92
92
  'Text("A", (1.85 , 2.5))',
93
93
  'Text("B", (1.85 , -2.8))',
94
94
  'Text("C", (5.5 , 2.85))',
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAG7D,QAAA,MAAM,gBAAgB,YAAiB,CAAC;AAExC,QAAA,MAAM,4BAA4B;aACT,WAAW;UAAQ,QAAQ,EAAE;GAkBrD,CAAC;AACF,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAS7D,QAAA,MAAM,gBAAgB,YAAiB,CAAC;AAExC,QAAA,MAAM,4BAA4B;aACT,WAAW;UAAQ,QAAQ,EAAE;GAkBrD,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ComplexNode } from '../../tree/nodes/complex/complexNode';
2
+ export declare abstract class ComplexConstructor {
3
+ static random(): Complex;
4
+ }
5
+ export declare class Complex {
6
+ re: number;
7
+ im: number;
8
+ constructor(re: number, im: number);
9
+ conjugate(): Complex;
10
+ toTree(): ComplexNode;
11
+ }
12
+ //# sourceMappingURL=complex.d.ts.map
@@ -0,0 +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;AAGnE,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;CAGd;AACD,qBAAa,OAAO;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;gBACC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAIlC,SAAS;IAGT,MAAM;CAGP"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Complex = exports.ComplexConstructor = void 0;
4
+ const complexNode_1 = require("../../tree/nodes/complex/complexNode");
5
+ const randint_1 = require("../utils/random/randint");
6
+ class ComplexConstructor {
7
+ static random() {
8
+ return new Complex((0, randint_1.randint)(-10, 11), (0, randint_1.randint)(-10, 11));
9
+ }
10
+ }
11
+ exports.ComplexConstructor = ComplexConstructor;
12
+ class Complex {
13
+ constructor(re, im) {
14
+ this.re = re;
15
+ this.im = im;
16
+ }
17
+ conjugate() {
18
+ return new Complex(this.re, -this.im);
19
+ }
20
+ toTree() {
21
+ return new complexNode_1.ComplexNode(this.re, this.im);
22
+ }
23
+ }
24
+ exports.Complex = Complex;
@@ -0,0 +1,24 @@
1
+ import { Node } from '../../tree/nodes/node';
2
+ import { NumberNode } from '../../tree/nodes/numbers/numberNode';
3
+ import { MathSet } from '../sets/mathSet';
4
+ import { Polynomial } from './polynomial';
5
+ export declare abstract class TrinomConstructor {
6
+ static random(domainA?: MathSet, domainB?: MathSet, domainC?: MathSet): Trinom;
7
+ static randomCanonical(domainA?: MathSet, domainAlpha?: MathSet, domainBeta?: MathSet): Trinom;
8
+ }
9
+ export declare class Trinom extends Polynomial {
10
+ a: number;
11
+ b: number;
12
+ c: number;
13
+ variable: string;
14
+ constructor(a: number, b: number, c: number, variable?: string);
15
+ getDelta(): number;
16
+ getDeltaNode(): NumberNode;
17
+ getAlpha(): number;
18
+ getAlphaNode(): Node;
19
+ getBeta(): number;
20
+ getBetaNode(): Node;
21
+ getCanonicalForm(): Node;
22
+ getSommet(): string;
23
+ }
24
+ //# sourceMappingURL=trinom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trinom.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/trinom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAajE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,MAAM,CACX,OAAO,GAAE,OAAmF,EAC5F,OAAO,GAAE,OAAqC,EAC9C,OAAO,GAAE,OAAqC,GAC7C,MAAM;IAOT,MAAM,CAAC,eAAe,CACpB,OAAO,GAAE,OAAmF,EAC5F,WAAW,GAAE,OAAqC,EAClD,UAAU,GAAE,OAAqC,GAChD,MAAM;CAQV;AAED,qBAAa,MAAO,SAAQ,UAAU;IACpC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;gBACL,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY;IAQnE,QAAQ;IAGR,YAAY,IAAI,UAAU;IAI1B,QAAQ;IAGR,YAAY,IAAI,IAAI;IAIpB,OAAO;IAIP,WAAW,IAAI,IAAI;IAInB,gBAAgB,IAAI,IAAI;IAYxB,SAAS;CAGV"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Trinom = exports.TrinomConstructor = void 0;
4
+ const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
5
+ const addNode_1 = require("../../tree/nodes/operators/addNode");
6
+ const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
7
+ const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
8
+ const powerNode_1 = require("../../tree/nodes/operators/powerNode");
9
+ const substractNode_1 = require("../../tree/nodes/operators/substractNode");
10
+ const variableNode_1 = require("../../tree/nodes/variables/variableNode");
11
+ const simplify_1 = require("../../tree/parsers/simplify");
12
+ const point_1 = require("../geometry/point");
13
+ const integer_1 = require("../numbers/integer/integer");
14
+ const discreteSet_1 = require("../sets/discreteSet");
15
+ const intervals_1 = require("../sets/intervals/intervals");
16
+ const polynomial_1 = require("./polynomial");
17
+ class TrinomConstructor {
18
+ static random(domainA = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)])), domainB = new intervals_1.Interval('[[-10; 10]]'), domainC = new intervals_1.Interval('[[-10; 10]]')) {
19
+ const a = domainA.getRandomElement();
20
+ const b = domainB.getRandomElement();
21
+ const c = domainC.getRandomElement();
22
+ return new Trinom(a.value, b.value, c.value);
23
+ }
24
+ static randomCanonical(domainA = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)])), domainAlpha = new intervals_1.Interval('[[-10; 10]]'), domainBeta = new intervals_1.Interval('[[-10; 10]]')) {
25
+ const a = domainA.getRandomElement();
26
+ const alpha = domainAlpha.getRandomElement();
27
+ const beta = domainBeta.getRandomElement();
28
+ const b = -2 * a.value * alpha.value;
29
+ const c = a.value * alpha.value ** 2 + beta.value;
30
+ return new Trinom(a.value, b, c);
31
+ }
32
+ }
33
+ exports.TrinomConstructor = TrinomConstructor;
34
+ class Trinom extends polynomial_1.Polynomial {
35
+ constructor(a, b, c, variable = 'x') {
36
+ super([c, b, a], variable);
37
+ this.a = a;
38
+ this.b = b;
39
+ this.c = c;
40
+ this.variable = variable;
41
+ }
42
+ getDelta() {
43
+ return this.b ** 2 - 4 * this.a * this.c;
44
+ }
45
+ getDeltaNode() {
46
+ return new numberNode_1.NumberNode(this.getDelta());
47
+ }
48
+ getAlpha() {
49
+ return -this.b / (2 * this.a);
50
+ }
51
+ getAlphaNode() {
52
+ return (0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-this.b), new numberNode_1.NumberNode(2 * this.a)));
53
+ }
54
+ getBeta() {
55
+ return -this.getDelta() / (4 * this.a);
56
+ }
57
+ getBetaNode() {
58
+ return (0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-this.getDelta()), new numberNode_1.NumberNode(4 * this.a)));
59
+ }
60
+ getCanonicalForm() {
61
+ return (0, simplify_1.simplifyNode)(new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(this.a), new powerNode_1.PowerNode(new substractNode_1.SubstractNode(new variableNode_1.VariableNode(this.variable), this.getAlphaNode()), new numberNode_1.NumberNode(2))), new numberNode_1.NumberNode(this.getBeta())));
62
+ }
63
+ getSommet() {
64
+ return new point_1.Point('S', this.getAlphaNode(), this.getBetaNode()).toTexWithCoords();
65
+ }
66
+ }
67
+ exports.Trinom = Trinom;