math-exercises 1.4.13 → 1.4.15

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 (76) hide show
  1. package/lib/exercises/calcul/arithmetics/primeNumbers.js +1 -1
  2. package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.js +1 -1
  3. package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.js +1 -1
  4. package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.js +1 -1
  5. package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.js +1 -1
  6. package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.js +1 -1
  7. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.js +1 -1
  8. package/lib/exercises/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
  9. package/lib/exercises/calculLitteral/equation/firstDegreeEquation.js +2 -1
  10. package/lib/exercises/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
  11. package/lib/exercises/calculLitteral/equation/fractionEquation.js +2 -3
  12. package/lib/exercises/calculLitteral/equation/logEquation.d.ts.map +1 -1
  13. package/lib/exercises/calculLitteral/equation/logEquation.js +2 -1
  14. package/lib/exercises/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  15. package/lib/exercises/calculLitteral/equation/multiplicationEquation.js +6 -2
  16. package/lib/exercises/conversion/aeraConversion.d.ts.map +1 -1
  17. package/lib/exercises/conversion/aeraConversion.js +1 -1
  18. package/lib/exercises/conversion/capacityConversion.d.ts.map +1 -1
  19. package/lib/exercises/conversion/capacityConversion.js +1 -1
  20. package/lib/exercises/conversion/lengthConversion.d.ts.map +1 -1
  21. package/lib/exercises/conversion/lengthConversion.js +1 -1
  22. package/lib/exercises/conversion/massConversion.d.ts.map +1 -1
  23. package/lib/exercises/conversion/massConversion.js +1 -1
  24. package/lib/exercises/conversion/volumeCapacityConversion.js +1 -1
  25. package/lib/exercises/conversion/volumeConversion.d.ts.map +1 -1
  26. package/lib/exercises/conversion/volumeConversion.js +1 -1
  27. package/lib/exercises/derivation/derivative/firstDegreeDerivative.js +1 -1
  28. package/lib/exercises/derivation/derivative/inverseFunctionDerivative.js +1 -1
  29. package/lib/exercises/derivation/derivative/rootFunctionDerivative.js +2 -2
  30. package/lib/exercises/derivation/derivative/secondDegreeDerivative.js +1 -1
  31. package/lib/exercises/derivation/derivative/thirdDegreeDerivative.js +3 -2
  32. package/lib/exercises/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
  33. package/lib/exercises/derivation/derivative/thirdDegreeFunctionVariation.js +5 -7
  34. package/lib/exercises/exercise.d.ts.map +1 -1
  35. package/lib/exercises/functions/affines/leadingCoefficientCalculV1.d.ts.map +1 -1
  36. package/lib/exercises/functions/affines/leadingCoefficientCalculV1.js +2 -1
  37. package/lib/exercises/functions/affines/leadingCoefficientCalculV2.d.ts.map +1 -1
  38. package/lib/exercises/functions/affines/leadingCoefficientCalculV2.js +4 -2
  39. package/lib/exercises/functions/affines/signFunction.js +6 -6
  40. package/lib/exercises/functions/basics/inverseImageFunction.js +1 -1
  41. package/lib/exercises/functions/basics/inverseImageFunctionGeogebra.js +2 -2
  42. package/lib/exercises/functions/cube/cubicEquation.js +1 -1
  43. package/lib/exercises/geometry/cartesian/midpoint.js +1 -1
  44. package/lib/exercises/geometry/euclidean/circleArea.js +1 -1
  45. package/lib/exercises/geometry/euclidean/circleCircumference.js +1 -1
  46. package/lib/exercises/geometry/euclidean/rightTriangleArea.js +1 -1
  47. package/lib/exercises/geometry/euclidean/thales.d.ts.map +1 -1
  48. package/lib/exercises/geometry/euclidean/thales.js +1 -3
  49. package/lib/exercises/geometry/euclidean/triangleArea.js +1 -1
  50. package/lib/exercises/geometry/euclidean/trigonometrySideCalcul.js +1 -1
  51. package/lib/exercises/percent/applyPercent.js +8 -7
  52. package/lib/exercises/percent/averageEvolutionRate.js +1 -1
  53. package/lib/exercises/percent/globalPercent.js +1 -1
  54. package/lib/exercises/percent/reciprocalPercentage.js +1 -1
  55. package/lib/exercises/powers/powersOfTenToDecimal.js +1 -1
  56. package/lib/exercises/primitve/logarithmePrimitive.js +1 -1
  57. package/lib/exercises/primitve/polynomialPrimitive.d.ts.map +1 -1
  58. package/lib/exercises/primitve/polynomialPrimitive.js +12 -4
  59. package/lib/exercises/probaStat/averageWithTable.js +1 -1
  60. package/lib/exercises/probaStat/cardBasicProbas.d.ts.map +1 -1
  61. package/lib/exercises/probaStat/cardBasicProbas.js +0 -1
  62. package/lib/exercises/probaStat/conditionalProbability.js +1 -1
  63. package/lib/exercises/probaStat/median.js +1 -1
  64. package/lib/exercises/probaStat/medianList.js +1 -1
  65. package/lib/exercises/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  66. package/lib/exercises/sets/intervals/inequalityToInterval.js +3 -3
  67. package/lib/exercises/sets/setBelonging.js +1 -1
  68. package/lib/exercises/squareRoots/squareRootEquation.js +1 -1
  69. package/lib/math/complex/complex.d.ts +1 -1
  70. package/lib/math/complex/complex.d.ts.map +1 -1
  71. package/lib/math/complex/complex.js +9 -0
  72. package/lib/math/sets/intervals/intervals.js +2 -2
  73. package/lib/tree/nodes/numbers/numberNode.js +3 -3
  74. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  75. package/lib/tree/nodes/operators/fractionNode.js +7 -0
  76. package/package.json +1 -1
@@ -42,7 +42,7 @@ function getPrimeNumbers() {
42
42
  }
43
43
  const prod = prodNumbers(choosenNumbers);
44
44
  choosenNumbers = choosenNumbers.sort((a, b) => a - b);
45
- let answer = `${prod}=${choosenNumbers[0]}`;
45
+ let answer = `${choosenNumbers[0]}`;
46
46
  for (let i = 1; i < choosenNumbers.length; i++) {
47
47
  answer += `\\times` + choosenNumbers[i];
48
48
  }
@@ -111,7 +111,7 @@ function getFractionToPercentToDecimal() {
111
111
  };
112
112
  const question = {
113
113
  instruction,
114
- answer,
114
+ answer: answer.replace('.', ','),
115
115
  keys: ['percent'],
116
116
  getPropositions,
117
117
  answerFormat: 'tex',
@@ -72,7 +72,7 @@ function getMentalAddAndSub() {
72
72
  const question = {
73
73
  instruction: `Calculer : $${statementTree.toTex()}$`,
74
74
  startStatement: statementTree.toTex(),
75
- answer: (0, round_1.round)(sum, 2) + '',
75
+ answer: ((0, round_1.round)(sum, 2) + '').replace('.', ','),
76
76
  keys: [],
77
77
  getPropositions,
78
78
  answerFormat: 'tex',
@@ -89,7 +89,7 @@ function getMentalDivisions() {
89
89
  const question = {
90
90
  instruction: `Calculer : $${statementTree.toTex()}$`,
91
91
  startStatement: statementTree.toTex(),
92
- answer: (0, round_1.round)(answer, 2) + '',
92
+ answer: ((0, round_1.round)(answer, 2) + '').replace('.', ','),
93
93
  keys: [],
94
94
  getPropositions,
95
95
  answerFormat: 'tex',
@@ -73,7 +73,7 @@ function getMentalMultiplications() {
73
73
  const question = {
74
74
  instruction: `Calculer : $${statementTree.toTex()}$`,
75
75
  startStatement: statementTree.toTex(),
76
- answer: (0, round_1.round)(answer, 2) + '',
76
+ answer: ((0, round_1.round)(answer, 2) + '').replace('.', ','),
77
77
  keys: [],
78
78
  getPropositions,
79
79
  answerFormat: 'tex',
@@ -127,7 +127,7 @@ function getMentalPercentage() {
127
127
  };
128
128
  const question = {
129
129
  instruction: `Calculer : $${String(a).replace('.', ',')}\\%$ de $${b}$.`,
130
- answer: (a * b) / 100 + '',
130
+ answer: ((a * b) / 100 + '').replace('.', ','),
131
131
  keys: [],
132
132
  getPropositions,
133
133
  answerFormat: 'tex',
@@ -41,7 +41,7 @@ function getEquationSimpleSquare() {
41
41
  const instruction = `Résoudre l'équation : $x^2 = ${randNbr}$`;
42
42
  const ans = Math.sqrt(randNbr);
43
43
  if (randNbr < 0)
44
- answer = `S=\\emptyset`;
44
+ answer = `S=\\varnothing`;
45
45
  else if (ans === Math.floor(ans))
46
46
  answer = `S=\\left\\{-${ans};${ans}\\right\\}`;
47
47
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"firstDegreeEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/firstDegreeEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ/E,eAAO,MAAM,mBAAmB,EAAE,YAYjC,CAAC;AAEF,wBAAgB,sBAAsB,IAAI,QAAQ,CAoDjD"}
1
+ {"version":3,"file":"firstDegreeEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/firstDegreeEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS/E,eAAO,MAAM,mBAAmB,EAAE,YAYjC,CAAC;AAEF,wBAAgB,sBAAsB,IAAI,QAAQ,CAoDjD"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFirstDegreeEquation = exports.firstDegreeEquation = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const rational_1 = require("../../../math/numbers/rationals/rational");
5
6
  const randint_1 = require("../../../math/utils/random/randint");
6
7
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
7
8
  const simplify_1 = require("../../../tree/parsers/simplify");
@@ -56,7 +57,7 @@ function getFirstDegreeEquation() {
56
57
  const question = {
57
58
  instruction: `Résoudre l'équation suivante : $\\frac{${a}}{x} = ${b}$`,
58
59
  startStatement: `x`,
59
- answer: `x=${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(a / b)).toTex()}`,
60
+ answer: `x=${new rational_1.Rational(a, b).simplify().toTree().toTex()}`,
60
61
  keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
61
62
  getPropositions,
62
63
  answerFormat: 'tex',
@@ -1 +1 @@
1
- {"version":3,"file":"fractionEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/fractionEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU/E,eAAO,MAAM,gBAAgB,EAAE,YAY9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAmE9C"}
1
+ {"version":3,"file":"fractionEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/fractionEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW/E,eAAO,MAAM,gBAAgB,EAAE,YAY9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAiE9C"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFractionEquation = exports.fractionEquation = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const rational_1 = require("../../../math/numbers/rationals/rational");
5
6
  const polynomial_1 = require("../../../math/polynomials/polynomial");
6
7
  const randint_1 = require("../../../math/utils/random/randint");
7
8
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
@@ -30,9 +31,7 @@ function getFractionEquation() {
30
31
  const d = (0, randint_1.randint)(-9, 10, [0]);
31
32
  const polynome1 = new polynomial_1.Polynomial([b, a]);
32
33
  const polynome2 = new polynomial_1.Polynomial([d, c]);
33
- const answer = -d / c === -b / a
34
- ? `S=\\emptyset`
35
- : `S=\\left\\{${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-b), new numberNode_1.NumberNode(a))).toTex()}\\right\\}`;
34
+ const answer = -d / c === -b / a ? `S=\\emptyset` : `S=\\left\\{${new rational_1.Rational(-b, a).simplify().toTree().toTex()}\\right\\}`;
36
35
  const getPropositions = (n) => {
37
36
  const res = [];
38
37
  res.push({
@@ -1 +1 @@
1
- {"version":3,"file":"logEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/logEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAc/E,eAAO,MAAM,WAAW,EAAE,YAYzB,CAAC;AAEF,wBAAgB,aAAa,IAAI,QAAQ,CAuDxC"}
1
+ {"version":3,"file":"logEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/logEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAe/E,eAAO,MAAM,WAAW,EAAE,YAYzB,CAAC;AAEF,wBAAgB,aAAa,IAAI,QAAQ,CAuDxC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLnEquation = exports.logEquation = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const rational_1 = require("../../../math/numbers/rationals/rational");
5
6
  const randint_1 = require("../../../math/utils/random/randint");
6
7
  const expNode_1 = require("../../../tree/nodes/functions/expNode");
7
8
  const logNode_1 = require("../../../tree/nodes/functions/logNode");
@@ -30,7 +31,7 @@ function getLnEquation() {
30
31
  const a = (0, randint_1.randint)(-9, 20, [0]);
31
32
  const k = (0, randint_1.randint)(-9, 20, [0]);
32
33
  const equation = new equalNode_1.EqualNode((0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new logNode_1.LogNode(new variableNode_1.VariableNode('x')))), new numberNode_1.NumberNode(k));
33
- const answer = new expNode_1.ExpNode((0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(k), new numberNode_1.NumberNode(a))));
34
+ const answer = new expNode_1.ExpNode(new rational_1.Rational(k, a).simplify().toTree());
34
35
  const getPropositions = (numOptions) => {
35
36
  const propositions = [];
36
37
  propositions.push({
@@ -1 +1 @@
1
- {"version":3,"file":"multiplicationEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/multiplicationEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU/E,eAAO,MAAM,sBAAsB,EAAE,YAYpC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CA0EpD"}
1
+ {"version":3,"file":"multiplicationEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/multiplicationEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW/E,eAAO,MAAM,sBAAsB,EAAE,YAYpC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CAyEpD"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMultiplicationEquation = exports.multiplicationEquation = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const rational_1 = require("../../../math/numbers/rationals/rational");
5
6
  const polynomial_1 = require("../../../math/polynomials/polynomial");
6
7
  const randint_1 = require("../../../math/utils/random/randint");
7
8
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
@@ -33,7 +34,10 @@ function getMultiplicationEquation() {
33
34
  } while (a / c === b / d);
34
35
  const polynome1 = new polynomial_1.Polynomial([b, a]);
35
36
  const polynome2 = new polynomial_1.Polynomial([d, c]);
36
- const answer = `S=\\left\\{${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-b), new numberNode_1.NumberNode(a))).toTex()};${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-d), new numberNode_1.NumberNode(c))).toTex()}\\right\\}`;
37
+ const answer = `S=\\left\\{${new rational_1.Rational(-b, a).simplify().toTree().toTex()};${new rational_1.Rational(-d, c)
38
+ .simplify()
39
+ .toTree()
40
+ .toTex()}\\right\\}`;
37
41
  const getPropositions = (n) => {
38
42
  const res = [];
39
43
  res.push({
@@ -70,7 +74,7 @@ function getMultiplicationEquation() {
70
74
  const question = {
71
75
  instruction: `Résoudre : $(${polynome1.toTex()})(${polynome2.toTex()}) = 0$`,
72
76
  startStatement: `(${polynome1.toTex()})(${polynome2.toTex()}) = 0`,
73
- answer: `S=\\left\\{${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-b), new numberNode_1.NumberNode(a))).toTex()};${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-d), new numberNode_1.NumberNode(c))).toTex()}\\right\\}`,
77
+ answer,
74
78
  keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'ou'],
75
79
  getPropositions,
76
80
  answerFormat: 'tex',
@@ -1 +1 @@
1
- {"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/aeraConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,cAAc,EAAE,YAY5B,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,QAAQ,CAuD5C"}
1
+ {"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/aeraConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,cAAc,EAAE,YAY5B,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,QAAQ,CA0D5C"}
@@ -54,7 +54,7 @@ function getAeraConversion() {
54
54
  };
55
55
  const question = {
56
56
  instruction: `$${randomAera.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
57
- answer: randomAera.multiplyByPowerOfTen(2 * (randomUnitIndex - randomUnitInstructionIndex)).value + '',
57
+ answer: (randomAera.multiplyByPowerOfTen(2 * (randomUnitIndex - randomUnitInstructionIndex)).value + '').replace('.', ','),
58
58
  keys: [],
59
59
  getPropositions,
60
60
  answerFormat: 'tex',
@@ -1 +1 @@
1
- {"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/capacityConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,kBAAkB,EAAE,YAYhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAkDhD"}
1
+ {"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/capacityConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,kBAAkB,EAAE,YAYhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAqDhD"}
@@ -52,7 +52,7 @@ function getCapacityConversion() {
52
52
  };
53
53
  const question = {
54
54
  instruction: `$${randomCapacity.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
55
- answer: randomCapacity.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '',
55
+ answer: (randomCapacity.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '').replace('.', ','),
56
56
  keys: [],
57
57
  getPropositions,
58
58
  answerFormat: 'tex',
@@ -1 +1 @@
1
- {"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/lengthConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,gBAAgB,EAAE,YAY9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAiD9C"}
1
+ {"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/lengthConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,gBAAgB,EAAE,YAY9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAoD9C"}
@@ -51,7 +51,7 @@ function getLengthConversion() {
51
51
  };
52
52
  const question = {
53
53
  instruction: `$${randomlength.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
54
- answer: randomlength.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '',
54
+ answer: (randomlength.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '').replace('.', ','),
55
55
  keys: [],
56
56
  getPropositions,
57
57
  answerFormat: 'tex',
@@ -1 +1 @@
1
- {"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/massConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,cAAc,EAAE,YAY5B,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,QAAQ,CAiD5C"}
1
+ {"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/massConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,cAAc,EAAE,YAY5B,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,QAAQ,CAoD5C"}
@@ -51,7 +51,7 @@ function getMassConversion() {
51
51
  };
52
52
  const question = {
53
53
  instruction: `$${randomMass.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
54
- answer: randomMass.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '',
54
+ answer: (randomMass.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '').replace('.', ','),
55
55
  keys: [],
56
56
  getPropositions,
57
57
  answerFormat: 'tex',
@@ -68,7 +68,7 @@ function getVolumeCapacityConversion() {
68
68
  };
69
69
  const question = {
70
70
  instruction: `$${random.value}$ $${instructionUnit}$ = ... $${AsnwerUnit}$`,
71
- answer: answer.value + '',
71
+ answer: (answer.value + '').replace('.', ','),
72
72
  keys: [],
73
73
  getPropositions,
74
74
  answerFormat: 'tex',
@@ -1 +1 @@
1
- {"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/volumeConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,gBAAgB,EAAE,YAY9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAsD9C"}
1
+ {"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/volumeConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,gBAAgB,EAAE,YAY9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAyD9C"}
@@ -53,7 +53,7 @@ function getVolumeConversion() {
53
53
  };
54
54
  const question = {
55
55
  instruction: `$${randomVolume.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
56
- answer: randomVolume.multiplyByPowerOfTen(3 * (randomUnitIndex - randomUnitInstructionIndex)).value + '',
56
+ answer: (randomVolume.multiplyByPowerOfTen(3 * (randomUnitIndex - randomUnitInstructionIndex)).value + '').replace('.', ','),
57
57
  keys: [],
58
58
  getPropositions,
59
59
  answerFormat: 'tex',
@@ -55,7 +55,7 @@ function getFirstDegreeDerivative() {
55
55
  instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial.toString()}$.`,
56
56
  startStatement: `f'(x)`,
57
57
  answer: a + '',
58
- keys: [],
58
+ keys: ['x'],
59
59
  getPropositions,
60
60
  answerFormat: 'tex',
61
61
  };
@@ -53,7 +53,7 @@ function getInverseFunctionDerivative() {
53
53
  const question = {
54
54
  instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) =\\frac{${a}}{x}$.`,
55
55
  startStatement: `f'(x)`,
56
- answer: `\\frac{${-a}}{x^2}`,
56
+ answer: `${a > 0 ? '-' : ''}\\frac{${Math.abs(a)}}{x^2}`,
57
57
  keys: ['x'],
58
58
  getPropositions,
59
59
  answerFormat: 'tex',
@@ -31,9 +31,9 @@ function getRootFunctionDerivative() {
31
31
  else
32
32
  instruction += `$${a}\\sqrt{x}$.`;
33
33
  if (a % 2 === 0)
34
- answer = `\\frac{${a / 2}}{\\sqrt{x}}`;
34
+ answer = `${a < 0 ? '-' : ''}\\frac{${Math.abs(a / 2)}}{\\sqrt{x}}`;
35
35
  else
36
- answer = `\\frac{${a}}{2\\sqrt{x}}`;
36
+ answer = `${a < 0 ? '-' : ''}\\frac{${Math.abs(a)}}{2\\sqrt{x}}`;
37
37
  const getPropositions = (numOptions) => {
38
38
  const propositions = [];
39
39
  propositions.push({
@@ -62,7 +62,7 @@ function getSecondDegreeDerivative() {
62
62
  const question = {
63
63
  instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial.toString()}$.`,
64
64
  startStatement: `f'(x)`,
65
- answer: derivative.toString(),
65
+ answer: derivative.toTree().toTex(),
66
66
  keys: ['x'],
67
67
  getPropositions,
68
68
  answerFormat: 'tex',
@@ -26,11 +26,12 @@ function getThirdDegreeDerivative() {
26
26
  coefficients.push((0, randint_1.randint)(-9, 10, [0]));
27
27
  const polynomial = new polynomial_1.Polynomial(coefficients);
28
28
  const derivative = polynomial.derivate();
29
+ const answer = derivative.toTree().toTex();
29
30
  const getPropositions = (numOptions) => {
30
31
  const propositions = [];
31
32
  propositions.push({
32
33
  id: (0, uuid_1.v4)(),
33
- statement: derivative.toString(),
34
+ statement: answer,
34
35
  isRightAnswer: true,
35
36
  format: 'tex',
36
37
  });
@@ -63,7 +64,7 @@ function getThirdDegreeDerivative() {
63
64
  const question = {
64
65
  instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial.toString()}$.`,
65
66
  startStatement: `f'(x)`,
66
- answer: derivative.toString(),
67
+ answer: answer,
67
68
  keys: ['x'],
68
69
  getPropositions,
69
70
  answerFormat: 'tex',
@@ -1 +1 @@
1
- {"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ/E,eAAO,MAAM,4BAA4B,EAAE,YAY1C,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAkG1D"}
1
+ {"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ/E,eAAO,MAAM,4BAA4B,EAAE,YAY1C,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CA+F1D"}
@@ -30,9 +30,7 @@ function getThirdDegreeFunctionVariation() {
30
30
  const coin = (0, coinFlip_1.coinFlip)() ? -1 : 1;
31
31
  const instruction = `Soit $f$ la fonction représentée ci-dessous. Sur quel intervalle la dérivée de $f$ est-elle ` +
32
32
  (coin < 0 ? 'négative ?' : 'positive ?');
33
- const answer = coin * a < 0
34
- ? `\\left[${racine1};${racine2}\\right]`
35
- : `\\left]-\\infty;${racine1}\\right]\\cup\\left[${racine2};+\\infty\\right[`;
33
+ const answer = coin * a < 0 ? `[${racine1};${racine2}]` : `]-\\infty;${racine1}]\\cup[${racine2};+\\infty[`;
36
34
  const getPropositions = (n) => {
37
35
  const res = [];
38
36
  res.push({
@@ -43,21 +41,21 @@ function getThirdDegreeFunctionVariation() {
43
41
  });
44
42
  res.push({
45
43
  id: (0, uuid_1.v4)() + '',
46
- statement: `\\left[${racine2};+\\infty\\right[`,
44
+ statement: `[${racine2};+\\infty[`,
47
45
  isRightAnswer: false,
48
46
  format: 'tex',
49
47
  });
50
48
  if (n > 2)
51
49
  res.push({
52
50
  id: (0, uuid_1.v4)() + '',
53
- statement: `\\left]-\\infty;${racine1}\\right]`,
51
+ statement: `]-\\infty;${racine1}]`,
54
52
  isRightAnswer: false,
55
53
  format: 'tex',
56
54
  });
57
55
  if (n > 3)
58
56
  res.push({
59
57
  id: (0, uuid_1.v4)() + '',
60
- statement: `\\left]-\\infty;${racine1}\\right] \\cup \\left[${racine2};+\\infty\\right[`,
58
+ statement: `]-\\infty;${racine1}] \\cup [${racine2};+\\infty[`,
61
59
  isRightAnswer: false,
62
60
  format: 'tex',
63
61
  });
@@ -67,7 +65,7 @@ function getThirdDegreeFunctionVariation() {
67
65
  do {
68
66
  const racine1 = (0, randint_1.randint)(-5, 4);
69
67
  const racine2 = (0, randint_1.randint)(racine1 + 1, 6);
70
- const wrongAnswer = `\\left[${racine1};${racine2}\\right]`;
68
+ const wrongAnswer = `[${racine1};${racine2}]`;
71
69
  proposition = {
72
70
  id: (0, uuid_1.v4)() + '',
73
71
  statement: wrongAnswer,
@@ -1 +1 @@
1
- {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,eAAO,MAAM,iBAAiB,UAAW,WAAW,EAAE,aAAa,MAAM,WAAU,KAAK,GAAG,KAAK,SAS/F,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,WAAW,EAAE,KAAK,MAAM,kBAE3D,CAAC;AACF,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,EAAE,MAAM,CAAC;IACpB,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,cAAc,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IACvC,eAAe,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,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,KAAK,EAAE,CAAC;IACf,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,QAAQ,EAAE,CAAC;IAC9D,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,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
+ {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,eAAO,MAAM,iBAAiB,UAAW,WAAW,EAAE,aAAa,MAAM,WAAU,KAAK,GAAG,KAAK,SAS/F,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,WAAW,EAAE,KAAK,MAAM,kBAE3D,CAAC;AAEF,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,EAAE,MAAM,CAAC;IACpB,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,cAAc,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IACvC,eAAe,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,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,KAAK,EAAE,CAAC;IACf,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,QAAQ,EAAE,CAAC;IAC9D,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,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":"leadingCoefficientCalculV1.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/leadingCoefficientCalculV1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS/E,eAAO,MAAM,0BAA0B,EAAE,YAWxC,CAAC;AAEF,wBAAgB,qCAAqC,IAAI,QAAQ,CAoDhE"}
1
+ {"version":3,"file":"leadingCoefficientCalculV1.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/leadingCoefficientCalculV1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU/E,eAAO,MAAM,0BAA0B,EAAE,YAWxC,CAAC;AAEF,wBAAgB,qCAAqC,IAAI,QAAQ,CAoDhE"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLeadingCoefficientCalculV1Question = exports.leadingCoefficientCalculV1 = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const rational_1 = require("../../../math/numbers/rationals/rational");
5
6
  const randint_1 = require("../../../math/utils/random/randint");
6
7
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
7
8
  const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
@@ -52,7 +53,7 @@ function getLeadingCoefficientCalculV1Question() {
52
53
  const question = {
53
54
  instruction: `Soit $f$ une fonction affine telle que $f(${xA})$ = $${yA}$ et $f(${xB})$ = $${yB}$.$\\\\$Quel est le coefficient directeur de $f$ ?`,
54
55
  startStatement: 'a',
55
- answer: (0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(yB - yA), new numberNode_1.NumberNode(xB - xA))).toTex(),
56
+ answer: new rational_1.Rational(yB - yA, xB - xA).simplify().toTree().toTex(),
56
57
  getPropositions,
57
58
  answerFormat: 'tex',
58
59
  keys: [],
@@ -1 +1 @@
1
- {"version":3,"file":"leadingCoefficientCalculV2.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/leadingCoefficientCalculV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS/E,eAAO,MAAM,0BAA0B,EAAE,YAWxC,CAAC;AAEF,wBAAgB,qCAAqC,IAAI,QAAQ,CAmDhE"}
1
+ {"version":3,"file":"leadingCoefficientCalculV2.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/leadingCoefficientCalculV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU/E,eAAO,MAAM,0BAA0B,EAAE,YAWxC,CAAC;AAEF,wBAAgB,qCAAqC,IAAI,QAAQ,CAmDhE"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLeadingCoefficientCalculV1Question = exports.leadingCoefficientCalculV2 = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const rational_1 = require("../../../math/numbers/rationals/rational");
5
6
  const randint_1 = require("../../../math/utils/random/randint");
6
7
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
7
8
  const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
@@ -24,11 +25,12 @@ function getLeadingCoefficientCalculV1Question() {
24
25
  const [xA, yA] = [1, 2].map((el) => (0, randint_1.randint)(-9, 10));
25
26
  const xB = (0, randint_1.randint)(-9, 10, [xA]);
26
27
  const yB = (0, randint_1.randint)(-9, 10);
28
+ const answer = new rational_1.Rational(yB - yA, xB - xA).simplify().toTree().toTex();
27
29
  const getPropositions = (n) => {
28
30
  const res = [];
29
31
  res.push({
30
32
  id: (0, uuid_1.v4)() + '',
31
- statement: (0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(yB - yA), new numberNode_1.NumberNode(xB - xA))).toTex(),
33
+ statement: answer,
32
34
  isRightAnswer: true,
33
35
  format: 'tex',
34
36
  });
@@ -51,7 +53,7 @@ function getLeadingCoefficientCalculV1Question() {
51
53
  };
52
54
  const question = {
53
55
  instruction: `Soit $d$ une droite passant par les points $A(${xA};${yA})$ et $B(${xB};${yB})$.$\\\\$Déterminer le coefficient directeur de $d$.`,
54
- answer: (0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(yB - yA), new numberNode_1.NumberNode(xB - xA))).toTex(),
56
+ answer: answer,
55
57
  getPropositions,
56
58
  answerFormat: 'tex',
57
59
  keys: [],
@@ -33,15 +33,15 @@ function getSignFunction() {
33
33
  instruction += 'positive ?';
34
34
  answer =
35
35
  a > 0
36
- ? `\\left[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty\\right[`
37
- : `\\left]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}\\right]`;
36
+ ? `[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty[`
37
+ : `]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}]`;
38
38
  break;
39
39
  case false:
40
40
  instruction += 'négative ?';
41
41
  answer =
42
42
  a > 0
43
- ? `\\left]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}\\right]`
44
- : `\\left[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty\\right[`;
43
+ ? `]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}]`
44
+ : `[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty[`;
45
45
  break;
46
46
  }
47
47
  const getPropositions = (n) => {
@@ -59,8 +59,8 @@ function getSignFunction() {
59
59
  const a = (0, randint_1.randint)(-9, 10, [0]);
60
60
  const b = (0, randint_1.randint)(-9, 10);
61
61
  const wrongAnswer = (0, coinFlip_1.coinFlip)()
62
- ? `\\left[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty\\right[`
63
- : `\\left]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}\\right]`;
62
+ ? `[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty[`
63
+ : `]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}]`;
64
64
  proposition = {
65
65
  id: (0, uuid_1.v4)() + '',
66
66
  statement: wrongAnswer,
@@ -54,7 +54,7 @@ function getInverseImageFunction() {
54
54
  const question = {
55
55
  instruction: statement,
56
56
  startStatement: `f(x) = ${answer}`,
57
- answer: xValue + '',
57
+ answer: 'x=' + xValue,
58
58
  keys: ['x', 'equal'],
59
59
  getPropositions,
60
60
  answerFormat: 'tex',
@@ -47,7 +47,7 @@ function getInverseImageFunctionGeogebra() {
47
47
  const answer = rand
48
48
  ? xValue
49
49
  : roots.length === 2
50
- ? `\\{${(0, round_1.round)(roots[0], 1)};${(0, round_1.round)(roots[1], 1)}\\}`
50
+ ? `\\left\\{${(0, round_1.round)(roots[0], 1)};${(0, round_1.round)(roots[1], 1)}\\right\\}`
51
51
  : roots.length === 1
52
52
  ? roots[0]
53
53
  : `\\emptyset`;
@@ -149,7 +149,7 @@ function getInverseImageFunctionGeogebra() {
149
149
  ];
150
150
  const question = {
151
151
  instruction: statement,
152
- answer: answer + '',
152
+ answer: (answer + '').replaceAll('.', ','),
153
153
  keys: ['S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
154
154
  commands,
155
155
  coords: [xmin, xmax, ymin, ymax],
@@ -21,7 +21,7 @@ exports.cubicEquation = {
21
21
  function getCubicEquationQuestion() {
22
22
  const x = (0, randint_1.randint)(-10, 11);
23
23
  const k = x ** 3;
24
- const answer = `S=\\{${x}\\}`;
24
+ const answer = `S=\\left\\{${x}\\right\\}`;
25
25
  const getPropositions = (n) => {
26
26
  const res = [];
27
27
  res.push({
@@ -56,7 +56,7 @@ function getMidpointQuestion() {
56
56
  instruction: `Soit $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$. Quelles sont les coordonnées du milieu $I$ de $[AB]$ ?`,
57
57
  startStatement: 'I',
58
58
  answer: A.midpoint(B).toTexWithCoords(),
59
- keys: ['semicolon'],
59
+ keys: ['I', 'semicolon'],
60
60
  getPropositions,
61
61
  answerFormat: 'tex',
62
62
  };
@@ -51,7 +51,7 @@ function getCircleArea() {
51
51
  };
52
52
  const question = {
53
53
  instruction: `Calculer l'aire d'un cercle de ${coin ? 'rayon ' + radius : 'diamètre ' + diametre} cm.`,
54
- answer: correctAnswer,
54
+ answer: correctAnswer.replace('.', ','),
55
55
  getPropositions,
56
56
  answerFormat: 'tex',
57
57
  keys: [],
@@ -51,7 +51,7 @@ function getCircleCircumference() {
51
51
  };
52
52
  const question = {
53
53
  instruction: `Calculer la circonférence d'un cercle de ${coin ? 'rayon ' + radius : 'diamètre ' + diametre} cm.`,
54
- answer: correctAnswer,
54
+ answer: correctAnswer.replace('.', ','),
55
55
  getPropositions,
56
56
  answerFormat: 'tex',
57
57
  keys: [],
@@ -57,7 +57,7 @@ function getRightTriangleArea() {
57
57
  };
58
58
  const question = {
59
59
  instruction: `Calculer l'aire du triangle ${triangle.getTriangleName()} rectangle en ${triangle.getRightAngle()} sachant que ${triangle.getSideBName()} = $${sidesLength[0]}$ cm et ${triangle.getSideCName()} = $${sidesLength[1]}$ cm.`,
60
- answer: (sidesLength[0] * sidesLength[1]) / 2 + '',
60
+ answer: ((sidesLength[0] * sidesLength[1]) / 2 + '').replace('.', ','),
61
61
  keys: [...vertices, 'equal', 'cm2'],
62
62
  commands,
63
63
  coords: triangle.generateCoords(),
@@ -1 +1 @@
1
- {"version":3,"file":"thales.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/euclidean/thales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO/E,eAAO,MAAM,MAAM,EAAE,YAWpB,CAAC;AAEF,wBAAgB,SAAS,IAAI,QAAQ,CA8GpC"}
1
+ {"version":3,"file":"thales.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/euclidean/thales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO/E,eAAO,MAAM,MAAM,EAAE,YAWpB,CAAC;AAEF,wBAAgB,SAAS,IAAI,QAAQ,CA4GpC"}
@@ -101,9 +101,7 @@ function getThales() {
101
101
  };
102
102
  const question = {
103
103
  instruction: `En utilisant le théoreme de Thalès, Écrire l'égalité des quotients sachant que :$\\\\$ (${vertices[3]}${vertices[4]})//(${vertices[1]}${vertices[2]})`,
104
- answer: `\\frac{${vertices[0]}${vertices[3]}}{${vertices[0]}${vertices[1]}}=
105
- \\frac{${vertices[0]}${vertices[4]}}{${vertices[0]}${vertices[2]}}=
106
- \\frac{${vertices[3]}${vertices[4]}}{${vertices[1]}${vertices[2]}}`,
104
+ answer: `\\frac{${vertices[0]}${vertices[3]}}{${vertices[0]}${vertices[1]}}=\\frac{${vertices[0]}${vertices[4]}}{${vertices[0]}${vertices[2]}}=\\frac{${vertices[3]}${vertices[4]}}{${vertices[1]}${vertices[2]}}`,
107
105
  keys: [...vertices, 'equal'],
108
106
  commands,
109
107
  coords: [xMin - 1, xMax + 1, yMin - 1, yMax + 1],
@@ -70,7 +70,7 @@ function getTriangleArea() {
70
70
  };
71
71
  const question = {
72
72
  instruction: `Calculer l'aire du triangle ${triangle.getTriangleName()} sachant que ${sides[randoms[0]]} = $${sidesLength[randoms[0]]}$ cm et la hauteur ${vertices[randoms[0]]}${String.fromCharCode(code + 3)} = $${height}$ cm.`,
73
- answer: (sidesLength[randoms[0]] * height) / 2 + '',
73
+ answer: ((sidesLength[randoms[0]] * height) / 2 + '').replace('.', ','),
74
74
  keys: [...vertices, 'equal', 'cm2'],
75
75
  commands,
76
76
  coords: triangle.generateCoords(),
@@ -70,7 +70,7 @@ function getTrigonometrySideCalcul() {
70
70
  };
71
71
  const question = {
72
72
  instruction: `Le triangle ${triangle.getTriangleName()} rectangle en ${triangle.getRightAngle()} tel que ${sides[randside]} = $${sideLengths[randside]}$ cm et $\\widehat{${angle[randAngle]}}$ = $${angleValue[randAngle]}$°.$\\\\$ Calculer ${sides[randsideQuestion]} à $0,1$ cm près.`,
73
- answer: `${(0, round_1.round)(sideLengths[randsideQuestion], 1)}`,
73
+ answer: `${((0, round_1.round)(sideLengths[randsideQuestion], 1) + '').replace('.', ',')}`,
74
74
  keys: [...vertices, 'equal', 'degree', 'cos', 'sin', 'tan', 'arccos', 'arcsin', 'arctan'],
75
75
  commands,
76
76
  coords: triangle.generateCoords(),
@@ -24,15 +24,16 @@ function getApplyPercentQuestion() {
24
24
  const randNbr = (0, randint_1.randint)(1, 500);
25
25
  const randPercent = (0, randint_1.randint)(1, 100);
26
26
  let instruction = '';
27
- let ans = 0;
27
+ let ans = '';
28
+ let ansNb = 0;
28
29
  if ((0, coinFlip_1.coinFlip)()) {
29
- ans = randNbr * (1 + randPercent / 100);
30
- ans = (0, round_1.round)(ans, 2);
30
+ ansNb = (0, round_1.round)(randNbr * (1 + randPercent / 100), 2);
31
+ ans = (ansNb + '').replace('.', ',');
31
32
  instruction = `Appliquer une hausse de $${randPercent}\\%$ à $${randNbr}$.`;
32
33
  }
33
34
  else {
34
- ans = randNbr * (1 - randPercent / 100);
35
- ans = (0, round_1.round)(ans, 2);
35
+ ansNb = (0, round_1.round)(randNbr * (1 - randPercent / 100), 2);
36
+ ans = (ansNb + '').replace('.', ',');
36
37
  instruction = `Appliquer une baisse de $${randPercent}\\%$ à $${randNbr}$.`;
37
38
  }
38
39
  const getPropositions = (n) => {
@@ -47,10 +48,10 @@ function getApplyPercentQuestion() {
47
48
  let isDuplicate;
48
49
  let proposition;
49
50
  do {
50
- let wrongAnswer = ans;
51
+ let wrongAnswer = ansNb;
51
52
  const deviation = Math.random() < 0.5 ? -1 : 1;
52
53
  const percentDeviation = Math.random() * 20 + 1;
53
- wrongAnswer += deviation * (percentDeviation / 100) * ans;
54
+ wrongAnswer += deviation * (percentDeviation / 100) * ansNb;
54
55
  wrongAnswer = (0, round_1.round)(wrongAnswer, 2);
55
56
  proposition = {
56
57
  id: (0, uuid_1.v4)() + '',
@@ -55,7 +55,7 @@ function getAverageEvolutionRate() {
55
55
  };
56
56
  const question = {
57
57
  instruction,
58
- answer: answer + `\\%`,
58
+ answer: (answer + '').replace('.', ',') + `\\%`,
59
59
  keys: ['percent'],
60
60
  getPropositions,
61
61
  answerFormat: 'tex',
@@ -37,7 +37,7 @@ function getGlobalPercentQuestion() {
37
37
  }
38
38
  ans = (0, mathjs_1.round)((ans - 1) * 100, 2);
39
39
  instruction += ". \nDéterminer le taux d'évolution global du prix de cet article.";
40
- const answer = `${ans}\\%`;
40
+ const answer = `${(ans + '').replace('.', ',')}\\%`;
41
41
  const getPropositions = (n) => {
42
42
  const res = [];
43
43
  res.push({
@@ -57,7 +57,7 @@ function getReciprocalPercentageQuestion() {
57
57
  };
58
58
  const question = {
59
59
  instruction,
60
- answer: `${ans > 0 ? '+' + (0, mathjs_1.round)(ans, 2) : (0, mathjs_1.round)(ans, 2)}\\%`,
60
+ answer: `${(ans > 0 ? '+' + (0, mathjs_1.round)(ans, 2) : '' + (0, mathjs_1.round)(ans, 2)).replace('.', ',')}\\%`,
61
61
  keys: ['percent'],
62
62
  getPropositions,
63
63
  answerFormat: 'tex',
@@ -72,7 +72,7 @@ function getPowersOfTenToDecimalQuestion() {
72
72
  const question = {
73
73
  instruction: `Donner l'écriture décimale de : $${statement.toTex()}$`,
74
74
  startStatement: statement.toTex(),
75
- answer: answerTree.toTex(),
75
+ answer: answerTree.toTex().replace('.', ','),
76
76
  keys: [],
77
77
  getPropositions,
78
78
  answerFormat: 'tex',
@@ -26,7 +26,7 @@ exports.logarithmePrimitive = {
26
26
  function getLogarithmePrimitive() {
27
27
  const u = polynomial_1.PolynomialConstructor.randomWithOrder((0, randint_1.randint)(1, 3));
28
28
  const selectedFunction = new fractionNode_1.FractionNode(u.derivate().toTree(), u.toTree());
29
- const integratedFuction = `ln\|${u.toTex()}\|`;
29
+ const integratedFuction = `\\ln\\left|${u.toTex()}\\right|`;
30
30
  const getPropositions = (n) => {
31
31
  const propositions = [];
32
32
  propositions.push({
@@ -1 +1 @@
1
- {"version":3,"file":"polynomialPrimitive.d.ts","sourceRoot":"","sources":["../../../src/exercises/primitve/polynomialPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAgB/E,eAAO,MAAM,mBAAmB,EAAE,YAYjC,CAAC;AAkBF,wBAAgB,sBAAsB,IAAI,QAAQ,CAiDjD"}
1
+ {"version":3,"file":"polynomialPrimitive.d.ts","sourceRoot":"","sources":["../../../src/exercises/primitve/polynomialPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAkB/E,eAAO,MAAM,mBAAmB,EAAE,YAYjC,CAAC;AA0BF,wBAAgB,sBAAsB,IAAI,QAAQ,CAiDjD"}
@@ -2,16 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPolynomialPrimitive = exports.polynomialPrimitive = void 0;
4
4
  const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
5
+ const rational_1 = require("../../math/numbers/rationals/rational");
5
6
  const polynomial_1 = require("../../math/polynomials/polynomial");
6
7
  const randint_1 = require("../../math/utils/random/randint");
8
+ const oppositeNode_1 = require("../../tree/nodes/functions/oppositeNode");
7
9
  const constantNode_1 = require("../../tree/nodes/numbers/constantNode");
8
10
  const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
9
11
  const addNode_1 = require("../../tree/nodes/operators/addNode");
10
- const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
11
12
  const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
12
13
  const powerNode_1 = require("../../tree/nodes/operators/powerNode");
13
14
  const variableNode_1 = require("../../tree/nodes/variables/variableNode");
14
- const simplify_1 = require("../../tree/parsers/simplify");
15
15
  const shuffle_1 = require("../../utils/shuffle");
16
16
  const uuid_1 = require("uuid");
17
17
  exports.polynomialPrimitive = {
@@ -33,8 +33,16 @@ function getIntegratedPolynomialNode(polynomial) {
33
33
  const coeff = polynomial.coefficients[i];
34
34
  if (coeff === 0)
35
35
  continue;
36
- const nodeCoeff = new fractionNode_1.FractionNode(new numberNode_1.NumberNode(coeff), new numberNode_1.NumberNode(i + 1));
37
- const terme = new multiplyNode_1.MultiplyNode((0, simplify_1.simplifyNode)(nodeCoeff), i + 1 === 1 ? new variableNode_1.VariableNode('x') : new powerNode_1.PowerNode(new variableNode_1.VariableNode('x'), new numberNode_1.NumberNode(i + 1)));
36
+ const nodeCoeff = new rational_1.Rational(coeff, i + 1).simplify().toTree();
37
+ const powerNode = i + 1 === 1 ? new variableNode_1.VariableNode('x') : new powerNode_1.PowerNode(new variableNode_1.VariableNode('x'), new numberNode_1.NumberNode(i + 1));
38
+ let terme;
39
+ if (nodeCoeff.toTex() === '1')
40
+ terme = powerNode;
41
+ else if (nodeCoeff.toTex() === '-1')
42
+ terme = new oppositeNode_1.OppositeNode(powerNode);
43
+ else {
44
+ terme = new multiplyNode_1.MultiplyNode(nodeCoeff, i + 1 === 1 ? new variableNode_1.VariableNode('x') : new powerNode_1.PowerNode(new variableNode_1.VariableNode('x'), new numberNode_1.NumberNode(i + 1)));
45
+ }
38
46
  integralPolynomial = new addNode_1.AddNode(terme, integralPolynomial);
39
47
  }
40
48
  return integralPolynomial;
@@ -68,7 +68,7 @@ function getAverageWithTableQuestion() {
68
68
  |Effectif|${randomEffectives[0]}|${randomEffectives[1]}|${randomEffectives[2]}|${randomEffectives[3]}|${randomEffectives[4]}|
69
69
 
70
70
  Calculer la moyenne de cette série de valeurs.`,
71
- answer: average + '',
71
+ answer: (average + '').replace('.', ','),
72
72
  keys: [],
73
73
  getPropositions,
74
74
  answerFormat: 'tex',
@@ -1 +1 @@
1
- {"version":3,"file":"cardBasicProbas.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/cardBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAYhH,eAAO,MAAM,eAAe,EAAE,YAW7B,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CA2FrD"}
1
+ {"version":3,"file":"cardBasicProbas.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/cardBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAYhH,eAAO,MAAM,eAAe,EAAE,YAW7B,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CA0FrD"}
@@ -39,7 +39,6 @@ function getCardBasicProbasQuestion() {
39
39
  case 'oneCard':
40
40
  value = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsValues);
41
41
  color = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsColor);
42
- console.log(value);
43
42
  target = `${value === 'dame' ? 'une' : 'un'} ${value} de ${color}`;
44
43
  answer = `\\frac{1}{52}`;
45
44
  break;
@@ -94,7 +94,7 @@ function getConditionalProbability() {
94
94
  const question = {
95
95
  instruction,
96
96
  startStatement,
97
- answer,
97
+ answer: answer.replace('.', ','),
98
98
  keys: ['p', 'cap', 'underscore'],
99
99
  getPropositions,
100
100
  answerFormat: 'tex',
@@ -74,7 +74,7 @@ function getMedianWithTable() {
74
74
  |Effectif|${randomEffectives[0]}|${randomEffectives[1]}|${randomEffectives[2]}|${randomEffectives[3]}|${randomEffectives[4]}|
75
75
 
76
76
  Calculer la médiane de cette série de valeurs.`,
77
- answer: median + '',
77
+ answer: (median + '').replace('.', ','),
78
78
  keys: [],
79
79
  getPropositions,
80
80
  answerFormat: 'tex',
@@ -61,7 +61,7 @@ function getMedianList() {
61
61
  const question = {
62
62
  instruction: `On considère la liste suivante : $${randomValeurs.join(';\\ ')}.$
63
63
  $\\\\$Calculer la médiane de cette liste de valeurs.`,
64
- answer: median + '',
64
+ answer: (median + '').replace('.', ','),
65
65
  keys: ['f', 'cap', 'underscore'],
66
66
  getPropositions,
67
67
  answerFormat: 'tex',
@@ -1 +1 @@
1
- {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO/E,eAAO,MAAM,oBAAoB,EAAE,YAWlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAyH1D"}
1
+ {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO/E,eAAO,MAAM,oBAAoB,EAAE,YAWlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAqH1D"}
@@ -105,19 +105,19 @@ function getInequalityToIntervalQuestion() {
105
105
  else {
106
106
  res.push({
107
107
  id: (0, uuid_1.v4)(),
108
- statement: `x \\in \\left${reverseBracket(interval.leftBracket)}${interval.insideToTex()}\\right${interval.rightBracket}`,
108
+ statement: `x \\in ${reverseBracket(interval.leftBracket)}${interval.insideToTex()}${interval.rightBracket}`,
109
109
  isRightAnswer: false,
110
110
  format: 'tex',
111
111
  });
112
112
  res.push({
113
113
  id: (0, uuid_1.v4)(),
114
- statement: `x \\in \\left${interval.leftBracket}${interval.insideToTex()}\\right${reverseBracket(interval.rightBracket)}`,
114
+ statement: `x \\in ${interval.leftBracket}${interval.insideToTex()}${reverseBracket(interval.rightBracket)}`,
115
115
  isRightAnswer: false,
116
116
  format: 'tex',
117
117
  });
118
118
  res.push({
119
119
  id: (0, uuid_1.v4)(),
120
- statement: `x \\in \\left${reverseBracket(interval.leftBracket)}${interval.insideToTex()}\\right${reverseBracket(interval.rightBracket)}`,
120
+ statement: `x \\in ${reverseBracket(interval.leftBracket)}${interval.insideToTex()}${reverseBracket(interval.rightBracket)}`,
121
121
  isRightAnswer: false,
122
122
  format: 'tex',
123
123
  });
@@ -39,7 +39,7 @@ function getSetBelongingQuestion() {
39
39
  break;
40
40
  case 2:
41
41
  nb = decimal_1.DecimalConstructor.random(-50, 50, (0, randint_1.randint)(1, 4)).toTree().toTex();
42
- answer = '\\mathbb{D}';
42
+ answer = '\\mathrm{D}';
43
43
  break;
44
44
  case 3:
45
45
  nb = rational_1.RationalConstructor.randomIrreductible().toTree().toTex();
@@ -19,7 +19,7 @@ exports.squareRootEquation = {
19
19
  };
20
20
  function getSquareRootEquationQuestion() {
21
21
  const k = Math.random() < 0.2 ? (0, randint_1.randint)(-20, 0) : (0, randint_1.randint)(0, 11);
22
- const answer = k < 0 ? 'S=\\emptyset' : `S=\\{${k ** 2}\\}`;
22
+ const answer = k < 0 ? 'S=\\emptyset' : `S=\\left\\{${k ** 2}\\right\\}`;
23
23
  const getPropositions = (n) => {
24
24
  const res = [];
25
25
  res.push({
@@ -10,7 +10,7 @@ export declare class Complex {
10
10
  constructor(re: number, im: number);
11
11
  moduleSquared(): number;
12
12
  inverseNode(): AddNode;
13
- divideNode(z: Complex): AddNode;
13
+ divideNode(z: Complex): import("../../tree/nodes/node").Node;
14
14
  multiply(z: Complex): Complex;
15
15
  opposite(): Complex;
16
16
  conjugate(): Complex;
@@ -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;IAOrB,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,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"}
@@ -45,6 +45,15 @@ class Complex {
45
45
  const moduleSq = z.moduleSquared();
46
46
  const newRe = new rational_1.Rational(this.re * z.re + this.im * z.im, moduleSq).simplify().toTree();
47
47
  const newIm = new rational_1.Rational(this.im * z.re - z.im * this.re, moduleSq).simplify().toTree();
48
+ let imNode;
49
+ if (newIm.toTex() === '0')
50
+ return newRe;
51
+ if (newIm.toTex() === '1')
52
+ imNode = new variableNode_1.VariableNode('i');
53
+ else
54
+ imNode = new multiplyNode_1.MultiplyNode(newIm, new variableNode_1.VariableNode('i'));
55
+ if (newRe.toTex() === '0')
56
+ return imNode;
48
57
  return new addNode_1.AddNode(newRe, new multiplyNode_1.MultiplyNode(newIm, new variableNode_1.VariableNode('i')));
49
58
  }
50
59
  multiply(z) {
@@ -148,7 +148,7 @@ class Interval {
148
148
  (this.min === interval.max && this.leftBracket === ']' && interval.rightBracket === '[')) {
149
149
  const firstInterval = this.min < interval.min ? this : interval;
150
150
  const secondInterval = this.min < interval.min ? interval : this;
151
- return new mathSet_1.MathSet(`\\left${unionLeftBracket}${firstInterval.minTex};${firstInterval.maxTex}\\right${firstInterval.rightBracket}\\cup\\left${secondInterval.leftBracket}${secondInterval.minTex};${secondInterval.maxTex}\\right${unionRightBracket}`, () => ((0, coinFlip_1.coinFlip)() ? firstInterval.getRandomElement() : secondInterval.getRandomElement()));
151
+ return new mathSet_1.MathSet(`${unionLeftBracket}${firstInterval.minTex};${firstInterval.maxTex}${firstInterval.rightBracket}\\cup${secondInterval.leftBracket}${secondInterval.minTex};${secondInterval.maxTex}${unionRightBracket}`, () => ((0, coinFlip_1.coinFlip)() ? firstInterval.getRandomElement() : secondInterval.getRandomElement()));
152
152
  }
153
153
  else {
154
154
  return new Interval(`${unionLeftBracket}${minTex};${maxTex}${unionRightBracket}`);
@@ -209,7 +209,7 @@ class Interval {
209
209
  return this.tex.replaceAll('[', '').replaceAll(']', '');
210
210
  }
211
211
  toTex() {
212
- return `\\left${this.leftBracket}${this.insideToTex()}\\right${this.rightBracket}`;
212
+ return `${this.leftBracket}${this.insideToTex()}${this.rightBracket}`;
213
213
  }
214
214
  toInequality() {
215
215
  const isLeftClosed = this.boundType === BoundType.FO || this.boundType === BoundType.FF;
@@ -6,11 +6,11 @@ class NumberNode {
6
6
  constructor(value, tex, mathString) {
7
7
  this.type = node_1.NodeType.number;
8
8
  this.value = value;
9
- this.tex = tex || value + '';
10
- this.mathString = mathString || this.tex;
9
+ this.tex = tex || (value + '').replace('.', ',');
10
+ this.mathString = mathString || this.value + '';
11
11
  }
12
12
  toMathString() {
13
- return `${this.mathString ? this.mathString : this.tex}`;
13
+ return `${this.mathString}`;
14
14
  }
15
15
  toTex() {
16
16
  return `${this.tex}`;
@@ -1 +1 @@
1
- {"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAC;AACzC,OAAO,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3D,qBAAa,YAAa,SAAQ,YAAa,YAAW,IAAI;IAC5D;;;OAGG;gBACS,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI;IAI7C,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAIf,QAAQ;CAGT"}
1
+ {"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAC;AACzC,OAAO,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI3D,qBAAa,YAAa,SAAQ,YAAa,YAAW,IAAI;IAC5D;;;OAGG;gBACS,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI;IAI7C,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAYf,QAAQ;CAGT"}
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FractionNode = void 0;
4
4
  const mathjs_1 = require("mathjs");
5
+ const node_1 = require("../node");
5
6
  const operatorNode_1 = require("./operatorNode");
7
+ const functionNode_1 = require("../functions/functionNode");
6
8
  class FractionNode extends operatorNode_1.OperatorNode {
7
9
  /**
8
10
  * @param leftChild num
@@ -15,6 +17,11 @@ class FractionNode extends operatorNode_1.OperatorNode {
15
17
  return `(${this.leftChild.toMathString()}) / (${this.rightChild.toMathString()})`;
16
18
  }
17
19
  toTex() {
20
+ if ((this.leftChild.type === node_1.NodeType.function &&
21
+ this.leftChild.id === functionNode_1.FunctionsIds.opposite) ||
22
+ (this.leftChild.type === node_1.NodeType.number && this.leftChild.value < 0)) {
23
+ return `-\\frac{${this.leftChild.toTex().slice(1)}}{${this.rightChild.toTex()}}`;
24
+ }
18
25
  return `\\frac{${this.leftChild.toTex()}}{${this.rightChild.toTex()}}`;
19
26
  }
20
27
  toMathjs() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [