math-exercises 2.2.93 → 2.2.95

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 (196) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionSquare.d.ts +8 -0
  2. package/lib/exercises/math/calcul/fractions/fractionSquare.d.ts.map +1 -0
  3. package/lib/exercises/math/calcul/fractions/fractionSquare.js +107 -0
  4. package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/fractions/fractionsSum.js +2 -1
  6. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -1
  7. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +2 -1
  8. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +2 -1
  10. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +2 -1
  12. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  13. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  14. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  15. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
  16. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +2 -1
  17. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -1
  18. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +0 -4
  19. package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts.map +1 -1
  20. package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +2 -1
  21. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts +9 -0
  22. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts.map +1 -1
  23. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.js +160 -126
  24. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
  25. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +2 -1
  26. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
  27. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  28. package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
  29. package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts.map +1 -1
  30. package/lib/exercises/math/calculLitteral/factorisation/factoByX.js +2 -1
  31. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
  32. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.js +76 -41
  33. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
  34. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.js +71 -40
  35. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
  36. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.js +79 -47
  37. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  38. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +2 -1
  39. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts.map +1 -1
  40. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.js +2 -1
  41. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
  42. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.js +2 -1
  43. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
  44. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +2 -1
  45. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  46. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +2 -1
  47. package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.d.ts.map +1 -1
  48. package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.js +2 -1
  49. package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.d.ts.map +1 -1
  50. package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +2 -1
  51. package/lib/exercises/math/derivation/derivative/expDerivativeFour.d.ts.map +1 -1
  52. package/lib/exercises/math/derivation/derivative/expDerivativeFour.js +2 -1
  53. package/lib/exercises/math/derivation/derivative/expDerivativeThree.d.ts.map +1 -1
  54. package/lib/exercises/math/derivation/derivative/expDerivativeThree.js +2 -1
  55. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
  56. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +2 -1
  57. package/lib/exercises/math/derivation/derivative/quotientDerivative.d.ts.map +1 -1
  58. package/lib/exercises/math/derivation/derivative/quotientDerivative.js +2 -1
  59. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  60. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +2 -1
  61. package/lib/exercises/math/derivation/derivative/sqrtCompositionDerivation.d.ts.map +1 -1
  62. package/lib/exercises/math/derivation/derivative/sqrtCompositionDerivation.js +2 -1
  63. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
  64. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +2 -1
  65. package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
  66. package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.js +2 -1
  67. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts.map +1 -1
  68. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +2 -1
  69. package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.d.ts.map +1 -1
  70. package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.js +2 -1
  71. package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
  72. package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +2 -1
  73. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
  74. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +2 -1
  75. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  76. package/lib/exercises/math/functions/affines/affineExpressionReading.js +46 -23
  77. package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
  78. package/lib/exercises/math/functions/affines/signFunction.js +2 -1
  79. package/lib/exercises/math/functions/basics/graphicEquation.d.ts.map +1 -1
  80. package/lib/exercises/math/functions/basics/graphicEquation.js +2 -1
  81. package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
  82. package/lib/exercises/math/functions/basics/graphicInequation.js +2 -1
  83. package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -1
  84. package/lib/exercises/math/functions/basics/graphicInequationAffine.js +2 -1
  85. package/lib/exercises/math/functions/basics/imageFunction.d.ts.map +1 -1
  86. package/lib/exercises/math/functions/basics/imageFunction.js +2 -1
  87. package/lib/exercises/math/functions/basics/twoFunctionsInequation.d.ts.map +1 -1
  88. package/lib/exercises/math/functions/basics/twoFunctionsInequation.js +2 -1
  89. package/lib/exercises/math/functions/exponential/expEquation.d.ts.map +1 -1
  90. package/lib/exercises/math/functions/exponential/expEquation.js +2 -1
  91. package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
  92. package/lib/exercises/math/functions/logarithm/logPowerEquation.js +2 -1
  93. package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
  94. package/lib/exercises/math/functions/sign/affineProductSign.js +2 -1
  95. package/lib/exercises/math/functions/square/squareImageInterval.d.ts.map +1 -1
  96. package/lib/exercises/math/functions/square/squareImageInterval.js +2 -1
  97. package/lib/exercises/math/functions/trinoms/coefficientsIdentification.d.ts.map +1 -1
  98. package/lib/exercises/math/functions/trinoms/coefficientsIdentification.js +2 -1
  99. package/lib/exercises/math/functions/trinoms/secondDegreeInequation.d.ts.map +1 -1
  100. package/lib/exercises/math/functions/trinoms/secondDegreeInequation.js +2 -1
  101. package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.d.ts.map +1 -1
  102. package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.js +2 -1
  103. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.d.ts.map +1 -1
  104. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.js +2 -1
  105. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.d.ts.map +1 -1
  106. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.js +2 -1
  107. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -1
  108. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +2 -1
  109. package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.d.ts.map +1 -1
  110. package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.js +2 -1
  111. package/lib/exercises/math/geometry/parametric/extractVectorFromParametricLine.d.ts.map +1 -1
  112. package/lib/exercises/math/geometry/parametric/extractVectorFromParametricLine.js +2 -1
  113. package/lib/exercises/math/matrices/matrixInversibilityDomain.d.ts.map +1 -1
  114. package/lib/exercises/math/matrices/matrixInversibilityDomain.js +2 -1
  115. package/lib/exercises/math/percent/findRightCalcul.d.ts +10 -0
  116. package/lib/exercises/math/percent/findRightCalcul.d.ts.map +1 -0
  117. package/lib/exercises/math/percent/findRightCalcul.js +116 -0
  118. package/lib/exercises/math/percent/htToTTC.d.ts.map +1 -1
  119. package/lib/exercises/math/percent/htToTTC.js +34 -12
  120. package/lib/exercises/math/percent/index.d.ts +2 -0
  121. package/lib/exercises/math/percent/index.d.ts.map +1 -1
  122. package/lib/exercises/math/percent/index.js +2 -0
  123. package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
  124. package/lib/exercises/math/percent/percentToDecimal.js +6 -2
  125. package/lib/exercises/math/percent/percentWritings.d.ts +8 -0
  126. package/lib/exercises/math/percent/percentWritings.d.ts.map +1 -0
  127. package/lib/exercises/math/percent/percentWritings.js +145 -0
  128. package/lib/exercises/math/percent/ttcToHT.d.ts.map +1 -1
  129. package/lib/exercises/math/percent/ttcToHT.js +33 -12
  130. package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
  131. package/lib/exercises/math/powers/powersMixOperations.js +2 -1
  132. package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
  133. package/lib/exercises/math/probaStat/probabilityTree.js +2 -1
  134. package/lib/exercises/math/sampling/confidenceInterval.d.ts.map +1 -1
  135. package/lib/exercises/math/sampling/confidenceInterval.js +2 -1
  136. package/lib/exercises/math/sampling/fluctuationInterval.d.ts.map +1 -1
  137. package/lib/exercises/math/sampling/fluctuationInterval.js +2 -1
  138. package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
  139. package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.js +55 -23
  140. package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  141. package/lib/exercises/math/sets/intervals/inequalityToInterval.js +2 -1
  142. package/lib/exercises/math/sets/intervals/intervalsIntersection.d.ts.map +1 -1
  143. package/lib/exercises/math/sets/intervals/intervalsIntersection.js +2 -1
  144. package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
  145. package/lib/exercises/math/sets/intervals/intervalsUnion.js +2 -1
  146. package/lib/exercises/math/trigonometry/degreeToRadians.d.ts.map +1 -1
  147. package/lib/exercises/math/trigonometry/degreeToRadians.js +2 -1
  148. package/lib/exercises/math/trigonometry/mainAngleMeasure.d.ts.map +1 -1
  149. package/lib/exercises/math/trigonometry/mainAngleMeasure.js +2 -1
  150. package/lib/exercises/vea/equationVEA.d.ts.map +1 -1
  151. package/lib/exercises/vea/equationVEA.js +2 -1
  152. package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
  153. package/lib/exercises/vea/rationalVEA.js +2 -1
  154. package/lib/exercises/vea/sqrtVEA.d.ts.map +1 -1
  155. package/lib/exercises/vea/sqrtVEA.js +2 -1
  156. package/lib/index.d.ts +16 -0
  157. package/lib/index.d.ts.map +1 -1
  158. package/lib/playground.d.ts.map +1 -1
  159. package/lib/playground.js +1 -12
  160. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  161. package/lib/tree/nodes/functions/oppositeNode.js +1 -1
  162. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  163. package/lib/tree/nodes/operators/addNode.js +1 -1
  164. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  165. package/lib/tree/nodes/operators/fractionNode.js +3 -2
  166. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  167. package/lib/tree/nodes/operators/multiplyNode.js +1 -1
  168. package/lib/tree/parsers/affineParser.d.ts.map +1 -1
  169. package/lib/tree/parsers/affineParser.js +2 -1
  170. package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
  171. package/lib/tree/parsers/discreteSetParser.js +2 -3
  172. package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
  173. package/lib/tree/parsers/equationSolutionParser.js +2 -1
  174. package/lib/tree/parsers/inequationParser.d.ts.map +1 -1
  175. package/lib/tree/parsers/inequationParser.js +2 -1
  176. package/lib/tree/parsers/intervalParser.d.ts.map +1 -1
  177. package/lib/tree/parsers/intervalParser.js +3 -2
  178. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  179. package/lib/tree/parsers/latexParser.js +12 -0
  180. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  181. package/lib/tree/parsers/monomParser.js +2 -1
  182. package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
  183. package/lib/tree/parsers/polynomialParser.js +2 -1
  184. package/lib/tree/parsers/powerParser.d.ts.map +1 -1
  185. package/lib/tree/parsers/powerParser.js +2 -1
  186. package/lib/tree/parsers/sqrtParser.d.ts.map +1 -1
  187. package/lib/tree/parsers/sqrtParser.js +2 -1
  188. package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
  189. package/lib/tree/parsers/trinomParser.js +2 -1
  190. package/lib/tree/parsers/unionIntervalParser.d.ts.map +1 -1
  191. package/lib/tree/parsers/unionIntervalParser.js +2 -1
  192. package/lib/utils/alea/random.js +1 -1
  193. package/lib/utils/errors/handleVEAError.d.ts +2 -0
  194. package/lib/utils/errors/handleVEAError.d.ts.map +1 -0
  195. package/lib/utils/errors/handleVEAError.js +9 -0
  196. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ type Identifiers = {
3
+ num: number;
4
+ denum: number;
5
+ };
6
+ export declare const fractionSquare: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=fractionSquare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fractionSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA6FF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAiBhD,CAAC"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fractionSquare = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const rational_1 = require("../../../../math/numbers/rationals/rational");
7
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
8
+ const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
9
+ const latexParser_1 = require("../../../../tree/parsers/latexParser");
10
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
11
+ const alignTex_1 = require("../../../../utils/latex/alignTex");
12
+ const getPropositions = (n, { answer, denum, num }) => {
13
+ const propositions = [];
14
+ (0, exercise_1.addValidProp)(propositions, answer);
15
+ const fraction = (0, fractionNode_1.frac)(num, denum);
16
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)(2 * num, 2 * denum).toTex());
17
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)((0, powerNode_1.square)(num), denum).simplify().toTex());
18
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)(num, (0, powerNode_1.square)(denum)).simplify().toTex());
19
+ while (propositions.length < n) {
20
+ (0, exercise_1.tryToAddWrongProp)(propositions, rational_1.RationalConstructor.randomIrreductible().toTree().toTex());
21
+ }
22
+ return (0, exercise_1.shuffleProps)(propositions, n);
23
+ };
24
+ const getStatementNode = (identifiers) => {
25
+ const { num, denum } = identifiers;
26
+ return (0, powerNode_1.square)((0, fractionNode_1.frac)(num, denum));
27
+ };
28
+ const getAnswer = (identifiers) => {
29
+ return getStatementNode(identifiers).simplify().toTex();
30
+ };
31
+ const getInstruction = (identifiers) => {
32
+ const statement = getStatementNode(identifiers);
33
+ return `Simplifier :
34
+
35
+ $$
36
+ ${statement.toTex()}
37
+ $$`;
38
+ };
39
+ const getHint = (identifiers) => {
40
+ return `Pour passer une fraction au carré, on met le numérateur au carré et le dénominateur au carré :
41
+
42
+ $$
43
+ \\left(\\frac ab\\right)^2 = \\frac{a^2}{b^2}
44
+ $$
45
+
46
+ Ensuite, on simplifie la fraction obtenue si possible.`;
47
+ };
48
+ const getCorrection = (identifiers) => {
49
+ const statement = getStatementNode(identifiers);
50
+ const midStep = (0, fractionNode_1.frac)((0, powerNode_1.square)(identifiers.num), (0, powerNode_1.square)(identifiers.denum));
51
+ return `On met le numérateur et le dénominateur au carré :
52
+
53
+ ${(0, alignTex_1.alignTex)([
54
+ [statement.toTex(), "=", midStep.toTex()],
55
+ ["", "=", getAnswer(identifiers)],
56
+ ])}`;
57
+ };
58
+ const getKeys = (identifiers) => {
59
+ return [];
60
+ };
61
+ const isAnswerValid = (ans, { answer }) => {
62
+ try {
63
+ const parsed = (0, latexParser_1.parseAlgebraic)(ans);
64
+ if (!parsed)
65
+ return false;
66
+ if (!(0, fractionNode_1.isFractionNode)(parsed))
67
+ return false;
68
+ return parsed.simplify().toTex() === answer;
69
+ }
70
+ catch (err) {
71
+ return (0, handleVEAError_1.handleVEAError)(err);
72
+ }
73
+ };
74
+ const getFractionSquareQuestion = (ops) => {
75
+ const rational = rational_1.RationalConstructor.randomIrreductible();
76
+ const identifiers = {
77
+ num: rational.num,
78
+ denum: rational.denum,
79
+ };
80
+ const question = {
81
+ answer: getAnswer(identifiers),
82
+ instruction: getInstruction(identifiers),
83
+ keys: getKeys(identifiers),
84
+ answerFormat: "tex",
85
+ identifiers,
86
+ hint: getHint(identifiers),
87
+ correction: getCorrection(identifiers),
88
+ };
89
+ return question;
90
+ };
91
+ exports.fractionSquare = {
92
+ id: "fractionSquare",
93
+ connector: "=",
94
+ label: "Passer une fraction au carré",
95
+ isSingleStep: true,
96
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFractionSquareQuestion(opts), nb),
97
+ qcmTimer: 60,
98
+ freeTimer: 60,
99
+ getPropositions,
100
+ isAnswerValid,
101
+ subject: "Mathématiques",
102
+ getInstruction,
103
+ getHint,
104
+ getCorrection,
105
+ getAnswer,
106
+ hasHintAndCorrection: true,
107
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAyGF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBvD,CAAC"}
1
+ {"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAyGF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBvD,CAAC"}
@@ -7,6 +7,7 @@ const rational_1 = require("../../../../math/numbers/rationals/rational");
7
7
  const addNode_1 = require("../../../../tree/nodes/operators/addNode");
8
8
  const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
9
9
  const shuffle_1 = require("../../../../utils/alea/shuffle");
10
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
10
11
  const getInstruction = (identifiers, opts) => {
11
12
  const { rational, rational2 } = identifiers;
12
13
  const rationalObj = new rational_1.Rational(rational[0], rational[1]);
@@ -67,7 +68,7 @@ const isAnswerValid = (ans, { rational, rational2 }, opts) => {
67
68
  return texs.includes(parsed.simplify().toTex());
68
69
  }
69
70
  catch (err) {
70
- return false;
71
+ return (0, handleVEAError_1.handleVEAError)(err);
71
72
  }
72
73
  else
73
74
  return texs.includes(ans);
@@ -1 +1 @@
1
- {"version":3,"file":"fractionsSumsMultiplesDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2FF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAkBpE,CAAC"}
1
+ {"version":3,"file":"fractionsSumsMultiplesDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2FF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAkBpE,CAAC"}
@@ -8,6 +8,7 @@ const randint_1 = require("../../../../math/utils/random/randint");
8
8
  const addNode_1 = require("../../../../tree/nodes/operators/addNode");
9
9
  const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
10
10
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
11
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
11
12
  const getFractionsSumsMultiplesDenominatorsQuestion = (opts) => {
12
13
  let denom1 = (0, randint_1.randint)(2, 10);
13
14
  let denom2 = denom1 * (0, randint_1.randint)(2, 10);
@@ -58,7 +59,7 @@ const isAnswerValid = (ans, { answer, denom1, denom2, num1, num2 }, opts) => {
58
59
  return texs.includes(parsed.simplify().toTex());
59
60
  }
60
61
  catch (err) {
61
- return false;
62
+ return (0, handleVEAError_1.handleVEAError)(err);
62
63
  }
63
64
  }
64
65
  else
@@ -1 +1 @@
1
- {"version":3,"file":"fractionsSumsPrimeDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA6FF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAkBhE,CAAC"}
1
+ {"version":3,"file":"fractionsSumsPrimeDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA6FF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAkBhE,CAAC"}
@@ -8,6 +8,7 @@ const gcd_1 = require("../../../../math/utils/arithmetic/gcd");
8
8
  const randint_1 = require("../../../../math/utils/random/randint");
9
9
  const addNode_1 = require("../../../../tree/nodes/operators/addNode");
10
10
  const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
11
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
11
12
  const getFractionsSumsPrimeDenominatorsQuestion = (opts) => {
12
13
  const denom1 = (0, randint_1.randint)(2, 13);
13
14
  let denom2 = 0;
@@ -59,7 +60,7 @@ const isAnswerValid = (ans, { answer, denom1, denom2, num1, num2 }, opts) => {
59
60
  return texs.includes(parsed.simplify().toTex());
60
61
  }
61
62
  catch (err) {
62
- return false;
63
+ return (0, handleVEAError_1.handleVEAError)(err);
63
64
  }
64
65
  }
65
66
  else
@@ -1 +1 @@
1
- {"version":3,"file":"fractionsSumsSameDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsSameDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAgIF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAmB/D,CAAC"}
1
+ {"version":3,"file":"fractionsSumsSameDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsSameDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAgIF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAmB/D,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 rationalParser_1 = require("../../../../tree/parsers/rationalParser");
13
13
  const operatorComposition_1 = require("../../../../tree/utilities/operatorComposition");
14
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
14
15
  const alignTex_1 = require("../../../../utils/latex/alignTex");
15
16
  const getFractionsSumsSameDenominatorsQuestion = (opts) => {
16
17
  const denom = (0, randint_1.randint)(2, 15);
@@ -85,7 +86,7 @@ const isAnswerValid = (ans, { answer, denom, num1, num2 }, opts) => {
85
86
  return texs.includes(parsed.simplify().toTex());
86
87
  }
87
88
  catch (err) {
88
- return false;
89
+ return (0, handleVEAError_1.handleVEAError)(err);
89
90
  }
90
91
  }
91
92
  else {
@@ -11,4 +11,5 @@ export * from "./fractionsSumsSameDenominators";
11
11
  export * from "./fractionsSumsMultiplesDenominators";
12
12
  export * from "./fractionsSumsPrimeDenominators";
13
13
  export * from "./fractionsOperations";
14
+ export * from "./fractionSquare";
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
@@ -27,3 +27,4 @@ __exportStar(require("./fractionsSumsSameDenominators"), exports);
27
27
  __exportStar(require("./fractionsSumsMultiplesDenominators"), exports);
28
28
  __exportStar(require("./fractionsSumsPrimeDenominators"), exports);
29
29
  __exportStar(require("./fractionsOperations"), exports);
30
+ __exportStar(require("./fractionSquare"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"findCoeffInProportionalTableNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAyHF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAoBF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAC5D,WAAW,EACX,OAAO,CAsBR,CAAC"}
1
+ {"version":3,"file":"findCoeffInProportionalTableNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAyHF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAoBF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAC5D,WAAW,EACX,OAAO,CAsBR,CAAC"}
@@ -11,6 +11,7 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
11
11
  const latexParser_1 = require("../../../../tree/parsers/latexParser");
12
12
  const random_1 = require("../../../../utils/alea/random");
13
13
  const doWhile_1 = require("../../../../utils/doWhile");
14
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
14
15
  const dollarize_1 = require("../../../../utils/latex/dollarize");
15
16
  const mdTable_1 = require("../../../../utils/markdown/mdTable");
16
17
  const getPropositions = (n, { answer, coeffType }) => {
@@ -58,7 +59,7 @@ const isAnswerValid = (ans, { answer }) => {
58
59
  return parsed.simplify().toTex() === answer;
59
60
  }
60
61
  catch (err) {
61
- return false;
62
+ return (0, handleVEAError_1.handleVEAError)(err);
62
63
  }
63
64
  };
64
65
  const getFindCoeffInProportionalTableNonIntegersQuestion = (opts) => {
@@ -1 +1 @@
1
- {"version":3,"file":"doubleDistributivityWithCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA4IF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAoB/D,CAAC"}
1
+ {"version":3,"file":"doubleDistributivityWithCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAyIF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAmB/D,CAAC"}
@@ -89,9 +89,6 @@ const isAnswerValid = (ans, { answer, affine1, affine2, coeff }) => {
89
89
  const answerTree = affine1Obj.times(coeff).multiply(affine2Obj).toTree();
90
90
  return answerTree.toAllValidTexs().includes(ans);
91
91
  };
92
- const isGGBAnswerValid = (ans, { ggbAnswer }) => {
93
- throw Error("GGBVea not implemented");
94
- };
95
92
  exports.doubleDistributivityWithCoeff = {
96
93
  id: "doubleDistributivityWithCoeff",
97
94
  connector: "=",
@@ -104,7 +101,6 @@ exports.doubleDistributivityWithCoeff = {
104
101
  freeTimer: 60,
105
102
  getPropositions,
106
103
  isAnswerValid,
107
- isGGBAnswerValid,
108
104
  subject: "Mathématiques",
109
105
  hasHintAndCorrection: true,
110
106
  getHint,
@@ -1 +1 @@
1
- {"version":3,"file":"identitiesWithNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAS1C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AA2HF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAgB3D,CAAC"}
1
+ {"version":3,"file":"identitiesWithNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAU1C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AA2HF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAgB3D,CAAC"}
@@ -14,6 +14,7 @@ const substractNode_1 = require("../../../../tree/nodes/operators/substractNode"
14
14
  const trinomNode_1 = require("../../../../tree/nodes/polynomials/trinomNode");
15
15
  const polynomialParser_1 = require("../../../../tree/parsers/polynomialParser");
16
16
  const random_1 = require("../../../../utils/alea/random");
17
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
17
18
  const getPropositions = (n, { answer, a, b, type }) => {
18
19
  const propositions = [];
19
20
  (0, exercise_1.addValidProp)(propositions, answer);
@@ -79,7 +80,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
79
80
  .toTex() === answer);
80
81
  }
81
82
  catch (err) {
82
- return false;
83
+ return (0, handleVEAError_1.handleVEAError)(err);
83
84
  }
84
85
  };
85
86
  //type1 (ax+b)^2
@@ -1 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ type Identifiers = {
3
+ a: number;
4
+ b: number;
5
+ c?: number;
6
+ type: number;
7
+ };
8
+ export declare const choseOperationToSolveEquation: Exercise<Identifiers>;
9
+ export {};
1
10
  //# sourceMappingURL=choseOperationToSolveEquation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"choseOperationToSolveEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"choseOperationToSolveEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAqJF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}
@@ -1,129 +1,163 @@
1
1
  "use strict";
2
- // import {
3
- // Exercise,
4
- // Proposition,
5
- // QCMGenerator,
6
- // Question,
7
- // QuestionGenerator,
8
- // VEA,
9
- // addValidProp,
10
- // shuffleProps,
11
- // GetAnswer,
12
- // GetHint,
13
- // GetCorrection,
14
- // GetInstruction,
15
- // GetKeys,
16
- // tryToAddWrongProp,
17
- // } from "../../../../exercises/exercise";
18
- // import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions";
19
- // import { randint } from "../../../../math/utils/random/randint";
20
- // import {
21
- // EqualNode,
22
- // EqualNodeConstructor,
23
- // EqualNodeIdentifiers,
24
- // } from "../../../../tree/nodes/equations/equalNode";
25
- // import {
26
- // NodeConstructor,
27
- // NodeIdentifiers,
28
- // } from "../../../../tree/nodes/nodeConstructor";
29
- // type Identifiers = {
30
- // equaIdentifiers: EqualNodeIdentifiers;
31
- // type: number
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.choseOperationToSolveEquation = 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 equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
8
+ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
9
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
10
+ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
11
+ const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
12
+ const getPropositions = (n, { answer }) => {
13
+ const propositions = [];
14
+ (0, exercise_1.addValidProp)(propositions, answer, "raw");
15
+ (0, exercise_1.tryToAddWrongProp)(propositions, "une soustraction", "raw");
16
+ (0, exercise_1.tryToAddWrongProp)(propositions, "une addition", "raw");
17
+ (0, exercise_1.tryToAddWrongProp)(propositions, "une division", "raw");
18
+ (0, exercise_1.tryToAddWrongProp)(propositions, "une multiplication", "raw");
19
+ return (0, exercise_1.shuffleProps)(propositions, n);
20
+ };
21
+ const getAnswer = ({ a, b, type, c }) => {
22
+ switch (type) {
23
+ case 1:
24
+ //ax = b tous entiers
25
+ return "une division";
26
+ case 2:
27
+ // ax + b = c tous entiers
28
+ return "une soustraction";
29
+ case 3:
30
+ //ax-b = c tous entiers
31
+ return "une addition";
32
+ case 4:
33
+ //x/a = b tous entiers
34
+ return "une multiplication";
35
+ case 5:
36
+ //x+a = b
37
+ return "une soustraction";
38
+ case 6:
39
+ default:
40
+ //x-a = b
41
+ return "une addition";
42
+ }
43
+ };
44
+ const getStatementNode = (identifiers) => {
45
+ const { type } = identifiers;
46
+ const a = identifiers.a.toTree();
47
+ const b = identifiers.b.toTree();
48
+ const c = identifiers.c?.toTree();
49
+ switch (type) {
50
+ case 1:
51
+ //ax = b tous entiers
52
+ return new equalNode_1.EqualNode((0, multiplyNode_1.multiply)(a, "x"), b);
53
+ case 2:
54
+ // ax + b = c tous entiers
55
+ return new equalNode_1.EqualNode((0, addNode_1.add)((0, multiplyNode_1.multiply)(a, "x"), b), c);
56
+ case 3:
57
+ //ax-b = c tous entiers
58
+ return new equalNode_1.EqualNode((0, substractNode_1.substract)((0, multiplyNode_1.multiply)(a, "x"), b), c);
59
+ case 4:
60
+ //x/a = b tous entiers
61
+ return new equalNode_1.EqualNode((0, fractionNode_1.frac)("x", a), b);
62
+ case 5:
63
+ //x+a = b
64
+ return new equalNode_1.EqualNode((0, addNode_1.add)("x", a), b);
65
+ case 6:
66
+ default:
67
+ //x-a = b
68
+ return new equalNode_1.EqualNode((0, substractNode_1.substract)("x", a), b);
69
+ }
70
+ };
71
+ const getInstruction = (identifiers) => {
72
+ const { type, a, b, c } = identifiers;
73
+ const equation = getStatementNode(identifiers);
74
+ return `Pour résoudre l'équation :
75
+
76
+ $$
77
+ ${equation.toTex()}
78
+ $$
79
+
80
+ il faut d'abord effectuer :
81
+ `;
82
+ };
83
+ // const getHint: GetHint<Identifiers> = (identifiers) => {
32
84
  // };
33
- // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
34
- // const propositions: Proposition[] = [];
35
- // addValidProp(propositions, answer);
36
- // tryToAddWrongProp(propositions, "une soustraction", "raw");
37
- // tryToAddWrongProp(propositions, "une addition", "raw");
38
- // tryToAddWrongProp(propositions, "une division", "raw");
39
- // tryToAddWrongProp(propositions, "une multiplication", "raw");
40
- // return shuffleProps(propositions, n);
41
- // };
42
- // const getAnswer: GetAnswer<Identifiers> = (identifiers) => {
43
- // return;
44
- // };
45
- // const getInstruction: GetInstruction<Identifiers> = (identifiers) => {
46
- // const equation = EqualNodeConstructor.fromIdentifiers(
47
- // identifiers.equaIdentifiers,
48
- // );
49
- // return `Pour résoudre l'équation :
50
- // $$
51
- // ${equation.toTex()}
52
- // $$
53
- // il faut d'abord effectuer :
54
- // `;
55
- // };
56
- // // const getHint: GetHint<Identifiers> = (identifiers) => {};
57
- // // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
58
- // const getKeys: GetKeys<Identifiers> = (identifiers) => {
59
- // return [];
60
- // };
61
- // const isAnswerValid: VEA<Identifiers> = (ans, { answer }) => {
62
- // throw Error("VEA not implemented");
63
- // };
64
- // const getChoseOperationToSolveEquationQuestion: QuestionGenerator<
65
- // Identifiers
66
- // > = (ops) => {
67
- // //ax=b avec a entier, ax+b = c tout entier, x/a = b tout entier, x+-a = b entiers ,
68
- // let a: number;
69
- // let b: number;
70
- // let c: number | undefined;
71
- // const type = randint(1, 7);
72
- // switch (type) {
73
- // case 1:
74
- // //ax = b tous entiers
75
- // a = randint(2, 10);
76
- // b = randint(2, 10)
77
- // break;
78
- // case 2 :
79
- // // ax + b = c tous entiers
80
- // break;
81
- // case 3:
82
- // //ax-b = c tous entiers
83
- // break;
84
- // case 4:
85
- // //x/a = b tous entiers
86
- // break;
87
- // case 5:
88
- // //x+a = b
89
- // break;
90
- // case 6:
91
- // //x-a = b
92
- // break;
93
- // case 7:
94
- // break;
95
- // }
96
- // const identifiers: Identifiers = {type, };
97
- // const question: Question<Identifiers> = {
98
- // answer: getAnswer(identifiers),
99
- // instruction: getInstruction(identifiers),
100
- // keys: getKeys(identifiers),
101
- // answerFormat: "tex",
102
- // identifiers,
103
- // // hint: getHint(identifiers),
104
- // // correction: getCorrection(identifiers),
105
- // };
106
- // return question;
107
- // };
108
- // export const choseOperationToSolveEquation: Exercise<Identifiers> = {
109
- // id: "choseOperationToSolveEquation",
110
- // connector: "=",
111
- // label:
112
- // "Choisir la bonne opération pour résoudre une équation du premier degré",
113
- // isSingleStep: true,
114
- // generator: (nb, opts) =>
115
- // getDistinctQuestions(
116
- // () => getChoseOperationToSolveEquationQuestion(opts),
117
- // nb,
118
- // ),
119
- // qcmTimer: 60,
120
- // freeTimer: 60,
121
- // getPropositions,
122
- // isAnswerValid,
123
- // subject: "Mathématiques",
124
- // getInstruction,
125
- // // getHint,
126
- // // getCorrection,
127
- // getAnswer,
128
- // answerType: "QCU",
85
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
86
+ // return ``
129
87
  // };
88
+ const getKeys = (identifiers) => {
89
+ return [];
90
+ };
91
+ const isAnswerValid = (ans, { answer }) => {
92
+ throw Error("VEA not implemented");
93
+ };
94
+ const getChoseOperationToSolveEquationQuestion = (opts) => {
95
+ //ax=b avec a entier, ax+b = c tout entier, x/a = b tout entier, x+-a = b entiers ,
96
+ let a;
97
+ let b;
98
+ let c;
99
+ const type = (0, randint_1.randint)(1, 7);
100
+ switch (type) {
101
+ case 1:
102
+ //ax = b tous entiers
103
+ a = (0, randint_1.randint)(2, 10);
104
+ b = (0, randint_1.randint)(1, 10);
105
+ break;
106
+ case 2:
107
+ // ax + b = c tous entiers
108
+ a = (0, randint_1.randint)(2, 10);
109
+ b = (0, randint_1.randint)(1, 10);
110
+ c = (0, randint_1.randint)(1, 10);
111
+ break;
112
+ case 3:
113
+ //ax-b = c tous entiers
114
+ a = (0, randint_1.randint)(2, 10);
115
+ b = (0, randint_1.randint)(1, 10);
116
+ c = (0, randint_1.randint)(1, 10);
117
+ break;
118
+ case 4:
119
+ //x/a = b tous entiers
120
+ a = (0, randint_1.randint)(2, 10);
121
+ b = (0, randint_1.randint)(1, 10);
122
+ break;
123
+ case 5:
124
+ //x+a = b
125
+ a = (0, randint_1.randint)(1, 10);
126
+ b = (0, randint_1.randint)(1, 10);
127
+ break;
128
+ case 6:
129
+ default:
130
+ //x-a = b
131
+ a = (0, randint_1.randint)(1, 10);
132
+ b = (0, randint_1.randint)(1, 10);
133
+ break;
134
+ }
135
+ const identifiers = { type, a, b, c };
136
+ const question = {
137
+ answer: getAnswer(identifiers),
138
+ instruction: getInstruction(identifiers),
139
+ keys: getKeys(identifiers),
140
+ answerFormat: "tex",
141
+ identifiers,
142
+ // hint: getHint(identifiers),
143
+ // correction: getCorrection(identifiers),
144
+ };
145
+ return question;
146
+ };
147
+ exports.choseOperationToSolveEquation = {
148
+ id: "choseOperationToSolveEquation",
149
+ connector: "=",
150
+ label: "Choisir la bonne opération pour résoudre une équation du premier degré",
151
+ isSingleStep: true,
152
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getChoseOperationToSolveEquationQuestion(opts), nb),
153
+ qcmTimer: 60,
154
+ freeTimer: 60,
155
+ getPropositions,
156
+ isAnswerValid,
157
+ subject: "Mathématiques",
158
+ getInstruction,
159
+ // getHint,
160
+ // getCorrection,
161
+ getAnswer,
162
+ answerType: "QCU",
163
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AA2BlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA+JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
1
+ {"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AA4BlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA+JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
@@ -15,6 +15,7 @@ const diceFlip_1 = require("../../../../utils/alea/diceFlip");
15
15
  const isInt_1 = require("../../../../utils/isInt");
16
16
  const random_1 = require("../../../../utils/alea/random");
17
17
  const discreteSetParser_1 = require("../../../../tree/parsers/discreteSetParser");
18
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
18
19
  const squares = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((el) => el ** 2);
19
20
  const higherFactor = (n) => {
20
21
  for (let i = Math.floor(Math.sqrt(n)); i > 0; i--)
@@ -141,7 +142,7 @@ const isAnswerValid = (ans, { answer, randNbr }) => {
141
142
  return "S=" + parsed.simplify().toTex() === answer;
142
143
  }
143
144
  catch (err) {
144
- return false;
145
+ return (0, handleVEAError_1.handleVEAError)(err);
145
146
  }
146
147
  };
147
148
  exports.equationSimpleSquare = {
@@ -12,4 +12,5 @@ export * from "./firstDegreeEquationIntType3";
12
12
  export * from "./equationFromSentenceExercise";
13
13
  export * from "./binomialsTrinomialsProposedSolutions";
14
14
  export * from "./equationWithDistributivity";
15
+ export * from "./choseOperationToSolveEquation";
15
16
  //# sourceMappingURL=index.d.ts.map