math-exercises 1.3.61 → 1.3.63

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 (28) hide show
  1. package/lib/exercises/exercise.d.ts +1 -1
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/exercises.d.ts.map +1 -1
  4. package/lib/exercises/exercises.js +5 -0
  5. package/lib/exercises/sets/intervals/inequalityToInterval.d.ts +4 -0
  6. package/lib/exercises/sets/intervals/inequalityToInterval.d.ts.map +1 -0
  7. package/lib/exercises/sets/intervals/inequalityToInterval.js +136 -0
  8. package/lib/exercises/sets/intervals/intervalBelonging.d.ts +4 -0
  9. package/lib/exercises/sets/intervals/intervalBelonging.d.ts.map +1 -0
  10. package/lib/exercises/sets/intervals/intervalBelonging.js +55 -0
  11. package/lib/exercises/sets/intervals/intervalsUnion.d.ts +4 -0
  12. package/lib/exercises/sets/intervals/intervalsUnion.d.ts.map +1 -0
  13. package/lib/exercises/sets/intervals/intervalsUnion.js +55 -0
  14. package/lib/exercises/sets/setBelonging.d.ts +4 -0
  15. package/lib/exercises/sets/setBelonging.d.ts.map +1 -0
  16. package/lib/exercises/sets/setBelonging.js +89 -0
  17. package/lib/index.js +1 -2
  18. package/lib/math/geometry/triangles.js +4 -4
  19. package/lib/math/polynomials/polynomial.js +1 -2
  20. package/lib/math/sets/intervals/intervals.d.ts +11 -0
  21. package/lib/math/sets/intervals/intervals.d.ts.map +1 -1
  22. package/lib/math/sets/intervals/intervals.js +88 -1
  23. package/lib/server.js +4 -5
  24. package/lib/tree/nodes/functions/oppositeNode.js +1 -1
  25. package/lib/tree/nodes/operators/divideNode.js +1 -1
  26. package/lib/tree/nodes/operators/multiplyNode.js +2 -2
  27. package/lib/tree/nodes/operators/powerNode.js +2 -2
  28. package/package.json +2 -2
@@ -32,5 +32,5 @@ export interface Exercise {
32
32
  freeTimer: number;
33
33
  }
34
34
  export type MathLevel = '6ème' | '5ème' | '4ème' | '3ème' | '2nde' | '1reTech' | '1reESM' | '1reSpé' | 'TermSpé' | 'TermTech' | 'MathExp' | 'MathComp' | 'CAP' | '2ndPro' | '1rePro' | 'TermPro';
35
- export type MathSection = 'Arithmétique' | 'Calcul littéral' | 'Calculs' | 'Conversions' | 'Dérivation' | 'Droites' | 'Équations' | 'Équations différentielles' | 'Exponentielle' | 'Fonction cube' | 'Fonction inverse' | 'Fonctions' | 'Fonctions affines' | 'Fonctions de référence' | 'Fractions' | 'Géométrie cartésienne' | 'Géométrie euclidienne' | 'Inéquations' | 'Intégration' | 'Intervalles' | 'Limites' | 'Logarithme népérien' | 'Nombres complexes' | 'Pourcentages' | 'Primitives' | 'Probabilités' | 'Proportionnalité' | 'Puissances' | 'Racines carrées' | 'Second degré' | 'Statistiques' | 'Suites' | 'Trigonométrie' | 'Vecteurs';
35
+ export type MathSection = 'Arithmétique' | 'Calcul littéral' | 'Calculs' | 'Conversions' | 'Dérivation' | 'Droites' | 'Ensembles et intervalles' | 'Équations' | 'Équations différentielles' | 'Exponentielle' | 'Fonction cube' | 'Fonction inverse' | 'Fonctions' | 'Fonctions affines' | 'Fonctions de référence' | 'Fractions' | 'Géométrie cartésienne' | 'Géométrie euclidienne' | 'Inéquations' | 'Intégration' | 'Limites' | 'Logarithme népérien' | 'Nombres complexes' | 'Pourcentages' | 'Primitives' | 'Probabilités' | 'Proportionnalité' | 'Puissances' | 'Racines carrées' | 'Second degré' | 'Statistiques' | 'Suites' | 'Trigonométrie' | 'Vecteurs';
36
36
  //# sourceMappingURL=exercise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAElC,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;CACvB,CAAC;AACF,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,KAAK,GAAG,KAAK,CAAC;IAC5B,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,eAAe,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,UAAU,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,QAAQ,EAAE,CAAC;IAC9D,UAAU,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,WAAW,GACnB,cAAc,GACd,iBAAiB,GACjB,SAAS,GACT,aAAa,GACb,YAAY,GACZ,SAAS,GACT,WAAW,GACX,2BAA2B,GAC3B,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,WAAW,GACX,mBAAmB,GACnB,wBAAwB,GACxB,WAAW,GACX,uBAAuB,GACvB,uBAAuB,GACvB,aAAa,GACb,aAAa,GACb,aAAa,GACb,SAAS,GACT,qBAAqB,GACrB,mBAAmB,GACnB,cAAc,GACd,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,cAAc,GACd,QAAQ,GACR,eAAe,GACf,UAAU,CAAC"}
1
+ {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAElC,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;CACvB,CAAC;AACF,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,KAAK,GAAG,KAAK,CAAC;IAC5B,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,eAAe,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,UAAU,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,QAAQ,EAAE,CAAC;IAC9D,UAAU,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,WAAW,GACnB,cAAc,GACd,iBAAiB,GACjB,SAAS,GACT,aAAa,GACb,YAAY,GACZ,SAAS,GACT,0BAA0B,GAC1B,WAAW,GACX,2BAA2B,GAC3B,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,WAAW,GACX,mBAAmB,GACnB,wBAAwB,GACxB,WAAW,GACX,uBAAuB,GACvB,uBAAuB,GACvB,aAAa,GACb,aAAa,GACb,SAAS,GACT,qBAAqB,GACrB,mBAAmB,GACnB,cAAc,GACd,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,cAAc,GACd,QAAQ,GACR,eAAe,GACf,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"AA2KA,eAAO,MAAM,SAAS,iCAwPrB,CAAC"}
1
+ {"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"AA6KA,eAAO,MAAM,SAAS,iCA4PrB,CAAC"}
@@ -161,6 +161,8 @@ const firstDegreeInequationsType0_1 = require("./calculLitteral/inequations/firs
161
161
  const chasles_1 = require("./geometry/vectors/chasles");
162
162
  const rootsFromFactorizedForm_1 = require("./functions/trinoms/rootsFromFactorizedForm");
163
163
  const rootsFromDevForm_1 = require("./functions/trinoms/rootsFromDevForm");
164
+ const inequalityToInterval_1 = require("./sets/intervals/inequalityToInterval");
165
+ const setBelonging_1 = require("./sets/setBelonging");
164
166
  exports.exercises = [
165
167
  /**
166
168
  * calcul litteral
@@ -387,4 +389,7 @@ exports.exercises = [
387
389
  inverseComplex_1.inverseComplex,
388
390
  divideComplex_1.divideComplex,
389
391
  conjugateDivideComplex_1.conjugateDivideComplex,
392
+ /**sets */
393
+ inequalityToInterval_1.inequalityToInterval,
394
+ setBelonging_1.setBelonging,
390
395
  ];
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const inequalityToInterval: Exercise;
3
+ export declare function getInequalityToIntervalQuestion(): Question;
4
+ //# sourceMappingURL=inequalityToInterval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,oBAAoB,EAAE,QAWlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAyH1D"}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInequalityToIntervalQuestion = exports.inequalityToInterval = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const intervals_1 = require("../../../math/sets/intervals/intervals");
6
+ const coinFlip_1 = require("../../../utils/coinFlip");
7
+ const shuffle_1 = require("../../../utils/shuffle");
8
+ const uuid_1 = require("uuid");
9
+ exports.inequalityToInterval = {
10
+ id: 'inequalityToInterval',
11
+ connector: '=',
12
+ instruction: '',
13
+ label: 'Traduire une inégalité en intervalle',
14
+ levels: ['2ndPro', '2nde', 'CAP', '1reESM'],
15
+ isSingleStep: true,
16
+ sections: ['Ensembles et intervalles'],
17
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getInequalityToIntervalQuestion, nb),
18
+ qcmTimer: 60,
19
+ freeTimer: 60,
20
+ };
21
+ function getInequalityToIntervalQuestion() {
22
+ const reverseBracket = (bracket) => {
23
+ return bracket === '[' ? ']' : '[';
24
+ };
25
+ const switchInequality = (symbol) => {
26
+ if (symbol === '\\leq')
27
+ return '<';
28
+ if (symbol === '<')
29
+ return '\\leq';
30
+ if (symbol === '>')
31
+ return '\\geq';
32
+ return '>';
33
+ };
34
+ const reverseInequality = (symbol) => {
35
+ if (symbol === '\\leq')
36
+ return '\\geq';
37
+ if (symbol === '<')
38
+ return '>';
39
+ if (symbol === '>')
40
+ return '<';
41
+ return '\\leq';
42
+ };
43
+ const isIntervalToInequality = (0, coinFlip_1.coinFlip)();
44
+ const interval = intervals_1.IntervalConstructor.random();
45
+ const inequalityString = interval.toInequality();
46
+ const answer = isIntervalToInequality ? inequalityString : `x \\in ${interval.toTex()}`;
47
+ const instruction = isIntervalToInequality
48
+ ? `Soit $x \\in ${interval.toTex()}$. Traduire cette appartenance en une inégalité.`
49
+ : `Soit $${inequalityString}$. Traduire cette inégalité en appartenance à un intervalle.`;
50
+ const getPropositions = (n) => {
51
+ const res = [];
52
+ res.push({
53
+ id: (0, uuid_1.v4)(),
54
+ statement: answer,
55
+ isRightAnswer: true,
56
+ format: 'tex',
57
+ });
58
+ if (isIntervalToInequality) {
59
+ if (interval.min === -Infinity) {
60
+ const wrongStatements = [
61
+ `x ${switchInequality(interval.rightInequalitySymbol)} ${interval.maxTex}`,
62
+ `-\\infty \\leq x ${switchInequality(interval.rightInequalitySymbol)} ${interval.maxTex}`,
63
+ `-\\infty < x ${switchInequality(interval.rightInequalitySymbol)} ${interval.maxTex}`,
64
+ ];
65
+ wrongStatements.forEach((statement) => {
66
+ res.push({
67
+ id: (0, uuid_1.v4)(),
68
+ statement,
69
+ isRightAnswer: false,
70
+ format: 'tex',
71
+ });
72
+ });
73
+ }
74
+ else if (interval.max === Infinity) {
75
+ const wrongStatements = [
76
+ `x ${switchInequality(reverseInequality(interval.leftInequalitySymbol))} ${interval.minTex}`,
77
+ `${interval.minTex} ${switchInequality(interval.leftInequalitySymbol)} x \\leq +\\infty`,
78
+ `${interval.minTex} ${switchInequality(interval.leftInequalitySymbol)} x \\leq +\\infty`,
79
+ ];
80
+ wrongStatements.forEach((statement) => {
81
+ res.push({
82
+ id: (0, uuid_1.v4)(),
83
+ statement,
84
+ isRightAnswer: false,
85
+ format: 'tex',
86
+ });
87
+ });
88
+ }
89
+ else {
90
+ const wrongStatements = [
91
+ `${interval.minTex} ${switchInequality(interval.leftInequalitySymbol)} x ${interval.rightInequalitySymbol} ${interval.maxTex}`,
92
+ `${interval.minTex} ${interval.leftInequalitySymbol} x ${switchInequality(interval.rightInequalitySymbol)} ${interval.maxTex}`,
93
+ `${interval.minTex} ${switchInequality(interval.leftInequalitySymbol)} x ${switchInequality(interval.rightInequalitySymbol)} ${interval.maxTex}`,
94
+ ];
95
+ wrongStatements.forEach((statement) => {
96
+ res.push({
97
+ id: (0, uuid_1.v4)(),
98
+ statement,
99
+ isRightAnswer: false,
100
+ format: 'tex',
101
+ });
102
+ });
103
+ }
104
+ }
105
+ else {
106
+ res.push({
107
+ id: (0, uuid_1.v4)(),
108
+ statement: `x \\in \\left${reverseBracket(interval.leftBracket)}${interval.insideToTex()}\\right${interval.rightBracket}`,
109
+ isRightAnswer: true,
110
+ format: 'tex',
111
+ });
112
+ res.push({
113
+ id: (0, uuid_1.v4)(),
114
+ statement: `x \\in \\left${interval.leftBracket}${interval.insideToTex()}\\right${reverseBracket(interval.rightBracket)}`,
115
+ isRightAnswer: true,
116
+ format: 'tex',
117
+ });
118
+ res.push({
119
+ id: (0, uuid_1.v4)(),
120
+ statement: `x \\in \\left${reverseBracket(interval.leftBracket)}${interval.insideToTex()}\\right${reverseBracket(interval.rightBracket)}`,
121
+ isRightAnswer: true,
122
+ format: 'tex',
123
+ });
124
+ }
125
+ return (0, shuffle_1.shuffle)(res);
126
+ };
127
+ const question = {
128
+ answer,
129
+ instruction: instruction,
130
+ keys: ['x', 'belongs', 'inf', 'sup', 'geq', 'leq', 'lbracket', 'rbracket', 'semicolon'],
131
+ getPropositions,
132
+ answerFormat: 'tex',
133
+ };
134
+ return question;
135
+ }
136
+ exports.getInequalityToIntervalQuestion = getInequalityToIntervalQuestion;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const intervalBelonging: Exercise;
3
+ export declare function getIntervalBelongingQuestion(): Question;
4
+ //# sourceMappingURL=intervalBelonging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intervalBelonging.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sets/intervals/intervalBelonging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK3E,eAAO,MAAM,iBAAiB,EAAE,QAW/B,CAAC;AAEF,wBAAgB,4BAA4B,IAAI,QAAQ,CA2CvD"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIntervalBelongingQuestion = exports.intervalBelonging = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const shuffle_1 = require("../../../utils/shuffle");
6
+ const uuid_1 = require("uuid");
7
+ exports.intervalBelonging = {
8
+ id: 'intervalBelonging',
9
+ connector: '=',
10
+ instruction: '',
11
+ label: '=',
12
+ levels: ['2nde', '2ndPro', '1reESM'],
13
+ isSingleStep: true,
14
+ sections: ['Ensembles et intervalles'],
15
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIntervalBelongingQuestion, nb),
16
+ qcmTimer: 60,
17
+ freeTimer: 60,
18
+ };
19
+ function getIntervalBelongingQuestion() {
20
+ const getPropositions = (n) => {
21
+ const res = [];
22
+ res.push({
23
+ id: (0, uuid_1.v4)(),
24
+ statement: ``,
25
+ isRightAnswer: true,
26
+ format: 'tex',
27
+ });
28
+ const missing = n - res.length;
29
+ for (let i = 0; i < missing; i++) {
30
+ let isDuplicate;
31
+ let proposition;
32
+ do {
33
+ const wrongAnswer = '';
34
+ proposition = {
35
+ id: (0, uuid_1.v4)() + ``,
36
+ statement: wrongAnswer,
37
+ isRightAnswer: false,
38
+ format: 'tex',
39
+ };
40
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
41
+ } while (isDuplicate);
42
+ res.push(proposition);
43
+ }
44
+ return (0, shuffle_1.shuffle)(res);
45
+ };
46
+ const question = {
47
+ answer: ``,
48
+ instruction: ``,
49
+ keys: [],
50
+ getPropositions,
51
+ answerFormat: 'tex',
52
+ };
53
+ return question;
54
+ }
55
+ exports.getIntervalBelongingQuestion = getIntervalBelongingQuestion;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const intervalsUnion: Exercise;
3
+ export declare function getIntervalsUnionQuestion(): Question;
4
+ //# sourceMappingURL=intervalsUnion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intervalsUnion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sets/intervals/intervalsUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK3E,eAAO,MAAM,cAAc,EAAE,QAW5B,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CA2CpD"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIntervalsUnionQuestion = exports.intervalsUnion = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const shuffle_1 = require("../../../utils/shuffle");
6
+ const uuid_1 = require("uuid");
7
+ exports.intervalsUnion = {
8
+ id: 'intervalsUnion',
9
+ connector: '=',
10
+ instruction: '',
11
+ label: "Déterminer l'union de deux intervalles",
12
+ levels: ['2nde', '2ndPro', '1reTech', 'CAP'],
13
+ isSingleStep: true,
14
+ sections: ['Ensembles et intervalles'],
15
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIntervalsUnionQuestion, nb),
16
+ qcmTimer: 60,
17
+ freeTimer: 60,
18
+ };
19
+ function getIntervalsUnionQuestion() {
20
+ const getPropositions = (n) => {
21
+ const res = [];
22
+ res.push({
23
+ id: (0, uuid_1.v4)(),
24
+ statement: ``,
25
+ isRightAnswer: true,
26
+ format: 'tex',
27
+ });
28
+ const missing = n - res.length;
29
+ for (let i = 0; i < missing; i++) {
30
+ let isDuplicate;
31
+ let proposition;
32
+ do {
33
+ const wrongAnswer = '';
34
+ proposition = {
35
+ id: (0, uuid_1.v4)() + ``,
36
+ statement: wrongAnswer,
37
+ isRightAnswer: false,
38
+ format: 'tex',
39
+ };
40
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
41
+ } while (isDuplicate);
42
+ res.push(proposition);
43
+ }
44
+ return (0, shuffle_1.shuffle)(res);
45
+ };
46
+ const question = {
47
+ answer: ``,
48
+ instruction: ``,
49
+ keys: [],
50
+ getPropositions,
51
+ answerFormat: 'tex',
52
+ };
53
+ return question;
54
+ }
55
+ exports.getIntervalsUnionQuestion = getIntervalsUnionQuestion;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../exercises/exercise';
2
+ export declare const setBelonging: Exercise;
3
+ export declare function getSetBelongingQuestion(): Question;
4
+ //# sourceMappingURL=setBelonging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setBelonging.d.ts","sourceRoot":"","sources":["../../../src/exercises/sets/setBelonging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS3E,eAAO,MAAM,YAAY,EAAE,QAW1B,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAwElD"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSetBelongingQuestion = exports.setBelonging = void 0;
4
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
5
+ const decimal_1 = require("../../math/numbers/decimals/decimal");
6
+ const rational_1 = require("../../math/numbers/rationals/rational");
7
+ const randint_1 = require("../../math/utils/random/randint");
8
+ const random_1 = require("../../utils/random");
9
+ const shuffle_1 = require("../../utils/shuffle");
10
+ const uuid_1 = require("uuid");
11
+ exports.setBelonging = {
12
+ id: 'setBelonging',
13
+ connector: '\\iff',
14
+ instruction: '',
15
+ label: 'Déterminer le plus petit ensemble auquel un nombre appartient',
16
+ levels: ['2nde', '1reESM'],
17
+ isSingleStep: true,
18
+ sections: ['Ensembles et intervalles'],
19
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getSetBelongingQuestion, nb),
20
+ qcmTimer: 60,
21
+ freeTimer: 60,
22
+ };
23
+ function getSetBelongingQuestion() {
24
+ //N Z D Q R (racine2, pi)
25
+ //fraction simplifiable en décimal/entier
26
+ //racine carrée simplifiable en entier / Fraction
27
+ //
28
+ const type = (0, randint_1.randint)(0, 5);
29
+ let answer = '';
30
+ let nb = '';
31
+ switch (type) {
32
+ case 0:
33
+ nb = (0, randint_1.randint)(0, 1000) + '';
34
+ answer = '\\mathbb{N}';
35
+ break;
36
+ case 1:
37
+ nb = -(0, randint_1.randint)(0, 1000) + '';
38
+ answer = '\\mathbb{Z}';
39
+ break;
40
+ case 2:
41
+ nb = decimal_1.DecimalConstructor.random(-50, 50, (0, randint_1.randint)(1, 4)).toTree().toTex();
42
+ answer = '\\mathbb{D}';
43
+ break;
44
+ case 3:
45
+ nb = rational_1.RationalConstructor.randomIrreductible().toTree().toTex();
46
+ answer = '\\mathbb{Q}';
47
+ break;
48
+ case 4:
49
+ nb = (0, random_1.random)(['\\sqrt 2', '\\pi']);
50
+ answer = '\\mathbb{R}';
51
+ break;
52
+ }
53
+ const getPropositions = (n) => {
54
+ const res = [];
55
+ const availableSets = ['N', 'Z', 'D', 'Q', 'R'].map((el) => `\\mathbb{${el}}`).filter((el) => el !== answer);
56
+ res.push({
57
+ id: (0, uuid_1.v4)(),
58
+ statement: answer,
59
+ isRightAnswer: true,
60
+ format: 'tex',
61
+ });
62
+ const missing = n - res.length;
63
+ for (let i = 0; i < missing; i++) {
64
+ let isDuplicate;
65
+ let proposition;
66
+ do {
67
+ const wrongAnswer = (0, random_1.random)(availableSets);
68
+ proposition = {
69
+ id: (0, uuid_1.v4)(),
70
+ statement: wrongAnswer,
71
+ isRightAnswer: false,
72
+ format: 'tex',
73
+ };
74
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
75
+ } while (isDuplicate);
76
+ res.push(proposition);
77
+ }
78
+ return (0, shuffle_1.shuffle)(res);
79
+ };
80
+ const question = {
81
+ answer,
82
+ instruction: `Donner le plus petit ensemble auquel le nombre $${nb}$ appartient.`,
83
+ keys: ['emptyset', 'naturals', 'integers', 'decimals', 'rationals', 'reals'],
84
+ getPropositions,
85
+ answerFormat: 'tex',
86
+ };
87
+ return question;
88
+ }
89
+ exports.getSetBelongingQuestion = getSetBelongingQuestion;
package/lib/index.js CHANGED
@@ -16,8 +16,7 @@ const getAllMathExercisesBySection = () => {
16
16
  }
17
17
  else {
18
18
  sectionsData.forEach((sectionData) => {
19
- var _a;
20
- (_a = data.find((d) => d.section === sectionData.section)) === null || _a === void 0 ? void 0 : _a.exos.push(exo);
19
+ data.find((d) => d.section === sectionData.section)?.exos.push(exo);
21
20
  });
22
21
  }
23
22
  });
@@ -136,8 +136,8 @@ class Triangle {
136
136
  `ShowLabel(${this.getSideCName()}, false)`,
137
137
  `ShowLabel(${this.getSideBName()}, false)`,
138
138
  `ShowLabel(${this.getSideBName()}, false)`,
139
- `ShowAxes(${showAxes !== null && showAxes !== void 0 ? showAxes : false})`,
140
- `ShowGrid(${showGrid !== null && showGrid !== void 0 ? showGrid : false})`,
139
+ `ShowAxes(${showAxes ?? false})`,
140
+ `ShowGrid(${showGrid ?? false})`,
141
141
  ];
142
142
  if (this.isRight())
143
143
  commands.push(`alpha = Angle(${this.vertexB.name},${this.vertexA.name},${this.vertexC.name}, Line(${this.vertexB.name},${this.vertexA.name}))`, `ShowLabel(alpha, false)`);
@@ -150,7 +150,7 @@ class Triangle {
150
150
  temp = [this.vertexB.name, this.vertexC.name, this.vertexA.name];
151
151
  if (highlightedAngle === this.vertexA.name)
152
152
  temp = [this.vertexC.name, this.vertexA.name, this.vertexB.name];
153
- commands.push(`be = Angle(${temp[0]}, ${temp[1]}, ${temp[2]}, Line(${temp[0]}, ${temp[1]}))`, `ShowLabel(be, false)`, `SetColor(be, "${colorHighlightedAngle !== null && colorHighlightedAngle !== void 0 ? colorHighlightedAngle : defautColor}")`);
153
+ commands.push(`be = Angle(${temp[0]}, ${temp[1]}, ${temp[2]}, Line(${temp[0]}, ${temp[1]}))`, `ShowLabel(be, false)`, `SetColor(be, "${colorHighlightedAngle ?? defautColor}")`);
154
154
  }
155
155
  if (showLabels)
156
156
  for (let i = 0; i < showLabels.length; i++) {
@@ -159,7 +159,7 @@ class Triangle {
159
159
  commands.push(`SetCaption(${showLabels[i]}, "${setCaptions[i]}")`);
160
160
  }
161
161
  if (highlightedSide)
162
- commands.push(`SetColor(${highlightedSide}, "${colorHighlightedSide !== null && colorHighlightedSide !== void 0 ? colorHighlightedSide : defautColor}")`);
162
+ commands.push(`SetColor(${highlightedSide}, "${colorHighlightedSide ?? defautColor}")`);
163
163
  return commands;
164
164
  }
165
165
  generateCoords() {
@@ -69,7 +69,6 @@ class Polynomial {
69
69
  return roots.sort((a, b) => a - b);
70
70
  }
71
71
  add(P) {
72
- var _a, _b;
73
72
  if (P.variable !== this.variable)
74
73
  throw Error("Can't add two polynomials with different variables");
75
74
  const newDegree = P.degree === this.degree && P.coefficients[P.degree] === -this.coefficients[this.degree]
@@ -77,7 +76,7 @@ class Polynomial {
77
76
  : Math.max(P.degree, this.degree);
78
77
  const res = [];
79
78
  for (let i = 0; i < newDegree + 1; i++) {
80
- res[i] = ((_a = P.coefficients[i]) !== null && _a !== void 0 ? _a : 0) + ((_b = this.coefficients[i]) !== null && _b !== void 0 ? _b : 0);
79
+ res[i] = (P.coefficients[i] ?? 0) + (this.coefficients[i] ?? 0);
81
80
  }
82
81
  return new Polynomial(res, this.variable);
83
82
  }
@@ -2,6 +2,9 @@ import { Nombre, NumberType } from '../../../math/numbers/nombre';
2
2
  import { DiscreteSet } from '../discreteSet';
3
3
  import { MathSet } from '../mathSet';
4
4
  import { MathSetInterface } from '../mathSetInterface';
5
+ export declare abstract class IntervalConstructor {
6
+ static random(): Interval;
7
+ }
5
8
  declare enum BoundType {
6
9
  OO = "]a;b[",
7
10
  OF = "]a;b]",
@@ -10,8 +13,14 @@ declare enum BoundType {
10
13
  }
11
14
  export declare class Interval implements MathSetInterface {
12
15
  min: number;
16
+ minTex: string;
13
17
  max: number;
18
+ maxTex: string;
14
19
  boundType: BoundType;
20
+ leftBracket: '[' | ']';
21
+ rightBracket: '[' | ']';
22
+ leftInequalitySymbol: '\\leq' | '<' | '\\geq' | '>';
23
+ rightInequalitySymbol: '\\leq' | '<' | '\\geq' | '>';
15
24
  type: NumberType;
16
25
  tex: string;
17
26
  /**
@@ -21,6 +30,8 @@ export declare class Interval implements MathSetInterface {
21
30
  exclude(nb: number): MathSet;
22
31
  difference(set: DiscreteSet): MathSet;
23
32
  toTex(): string;
33
+ insideToTex(): string;
34
+ toInequality(): string;
24
35
  getRandomElement(precision?: number): Nombre;
25
36
  }
26
37
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"intervals.d.ts","sourceRoot":"","sources":["../../../../src/math/sets/intervals/intervals.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,aAAK,SAAS;IACZ,EAAE,UAAU;IACZ,EAAE,UAAU;IACZ,EAAE,UAAU;IACZ,EAAE,UAAU;CACb;AAED,qBAAa,QAAS,YAAW,gBAAgB;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;gBACS,GAAG,SAAc;IA+C7B,OAAO,CAAC,EAAE,EAAE,MAAM;IAWlB,UAAU,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO;IAYrC,KAAK,IAAI,MAAM;IAIf,gBAAgB,CAAC,SAAS,GAAE,MAAiD,GAAG,MAAM;CAYvF"}
1
+ {"version":3,"file":"intervals.d.ts","sourceRoot":"","sources":["../../../../src/math/sets/intervals/intervals.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAM/D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,8BAAsB,mBAAmB;IACvC,MAAM,CAAC,MAAM;CA2Cd;AACD,aAAK,SAAS;IACZ,EAAE,UAAU;IACZ,EAAE,UAAU;IACZ,EAAE,UAAU;IACZ,EAAE,UAAU;CACb;AAED,qBAAa,QAAS,YAAW,gBAAgB;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,GAAG,GAAG,GAAG,CAAC;IACvB,YAAY,EAAE,GAAG,GAAG,GAAG,CAAC;IACxB,oBAAoB,EAAE,OAAO,GAAG,GAAG,GAAG,OAAO,GAAG,GAAG,CAAC;IACpD,qBAAqB,EAAE,OAAO,GAAG,GAAG,GAAG,OAAO,GAAG,GAAG,CAAC;IAErD,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;gBACS,GAAG,SAAc;IAgE7B,OAAO,CAAC,EAAE,EAAE,MAAM;IAWlB,UAAU,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO;IAYrC,KAAK,IAAI,MAAM;IAGf,WAAW,IAAI,MAAM;IAIrB,YAAY,IAAI,MAAM;IAetB,gBAAgB,CAAC,SAAS,GAAE,MAAiD,GAAG,MAAM;CAYvF"}
@@ -1,12 +1,59 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Interval = void 0;
3
+ exports.Interval = exports.IntervalConstructor = void 0;
4
4
  const epsilon_1 = require("../../../math/numbers/epsilon");
5
5
  const integer_1 = require("../../../math/numbers/integer/integer");
6
6
  const nombre_1 = require("../../../math/numbers/nombre");
7
7
  const real_1 = require("../../../math/numbers/reals/real");
8
+ const randint_1 = require("../../../math/utils/random/randint");
8
9
  const round_1 = require("../../../math/utils/round");
10
+ const coinFlip_1 = require("../../../utils/coinFlip");
9
11
  const mathSet_1 = require("../mathSet");
12
+ class IntervalConstructor {
13
+ static random() {
14
+ let tex = '';
15
+ const randType = (0, randint_1.randint)(0, 6);
16
+ let a, b;
17
+ switch (randType) {
18
+ case 0:
19
+ b = (0, randint_1.randint)(-10, 10);
20
+ tex = `]-\\infty;${b}${(0, coinFlip_1.coinFlip)() ? ']' : '['}`;
21
+ break;
22
+ case 1:
23
+ a = (0, randint_1.randint)(-10, 10);
24
+ tex = `${(0, coinFlip_1.coinFlip)() ? ']' : '['}${a};+\\infty[`;
25
+ break;
26
+ case 2:
27
+ a = (0, randint_1.randint)(-10, 10);
28
+ b = (0, randint_1.randint)(a + 1, a + 10);
29
+ tex = `[${a};${b}]`;
30
+ break;
31
+ case 3:
32
+ a = (0, randint_1.randint)(-10, 10);
33
+ b = (0, randint_1.randint)(a + 1, a + 10);
34
+ tex = `]${a};${b}]`;
35
+ break;
36
+ case 4:
37
+ a = (0, randint_1.randint)(-10, 10);
38
+ b = (0, randint_1.randint)(a + 1, a + 10);
39
+ tex = `[${a};${b}[`;
40
+ break;
41
+ case 5:
42
+ a = (0, randint_1.randint)(-10, 10);
43
+ b = (0, randint_1.randint)(a + 1, a + 10);
44
+ tex = `]${a};${b}[`;
45
+ break;
46
+ }
47
+ //-inf; x[
48
+ //[x; inf
49
+ //[a,b]
50
+ //[ [
51
+ //] ]
52
+ //] [
53
+ return new Interval(tex);
54
+ }
55
+ }
56
+ exports.IntervalConstructor = IntervalConstructor;
10
57
  var BoundType;
11
58
  (function (BoundType) {
12
59
  BoundType["OO"] = "]a;b[";
@@ -27,17 +74,35 @@ class Interval {
27
74
  const left = tex[0];
28
75
  const right = tex[tex.length - 1];
29
76
  const [a, b] = tex.slice(isInt ? 2 : 1, isInt ? tex.length - 2 : tex.length - 1).split(';');
77
+ this.minTex = a;
78
+ this.maxTex = b;
30
79
  switch (`${left}a;b${right}`) {
31
80
  case '[a;b]':
81
+ this.leftBracket = '[';
82
+ this.leftInequalitySymbol = '\\leq';
83
+ this.rightInequalitySymbol = '\\leq';
84
+ this.rightBracket = ']';
32
85
  this.boundType = BoundType.FF;
33
86
  break;
34
87
  case ']a;b[':
88
+ this.leftBracket = ']';
89
+ this.rightBracket = '[';
90
+ this.leftInequalitySymbol = '<';
91
+ this.rightInequalitySymbol = '<';
35
92
  this.boundType = BoundType.OO;
36
93
  break;
37
94
  case '[a;b[':
95
+ this.leftBracket = '[';
96
+ this.rightBracket = '[';
97
+ this.leftInequalitySymbol = '\\leq';
98
+ this.rightInequalitySymbol = '<';
38
99
  this.boundType = BoundType.FO;
39
100
  break;
40
101
  case ']a;b]':
102
+ this.leftBracket = ']';
103
+ this.rightBracket = ']';
104
+ this.leftInequalitySymbol = '<';
105
+ this.rightInequalitySymbol = '\\leq';
41
106
  this.boundType = BoundType.OF;
42
107
  break;
43
108
  default:
@@ -87,6 +152,28 @@ class Interval {
87
152
  toTex() {
88
153
  return this.tex;
89
154
  }
155
+ insideToTex() {
156
+ return this.tex.replaceAll('[', '').replaceAll(']', '');
157
+ }
158
+ toInequality() {
159
+ const isLeftClosed = this.boundType === BoundType.FO || this.boundType === BoundType.FF;
160
+ const isRightClosed = this.boundType === BoundType.FF || this.boundType === BoundType.OF;
161
+ if (this.max === Infinity) {
162
+ if (isLeftClosed) {
163
+ return `x \\geq ${this.min}`;
164
+ }
165
+ else
166
+ return `x > ${this.min}`;
167
+ }
168
+ else if (this.min === -Infinity) {
169
+ if (this.boundType === BoundType.OF) {
170
+ return `x \\leq ${this.max}`;
171
+ }
172
+ else
173
+ return `x < ${this.max}`;
174
+ }
175
+ return `${this.min} ${isLeftClosed ? '\\leq' : '<'} x ${isRightClosed ? '\\leq' : '<'} ${this.max}`;
176
+ }
90
177
  getRandomElement(precision = this.type === nombre_1.NumberType.Integer ? 0 : 2) {
91
178
  if (this.min === -Infinity || this.max === Infinity)
92
179
  throw Error("Can't chose amongst infinity");
package/lib/server.js CHANGED
@@ -21,7 +21,7 @@ const runServer = () => {
21
21
  const exo = allExercises[exoIndex];
22
22
  if (!exo)
23
23
  res.send('Exo not found');
24
- const questions = exo === null || exo === void 0 ? void 0 : exo.generator(10);
24
+ const questions = exo?.generator(10);
25
25
  res.json({
26
26
  exercise: exo,
27
27
  questions,
@@ -35,10 +35,9 @@ const runServer = () => {
35
35
  const exo = allExercises[exoIndex];
36
36
  if (!exo)
37
37
  res.send('Exo not found');
38
- const questions = exo === null || exo === void 0 ? void 0 : exo.generator(10);
39
- const populatedQuestions = questions === null || questions === void 0 ? void 0 : questions.map((q) => {
40
- var _a;
41
- return Object.assign(Object.assign({}, q), { propositions: (_a = q.getPropositions) === null || _a === void 0 ? void 0 : _a.call(q, 4) });
38
+ const questions = exo?.generator(10);
39
+ const populatedQuestions = questions?.map((q) => {
40
+ return { ...q, propositions: q.getPropositions?.(4) };
42
41
  });
43
42
  res.json({
44
43
  exercise: exo,
@@ -17,7 +17,7 @@ class OppositeNode extends functionNode_1.FunctionNode {
17
17
  let needBrackets = childTex[0] === '-';
18
18
  if (this.child.type === node_1.NodeType.operator) {
19
19
  const operatorChild = this.child;
20
- needBrackets || (needBrackets = [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract].includes(operatorChild.id));
20
+ needBrackets ||= [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract].includes(operatorChild.id);
21
21
  }
22
22
  if (this.child.type === node_1.NodeType.number && childTex[0] === '-') {
23
23
  return childTex.substring(1);
@@ -25,7 +25,7 @@ class DivideNode extends operatorNode_1.OperatorNode {
25
25
  let needBrackets = rightTex[0] === '-';
26
26
  if (this.rightChild.type === node_1.NodeType.operator) {
27
27
  const operatorRightChild = this.rightChild;
28
- needBrackets || (needBrackets = [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.divide].includes(operatorRightChild.id));
28
+ needBrackets ||= [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.divide].includes(operatorRightChild.id);
29
29
  }
30
30
  if (needBrackets)
31
31
  rightTex = `(${rightTex})`;
@@ -33,7 +33,7 @@ class MultiplyNode extends operatorNode_1.OperatorNode {
33
33
  let needBrackets = rightTex[0] === '-';
34
34
  if (this.rightChild.type === node_1.NodeType.operator) {
35
35
  const operatorRightChild = this.rightChild;
36
- needBrackets || (needBrackets = [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract].includes(operatorRightChild.id));
36
+ needBrackets ||= [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract].includes(operatorRightChild.id);
37
37
  }
38
38
  if (needBrackets)
39
39
  rightTex = `(${rightTex})`;
@@ -41,7 +41,7 @@ class MultiplyNode extends operatorNode_1.OperatorNode {
41
41
  let showTimesSign = !isNaN(+rightTex[0]) || this.rightChild.type === node_1.NodeType.number;
42
42
  if (this.rightChild.type === node_1.NodeType.operator) {
43
43
  const operatorRightChild = this.rightChild;
44
- showTimesSign || (showTimesSign = [operatorNode_1.OperatorIds.fraction].includes(operatorRightChild.id));
44
+ showTimesSign ||= [operatorNode_1.OperatorIds.fraction].includes(operatorRightChild.id);
45
45
  }
46
46
  return `${leftTex}${showTimesSign ? '\\times ' : ''}${rightTex}`;
47
47
  }
@@ -17,14 +17,14 @@ class PowerNode extends operatorNode_1.OperatorNode {
17
17
  let needBrackets = leftTex[0] === '-';
18
18
  if (this.leftChild.type === node_1.NodeType.operator) {
19
19
  const childOperator = this.leftChild;
20
- needBrackets || (needBrackets = [
20
+ needBrackets ||= [
21
21
  operatorNode_1.OperatorIds.add,
22
22
  operatorNode_1.OperatorIds.substract,
23
23
  operatorNode_1.OperatorIds.multiply,
24
24
  operatorNode_1.OperatorIds.divide,
25
25
  operatorNode_1.OperatorIds.fraction,
26
26
  operatorNode_1.OperatorIds.power,
27
- ].includes(childOperator.id));
27
+ ].includes(childOperator.id);
28
28
  }
29
29
  if (needBrackets)
30
30
  leftTex = `(${leftTex})`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "1.3.61",
3
+ "version": "1.3.63",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -29,7 +29,7 @@
29
29
  "express": "^4.18.2",
30
30
  "nodemon": "^2.0.20",
31
31
  "prettier": "^2.8.4",
32
- "react-math-keyboard": "^1.2.39",
32
+ "react-math-keyboard": "^1.3.1",
33
33
  "ts-node": "^10.9.1",
34
34
  "ts-node-dev": "^2.0.0",
35
35
  "tsc-alias": "^1.8.2",