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
@@ -1 +1 @@
1
- {"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA0FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAkBrD,CAAC"}
1
+ {"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA0FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAmBrD,CAAC"}
@@ -104,4 +104,5 @@ exports.divisibiltyCriteria = {
104
104
  getAnswer,
105
105
  hasHintAndCorrection: true,
106
106
  answerType: "QCU",
107
+ getKeys,
107
108
  };
@@ -6,6 +6,9 @@ type Identifiers = {
6
6
  b: number;
7
7
  c: number;
8
8
  };
9
- export declare const firstDegreeInequationsType2: Exercise<Identifiers>;
9
+ type Options = {
10
+ inequationSolutionFormat: string;
11
+ };
12
+ export declare const firstDegreeInequationsType2: Exercise<Identifiers, Options>;
10
13
  export {};
11
14
  //# sourceMappingURL=firstDegreeInequationsType2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"firstDegreeInequationsType2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAc3C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAyEF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAc7D,CAAC"}
1
+ {"version":3,"file":"firstDegreeInequationsType2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAW3C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwIF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBtE,CAAC"}
@@ -2,62 +2,107 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.firstDegreeInequationsType2 = void 0;
4
4
  const exercise_1 = require("../../../../exercises/exercise");
5
+ const inequationSolutionFormat_1 = require("../../../../exercises/options/inequationSolutionFormat");
5
6
  const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
- const inequationKeys_1 = require("../../../../exercises/utils/keys/inequationKeys");
7
7
  const inequation_1 = require("../../../../math/inequations/inequation");
8
8
  const rational_1 = require("../../../../math/numbers/rationals/rational");
9
9
  const affine_1 = require("../../../../math/polynomials/affine");
10
10
  const randint_1 = require("../../../../math/utils/random/randint");
11
11
  const inequationNode_1 = require("../../../../tree/nodes/inequations/inequationNode");
12
12
  const inequationSolutionNode_1 = require("../../../../tree/nodes/inequations/inequationSolutionNode");
13
- const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
13
+ const inequationParser_1 = require("../../../../tree/parsers/inequationParser");
14
+ const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
14
15
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
15
16
  const shuffle_1 = require("../../../../utils/alea/shuffle");
16
17
  /**ax+b<c */
17
- const getFirstDegreeInequationsQuestion = () => {
18
+ const getKeys = (identifiers, opts) => {
19
+ const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
20
+ if (isInterval)
21
+ return ["S", "equal", "lbracket", "semicolon", "rbracket", "infty"];
22
+ return ["x", "inf", "sup", "leq", "geq"];
23
+ };
24
+ const getInstruction = (identifiers) => {
25
+ const { ineqType, a, b, c } = identifiers;
26
+ const affine = new affine_1.Affine(a, b);
27
+ return `Résoudre l'inéquation :
28
+
29
+ $$
30
+ ${affine.toTex()} ${ineqType} ${c}
31
+ $$`;
32
+ };
33
+ const getAnswer = (identifiers, opts) => {
34
+ const { ineqType, a, b, c } = identifiers;
35
+ const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
36
+ const result = new rational_1.Rational(c - b, a).simplify().toTree();
37
+ const invIneqType = new inequation_1.InequationSymbol(ineqType).reversed();
38
+ const ineq = new inequationNode_1.InequationNode(["x".toTree(), result], a > 0 ? ineqType : invIneqType);
39
+ const answer = isInterval
40
+ ? new inequationSolutionNode_1.InequationSolutionNode(ineq.toInterval()).toTex()
41
+ : ineq.toTex();
42
+ return answer;
43
+ };
44
+ const getFirstDegreeInequationsQuestion = (opts) => {
18
45
  const affine = new affine_1.Affine((0, randint_1.randint)(-10, 10, [0, 1]), (0, randint_1.randint)(-10, 10, [0]));
19
46
  const c = (0, randint_1.randint)(-10, 11);
20
- const result = new rational_1.Rational(c - affine.b, affine.a)
21
- .simplify()
22
- .toTree()
23
- .toTex();
24
47
  const ineqType = inequation_1.InequationSymbolConstructor.random();
25
- const invIneqType = ineqType.reversed();
26
- const answer = `x${affine.a > 0 ? ineqType.symbol : invIneqType}${result}`;
48
+ const identifiers = {
49
+ a: affine.a,
50
+ b: affine.b,
51
+ c,
52
+ ineqType: ineqType.symbol,
53
+ };
27
54
  const question = {
28
- answer: answer,
29
- instruction: `Résoudre l'inéquation : $${affine.toTex()} ${ineqType.symbol} ${c}$ `,
30
- keys: inequationKeys_1.inequationKeys,
55
+ answer: getAnswer(identifiers, opts),
56
+ instruction: getInstruction(identifiers, opts),
57
+ keys: getKeys(identifiers, opts),
31
58
  answerFormat: "tex",
32
- identifiers: { a: affine.a, b: affine.b, c, ineqType: ineqType.symbol },
59
+ identifiers,
33
60
  };
34
61
  return question;
35
62
  };
36
- const getPropositions = (n, { answer, a, ineqType, b, c }) => {
37
- const result = new rational_1.Rational(c - b, a).simplify().toTree().toTex();
63
+ const getPropositions = (n, { answer, a, ineqType, b, c }, opts) => {
64
+ const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
65
+ const result = new rational_1.Rational(c - b, a).simplify().toTree();
38
66
  const propositions = [];
39
67
  (0, exercise_1.addValidProp)(propositions, answer);
40
68
  const ineq = new inequation_1.InequationSymbol(ineqType);
41
69
  const invIneqType = ineq.reversed();
42
- (0, exercise_1.tryToAddWrongProp)(propositions, `x${a < 0 ? ineqType : invIneqType}${result}`);
70
+ const fakeIneq = new inequationNode_1.InequationNode(["x".toTree(), result], a < 0 ? ineqType : invIneqType);
71
+ (0, exercise_1.tryToAddWrongProp)(propositions, isInterval
72
+ ? new inequationSolutionNode_1.InequationSolutionNode(fakeIneq.toInterval()).toTex()
73
+ : fakeIneq.toTex());
43
74
  while (propositions.length < n) {
44
- const wrongAnswer = `x${(0, coinFlip_1.coinFlip)() ? ineqType : invIneqType}${(0, randint_1.randint)(-10, 11)}`;
45
- (0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer);
75
+ const wrongRes = (0, randint_1.randint)(-10, 11).toTree();
76
+ const wrongSymb = (0, coinFlip_1.coinFlip)() ? ineqType : invIneqType;
77
+ const wrongIneq = new inequationNode_1.InequationNode(["x".toTree(), wrongRes], wrongSymb);
78
+ (0, exercise_1.tryToAddWrongProp)(propositions, isInterval
79
+ ? new inequationSolutionNode_1.InequationSolutionNode(wrongIneq.toInterval()).toTex()
80
+ : wrongIneq.toTex());
46
81
  }
47
82
  return (0, shuffle_1.shuffle)(propositions);
48
83
  };
49
- const isAnswerValid = (ans, { a, b, c, ineqType }) => {
50
- const ineqSymbol = new inequation_1.InequationSymbol(ineqType);
51
- const invIneqType = ineqSymbol.reversed();
52
- const trueIneqType = a < 0 ? invIneqType : ineqType;
53
- const result = new rational_1.Rational(c - b, a).simplify().toTree();
54
- const ineq = new inequationNode_1.InequationNode([new variableNode_1.VariableNode("x"), result], trueIneqType);
55
- const answer = new inequationSolutionNode_1.InequationSolutionNode(ineq.toInterval(), {
56
- opts: { allowFractionToDecimal: true },
57
- });
58
- const texs = answer.toAllValidTexs();
59
- return texs.includes(ans);
84
+ const isAnswerValid = (ans, { answer, a, b, c, ineqType }, opts) => {
85
+ try {
86
+ const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
87
+ if (isInterval) {
88
+ const parsed = (0, intervalParser_1.intervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
89
+ if (!parsed)
90
+ return false;
91
+ return ("S=\\ " + parsed.simplify({ decimalToFractions: true }).toTex() ===
92
+ answer);
93
+ }
94
+ else {
95
+ const parsed = (0, inequationParser_1.inequationParser)(ans);
96
+ if (!parsed)
97
+ return false;
98
+ return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
99
+ }
100
+ }
101
+ catch (err) {
102
+ return false;
103
+ }
60
104
  };
105
+ const options = [inequationSolutionFormat_1.inequationSolutionFormat];
61
106
  exports.firstDegreeInequationsType2 = {
62
107
  id: "firstDegreeInequationsType2",
63
108
  connector: "\\iff",
@@ -67,8 +112,12 @@ exports.firstDegreeInequationsType2 = {
67
112
  levels: ["3ème", "2ndPro", "2nde", "1reESM", "1rePro", "1reTech"],
68
113
  isSingleStep: true,
69
114
  sections: ["Inéquations"],
70
- generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFirstDegreeInequationsQuestion, nb),
115
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFirstDegreeInequationsQuestion(opts), nb),
71
116
  qcmTimer: 60,
72
117
  freeTimer: 60,
73
118
  subject: "Mathématiques",
119
+ options,
120
+ getKeys,
121
+ getAnswer,
122
+ getInstruction,
74
123
  };
@@ -8,6 +8,9 @@ type Identifiers = {
8
8
  c: number;
9
9
  d: number;
10
10
  };
11
- export declare const firstDegreeInequationsType3: Exercise<Identifiers>;
11
+ type Options = {
12
+ inequationSolutionFormat: string;
13
+ };
14
+ export declare const firstDegreeInequationsType3: Exercise<Identifiers, Options>;
12
15
  export {};
13
16
  //# sourceMappingURL=firstDegreeInequationsType3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"firstDegreeInequationsType3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAW3C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoFF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAc7D,CAAC"}
1
+ {"version":3,"file":"firstDegreeInequationsType3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAW3C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmJF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBtE,CAAC"}
@@ -2,70 +2,116 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.firstDegreeInequationsType3 = void 0;
4
4
  const exercise_1 = require("../../../../exercises/exercise");
5
+ const inequationSolutionFormat_1 = require("../../../../exercises/options/inequationSolutionFormat");
5
6
  const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
- const inequationKeys_1 = require("../../../../exercises/utils/keys/inequationKeys");
7
7
  const inequation_1 = require("../../../../math/inequations/inequation");
8
8
  const rational_1 = require("../../../../math/numbers/rationals/rational");
9
9
  const affine_1 = require("../../../../math/polynomials/affine");
10
10
  const randint_1 = require("../../../../math/utils/random/randint");
11
11
  const inequationNode_1 = require("../../../../tree/nodes/inequations/inequationNode");
12
12
  const inequationSolutionNode_1 = require("../../../../tree/nodes/inequations/inequationSolutionNode");
13
- const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
13
+ const inequationParser_1 = require("../../../../tree/parsers/inequationParser");
14
+ const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
14
15
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
15
16
  const shuffle_1 = require("../../../../utils/alea/shuffle");
16
17
  /**ax+b<cx+d */
17
- const getFirstDegreeInequationsQuestion = () => {
18
- const affine1 = new affine_1.Affine((0, randint_1.randint)(-10, 10, [0]), (0, randint_1.randint)(-10, 10));
19
- const affine2 = new affine_1.Affine((0, randint_1.randint)(-10, 10, [0, affine1.a]), (0, randint_1.randint)(-10, 10));
18
+ const getInstruction = (identifiers) => {
19
+ const { ineqType, a, b, c, d } = identifiers;
20
+ const affine1 = new affine_1.Affine(a, b);
21
+ const affine2 = new affine_1.Affine(c, d);
22
+ return `Résoudre l'inéquation :
23
+
24
+ $$
25
+ ${affine1.toTex()} ${ineqType} ${affine2.toTex()}
26
+ $$`;
27
+ };
28
+ const getAnswer = (identifiers, opts) => {
29
+ const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
30
+ const { ineqType, a, b, c, d, coeff } = identifiers;
31
+ const affine1 = new affine_1.Affine(a, b);
32
+ const affine2 = new affine_1.Affine(c, d);
20
33
  const result = new rational_1.Rational(affine2.b - affine1.b, affine1.a - affine2.a)
21
34
  .simplify()
22
- .toTree()
23
- .toTex();
35
+ .toTree();
36
+ const invIneqType = new inequation_1.InequationSymbol(ineqType).reversed();
37
+ const ineq = new inequationNode_1.InequationNode(["x".toTree(), result], coeff > 0 ? ineqType : invIneqType);
38
+ const answer = isInterval
39
+ ? new inequationSolutionNode_1.InequationSolutionNode(ineq.toInterval()).toTex()
40
+ : ineq.toTex();
41
+ return answer;
42
+ };
43
+ const getFirstDegreeInequationsQuestion = (opts) => {
44
+ const affine1 = new affine_1.Affine((0, randint_1.randint)(-10, 10, [0]), (0, randint_1.randint)(-10, 10));
45
+ const affine2 = new affine_1.Affine((0, randint_1.randint)(-10, 10, [0, affine1.a]), (0, randint_1.randint)(-10, 10));
24
46
  const coeff = affine1.a - affine2.a;
25
47
  const ineqType = inequation_1.InequationSymbolConstructor.random();
26
- const invIneqType = ineqType.reversed();
27
- const answer = `x${coeff > 0 ? ineqType.symbol : invIneqType}${result}`;
48
+ const identifiers = {
49
+ coeff,
50
+ ineqType: ineqType.symbol,
51
+ a: affine1.a,
52
+ b: affine1.b,
53
+ c: affine2.a,
54
+ d: affine2.b,
55
+ };
28
56
  const question = {
29
- answer: answer,
30
- instruction: `Résoudre l'inéquation : $${affine1.toTex()} ${ineqType.symbol} ${affine2.toTex()}$ `,
31
- keys: inequationKeys_1.inequationKeys,
57
+ answer: getAnswer(identifiers, opts),
58
+ instruction: getInstruction(identifiers),
59
+ keys: getKeys(identifiers, opts),
32
60
  answerFormat: "tex",
33
- identifiers: {
34
- coeff,
35
- ineqType: ineqType.symbol,
36
- a: affine1.a,
37
- b: affine1.b,
38
- c: affine2.a,
39
- d: affine2.b,
40
- },
61
+ identifiers,
41
62
  };
42
63
  return question;
43
64
  };
44
- const getPropositions = (n, { answer, coeff, ineqType, a, b, c, d }) => {
45
- const result = new rational_1.Rational(d - b, a - c).simplify().toTree().toTex();
65
+ const getKeys = (identifiers, opts) => {
66
+ const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
67
+ if (isInterval)
68
+ return ["S", "equal", "lbracket", "semicolon", "rbracket", "infty"];
69
+ return ["x", "inf", "sup", "leq", "geq"];
70
+ };
71
+ const getPropositions = (n, { answer, coeff, ineqType, a, b, c, d }, opts) => {
72
+ const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
73
+ const result = new rational_1.Rational(d - b, a - c).simplify().toTree();
46
74
  const propositions = [];
47
75
  (0, exercise_1.addValidProp)(propositions, answer);
48
- const ineq = new inequation_1.InequationSymbol(ineqType);
49
- const invIneqType = ineq.reversed();
50
- (0, exercise_1.tryToAddWrongProp)(propositions, `x${coeff < 0 ? ineqType : invIneqType}${result}`);
76
+ const ineqSymb = new inequation_1.InequationSymbol(ineqType);
77
+ const invIneqSymb = ineqSymb.reversed();
78
+ const ineq = new inequationNode_1.InequationNode(["x".toTree(), result], coeff < 0 ? ineqSymb.symbol : invIneqSymb);
79
+ const fakeAns = isInterval
80
+ ? new inequationSolutionNode_1.InequationSolutionNode(ineq.toInterval()).toTex()
81
+ : ineq.toTex();
82
+ (0, exercise_1.tryToAddWrongProp)(propositions, fakeAns);
51
83
  while (propositions.length < n) {
52
- const wrongAnswer = `x ${(0, coinFlip_1.coinFlip)() ? ineqType : invIneqType} ${(0, randint_1.randint)(-10, 11)}`;
53
- (0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer);
84
+ const wrongRes = (0, randint_1.randint)(-10, 11).toTree();
85
+ const wrongSymb = (0, coinFlip_1.coinFlip)() ? ineqSymb.symbol : invIneqSymb;
86
+ const wrongIneq = new inequationNode_1.InequationNode(["x".toTree(), wrongRes], wrongSymb);
87
+ (0, exercise_1.tryToAddWrongProp)(propositions, isInterval
88
+ ? new inequationSolutionNode_1.InequationSolutionNode(wrongIneq.toInterval()).toTex()
89
+ : wrongIneq.toTex());
54
90
  }
55
91
  return (0, shuffle_1.shuffle)(propositions);
56
92
  };
57
- const isAnswerValid = (ans, { a, b, c, d, ineqType }) => {
58
- const ineqSymbol = new inequation_1.InequationSymbol(ineqType);
59
- const invIneqType = ineqSymbol.reversed();
60
- const trueIneqType = a - c < 0 ? invIneqType : ineqType;
61
- const result = new rational_1.Rational(d - b, a - c).simplify().toTree();
62
- const ineq = new inequationNode_1.InequationNode([new variableNode_1.VariableNode("x"), result], trueIneqType);
63
- const answer = new inequationSolutionNode_1.InequationSolutionNode(ineq.toInterval(), {
64
- opts: { allowFractionToDecimal: true },
65
- });
66
- const texs = answer.toAllValidTexs();
67
- return texs.includes(ans);
93
+ const isAnswerValid = (ans, { answer, a, b, c, d, ineqType }, opts) => {
94
+ try {
95
+ const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
96
+ if (isInterval) {
97
+ const parsed = (0, intervalParser_1.intervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
98
+ if (!parsed)
99
+ return false;
100
+ return ("S=\\ " + parsed.simplify({ decimalToFractions: true }).toTex() ===
101
+ answer);
102
+ }
103
+ else {
104
+ const parsed = (0, inequationParser_1.inequationParser)(ans);
105
+ if (!parsed)
106
+ return false;
107
+ return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
108
+ }
109
+ }
110
+ catch (err) {
111
+ return false;
112
+ }
68
113
  };
114
+ const options = [inequationSolutionFormat_1.inequationSolutionFormat];
69
115
  exports.firstDegreeInequationsType3 = {
70
116
  id: "firstDegreeInequationsType3",
71
117
  connector: "\\iff",
@@ -73,10 +119,14 @@ exports.firstDegreeInequationsType3 = {
73
119
  levels: ["3ème", "2ndPro", "2nde", "1reESM", "1rePro", "1reTech"],
74
120
  isSingleStep: true,
75
121
  sections: ["Inéquations"],
76
- generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFirstDegreeInequationsQuestion, nb),
122
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFirstDegreeInequationsQuestion(opts), nb),
77
123
  qcmTimer: 60,
78
124
  freeTimer: 60,
79
125
  getPropositions,
80
126
  isAnswerValid,
81
127
  subject: "Mathématiques",
128
+ options,
129
+ getAnswer,
130
+ getKeys,
131
+ getInstruction,
82
132
  };
@@ -1 +1 @@
1
- {"version":3,"file":"squareFunctionInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/squareFunctionInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAc3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAoEF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
1
+ {"version":3,"file":"squareFunctionInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/squareFunctionInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAe3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAqFF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAgB1D,CAAC"}
@@ -10,46 +10,64 @@ const sqrtNode_1 = require("../../../../tree/nodes/functions/sqrtNode");
10
10
  const inequationSolutionNode_1 = require("../../../../tree/nodes/inequations/inequationSolutionNode");
11
11
  const closure_1 = require("../../../../tree/nodes/sets/closure");
12
12
  const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
13
+ const unionIntervalParser_1 = require("../../../../tree/parsers/unionIntervalParser");
13
14
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
14
- const getAnswer = (k, ineqSymbol) => {
15
- const sqrt = Math.sqrt(k);
16
- const sqrtTree = Math.floor(sqrt) === sqrt ? sqrt.toTree() : new sqrtNode_1.SqrtNode(k.toTree());
17
- const inequationSymbol = new inequation_1.InequationSymbol(ineqSymbol);
18
- const isStrict = inequationSymbol.isStrict;
15
+ const getAnswer = (identifiers) => {
16
+ const { k, inequationSymbol } = identifiers;
17
+ const sqrtTree = (0, sqrtNode_1.sqrt)(k).simplify();
18
+ const symbol = new inequation_1.InequationSymbol(inequationSymbol);
19
+ const isStrict = symbol.isStrict;
19
20
  const insideInterval = new intervalNode_1.IntervalNode(new oppositeNode_1.OppositeNode(sqrtTree), sqrtTree, isStrict ? closure_1.ClosureType.OO : closure_1.ClosureType.FF);
20
- const set = inequationSymbol.isSup
21
+ const set = symbol.isSup
21
22
  ? insideInterval.toReversedClosure().toComplement()
22
23
  : insideInterval;
23
24
  const solution = new inequationSolutionNode_1.InequationSolutionNode(set);
24
- return solution;
25
+ return solution.toTex();
26
+ };
27
+ const getInstruction = (identifiers) => {
28
+ const { k, inequationSymbol } = identifiers;
29
+ return `Résoudre l'inéquation suivante :
30
+
31
+ $$
32
+ x^2 ${inequationSymbol} ${k}
33
+ $$`;
25
34
  };
26
35
  const getSquareFunctionInequationQuestion = () => {
27
36
  const k = (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(1, 11) ** 2 : (0, randint_1.randint)(1, 100);
28
37
  const inequationSymbol = inequation_1.InequationSymbolConstructor.random();
29
- const solution = getAnswer(k, inequationSymbol.symbol);
38
+ const identifiers = { k, inequationSymbol: inequationSymbol.symbol };
30
39
  const question = {
31
- answer: solution.toTex(),
32
- instruction: `Résoudre l'inéquation suivante : $x^2 ${inequationSymbol.symbol} ${k}$`,
40
+ answer: getAnswer(identifiers),
41
+ instruction: getInstruction(identifiers),
33
42
  keys: ["S", "equal", "lbracket", "rbracket", "semicolon", "infty", "cup"],
34
43
  answerFormat: "tex",
35
- identifiers: { k, inequationSymbol: inequationSymbol.symbol },
44
+ identifiers,
36
45
  };
37
46
  return question;
38
47
  };
39
48
  const getPropositions = (n, { answer, k, inequationSymbol }) => {
40
49
  const propositions = [];
41
50
  (0, exercise_1.addValidProp)(propositions, answer);
42
- (0, exercise_1.tryToAddWrongProp)(propositions, getAnswer(k ** 2, inequationSymbol).toTex());
43
- (0, exercise_1.tryToAddWrongProp)(propositions, getAnswer(k, new inequation_1.InequationSymbol(inequationSymbol).reversed()).toTex());
51
+ (0, exercise_1.tryToAddWrongProp)(propositions, getAnswer({ k: k ** 2, inequationSymbol }));
52
+ (0, exercise_1.tryToAddWrongProp)(propositions, getAnswer({
53
+ k,
54
+ inequationSymbol: new inequation_1.InequationSymbol(inequationSymbol).reversed(),
55
+ }));
44
56
  while (propositions.length < n) {
45
- (0, exercise_1.tryToAddWrongProp)(propositions, getAnswer((0, randint_1.randint)(1, 100), inequationSymbol).toTex());
57
+ (0, exercise_1.tryToAddWrongProp)(propositions, getAnswer({ k: (0, randint_1.randint)(1, 100), inequationSymbol }));
46
58
  }
47
59
  return (0, exercise_1.shuffleProps)(propositions, n);
48
60
  };
49
61
  const isAnswerValid = (ans, { answer, k, inequationSymbol }) => {
50
- const solution = getAnswer(k, inequationSymbol);
51
- const texs = solution.toAllValidTexs();
52
- return texs.includes(ans);
62
+ try {
63
+ const parsed = (0, unionIntervalParser_1.unionIntervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
64
+ if (!parsed)
65
+ return false;
66
+ return "S=\\ " + parsed.simplify().toTex() === answer;
67
+ }
68
+ catch (err) {
69
+ return false;
70
+ }
53
71
  };
54
72
  exports.squareFunctionInequation = {
55
73
  id: "squareFunctionInequation",
@@ -64,4 +82,6 @@ exports.squareFunctionInequation = {
64
82
  isAnswerValid,
65
83
  subject: "Mathématiques",
66
84
  pdfOptions: { shouldSpreadPropositions: true },
85
+ getAnswer,
86
+ getInstruction,
67
87
  };
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/evaluateExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAmDF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
1
+ {"version":3,"file":"evaluateExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/evaluateExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAoFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
@@ -3,10 +3,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.evaluateExpression = void 0;
4
4
  const exercise_1 = require("../../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const numberVEA_1 = require("../../../../exercises/vea/numberVEA");
6
7
  const polynomial_1 = require("../../../../math/polynomials/polynomial");
7
8
  const randint_1 = require("../../../../math/utils/random/randint");
8
9
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
9
10
  const shuffle_1 = require("../../../../utils/alea/shuffle");
11
+ const alignTex_1 = require("../../../../utils/latex/alignTex");
12
+ const getInstruction = (identifiers) => {
13
+ const { rand, poly1, poly2, xValue } = identifiers;
14
+ const polynome1 = new polynomial_1.Polynomial(poly1);
15
+ const polynome2 = new polynomial_1.Polynomial(poly2);
16
+ return rand
17
+ ? `Calculer $${polynome1.toTree().toTex()}$ pour $x = ${xValue}$.`
18
+ : `Calculer $${polynome2.toTree().toTex()}$ pour $x = ${xValue}$.`;
19
+ };
20
+ const getHint = (identifiers) => {
21
+ return `Remplace $x$ par $${identifiers.xValue}$ dans l'expression.`;
22
+ };
23
+ const getCorrection = (identifiers) => {
24
+ const answer = getAnswer(identifiers);
25
+ const { rand, poly1, poly2, xValue } = identifiers;
26
+ const polynome1 = new polynomial_1.Polynomial(poly1);
27
+ const polynome2 = new polynomial_1.Polynomial(poly2);
28
+ return `On remplace $x$ par $${identifiers.xValue}$ dans l'expression :
29
+
30
+ ${(0, alignTex_1.alignTex)([
31
+ [
32
+ "",
33
+ rand
34
+ ? polynome1.toTree().toDetailedEvaluation({ x: xValue.toTree() }).toTex()
35
+ : polynome2.toTree().toDetailedEvaluation({ x: xValue.toTree() }).toTex(),
36
+ ],
37
+ ["=", answer],
38
+ ])}`;
39
+ };
40
+ const getAnswer = (identifiers) => {
41
+ const { rand, poly1, poly2, xValue } = identifiers;
42
+ const polynome1 = new polynomial_1.Polynomial(poly1);
43
+ const polynome2 = new polynomial_1.Polynomial(poly2);
44
+ return rand
45
+ ? polynome1.calculate(xValue) + ""
46
+ : polynome2.calculate(xValue) + "";
47
+ };
10
48
  const getEvaluateExpression = () => {
11
49
  const rand = (0, coinFlip_1.coinFlip)();
12
50
  const polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-5, 6, [0])]);
@@ -16,23 +54,20 @@ const getEvaluateExpression = () => {
16
54
  (0, randint_1.randint)(-4, 5, [0]),
17
55
  ]);
18
56
  const xValue = (0, randint_1.randint)(-9, 10);
19
- const statement = rand
20
- ? `Calculer $${polynome1.toTree().toTex()}$ pour $x = ${xValue}$.`
21
- : `Calculer $${polynome2.toTree().toTex()}$ pour $x = ${xValue}$.`;
22
- const answer = rand
23
- ? polynome1.calculate(xValue) + ""
24
- : polynome2.calculate(xValue) + "";
57
+ const identifiers = {
58
+ rand,
59
+ poly1: polynome1.coefficients,
60
+ poly2: polynome2.coefficients,
61
+ xValue,
62
+ };
25
63
  const question = {
26
- instruction: statement,
27
- answer,
64
+ instruction: getInstruction(identifiers),
65
+ answer: getAnswer(identifiers),
28
66
  keys: ["x"],
29
67
  answerFormat: "tex",
30
- identifiers: {
31
- rand,
32
- poly1: polynome1.coefficients,
33
- poly2: polynome2.coefficients,
34
- xValue,
35
- },
68
+ identifiers,
69
+ hint: getHint(identifiers),
70
+ correction: getCorrection(identifiers),
36
71
  };
37
72
  return question;
38
73
  };
@@ -46,7 +81,7 @@ const getPropositions = (n, { answer }) => {
46
81
  return (0, shuffle_1.shuffle)(propositions);
47
82
  };
48
83
  const isAnswerValid = (ans, { answer }) => {
49
- return ans === answer;
84
+ return (0, numberVEA_1.numberVEA)(ans, answer);
50
85
  };
51
86
  exports.evaluateExpression = {
52
87
  id: "evaluateExpression",
@@ -61,4 +96,9 @@ exports.evaluateExpression = {
61
96
  getPropositions,
62
97
  isAnswerValid,
63
98
  subject: "Mathématiques",
99
+ getHint,
100
+ getCorrection,
101
+ getAnswer,
102
+ getInstruction,
103
+ hasHintAndCorrection: true,
64
104
  };
@@ -1 +1 @@
1
- {"version":3,"file":"convexityQuadrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/convexityQuadrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAoIF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
1
+ {"version":3,"file":"convexityQuadrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/convexityQuadrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAmBlC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAqHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
@@ -11,6 +11,7 @@ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
11
11
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
12
  const closure_1 = require("../../../../tree/nodes/sets/closure");
13
13
  const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
14
+ const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
14
15
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
15
16
  const getConvexityQuadrinomialsQuestion = () => {
16
17
  const quadrinomial = polynomial_1.PolynomialConstructor.randomWithOrder(3);
@@ -59,26 +60,16 @@ const getPropositions = (n, { answer, quadcoeffs }) => {
59
60
  (0, exercise_1.tryToAddWrongProp)(propositions, wrongInterval4);
60
61
  return (0, exercise_1.shuffleProps)(propositions, n);
61
62
  };
62
- const isAnswerValid = (ans, { askConvex, quadcoeffs }) => {
63
- const quadrinomial = new polynomial_1.Polynomial(quadcoeffs);
64
- const secondderivative = quadrinomial.derivate().derivate();
65
- const seconddcoeffs = secondderivative.coefficients;
66
- const inflexionPoint = new fractionNode_1.FractionNode(new multiplyNode_1.MultiplyNode(seconddcoeffs[0].toTree(), new numberNode_1.NumberNode(-1)), seconddcoeffs[1].toTree()).simplify();
67
- let interval;
68
- if (askConvex) {
69
- interval =
70
- quadcoeffs[3] > 0
71
- ? new intervalNode_1.IntervalNode(inflexionPoint, infiniteNode_1.PlusInfinityNode, closure_1.ClosureType.OO)
72
- : new intervalNode_1.IntervalNode(infiniteNode_1.MinusInfinityNode, inflexionPoint, closure_1.ClosureType.OO);
63
+ const isAnswerValid = (ans, { answer, askConvex, quadcoeffs }) => {
64
+ try {
65
+ const parsed = (0, intervalParser_1.intervalParser)(ans);
66
+ if (!parsed)
67
+ return false;
68
+ return parsed.simplify().toTex() === answer;
73
69
  }
74
- else {
75
- interval =
76
- quadcoeffs[3] <= 0
77
- ? new intervalNode_1.IntervalNode(inflexionPoint, infiniteNode_1.PlusInfinityNode, closure_1.ClosureType.OO)
78
- : new intervalNode_1.IntervalNode(infiniteNode_1.MinusInfinityNode, inflexionPoint, closure_1.ClosureType.OO);
70
+ catch (err) {
71
+ return false;
79
72
  }
80
- const latexs = interval.toAllValidTexs({ allowFractionToDecimal: true });
81
- return latexs.includes(ans);
82
73
  };
83
74
  exports.convexityQuadrinomials = {
84
75
  id: "convexityQuadrinomials",
@@ -1 +1 @@
1
- {"version":3,"file":"lnDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAanD,CAAC"}
1
+ {"version":3,"file":"lnDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}