math-exercises 2.2.80 → 2.2.82

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 (115) hide show
  1. package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.js +1 -0
  3. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts +4 -1
  4. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
  5. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +79 -30
  6. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts +4 -1
  7. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  8. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +89 -39
  9. package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.js +37 -17
  11. package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.d.ts.map +1 -1
  12. package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.js +55 -15
  13. package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +9 -18
  15. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
  16. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +3 -0
  17. package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
  18. package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.js +11 -11
  19. package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.d.ts.map +1 -1
  20. package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.js +10 -2
  21. package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
  22. package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +11 -4
  23. package/lib/exercises/math/functions/basics/graphicEquation.d.ts.map +1 -1
  24. package/lib/exercises/math/functions/basics/graphicEquation.js +46 -28
  25. package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
  26. package/lib/exercises/math/functions/basics/graphicInequation.js +0 -1
  27. package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -1
  28. package/lib/exercises/math/functions/basics/graphicInequationAffine.js +10 -3
  29. package/lib/exercises/math/functions/basics/twoFunctionsInequation.d.ts.map +1 -1
  30. package/lib/exercises/math/functions/basics/twoFunctionsInequation.js +74 -58
  31. package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/exponentials/exponentialsVariations.js +1 -0
  33. package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts +5 -2
  34. package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
  35. package/lib/exercises/math/functions/logarithm/log10Simplifying.js +2 -0
  36. package/lib/exercises/math/functions/logarithm/logEquation.d.ts.map +1 -1
  37. package/lib/exercises/math/functions/logarithm/logEquation.js +1 -0
  38. package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts +5 -2
  39. package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
  40. package/lib/exercises/math/functions/logarithm/logPowerEquation.js +2 -0
  41. package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/logarithm/logSimplifiying.js +1 -0
  43. package/lib/exercises/math/functions/square/squareImageInterval.d.ts.map +1 -1
  44. package/lib/exercises/math/functions/square/squareImageInterval.js +13 -4
  45. package/lib/exercises/math/functions/trinoms/secondDegreeInequation.d.ts.map +1 -1
  46. package/lib/exercises/math/functions/trinoms/secondDegreeInequation.js +10 -6
  47. package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.d.ts.map +1 -1
  48. package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.js +12 -6
  49. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -1
  50. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +9 -14
  51. package/lib/exercises/math/matrices/matrixInversibilityDomain.d.ts.map +1 -1
  52. package/lib/exercises/math/matrices/matrixInversibilityDomain.js +15 -2
  53. package/lib/exercises/math/probaStat/binomial/binomialInequation.d.ts.map +1 -1
  54. package/lib/exercises/math/python/pyForLoop1Exercise.d.ts.map +1 -1
  55. package/lib/exercises/math/sequences/genericSequenceVariations.d.ts.map +1 -1
  56. package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts +2 -4
  57. package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  58. package/lib/exercises/math/sets/intervals/inequalityToInterval.js +28 -25
  59. package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts +2 -4
  60. package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts.map +1 -1
  61. package/lib/exercises/math/sets/intervals/intervalToInequality.js +40 -78
  62. package/lib/exercises/math/sets/intervals/intervalsIntersection.d.ts +3 -7
  63. package/lib/exercises/math/sets/intervals/intervalsIntersection.d.ts.map +1 -1
  64. package/lib/exercises/math/sets/intervals/intervalsIntersection.js +91 -31
  65. package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts +3 -7
  66. package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
  67. package/lib/exercises/math/sets/intervals/intervalsUnion.js +58 -19
  68. package/lib/exercises/pc/index.d.ts +4 -0
  69. package/lib/exercises/pc/index.d.ts.map +1 -1
  70. package/lib/exercises/pc/index.js +4 -6
  71. package/lib/exercises/vea/equationVEA.js +2 -2
  72. package/lib/geogebra/lagrange.d.ts.map +1 -1
  73. package/lib/geogebra/spline.d.ts.map +1 -1
  74. package/lib/index.d.ts +49 -23
  75. package/lib/index.d.ts.map +1 -1
  76. package/lib/math/geometry/point.d.ts.map +1 -1
  77. package/lib/math/inequations/inequation.d.ts +1 -1
  78. package/lib/math/inequations/inequation.d.ts.map +1 -1
  79. package/lib/math/numbers/integer/integer.d.ts.map +1 -1
  80. package/lib/math/numbers/rationals/rational.d.ts +2 -3
  81. package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
  82. package/lib/math/polynomials/trinom.d.ts +2 -4
  83. package/lib/math/polynomials/trinom.d.ts.map +1 -1
  84. package/lib/playground.d.ts.map +1 -1
  85. package/lib/playground.js +4 -4
  86. package/lib/tree/nodes/equations/equationSolutionNode.d.ts +0 -1
  87. package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
  88. package/lib/tree/nodes/equations/equationSolutionNode.js +0 -3
  89. package/lib/tree/nodes/inequations/inequationNode.d.ts +2 -1
  90. package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
  91. package/lib/tree/nodes/inequations/inequationNode.js +4 -3
  92. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +0 -1
  93. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
  94. package/lib/tree/nodes/inequations/inequationSolutionNode.js +0 -3
  95. package/lib/tree/nodes/numbers/numberNode.d.ts +1 -1
  96. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  97. package/lib/tree/nodes/operators/multiplyNode.js +6 -1
  98. package/lib/tree/nodes/sets/closure.d.ts +5 -0
  99. package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
  100. package/lib/tree/nodes/sets/closure.js +32 -0
  101. package/lib/tree/nodes/sets/discreteSetNode.d.ts +4 -4
  102. package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
  103. package/lib/tree/nodes/sets/discreteSetNode.js +3 -4
  104. package/lib/tree/nodes/sets/intervalNode.d.ts +13 -1
  105. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  106. package/lib/tree/nodes/sets/intervalNode.js +154 -3
  107. package/lib/tree/parsers/discreteSetParser.d.ts +2 -2
  108. package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
  109. package/lib/tree/parsers/discreteSetParser.js +2 -1
  110. package/lib/tree/parsers/equationSolutionParser.js +1 -1
  111. package/lib/tree/parsers/powerParser.d.ts +1 -1
  112. package/lib/tree/parsers/rationalParser.d.ts +1 -1
  113. package/lib/tree/parsers/unionIntervalParser.d.ts.map +1 -1
  114. package/lib/tree/parsers/unionIntervalParser.js +3 -1
  115. package/package.json +1 -1
@@ -99,4 +99,7 @@ exports.lnDerivativeThree = {
99
99
  getPropositions,
100
100
  isAnswerValid,
101
101
  subject: "Mathématiques",
102
+ getKeys,
103
+ getAnswer,
104
+ getInstruction,
102
105
  };
@@ -1 +1 @@
1
- {"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAuHF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAwB9D,CAAC"}
1
+ {"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAmBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkHF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAwB9D,CAAC"}
@@ -12,6 +12,7 @@ const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
12
12
  const closure_1 = require("../../../../tree/nodes/sets/closure");
13
13
  const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
14
14
  const unionIntervalNode_1 = require("../../../../tree/nodes/sets/unionIntervalNode");
15
+ const unionIntervalParser_1 = require("../../../../tree/parsers/unionIntervalParser");
15
16
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
16
17
  const shuffle_1 = require("../../../../utils/alea/shuffle");
17
18
  const getThirdDegreeFunctionVariation = () => {
@@ -86,17 +87,16 @@ const getPropositions = (n, { answer, racine1, racine2 }) => {
86
87
  }
87
88
  return (0, shuffle_1.shuffle)(propositions);
88
89
  };
89
- const isAnswerValid = (ans, { racine1, racine2, coin, a }) => {
90
- const r1 = new numberNode_1.NumberNode(racine1);
91
- const r2 = new numberNode_1.NumberNode(racine2);
92
- const answer = coin * a < 0
93
- ? new intervalNode_1.IntervalNode(r1, r2, closure_1.ClosureType.FF)
94
- : new unionIntervalNode_1.UnionIntervalNode([
95
- new intervalNode_1.IntervalNode(infiniteNode_1.MinusInfinityNode, r1, closure_1.ClosureType.OF),
96
- new intervalNode_1.IntervalNode(r2, infiniteNode_1.PlusInfinityNode, closure_1.ClosureType.FO),
97
- ]);
98
- const texs = answer.toAllValidTexs();
99
- return texs.includes(ans);
90
+ const isAnswerValid = (ans, { answer, racine1, racine2, coin, a }) => {
91
+ try {
92
+ const parsed = (0, unionIntervalParser_1.unionIntervalParser)(ans);
93
+ if (!parsed)
94
+ return false;
95
+ return parsed.simplify().toTex() === answer;
96
+ }
97
+ catch (err) {
98
+ return false;
99
+ }
100
100
  };
101
101
  exports.thirdDegreeFunctionVariation = {
102
102
  id: "thirdDegreeFunctionVariation",
@@ -1 +1 @@
1
- {"version":3,"file":"absolueValueInequationsSup.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/absolueValueInequationsSup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAoBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AA8FF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAgB5D,CAAC"}
1
+ {"version":3,"file":"absolueValueInequationsSup.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/absolueValueInequationsSup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAqBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAqGF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAgB5D,CAAC"}
@@ -14,6 +14,7 @@ const substractNode_1 = require("../../../../tree/nodes/operators/substractNode"
14
14
  const closure_1 = require("../../../../tree/nodes/sets/closure");
15
15
  const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
16
16
  const unionIntervalNode_1 = require("../../../../tree/nodes/sets/unionIntervalNode");
17
+ const unionIntervalParser_1 = require("../../../../tree/parsers/unionIntervalParser");
17
18
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
18
19
  const getPropositions = (n, { answer, a, b, c, isStrict }) => {
19
20
  const propositions = [];
@@ -56,8 +57,15 @@ const getKeys = (identifiers) => {
56
57
  return ["S", "equal", "lbracket", "semicolon", "rbracket", "cup", "infty"];
57
58
  };
58
59
  const isAnswerValid = (ans, { answer, ...identifiers }) => {
59
- const texs = getAnswerNode(identifiers).toAllValidTexs();
60
- return texs.includes(ans);
60
+ try {
61
+ const parsed = (0, unionIntervalParser_1.unionIntervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
62
+ if (!parsed)
63
+ return false;
64
+ return "S=\\ " + parsed.simplify().toTex() === answer;
65
+ }
66
+ catch (err) {
67
+ return false;
68
+ }
61
69
  };
62
70
  const getAbsolueValueInequationsSupQuestion = (ops) => {
63
71
  const a = (0, randint_1.randint)(-10, 11, [0]);
@@ -1 +1 @@
1
- {"version":3,"file":"absoluteValueInequations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/absoluteValueInequations.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAuFF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
1
+ {"version":3,"file":"absoluteValueInequations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/absoluteValueInequations.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAuFF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
@@ -9,6 +9,7 @@ const inequationSolutionNode_1 = require("../../../../tree/nodes/inequations/ine
9
9
  const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
10
10
  const closure_1 = require("../../../../tree/nodes/sets/closure");
11
11
  const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
12
+ const unionIntervalParser_1 = require("../../../../tree/parsers/unionIntervalParser");
12
13
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
13
14
  const getAbsoluteValueInequationsQuestion = () => {
14
15
  const poly = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10, [0]), 1]);
@@ -53,10 +54,16 @@ const getPropositions = (n, { answer, a, b }) => {
53
54
  }
54
55
  return (0, exercise_1.shuffleProps)(propositions, n);
55
56
  };
56
- const isAnswerValid = (ans, { a, b, isStrict }) => {
57
- const answer = new inequationSolutionNode_1.InequationSolutionNode(new intervalNode_1.IntervalNode(new numberNode_1.NumberNode(b - a), new numberNode_1.NumberNode(b + a), isStrict ? closure_1.ClosureType.OO : closure_1.ClosureType.FF));
58
- const texs = answer.toAllValidTexs();
59
- return texs.includes(ans);
57
+ const isAnswerValid = (ans, { answer, a, b, isStrict }) => {
58
+ try {
59
+ const parsed = (0, unionIntervalParser_1.unionIntervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
60
+ if (!parsed)
61
+ return false;
62
+ return "S=\\ " + parsed.simplify().toTex() === answer;
63
+ }
64
+ catch (err) {
65
+ return false;
66
+ }
60
67
  };
61
68
  exports.absoluteValueInequations = {
62
69
  id: "absoluteValueInequations",
@@ -1 +1 @@
1
- {"version":3,"file":"graphicEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/graphicEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CAClC,CAAC;AAkGF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC"}
1
+ {"version":3,"file":"graphicEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/graphicEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CAClC,CAAC;AAuHF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC"}
@@ -10,7 +10,38 @@ const randint_1 = require("../../../../math/utils/random/randint");
10
10
  const equationSolutionNode_1 = require("../../../../tree/nodes/equations/equationSolutionNode");
11
11
  const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
12
12
  const discreteSetNode_1 = require("../../../../tree/nodes/sets/discreteSetNode");
13
+ const discreteSetParser_1 = require("../../../../tree/parsers/discreteSetParser");
13
14
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
15
+ const getInstruction = (identifiers) => {
16
+ return `Déterminer graphiquement les solutions de l'équation $f(x) = ${identifiers.yValue}$ où $f$ est la fonction représentée ci-dessous.`;
17
+ };
18
+ const getGGBOptions = (identifiers) => {
19
+ const { splinePoints } = identifiers;
20
+ const xMin = Math.min(...splinePoints.map((point) => point[0]));
21
+ const yMin = Math.min(...splinePoints.map((point) => point[1]));
22
+ const xMax = Math.max(...splinePoints.map((point) => point[0]));
23
+ const yMax = Math.max(...splinePoints.map((point) => point[1]));
24
+ const commands = [
25
+ `S = Spline(${splinePoints
26
+ .map((point) => `(${point[0]},${point[1]})`)
27
+ .join(",")})`,
28
+ "SetFixed(S, true)",
29
+ `SetColor(S, "${(0, colors_1.randomColor)()}")`,
30
+ ];
31
+ const ggb = new geogebraConstructor_1.GeogebraConstructor({
32
+ commands,
33
+ });
34
+ return ggb.getOptions({
35
+ coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
36
+ });
37
+ };
38
+ const getAnswer = (identifiers) => {
39
+ const xSolutions = identifiers.splinePoints
40
+ .filter((p) => p[1] === identifiers.yValue)
41
+ .map((p) => p[0]);
42
+ const answer = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode(xSolutions.map((sol) => new numberNode_1.NumberNode(sol)))).toTex();
43
+ return answer;
44
+ };
14
45
  const getGraphicEquationQuestion = () => {
15
46
  let xSolutions = [];
16
47
  const nb = (0, randint_1.randint)(2, 4);
@@ -19,7 +50,6 @@ const getGraphicEquationQuestion = () => {
19
50
  xSolutions.push((0, randint_1.randint)(-9, 10, xSolutions));
20
51
  }
21
52
  xSolutions.sort((a, b) => a - b);
22
- const answer = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode(xSolutions.map((sol) => new numberNode_1.NumberNode(sol)))).toTex();
23
53
  const yValue = (0, randint_1.randint)(-5, 6);
24
54
  const splinePoints = [];
25
55
  let prevYWasAbove = (0, coinFlip_1.coinFlip)();
@@ -47,29 +77,14 @@ const getGraphicEquationQuestion = () => {
47
77
  yValue + y,
48
78
  ]);
49
79
  }
50
- const xMin = Math.min(...splinePoints.map((point) => point[0]));
51
- const yMin = Math.min(...splinePoints.map((point) => point[1]));
52
- const xMax = Math.max(...splinePoints.map((point) => point[0]));
53
- const yMax = Math.max(...splinePoints.map((point) => point[1]));
54
- const commands = [
55
- `S = Spline(${splinePoints
56
- .map((point) => `(${point[0]},${point[1]})`)
57
- .join(",")})`,
58
- "SetFixed(S, true)",
59
- `SetColor(S, "${(0, colors_1.randomColor)()}")`,
60
- ];
61
- const ggb = new geogebraConstructor_1.GeogebraConstructor({
62
- commands,
63
- });
80
+ const identifiers = { yValue, splinePoints };
64
81
  const question = {
65
- answer,
66
- instruction: `Déterminer graphiquement les solutions de l'équation $f(x) = ${yValue}$ où $f$ est la fonction représentée ci-dessous.`,
82
+ answer: getAnswer(identifiers),
83
+ instruction: getInstruction(identifiers),
67
84
  keys: discreteSetKeys_1.discreteSetKeys,
68
85
  answerFormat: "tex",
69
- ggbOptions: ggb.getOptions({
70
- coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
71
- }),
72
- identifiers: { yValue, splinePoints },
86
+ ggbOptions: getGGBOptions(identifiers),
87
+ identifiers,
73
88
  };
74
89
  return question;
75
90
  };
@@ -89,13 +104,16 @@ const getPropositions = (n, { answer }) => {
89
104
  }
90
105
  return (0, exercise_1.shuffleProps)(propositions, n);
91
106
  };
92
- const isAnswerValid = (ans, { yValue, splinePoints }) => {
93
- const xSolutions = splinePoints
94
- .filter((p) => p[1] === yValue)
95
- .map((p) => p[0]);
96
- const answerTree = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode(xSolutions.map((sol) => new numberNode_1.NumberNode(sol))));
97
- const texs = answerTree.toAllValidTexs();
98
- return texs.includes(ans);
107
+ const isAnswerValid = (ans, { answer, yValue, splinePoints }) => {
108
+ try {
109
+ const parsed = (0, discreteSetParser_1.discreteSetParser)(ans);
110
+ if (!parsed)
111
+ return false;
112
+ return "S=" + parsed.simplify().toTex() === answer;
113
+ }
114
+ catch (err) {
115
+ return false;
116
+ }
99
117
  };
100
118
  exports.graphicEquation = {
101
119
  id: "graphicEquation",
@@ -1 +1 @@
1
- {"version":3,"file":"graphicInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/graphicInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAO5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAC;AAgNF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
1
+ {"version":3,"file":"graphicInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/graphicInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAO5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAC;AA+MF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
@@ -161,7 +161,6 @@ const isAnswerValid = (ans, { answer, intervals }) => {
161
161
  const parsed = (0, unionIntervalParser_1.unionIntervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
162
162
  if (!parsed)
163
163
  return false;
164
- console.log(parsed.simplify().toTex(), answer);
165
164
  return "S=\\ " + parsed.simplify().toTex() === answer;
166
165
  }
167
166
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"graphicInequationAffine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/graphicInequationAffine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAa3C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,gBAAgB,CAAC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAsHF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAkBzD,CAAC"}
1
+ {"version":3,"file":"graphicInequationAffine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/graphicInequationAffine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAc3C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,gBAAgB,CAAC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4HF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAkBzD,CAAC"}
@@ -11,6 +11,7 @@ const randint_1 = require("../../../../math/utils/random/randint");
11
11
  const infiniteNode_1 = require("../../../../tree/nodes/numbers/infiniteNode");
12
12
  const closure_1 = require("../../../../tree/nodes/sets/closure");
13
13
  const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
14
+ const unionIntervalParser_1 = require("../../../../tree/parsers/unionIntervalParser");
14
15
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
15
16
  const random_1 = require("../../../../utils/alea/random");
16
17
  const getPropositions = (n, { answer }) => {
@@ -75,9 +76,15 @@ const getKeys = (identifiers) => {
75
76
  ];
76
77
  };
77
78
  const isAnswerValid = (ans, { answer }) => {
78
- const inter = answer;
79
- return ans === inter || ans === "S=\\ " + inter;
80
- throw Error("VEA not implemented");
79
+ try {
80
+ const parsed = (0, unionIntervalParser_1.unionIntervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
81
+ if (!parsed)
82
+ return false;
83
+ return parsed.simplify().toTex() === answer;
84
+ }
85
+ catch (err) {
86
+ return false;
87
+ }
81
88
  };
82
89
  const getGraphicInequationAffineQuestion = (opts) => {
83
90
  const yValue = (0, randint_1.randint)(-5, 6);
@@ -1 +1 @@
1
- {"version":3,"file":"twoFunctionsInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/twoFunctionsInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAQ5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAC;AAqOF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
1
+ {"version":3,"file":"twoFunctionsInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/twoFunctionsInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAS5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAC;AAyPF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
@@ -7,13 +7,65 @@ const colors_1 = require("../../../../geogebra/colors");
7
7
  const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
8
8
  const inequation_1 = require("../../../../math/inequations/inequation");
9
9
  const randint_1 = require("../../../../math/utils/random/randint");
10
- const inequationSolutionNode_1 = require("../../../../tree/nodes/inequations/inequationSolutionNode");
11
10
  const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
12
11
  const closure_1 = require("../../../../tree/nodes/sets/closure");
13
12
  const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
14
13
  const unionIntervalNode_1 = require("../../../../tree/nodes/sets/unionIntervalNode");
15
14
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
16
15
  const random_1 = require("../../../../utils/alea/random");
16
+ const unionIntervalParser_1 = require("../../../../tree/parsers/unionIntervalParser");
17
+ const getInstruction = (identifiers) => {
18
+ return `Déterminer graphiquement les solutions de l'inéquation $f(x) ${identifiers.ineqSymbol} g(x)$ où $f$ et $g$ sont les fonctions représentées ci-dessous.`;
19
+ };
20
+ const getKeys = (identifiers) => {
21
+ return [
22
+ "S",
23
+ "equal",
24
+ "lbracket",
25
+ "semicolon",
26
+ "rbracket",
27
+ "cup",
28
+ "lbrace",
29
+ "rbrace",
30
+ "varnothing",
31
+ ];
32
+ };
33
+ const getAnswer = (identifiers) => {
34
+ const intervalsNodes = identifiers.intervals.map((i) => new intervalNode_1.IntervalNode(new numberNode_1.NumberNode(i.a), new numberNode_1.NumberNode(i.b), i.closure));
35
+ const answer = intervalsNodes.length === 1
36
+ ? `S=\\ ${intervalsNodes[0].toTex()}`
37
+ : `S=\\ ${new unionIntervalNode_1.UnionIntervalNode(intervalsNodes).toTex()}`;
38
+ return answer;
39
+ };
40
+ const getGGBOptions = (identifiers) => {
41
+ const { fSplinePoints, gSplinePoints } = identifiers;
42
+ const fColor = (0, random_1.random)(colors_1.blues);
43
+ const gColor = (0, random_1.random)(colors_1.oranges);
44
+ const commands = [
45
+ `S = Spline(${fSplinePoints
46
+ .map((point) => `(${point[0]},${point[1]})`)
47
+ .join(",")})`,
48
+ "SetFixed(S, true)",
49
+ `SetColor(S, "${fColor}")`,
50
+ `SetCaption(S, "$f$")`,
51
+ `ShowLabel(S, true)`,
52
+ `T = Spline(${gSplinePoints
53
+ .map((point) => `(${point[0]},${point[1]})`)
54
+ .join(",")})`,
55
+ "SetFixed(T, true)",
56
+ `SetColor(T, "${gColor}")`,
57
+ `SetCaption(T, "$g$")`,
58
+ `ShowLabel(T, true)`,
59
+ ];
60
+ const xMin = Math.min(...[...fSplinePoints, ...gSplinePoints].map((point) => point[0]));
61
+ const yMin = Math.min(...[...fSplinePoints, ...gSplinePoints].map((point) => point[1]));
62
+ const xMax = Math.max(...[...fSplinePoints, ...gSplinePoints].map((point) => point[0]));
63
+ const yMax = Math.max(...[...fSplinePoints, ...gSplinePoints].map((point) => point[1]));
64
+ const ggb = new geogebraConstructor_1.GeogebraConstructor({ commands });
65
+ return ggb.getOptions({
66
+ coords: ggb.getAdaptedCoords({ xMax, xMin, yMax, yMin }),
67
+ });
68
+ };
17
69
  const getTwoFunctionsInequationQuestion = () => {
18
70
  const ineq = inequation_1.InequationSymbolConstructor.random();
19
71
  const yValue = (0, randint_1.randint)(-5, 5);
@@ -83,58 +135,20 @@ const getTwoFunctionsInequationQuestion = () => {
83
135
  b: xEnd,
84
136
  closure: ineq.isStrict ? closure_1.ClosureType.OF : closure_1.ClosureType.FF,
85
137
  });
86
- const xMin = Math.min(...[...fSplinePoints, ...gSplinePoints].map((point) => point[0]));
87
- const yMin = Math.min(...[...fSplinePoints, ...gSplinePoints].map((point) => point[1]));
88
- const xMax = Math.max(...[...fSplinePoints, ...gSplinePoints].map((point) => point[0]));
89
- const yMax = Math.max(...[...fSplinePoints, ...gSplinePoints].map((point) => point[1]));
90
- const fColor = (0, random_1.random)(colors_1.blues);
91
- const gColor = (0, random_1.random)(colors_1.oranges);
92
- const commands = [
93
- `S = Spline(${fSplinePoints
94
- .map((point) => `(${point[0]},${point[1]})`)
95
- .join(",")})`,
96
- "SetFixed(S, true)",
97
- `SetColor(S, "${fColor}")`,
98
- `SetCaption(S, "$f$")`,
99
- `ShowLabel(S, true)`,
100
- `T = Spline(${gSplinePoints
101
- .map((point) => `(${point[0]},${point[1]})`)
102
- .join(",")})`,
103
- "SetFixed(T, true)",
104
- `SetColor(T, "${gColor}")`,
105
- `SetCaption(T, "$g$")`,
106
- `ShowLabel(T, true)`,
107
- ];
108
- const ggb = new geogebraConstructor_1.GeogebraConstructor({ commands });
109
- const intervalsNodes = intervals.map((i) => new intervalNode_1.IntervalNode(new numberNode_1.NumberNode(i.a), new numberNode_1.NumberNode(i.b), i.closure));
110
- const answer = intervalsNodes.length === 1
111
- ? `S=\\ ${intervalsNodes[0].toTex()}`
112
- : `S=\\ ${new unionIntervalNode_1.UnionIntervalNode(intervalsNodes).toTex()}`;
138
+ const identifiers = {
139
+ yValue,
140
+ fSplinePoints,
141
+ gSplinePoints,
142
+ ineqSymbol: ineq.symbol,
143
+ intervals,
144
+ };
113
145
  const question = {
114
- answer,
115
- instruction: `Déterminer graphiquement les solutions de l'inéquation $f(x) ${ineq.symbol} g(x)$ où $f$ et $g$ sont les fonctions représentées ci-dessous.`,
116
- keys: [
117
- "S",
118
- "equal",
119
- "lbracket",
120
- "semicolon",
121
- "rbracket",
122
- "cup",
123
- "lbrace",
124
- "rbrace",
125
- "varnothing",
126
- ],
146
+ answer: getAnswer(identifiers),
147
+ instruction: getInstruction(identifiers),
148
+ keys: getKeys(identifiers),
127
149
  answerFormat: "tex",
128
- identifiers: {
129
- yValue,
130
- fSplinePoints,
131
- gSplinePoints,
132
- ineqSymbol: ineq.symbol,
133
- intervals,
134
- },
135
- ggbOptions: ggb.getOptions({
136
- coords: ggb.getAdaptedCoords({ xMax, xMin, yMax, yMin }),
137
- }),
150
+ identifiers,
151
+ ggbOptions: getGGBOptions(identifiers),
138
152
  };
139
153
  return question;
140
154
  };
@@ -167,13 +181,15 @@ const getPropositions = (n, { answer, intervals, fSplinePoints, ineqSymbol }) =>
167
181
  return (0, exercise_1.shuffleProps)(propositions, n);
168
182
  };
169
183
  const isAnswerValid = (ans, { answer, fSplinePoints, yValue, intervals }) => {
170
- const intervalsNodes = intervals.map((n) => new intervalNode_1.IntervalNode(new numberNode_1.NumberNode(n.a), new numberNode_1.NumberNode(n.b), n.closure));
171
- const intervalsTree = intervalsNodes.length === 1
172
- ? intervalsNodes[0]
173
- : new unionIntervalNode_1.UnionIntervalNode(intervalsNodes);
174
- const answerTree = new inequationSolutionNode_1.InequationSolutionNode(intervalsTree);
175
- const texs = answerTree.toAllValidTexs();
176
- return texs.includes(ans);
184
+ try {
185
+ const parsed = (0, unionIntervalParser_1.unionIntervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
186
+ if (!parsed)
187
+ return false;
188
+ return "S=\\ " + parsed.simplify().toTex() === answer;
189
+ }
190
+ catch (err) {
191
+ return false;
192
+ }
177
193
  };
178
194
  exports.twoFunctionsInequation = {
179
195
  id: "twoFunctionsInequation",
@@ -1 +1 @@
1
- {"version":3,"file":"exponentialsVariations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/exponentialsVariations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAM1C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
1
+ {"version":3,"file":"exponentialsVariations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/exponentialsVariations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAM1C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAmBxD,CAAC"}
@@ -121,4 +121,5 @@ exports.exponentialsVariations = {
121
121
  getAnswer,
122
122
  answerType: "QCU",
123
123
  hasHintAndCorrection: true,
124
+ getKeys,
124
125
  };
@@ -5,7 +5,10 @@ type Identifiers = {
5
5
  signs: number[];
6
6
  isLog10: boolean;
7
7
  };
8
- export declare const log10SumSimplifying: Exercise<Identifiers>;
9
- export declare const logSumSimplifying: Exercise<Identifiers>;
8
+ type Options = {
9
+ isLog10: boolean;
10
+ };
11
+ export declare const log10SumSimplifying: Exercise<Identifiers, Options>;
12
+ export declare const logSumSimplifying: Exercise<Identifiers, Options>;
10
13
  export {};
11
14
  //# sourceMappingURL=log10Simplifying.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log10Simplifying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/log10Simplifying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAkGF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAiBnD,CAAC"}
1
+ {"version":3,"file":"log10Simplifying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/log10Simplifying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AA8FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB9D,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB5D,CAAC"}
@@ -87,6 +87,7 @@ exports.log10SumSimplifying = {
87
87
  getPropositions,
88
88
  isAnswerValid,
89
89
  subject: "Mathématiques",
90
+ getKeys,
90
91
  };
91
92
  exports.logSumSimplifying = {
92
93
  id: "logSumSimplifying",
@@ -101,4 +102,5 @@ exports.logSumSimplifying = {
101
102
  getPropositions,
102
103
  isAnswerValid,
103
104
  subject: "Mathématiques",
105
+ getKeys,
104
106
  };
@@ -1 +1 @@
1
- {"version":3,"file":"logEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAclC,cAAc;AACd,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA6EF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAa7C,CAAC"}
1
+ {"version":3,"file":"logEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAclC,cAAc;AACd,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA6EF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAc7C,CAAC"}
@@ -79,4 +79,5 @@ exports.logEquation = {
79
79
  freeTimer: 60,
80
80
  isAnswerValid,
81
81
  subject: "Mathématiques",
82
+ getKeys,
82
83
  };
@@ -6,7 +6,10 @@ type Identifiers = {
6
6
  k: number;
7
7
  isLog10: boolean;
8
8
  };
9
- export declare const logPowerEquation: Exercise<Identifiers>;
10
- export declare const log10PowerEquation: Exercise<Identifiers>;
9
+ type Options = {
10
+ isLog10: boolean;
11
+ };
12
+ export declare const logPowerEquation: Exercise<Identifiers, Options>;
13
+ export declare const log10PowerEquation: Exercise<Identifiers, Options>;
11
14
  export {};
12
15
  //# sourceMappingURL=logPowerEquation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logPowerEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logPowerEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AA4GF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAelD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
1
+ {"version":3,"file":"logPowerEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logPowerEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAwGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB3D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmB7D,CAAC"}
@@ -90,6 +90,7 @@ exports.logPowerEquation = {
90
90
  getPropositions,
91
91
  isAnswerValid,
92
92
  subject: "Mathématiques",
93
+ getKeys,
93
94
  };
94
95
  exports.log10PowerEquation = {
95
96
  id: "log10PowerEquation",
@@ -104,4 +105,5 @@ exports.log10PowerEquation = {
104
105
  getPropositions,
105
106
  isAnswerValid,
106
107
  subject: "Mathématiques",
108
+ getKeys,
107
109
  };
@@ -1 +1 @@
1
- {"version":3,"file":"logSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqFF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
1
+ {"version":3,"file":"logSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqFF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
@@ -95,4 +95,5 @@ exports.logSimplifiying = {
95
95
  getPropositions,
96
96
  isAnswerValid,
97
97
  subject: "Mathématiques",
98
+ getKeys,
98
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"squareImageInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/squareImageInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAW,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGrE,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAgIF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAarD,CAAC"}
1
+ {"version":3,"file":"squareImageInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/squareImageInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAW,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAKrE,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAsIF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAarD,CAAC"}
@@ -6,6 +6,7 @@ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQ
6
6
  const randint_1 = require("../../../../math/utils/random/randint");
7
7
  const closure_1 = require("../../../../tree/nodes/sets/closure");
8
8
  const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
9
+ const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
9
10
  // a < x < b avec a > 0 ==> a^2 < x^2 < b^2
10
11
  // a < x < b avec b < 0 ==> b^2 < x^2 < a^2
11
12
  // a < x < b avec a<0 et b>0 ==> 0 < x^2 < max(|a|,|b|)^2
@@ -69,7 +70,9 @@ const getSquareImageIntervalQuestion = () => {
69
70
  const answer = getAnswer(a, b, type, closure).toTex();
70
71
  const question = {
71
72
  answer,
72
- instruction: `Soit $${instruction}$. A quel intervalle appartient $x^2$ ?`,
73
+ instruction: `Soit $${instruction}$.
74
+
75
+ À quel intervalle appartient $x^2$ ?`,
73
76
  keys: ["lbracket", "semicolon", "rbracket"],
74
77
  answerFormat: "tex",
75
78
  identifiers: { a, b, closure, type },
@@ -91,9 +94,15 @@ const getPropositions = (n, { answer, a, b, type, closure }) => {
91
94
  return (0, exercise_1.shuffleProps)(propositions, n);
92
95
  };
93
96
  const isAnswerValid = (ans, { answer, a, b, closure, type }) => {
94
- const interval = getAnswer(a, b, type, closure);
95
- const texs = interval.toAllValidTexs({ allowCommaInInterval: true });
96
- return texs.includes(ans);
97
+ try {
98
+ const parsed = (0, intervalParser_1.intervalParser)(ans);
99
+ if (!parsed)
100
+ return false;
101
+ return parsed.simplify().toTex() === answer;
102
+ }
103
+ catch (err) {
104
+ return false;
105
+ }
97
106
  };
98
107
  exports.squareImageInterval = {
99
108
  id: "squareImageInterval",
@@ -1 +1 @@
1
- {"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAe3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAsHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
1
+ {"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAgB3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAwHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}