math-exercises 2.2.7 → 2.2.8

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 (183) hide show
  1. package/lib/exercises/math/calcul/arithmetics/divisorsList.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/arithmetics/divisorsList.js +10 -7
  3. package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +0 -1
  5. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.js +0 -1
  7. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.js +0 -1
  9. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
  10. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +0 -1
  11. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts +10 -0
  12. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -0
  13. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +61 -0
  14. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts +10 -0
  15. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -0
  16. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +56 -0
  17. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts +9 -0
  18. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts.map +1 -0
  19. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +57 -0
  20. package/lib/exercises/math/calcul/fractions/index.d.ts +3 -0
  21. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  22. package/lib/exercises/math/calcul/fractions/index.js +3 -0
  23. package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
  24. package/lib/exercises/math/calcul/fractions/simplifyFraction.js +0 -1
  25. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
  26. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +0 -1
  27. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
  28. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +0 -1
  29. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  30. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +0 -1
  31. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  32. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +0 -1
  33. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
  34. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.js +0 -1
  35. package/lib/exercises/math/complex/addComplex.d.ts.map +1 -1
  36. package/lib/exercises/math/complex/addComplex.js +0 -1
  37. package/lib/exercises/math/complex/conjugateComplex.ts.d.ts.map +1 -1
  38. package/lib/exercises/math/complex/conjugateComplex.ts.js +0 -1
  39. package/lib/exercises/math/complex/conjugateDivideComplex.d.ts.map +1 -1
  40. package/lib/exercises/math/complex/conjugateDivideComplex.js +0 -1
  41. package/lib/exercises/math/complex/inverseComplex.d.ts.map +1 -1
  42. package/lib/exercises/math/complex/inverseComplex.js +0 -1
  43. package/lib/exercises/math/complex/moduloFromAlgebraicComplex.d.ts.map +1 -1
  44. package/lib/exercises/math/complex/moduloFromAlgebraicComplex.js +0 -1
  45. package/lib/exercises/math/complex/mutiplyComplex.d.ts.map +1 -1
  46. package/lib/exercises/math/complex/mutiplyComplex.js +0 -1
  47. package/lib/exercises/math/conversion/aeraConversion.d.ts.map +1 -1
  48. package/lib/exercises/math/conversion/aeraConversion.js +0 -2
  49. package/lib/exercises/math/conversion/capacityConversion.d.ts.map +1 -1
  50. package/lib/exercises/math/conversion/capacityConversion.js +0 -1
  51. package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
  52. package/lib/exercises/math/conversion/lengthConversion.js +0 -2
  53. package/lib/exercises/math/conversion/massConversion.d.ts.map +1 -1
  54. package/lib/exercises/math/conversion/massConversion.js +0 -2
  55. package/lib/exercises/math/conversion/volumeCapacityConversion.d.ts.map +1 -1
  56. package/lib/exercises/math/conversion/volumeCapacityConversion.js +0 -2
  57. package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
  58. package/lib/exercises/math/conversion/volumeConversion.js +0 -2
  59. package/lib/exercises/math/derivation/derivative/expDerivativeOne.d.ts.map +1 -1
  60. package/lib/exercises/math/derivation/derivative/expDerivativeOne.js +0 -1
  61. package/lib/exercises/math/derivation/derivative/inverseFunctionDerivative.d.ts.map +1 -1
  62. package/lib/exercises/math/derivation/derivative/inverseFunctionDerivative.js +0 -1
  63. package/lib/exercises/math/derivation/derivative/lnDerivativeOne.d.ts.map +1 -1
  64. package/lib/exercises/math/derivation/derivative/lnDerivativeOne.js +0 -1
  65. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
  66. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +0 -1
  67. package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.d.ts.map +1 -1
  68. package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.js +0 -2
  69. package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -1
  70. package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.js +0 -1
  71. package/lib/exercises/math/derivation/derivative/quotientDerivative.d.ts.map +1 -1
  72. package/lib/exercises/math/derivation/derivative/quotientDerivative.js +0 -1
  73. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  74. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +0 -1
  75. package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
  76. package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.js +0 -1
  77. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
  78. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +0 -1
  79. package/lib/exercises/math/derivation/derivativeNumberReading.d.ts.map +1 -1
  80. package/lib/exercises/math/derivation/derivativeNumberReading.js +0 -1
  81. package/lib/exercises/math/equaDiff/equaDiffGeneralForme.js +0 -1
  82. package/lib/exercises/math/equaDiff/equaDiffGeneralFormeWithIC.js +0 -1
  83. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
  84. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +0 -1
  85. package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
  86. package/lib/exercises/math/functions/basics/graphicInequation.js +12 -3
  87. package/lib/exercises/math/functions/cube/cubicEquation.js +0 -1
  88. package/lib/exercises/math/functions/exponential/expEquation.js +0 -1
  89. package/lib/exercises/math/functions/logarithm/log10PowerSimplifying.d.ts.map +1 -1
  90. package/lib/exercises/math/functions/logarithm/log10PowerSimplifying.js +3 -4
  91. package/lib/exercises/math/functions/trinoms/rootsFromFactorizedForm.js +0 -1
  92. package/lib/exercises/math/functions/trinoms/secondDegreeInequation.d.ts.map +1 -1
  93. package/lib/exercises/math/functions/trinoms/secondDegreeInequation.js +0 -1
  94. package/lib/exercises/math/functions/trinoms/summitAbscissFromRoots.d.ts.map +1 -1
  95. package/lib/exercises/math/functions/trinoms/summitAbscissFromRoots.js +0 -2
  96. package/lib/exercises/math/geometry/areas/triangleAreaV2.d.ts.map +1 -1
  97. package/lib/exercises/math/geometry/areas/triangleAreaV2.js +0 -1
  98. package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -1
  99. package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.js +0 -1
  100. package/lib/exercises/math/geometry/cartesian/midpoint.js +0 -1
  101. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +0 -1
  102. package/lib/exercises/math/geometry/thales/thales.js +0 -1
  103. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
  104. package/lib/exercises/math/geometry/thales/thalesCalcul.js +0 -1
  105. package/lib/exercises/math/geometry/vectors/alignementViaColinearity.d.ts.map +1 -1
  106. package/lib/exercises/math/geometry/vectors/alignementViaColinearity.js +0 -2
  107. package/lib/exercises/math/geometry/vectors/parallelogramViaEqualVectors.d.ts.map +1 -1
  108. package/lib/exercises/math/geometry/vectors/parallelogramViaEqualVectors.js +0 -2
  109. package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
  110. package/lib/exercises/math/percent/findProportion.js +1 -1
  111. package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
  112. package/lib/exercises/math/percent/percentToDecimal.js +0 -1
  113. package/lib/exercises/math/powers/calculateNegativePower.js +0 -1
  114. package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
  115. package/lib/exercises/math/powers/decimalToScientific.js +0 -1
  116. package/lib/exercises/math/powers/powersPower.d.ts.map +1 -1
  117. package/lib/exercises/math/powers/powersPower.js +0 -1
  118. package/lib/exercises/math/powers/scientificToDecimal.d.ts.map +1 -1
  119. package/lib/exercises/math/powers/scientificToDecimal.js +0 -2
  120. package/lib/exercises/math/primitive/expUPrimitive.js +0 -1
  121. package/lib/exercises/math/primitive/exponentialPrimitive.js +0 -1
  122. package/lib/exercises/math/primitive/logarithmePrimitive.js +0 -1
  123. package/lib/exercises/math/primitive/polynomialPrimitive.js +0 -1
  124. package/lib/exercises/math/primitive/sinCosPrimitive.js +0 -1
  125. package/lib/exercises/math/primitive/sinUCosUPrimitive.js +0 -1
  126. package/lib/exercises/math/probaStat/cardBasicProbas.js +0 -1
  127. package/lib/exercises/math/probaStat/diceBasicProbas.js +0 -1
  128. package/lib/exercises/math/probaStat/probabilityTree.js +0 -1
  129. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  130. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +13 -4
  131. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormula.js +0 -1
  132. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplictFormulaFirstTermRandom.js +0 -1
  133. package/lib/exercises/math/sequences/arithmetic/arithmeticFindTerm.d.ts +10 -0
  134. package/lib/exercises/math/sequences/arithmetic/arithmeticFindTerm.d.ts.map +1 -0
  135. package/lib/exercises/math/sequences/arithmetic/arithmeticFindTerm.js +48 -0
  136. package/lib/exercises/math/sequences/arithmetic/index.d.ts +1 -0
  137. package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
  138. package/lib/exercises/math/sequences/arithmetic/index.js +1 -0
  139. package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.js +1 -1
  140. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
  141. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +0 -1
  142. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.d.ts.map +1 -1
  143. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.js +0 -1
  144. package/lib/exercises/math/sequences/geometric/geometricFindTerm.d.ts +10 -0
  145. package/lib/exercises/math/sequences/geometric/geometricFindTerm.d.ts.map +1 -0
  146. package/lib/exercises/math/sequences/geometric/geometricFindTerm.js +48 -0
  147. package/lib/exercises/math/sequences/geometric/geometricRecognizeReasonFromFirstTerms.d.ts +8 -0
  148. package/lib/exercises/math/sequences/geometric/geometricRecognizeReasonFromFirstTerms.d.ts.map +1 -0
  149. package/lib/exercises/math/sequences/geometric/geometricRecognizeReasonFromFirstTerms.js +46 -0
  150. package/lib/exercises/math/sequences/geometric/index.d.ts +2 -0
  151. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  152. package/lib/exercises/math/sequences/geometric/index.js +2 -0
  153. package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts +2 -3
  154. package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  155. package/lib/exercises/math/sets/intervals/inequalityToInterval.js +23 -91
  156. package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts +10 -0
  157. package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts.map +1 -0
  158. package/lib/exercises/math/sets/intervals/intervalToInequality.js +112 -0
  159. package/lib/exercises/math/squareRoots/squareRootsSum.d.ts.map +1 -1
  160. package/lib/exercises/math/squareRoots/squareRootsSum.js +0 -1
  161. package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.d.ts.map +1 -1
  162. package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.js +0 -1
  163. package/lib/exercises/pc/energy/energyTransfer.d.ts.map +1 -1
  164. package/lib/exercises/pc/energy/energyTransfer.js +0 -1
  165. package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.d.ts.map +1 -1
  166. package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.js +0 -1
  167. package/lib/exercises/pc/mecanicalWaves/elongationReading.d.ts.map +1 -1
  168. package/lib/exercises/pc/mecanicalWaves/elongationReading.js +0 -1
  169. package/lib/index.d.ts +29 -3
  170. package/lib/index.d.ts.map +1 -1
  171. package/lib/math/geometry/line.d.ts.map +1 -1
  172. package/lib/math/geometry/line.js +0 -2
  173. package/lib/pc/constants/molecularChemistry/reaction.js +3 -1
  174. package/lib/playground.d.ts.map +1 -1
  175. package/lib/playground.js +2 -2
  176. package/lib/tree/nodes/sets/closure.d.ts +2 -0
  177. package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
  178. package/lib/tree/nodes/sets/closure.js +24 -0
  179. package/lib/tree/nodes/sets/intervalNode.d.ts +3 -0
  180. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  181. package/lib/tree/nodes/sets/intervalNode.js +13 -0
  182. package/lib/tree/parsers/latexParser.js +6 -6
  183. package/package.json +1 -1
@@ -14,7 +14,6 @@ const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
14
14
  const getScientificToDecimalQuestion = () => {
15
15
  const decScientific = decimal_1.DecimalConstructor.randomScientific((0, randint_1.randint)(1, 4));
16
16
  const tenPower = (0, randint_1.randint)(-5, 6, [0, 1]);
17
- console.log("scien to dec q");
18
17
  const answer = decScientific.multiplyByPowerOfTen(tenPower).toTree().toTex();
19
18
  const statement = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(decScientific.value), new powerNode_1.PowerNode(new numberNode_1.NumberNode(10), new numberNode_1.NumberNode(tenPower)));
20
19
  const statementTex = statement.toTex();
@@ -34,7 +33,6 @@ const getPropositions = (n, { answer, tenPower, decimal }) => {
34
33
  (0, exercise_1.addValidProp)(propositions, answer);
35
34
  (0, exercise_1.tryToAddWrongProp)(propositions, decScientific.multiplyByPowerOfTen(-tenPower).toTree().toTex());
36
35
  while (propositions.length < n) {
37
- console.log("scien to dec qcm");
38
36
  const wrongAnswerTree = decScientific
39
37
  .multiplyByPowerOfTen((0, randint_1.randint)(-6, 6, [tenPower]))
40
38
  .toTree();
@@ -57,7 +57,6 @@ const isExpUPrimitiveAnswerValid = (ans, { coeffs }) => {
57
57
  const integratedFuction = new expNode_1.ExpNode(u.toTree({ forbidPowerToProduct: true }));
58
58
  const answer = new addNode_1.AddNode(integratedFuction, new variableNode_1.VariableNode("C"));
59
59
  const texs = answer.toAllValidTexs();
60
- console.log(texs);
61
60
  return texs.includes(ans);
62
61
  };
63
62
  exports.isExpUPrimitiveAnswerValid = isExpUPrimitiveAnswerValid;
@@ -53,7 +53,6 @@ const isExponentialPrimitiveAnswerValid = (ans, { a }) => {
53
53
  const integratedFuction = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new expNode_1.ExpNode(new variableNode_1.VariableNode("x")));
54
54
  const answer = new addNode_1.AddNode(integratedFuction, new variableNode_1.VariableNode("C"));
55
55
  const texs = answer.toAllValidTexs();
56
- console.log(texs);
57
56
  return texs.includes(ans);
58
57
  };
59
58
  exports.isExponentialPrimitiveAnswerValid = isExponentialPrimitiveAnswerValid;
@@ -61,7 +61,6 @@ const isLogarithmePrimitiveAnswerValid = (ans, { coeffs }) => {
61
61
  const integratedFuction = new logNode_1.LogNode(new absNode_1.AbsNode(uTree));
62
62
  const answer = new addNode_1.AddNode(integratedFuction, new variableNode_1.VariableNode("C"));
63
63
  const texs = answer.toAllValidTexs();
64
- console.log(texs);
65
64
  return texs.includes(ans);
66
65
  };
67
66
  exports.logarithmePrimitive = {
@@ -41,7 +41,6 @@ const isPolynomialPrimitiveAnswerValid = (ans, { coeffs }) => {
41
41
  const polynomial = new polynomial_1.Polynomial(coeffs);
42
42
  const integralPolynomial = polynomial.integrateToNode(opts);
43
43
  const texs = integralPolynomial.toAllValidTexs(opts);
44
- console.log(texs);
45
44
  return texs.includes(ans);
46
45
  };
47
46
  exports.isPolynomialPrimitiveAnswerValid = isPolynomialPrimitiveAnswerValid;
@@ -60,7 +60,6 @@ const isSinCosPrimitiveAnswerValid = (ans, { isCos, a }) => {
60
60
  : new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(-a), new cosNode_1.CosNode(new variableNode_1.VariableNode("x")));
61
61
  const answer = new addNode_1.AddNode(integratedFuction, new variableNode_1.VariableNode("C"));
62
62
  const texs = answer.toAllValidTexs();
63
- console.log(texs);
64
63
  return texs.includes(ans);
65
64
  };
66
65
  exports.isSinCosPrimitiveAnswerValid = isSinCosPrimitiveAnswerValid;
@@ -66,7 +66,6 @@ const isSinUCosUPrimitiveAnswerValid = (ans, { isCos, coeffs }) => {
66
66
  : new oppositeNode_1.OppositeNode(new cosNode_1.CosNode(u.toTree({ forbidPowerToProduct: true })));
67
67
  const answer = new addNode_1.AddNode(integratedFuction, new variableNode_1.VariableNode("C"));
68
68
  const texs = answer.toAllValidTexs();
69
- console.log(texs);
70
69
  return texs.includes(ans);
71
70
  };
72
71
  exports.isSinUCosUPrimitiveAnswerValid = isSinUCosUPrimitiveAnswerValid;
@@ -86,7 +86,6 @@ const isAnswerValid = (ans, { questionType }) => {
86
86
  allowFractionToDecimal: true,
87
87
  });
88
88
  const texs = answer.toAllValidTexs();
89
- console.log(texs);
90
89
  return texs.includes(ans);
91
90
  };
92
91
  exports.cardBasicProbas = {
@@ -59,7 +59,6 @@ const isAnswerValid = (ans, { isParityQuestion, isEvenQuestion, nbFaces }) => {
59
59
  : new rational_1.Rational(Math.ceil(nbFaces / 2), nbFaces).simplify().toTree(opts)
60
60
  : new fractionNode_1.FractionNode(new numberNode_1.NumberNode(1), new numberNode_1.NumberNode(nbFaces), opts);
61
61
  const texs = answer.toAllValidTexs();
62
- console.log(texs);
63
62
  return texs.includes(ans);
64
63
  };
65
64
  exports.diceBasicProbas = {
@@ -118,7 +118,6 @@ const getPropositions = (n, { answer, A, AC, AD, B, BC, BD, type }) => {
118
118
  const isAnswerValid = (ans, { A, AC, AD, B, BC, BD, type }) => {
119
119
  const answer = getAnswerNode({ type, A, AC, AD, B, BC, BD });
120
120
  const texs = answer.toTree({ allowFractionToDecimal: true }).toAllValidTexs();
121
- console.log(texs);
122
121
  return texs.includes(ans);
123
122
  };
124
123
  exports.probabilityTree = {
@@ -1 +1 @@
1
- {"version":3,"file":"marginalAndConditionalFrequency.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkIF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAcjE,CAAC"}
1
+ {"version":3,"file":"marginalAndConditionalFrequency.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA2IF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAcjE,CAAC"}
@@ -8,6 +8,15 @@ const exercise_1 = require("../../../exercise");
8
8
  const getDistinctQuestions_1 = require("../../../utils/getDistinctQuestions");
9
9
  const getAnswer = (rand, x1, x2, x3, x4) => {
10
10
  const x = x1 + x2 + x3 + x4;
11
+ const total = x1 + x2 + x3 + x4;
12
+ const totalA = x1 + x3;
13
+ const totalB = x2 + x4;
14
+ const totalC = x1 + x2;
15
+ const totalD = x3 + x4;
16
+ const A_C = x1;
17
+ const A_D = x3;
18
+ const B_C = x2;
19
+ const B_D = x4;
11
20
  let freqString;
12
21
  let frequence;
13
22
  let answer;
@@ -43,8 +52,8 @@ const getAnswer = (rand, x1, x2, x3, x4) => {
43
52
  answer = new rational_1.Rational(x3, x3 + x4).simplify().toTree();
44
53
  break;
45
54
  case 6:
46
- freqString = "conditionnelle de B parmi D";
47
- frequence = "f_D(B)";
55
+ freqString = "conditionnelle de B parmi C";
56
+ frequence = "f_C(B)";
48
57
  answer = new rational_1.Rational(x2, x1 + x2).simplify().toTree();
49
58
  break;
50
59
  case 7:
@@ -60,12 +69,12 @@ const getAnswer = (rand, x1, x2, x3, x4) => {
60
69
  case 9:
61
70
  freqString = "conditionnelle de C parmi B";
62
71
  frequence = "f_B(C)";
63
- answer = new rational_1.Rational(x3, x1 + x3).simplify().toTree();
72
+ answer = new rational_1.Rational(x2, x2 + x4).simplify().toTree();
64
73
  break;
65
74
  case 10:
66
75
  freqString = "conditionnelle de D parmi A";
67
76
  frequence = "f_A(D)";
68
- answer = new rational_1.Rational(x2, x2 + x4).simplify().toTree();
77
+ answer = new rational_1.Rational(x3, x1 + x3).simplify().toTree();
69
78
  break;
70
79
  case 11:
71
80
  freqString = "conditionnelle de D parmi B";
@@ -56,7 +56,6 @@ const isAnswerValid = (ans, { reason, firstValue }) => {
56
56
  allowRawRightChildAsSolution: true,
57
57
  });
58
58
  const texs = equal.toAllValidTexs();
59
- console.log(texs);
60
59
  return texs.includes(ans);
61
60
  };
62
61
  exports.arithmeticFindExplicitFormula = {
@@ -40,7 +40,6 @@ const isAnswerValid = (ans, { reason, firstValue, firstRank }) => {
40
40
  allowRawRightChildAsSolution: true,
41
41
  });
42
42
  const texs = equal.toAllValidTexs();
43
- console.log(texs);
44
43
  return texs.includes(ans);
45
44
  };
46
45
  exports.arithmeticFindExplicitFormulaFirstTermRandom = {
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ type Identifiers = {
3
+ firstRank: number;
4
+ firstTerm: number;
5
+ reason: number;
6
+ askedRank: number;
7
+ };
8
+ export declare const arithmeticFindTerm: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=arithmeticFindTerm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arithmeticFindTerm.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFindTerm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAqCF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.arithmeticFindTerm = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../../../math/utils/random/randint");
7
+ const random_1 = require("../../../../utils/random");
8
+ const getArithmeticFindTermQuestion = () => {
9
+ const firstRank = (0, random_1.random)([0, 1]);
10
+ const firstTerm = (0, randint_1.randint)(-15, 15);
11
+ const reason = (0, randint_1.randint)(-10, 10, [0]);
12
+ const askedRank = (0, randint_1.randint)(5, 15);
13
+ const answer = firstTerm + reason * (askedRank - firstRank);
14
+ const question = {
15
+ answer: answer + "",
16
+ instruction: `Soit $u$ la suite arithmétique de premier terme $u_${firstRank} = ${firstTerm}$ et de raison $r = ${reason}$. Calculer $u_{${askedRank}}$.`,
17
+ keys: [],
18
+ answerFormat: "tex",
19
+ identifiers: { firstRank, askedRank, firstTerm, reason },
20
+ };
21
+ return question;
22
+ };
23
+ const getPropositions = (n, { answer, askedRank, firstRank, firstTerm, reason }) => {
24
+ const propositions = [];
25
+ (0, exercise_1.addValidProp)(propositions, answer);
26
+ while (propositions.length < n) {
27
+ const fake = firstTerm + reason * (askedRank - (0, randint_1.randint)(-4, 4, [firstRank]));
28
+ (0, exercise_1.tryToAddWrongProp)(propositions, fake + "");
29
+ }
30
+ return (0, exercise_1.shuffleProps)(propositions, n);
31
+ };
32
+ const isAnswerValid = (ans, { answer }) => {
33
+ return ans === answer;
34
+ };
35
+ exports.arithmeticFindTerm = {
36
+ id: "arithmeticFindTerm",
37
+ connector: "=",
38
+ label: "Calculer un terme d'une suite arithmétique à partir de son premier terme et sa raison",
39
+ levels: [],
40
+ isSingleStep: true,
41
+ sections: [],
42
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getArithmeticFindTermQuestion, nb),
43
+ qcmTimer: 60,
44
+ freeTimer: 60,
45
+ getPropositions,
46
+ isAnswerValid,
47
+ subject: "Mathématiques",
48
+ };
@@ -13,4 +13,5 @@ export * from "./arithmeticFirstTermsSum";
13
13
  export * from "./arithmeticFindExplictFormulaFirstTermRandom";
14
14
  export * from "./arithmeticFindReasonRandomRange";
15
15
  export * from "./arithmeticFindRandomTermFromTwoTerms";
16
+ export * from "./arithmeticFindTerm";
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mCAAmC,CAAC;AAClD,cAAc,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mCAAmC,CAAC;AAClD,cAAc,wCAAwC,CAAC;AACvD,cAAc,sBAAsB,CAAC"}
@@ -29,3 +29,4 @@ __exportStar(require("./arithmeticFirstTermsSum"), exports);
29
29
  __exportStar(require("./arithmeticFindExplictFormulaFirstTermRandom"), exports);
30
30
  __exportStar(require("./arithmeticFindReasonRandomRange"), exports);
31
31
  __exportStar(require("./arithmeticFindRandomTermFromTwoTerms"), exports);
32
+ __exportStar(require("./arithmeticFindTerm"), exports);
@@ -12,7 +12,7 @@ const alignTex_1 = require("../../../../utils/alignTex");
12
12
  const shuffle_1 = require("../../../../utils/shuffle");
13
13
  const getGeometricExplicitFormulaUsage = () => {
14
14
  const askedRank = (0, randint_1.randint)(0, 10);
15
- const firstValue = (0, randint_1.randint)(1, 10);
15
+ const firstValue = (0, randint_1.randint)(-5, 10, [0]);
16
16
  const reason = (0, randint_1.randint)(2, 10);
17
17
  const formula = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(firstValue), new powerNode_1.PowerNode(new numberNode_1.NumberNode(reason), new variableNode_1.VariableNode("n")));
18
18
  const formulaTex = formula.toTex();
@@ -1 +1 @@
1
- {"version":3,"file":"geometricFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAiFF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAe9D,CAAC"}
1
+ {"version":3,"file":"geometricFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAgFF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAe9D,CAAC"}
@@ -56,7 +56,6 @@ const isAnswerValid = (ans, { reason, firstValue }) => {
56
56
  allowRawRightChildAsSolution: true,
57
57
  });
58
58
  const texs = equal.toAllValidTexs();
59
- console.log(ans, texs);
60
59
  return texs.includes(ans);
61
60
  };
62
61
  exports.geometricFindExplicitFormula = {
@@ -1 +1 @@
1
- {"version":3,"file":"geometricFindExplicitFormulaFirstTermRandom.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAgFF,eAAO,MAAM,2CAA2C,EAAE,QAAQ,CAAC,WAAW,CAgB3E,CAAC"}
1
+ {"version":3,"file":"geometricFindExplicitFormulaFirstTermRandom.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA+EF,eAAO,MAAM,2CAA2C,EAAE,QAAQ,CAAC,WAAW,CAgB3E,CAAC"}
@@ -43,7 +43,6 @@ const isAnswerValid = (ans, { reason, firstValue, firstRank }) => {
43
43
  allowRawRightChildAsSolution: true,
44
44
  });
45
45
  const texs = equal.toAllValidTexs();
46
- console.log(ans, texs);
47
46
  return texs.includes(ans);
48
47
  };
49
48
  exports.geometricFindExplicitFormulaFirstTermRandom = {
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ type Identifiers = {
3
+ firstRank: number;
4
+ firstTerm: number;
5
+ reason: number;
6
+ askedRank: number;
7
+ };
8
+ export declare const geometricFindTerm: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=geometricFindTerm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometricFindTerm.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindTerm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAqCF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAenD,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.geometricFindTerm = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../../../math/utils/random/randint");
7
+ const random_1 = require("../../../../utils/random");
8
+ const getGeometricFindTermQuestion = () => {
9
+ const firstRank = (0, random_1.random)([0, 1]);
10
+ const firstTerm = (0, randint_1.randint)(-10, 10, [0]);
11
+ const reason = (0, randint_1.randint)(2, 6);
12
+ const askedRank = (0, randint_1.randint)(5, 12);
13
+ const answer = firstTerm * Math.pow(reason, askedRank - firstRank);
14
+ const question = {
15
+ answer: answer + "",
16
+ instruction: `Soit $u$ la suite géométrique de premier terme $u_${firstRank} = ${firstTerm}$ et de raison $q = ${reason}$. Calculer $u_{${askedRank}}$.`,
17
+ keys: [],
18
+ answerFormat: "tex",
19
+ identifiers: { firstRank, askedRank, firstTerm, reason },
20
+ };
21
+ return question;
22
+ };
23
+ const getPropositions = (n, { answer, askedRank, firstRank, firstTerm, reason }) => {
24
+ const propositions = [];
25
+ (0, exercise_1.addValidProp)(propositions, answer);
26
+ while (propositions.length < n) {
27
+ const fake = firstTerm * Math.pow(reason, askedRank - (0, randint_1.randint)(-5, 3, [firstRank]));
28
+ (0, exercise_1.tryToAddWrongProp)(propositions, fake + "");
29
+ }
30
+ return (0, exercise_1.shuffleProps)(propositions, n);
31
+ };
32
+ const isAnswerValid = (ans, { answer }) => {
33
+ return ans === answer;
34
+ };
35
+ exports.geometricFindTerm = {
36
+ id: "geometricFindTerm",
37
+ connector: "=",
38
+ label: "Calculer un terme d'une suite géométrique à partir de son premier terme et sa raison",
39
+ levels: [],
40
+ isSingleStep: true,
41
+ sections: [],
42
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getGeometricFindTermQuestion, nb),
43
+ qcmTimer: 60,
44
+ freeTimer: 60,
45
+ getPropositions,
46
+ isAnswerValid,
47
+ subject: "Mathématiques",
48
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ type Identifiers = {
3
+ sequence: number[];
4
+ reason: number;
5
+ };
6
+ export declare const geometricRecognizeReasonFromFirstTerms: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=geometricRecognizeReasonFromFirstTerms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometricRecognizeReasonFromFirstTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricRecognizeReasonFromFirstTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAIlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAqCF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,WAAW,CAexE,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.geometricRecognizeReasonFromFirstTerms = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../../../math/utils/random/randint");
7
+ const getGeometricRecognizeReasonFromFirstTermsQuestion = () => {
8
+ const firstTerm = (0, randint_1.randint)(1, 20);
9
+ const reason = (0, randint_1.randint)(-5, 6, [0, 1]);
10
+ const sequence = new Array(5)
11
+ .fill(0)
12
+ .map((el, index) => firstTerm * Math.pow(reason, index));
13
+ const question = {
14
+ answer: reason + "",
15
+ instruction: `Voici les premiers termes d'une suite géométrique $u$ : $${sequence.join("\\ ; \\ ")}$. Quelle est la raison de $u$ ?`,
16
+ keys: [],
17
+ answerFormat: "tex",
18
+ identifiers: { sequence, reason },
19
+ };
20
+ return question;
21
+ };
22
+ const getPropositions = (n, { answer, reason }) => {
23
+ const propositions = [];
24
+ (0, exercise_1.addValidProp)(propositions, answer);
25
+ while (propositions.length < n) {
26
+ (0, exercise_1.tryToAddWrongProp)(propositions, reason + (0, randint_1.randint)(-5, 5, [0]) + "");
27
+ }
28
+ return (0, exercise_1.shuffleProps)(propositions, n);
29
+ };
30
+ const isAnswerValid = (ans, { answer }) => {
31
+ return ans === answer;
32
+ };
33
+ exports.geometricRecognizeReasonFromFirstTerms = {
34
+ id: "geometricRecognizeReasonFromFirstTerms",
35
+ connector: "=",
36
+ label: "Reconnaître la raison d'une suite géométrique via ses premiers termes",
37
+ levels: [],
38
+ isSingleStep: true,
39
+ sections: [],
40
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getGeometricRecognizeReasonFromFirstTermsQuestion, nb),
41
+ qcmTimer: 60,
42
+ freeTimer: 60,
43
+ getPropositions,
44
+ isAnswerValid,
45
+ subject: "Mathématiques",
46
+ };
@@ -5,4 +5,6 @@ export * from "./geometricFirstTermsSum";
5
5
  export * from "./geometricReasonUsage";
6
6
  export * from "./geometricRecurrenceFormulaUsage";
7
7
  export * from "./geometricFindExplicitFormulaFirstTermRandom";
8
+ export * from "./geometricFindTerm";
9
+ export * from "./geometricRecognizeReasonFromFirstTerms";
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qBAAqB,CAAC;AACpC,cAAc,0CAA0C,CAAC"}
@@ -21,3 +21,5 @@ __exportStar(require("./geometricFirstTermsSum"), exports);
21
21
  __exportStar(require("./geometricReasonUsage"), exports);
22
22
  __exportStar(require("./geometricRecurrenceFormulaUsage"), exports);
23
23
  __exportStar(require("./geometricFindExplicitFormulaFirstTermRandom"), exports);
24
+ __exportStar(require("./geometricFindTerm"), exports);
25
+ __exportStar(require("./geometricRecognizeReasonFromFirstTerms"), exports);
@@ -1,9 +1,8 @@
1
1
  import { Exercise } from "../../../../exercises/exercise";
2
2
  import { ClosureType } from "../../../../tree/nodes/sets/closure";
3
3
  type Identifiers = {
4
- isIntervalToInequality: boolean;
5
- intervalMin: number;
6
- intervalMax: number;
4
+ intervalMin: number | string;
5
+ intervalMax: number | string;
7
6
  intervalClosure: ClosureType;
8
7
  };
9
8
  export declare const inequalityToInterval: Exercise<Identifiers>;
@@ -1 +1 @@
1
- {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAK5D,KAAK,WAAW,GAAG;IACjB,sBAAsB,EAAE,OAAO,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,WAAW,CAAC;CAC9B,CAAC;AA8KF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
1
+ {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAK5D,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,eAAe,EAAE,WAAW,CAAC;CAC9B,CAAC;AAoFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
@@ -4,22 +4,14 @@ exports.inequalityToInterval = void 0;
4
4
  const exercise_1 = require("../../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
6
  const intervals_1 = require("../../../../math/sets/intervals/intervals");
7
- const inequationNode_1 = require("../../../../tree/nodes/inequations/inequationNode");
8
- const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
9
7
  const belongsNode_1 = require("../../../../tree/nodes/sets/belongsNode");
10
8
  const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
11
- const coinFlip_1 = require("../../../../utils/coinFlip");
12
9
  const shuffle_1 = require("../../../../utils/shuffle");
13
10
  const getInequalityToIntervalQuestion = () => {
14
- const isIntervalToInequality = (0, coinFlip_1.coinFlip)();
15
11
  const interval = intervals_1.IntervalConstructor.random();
16
12
  const inequalityString = interval.toInequality();
17
- const answer = isIntervalToInequality
18
- ? inequalityString
19
- : `x\\in${interval.toTex()}`;
20
- const instruction = isIntervalToInequality
21
- ? `Soit $x \\in ${interval.toTex()}$. Traduire cette appartenance en une inégalité.`
22
- : `Soit $${inequalityString}$. Traduire cette inégalité en appartenance à un intervalle.`;
13
+ const answer = `x\\in${interval.toTex()}`;
14
+ const instruction = `Soit $${inequalityString}$. Traduire cette inégalité en appartenance à un intervalle.`;
23
15
  const question = {
24
16
  answer,
25
17
  instruction: instruction,
@@ -37,100 +29,40 @@ const getInequalityToIntervalQuestion = () => {
37
29
  ],
38
30
  answerFormat: "tex",
39
31
  identifiers: {
40
- isIntervalToInequality: isIntervalToInequality,
41
- intervalMin: interval.min,
42
- intervalMax: interval.max,
32
+ intervalMin: interval.min === -Infinity ? "-infty" : interval.min,
33
+ intervalMax: interval.max === Infinity ? "infty" : interval.max,
43
34
  intervalClosure: interval.closure,
44
35
  },
45
36
  };
46
37
  return question;
47
38
  };
48
- const getPropositions = (n, { answer, isIntervalToInequality, intervalClosure, intervalMax, intervalMin }) => {
39
+ const getPropositions = (n, { answer, intervalClosure, intervalMax, intervalMin }) => {
49
40
  const reverseBracket = (bracket) => {
50
41
  return bracket === "[" ? "]" : "[";
51
42
  };
52
- const switchInclusion = (symbol) => {
53
- if (symbol === "\\le")
54
- return "<";
55
- if (symbol === "<")
56
- return "\\le";
57
- if (symbol === ">")
58
- return "\\ge";
59
- return ">";
60
- };
61
- const reverseInequality = (symbol) => {
62
- if (symbol === "\\le")
63
- return "\\ge";
64
- if (symbol === "<")
65
- return ">";
66
- if (symbol === ">")
67
- return "<";
68
- return "\\le";
69
- };
70
- const interval = new intervals_1.Interval(intervalMin.toTree(), intervalMax.toTree(), intervalClosure);
43
+ const min = intervalMin === "-infty" ? -Infinity : intervalMin;
44
+ const max = intervalMax === "infty" ? Infinity : intervalMax;
45
+ const interval = new intervals_1.Interval(min.toTree(), max.toTree(), intervalClosure);
71
46
  const propositions = [];
72
47
  (0, exercise_1.addValidProp)(propositions, answer);
73
- const xNode = new variableNode_1.VariableNode("x");
74
- if (isIntervalToInequality) {
75
- let wrongIneqs = [];
76
- if (interval.min === -Infinity) {
77
- wrongIneqs = [
78
- new inequationNode_1.InequationNode([xNode, new numberNode_1.NumberNode(interval.max)], switchInclusion(interval.rightInequalitySymbol)),
79
- new inequationNode_1.InequationNode([xNode, new numberNode_1.NumberNode(interval.max)], reverseInequality(switchInclusion(interval.rightInequalitySymbol))),
80
- new inequationNode_1.InequationNode([xNode, new numberNode_1.NumberNode(interval.max)], reverseInequality(interval.rightInequalitySymbol)),
81
- ];
82
- }
83
- else if (interval.max === Infinity) {
84
- wrongIneqs = [
85
- new inequationNode_1.InequationNode([xNode, new numberNode_1.NumberNode(interval.min)], switchInclusion(interval.leftInequalitySymbol)),
86
- new inequationNode_1.InequationNode([xNode, new numberNode_1.NumberNode(interval.min)], reverseInequality(switchInclusion(interval.leftInequalitySymbol))),
87
- new inequationNode_1.InequationNode([xNode, new numberNode_1.NumberNode(interval.min)], reverseInequality(interval.leftInequalitySymbol)),
88
- ];
89
- }
90
- else {
91
- wrongIneqs = [
92
- new inequationNode_1.InequationNode([new numberNode_1.NumberNode(interval.min), xNode, new numberNode_1.NumberNode(interval.max)], [
93
- switchInclusion(interval.leftInequalitySymbol),
94
- interval.rightInequalitySymbol,
95
- ]),
96
- new inequationNode_1.InequationNode([new numberNode_1.NumberNode(interval.min), xNode, new numberNode_1.NumberNode(interval.max)], [
97
- interval.leftInequalitySymbol,
98
- switchInclusion(interval.rightInequalitySymbol),
99
- ]),
100
- new inequationNode_1.InequationNode([new numberNode_1.NumberNode(interval.min), xNode, new numberNode_1.NumberNode(interval.max)], [
101
- switchInclusion(interval.leftInequalitySymbol),
102
- switchInclusion(interval.rightInequalitySymbol),
103
- ]),
104
- ];
105
- }
106
- wrongIneqs.forEach((ineq) => {
107
- (0, exercise_1.addWrongProp)(propositions, ineq.toTex());
108
- });
109
- }
110
- else {
111
- const wrongStatements = [
112
- `x\\in${reverseBracket(interval.leftBracket)}${interval.insideToTex()}${interval.rightBracket}`,
113
- `x\\in${interval.leftBracket}${interval.insideToTex()}${reverseBracket(interval.rightBracket)}`,
114
- `x\\in${reverseBracket(interval.leftBracket)}${interval.insideToTex()}${reverseBracket(interval.rightBracket)}`,
115
- ];
116
- wrongStatements.forEach((ineq) => {
117
- (0, exercise_1.addWrongProp)(propositions, ineq);
118
- });
119
- }
48
+ const wrongStatements = [
49
+ `x\\in${reverseBracket(interval.leftBracket)}${interval.insideToTex()}${interval.rightBracket}`,
50
+ `x\\in${interval.leftBracket}${interval.insideToTex()}${reverseBracket(interval.rightBracket)}`,
51
+ `x\\in${reverseBracket(interval.leftBracket)}${interval.insideToTex()}${reverseBracket(interval.rightBracket)}`,
52
+ ];
53
+ wrongStatements.forEach((ineq) => {
54
+ (0, exercise_1.addWrongProp)(propositions, ineq);
55
+ });
120
56
  return (0, shuffle_1.shuffle)(propositions);
121
57
  };
122
- const isAnswerValid = (ans, { intervalClosure, intervalMax, intervalMin, isIntervalToInequality }) => {
123
- const interval = new intervals_1.Interval(intervalMin.toTree(), intervalMax.toTree(), intervalClosure).toTree();
124
- console.log("int", interval.toTex());
125
- const inequality = interval.toInequality();
126
- const answer = isIntervalToInequality
127
- ? inequality
128
- : new belongsNode_1.BelongsNode(new variableNode_1.VariableNode("x"), interval, {
129
- allowRawRightChildAsSolution: true,
130
- });
131
- console.log("ans", answer);
58
+ const isAnswerValid = (ans, { intervalClosure, intervalMax, intervalMin }) => {
59
+ const min = intervalMin === "-infty" ? -Infinity : intervalMin;
60
+ const max = intervalMax === "infty" ? Infinity : intervalMax;
61
+ const interval = new intervals_1.Interval(min.toTree(), max.toTree(), intervalClosure).toTree();
62
+ const answer = new belongsNode_1.BelongsNode(new variableNode_1.VariableNode("x"), interval, {
63
+ allowRawRightChildAsSolution: true,
64
+ });
132
65
  const texs = answer.toAllValidTexs();
133
- console.log("texs", texs);
134
66
  return texs.includes(ans);
135
67
  };
136
68
  exports.inequalityToInterval = {
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { ClosureType } from "../../../../tree/nodes/sets/closure";
3
+ type Identifiers = {
4
+ intervalMin: number | string;
5
+ intervalMax: number | string;
6
+ intervalClosure: ClosureType;
7
+ };
8
+ export declare const inequalityToInterval: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=intervalToInequality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intervalToInequality.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/intervalToInequality.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAK5D,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,eAAe,EAAE,WAAW,CAAC;CAC9B,CAAC;AAkIF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}