math-exercises 3.0.49 → 3.0.50

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 (141) hide show
  1. package/lib/exercises/math/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/operations/expressionNature.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/ordering/decimalOrdering.js +0 -2
  5. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +6 -0
  7. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +33 -3
  9. package/lib/exercises/math/calculLitteral/index.d.ts +1 -0
  10. package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
  11. package/lib/exercises/math/calculLitteral/index.js +1 -0
  12. package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -0
  13. package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -0
  14. package/lib/exercises/math/calculLitteral/isolate/index.js +2 -0
  15. package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts +2 -0
  16. package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts.map +1 -0
  17. package/lib/exercises/math/calculLitteral/isolate/isolateVariable.js +83 -0
  18. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
  19. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
  20. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  21. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +1 -1
  22. package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -1
  23. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  24. package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
  25. package/lib/exercises/math/functions/basics/inverseImageFunction.d.ts.map +1 -1
  26. package/lib/exercises/math/functions/basics/inverseImageFunction.js +16 -3
  27. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -1
  28. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -1
  29. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -1
  30. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +10 -0
  31. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.js +31 -16
  33. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.js +50 -14
  35. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts +1 -0
  36. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts.map +1 -1
  37. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.js +48 -40
  38. package/lib/exercises/math/geometry/lines/isPointOnLine.js +1 -1
  39. package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
  40. package/lib/exercises/math/geometry/lines/linesRelativePositions.js +0 -2
  41. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts +8 -0
  42. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts.map +1 -0
  43. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +93 -0
  44. package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts +9 -0
  45. package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts.map +1 -0
  46. package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.js +111 -0
  47. package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts +3 -0
  48. package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts.map +1 -1
  49. package/lib/exercises/math/geometry/vectors/scalarProduct/index.js +3 -0
  50. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts +10 -0
  51. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts.map +1 -0
  52. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.js +174 -0
  53. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +2 -2
  54. package/lib/exercises/math/primitive/constantPrimitive.d.ts.map +1 -1
  55. package/lib/exercises/math/primitive/constantPrimitive.js +22 -5
  56. package/lib/exercises/math/primitive/expUPrimitive.d.ts.map +1 -1
  57. package/lib/exercises/math/primitive/expUPrimitive.js +25 -7
  58. package/lib/exercises/math/primitive/exponentialPrimitive.d.ts.map +1 -1
  59. package/lib/exercises/math/primitive/exponentialPrimitive.js +23 -5
  60. package/lib/exercises/math/primitive/index.d.ts +2 -0
  61. package/lib/exercises/math/primitive/index.d.ts.map +1 -1
  62. package/lib/exercises/math/primitive/index.js +2 -0
  63. package/lib/exercises/math/primitive/kexpUPrimitive.d.ts +9 -0
  64. package/lib/exercises/math/primitive/kexpUPrimitive.d.ts.map +1 -0
  65. package/lib/exercises/math/primitive/kexpUPrimitive.js +130 -0
  66. package/lib/exercises/math/primitive/klogUPrimitive.d.ts +9 -0
  67. package/lib/exercises/math/primitive/klogUPrimitive.d.ts.map +1 -0
  68. package/lib/exercises/math/primitive/klogUPrimitive.js +120 -0
  69. package/lib/exercises/math/primitive/logarithmePrimitive.d.ts.map +1 -1
  70. package/lib/exercises/math/primitive/logarithmePrimitive.js +30 -18
  71. package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
  72. package/lib/exercises/math/primitive/polynomialPrimitive.js +0 -11
  73. package/lib/exercises/math/primitive/sinCosPrimitive.d.ts.map +1 -1
  74. package/lib/exercises/math/primitive/sinUCosUPrimitive.d.ts.map +1 -1
  75. package/lib/exercises/math/primitive/sinUCosUPrimitive.js +33 -18
  76. package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
  77. package/lib/exercises/math/probaStat/ballsBasicProbas.js +28 -4
  78. package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
  79. package/lib/index.d.ts +17 -0
  80. package/lib/index.d.ts.map +1 -1
  81. package/lib/math/geometry/spaceVector.d.ts +1 -2
  82. package/lib/math/geometry/spaceVector.d.ts.map +1 -1
  83. package/lib/math/geometry/vector.d.ts +8 -0
  84. package/lib/math/geometry/vector.d.ts.map +1 -1
  85. package/lib/math/geometry/vector.js +12 -1
  86. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  87. package/lib/math/numbers/integer/integer.d.ts.map +1 -1
  88. package/lib/math/numbers/integer/power.d.ts.map +1 -1
  89. package/lib/math/numbers/nombre.d.ts.map +1 -1
  90. package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
  91. package/lib/math/numbers/reals/real.d.ts.map +1 -1
  92. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  93. package/lib/math/sequences/sequence.d.ts +3 -3
  94. package/lib/math/sequences/sequence.d.ts.map +1 -1
  95. package/lib/playground.d.ts.map +1 -1
  96. package/lib/playground.js +4 -0
  97. package/lib/prototypesEnhancement.d.ts.map +1 -1
  98. package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
  99. package/lib/tree/nodes/equations/equalNode.d.ts +14 -8
  100. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  101. package/lib/tree/nodes/equations/equalNode.js +119 -6
  102. package/lib/tree/nodes/equations/equationSolutionNode.d.ts +8 -2
  103. package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
  104. package/lib/tree/nodes/equations/equationSolutionNode.js +14 -0
  105. package/lib/tree/nodes/equations/multiEqualNode.d.ts +7 -1
  106. package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
  107. package/lib/tree/nodes/equations/multiEqualNode.js +14 -0
  108. package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
  109. package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
  110. package/lib/tree/nodes/functions/arccosNode.js +4 -0
  111. package/lib/tree/nodes/functions/integralNode.d.ts +8 -3
  112. package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
  113. package/lib/tree/nodes/functions/integralNode.js +14 -0
  114. package/lib/tree/nodes/geometry/pointNode.d.ts +8 -2
  115. package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
  116. package/lib/tree/nodes/geometry/pointNode.js +14 -0
  117. package/lib/tree/nodes/geometry/vectorNode.d.ts +8 -2
  118. package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
  119. package/lib/tree/nodes/geometry/vectorNode.js +14 -0
  120. package/lib/tree/nodes/inequations/inequationNode.d.ts +8 -3
  121. package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
  122. package/lib/tree/nodes/inequations/inequationNode.js +14 -0
  123. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +8 -2
  124. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
  125. package/lib/tree/nodes/inequations/inequationSolutionNode.js +14 -0
  126. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  127. package/lib/tree/nodes/numbers/percentNode.d.ts +10 -3
  128. package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
  129. package/lib/tree/nodes/numbers/percentNode.js +17 -1
  130. package/lib/tree/nodes/operators/scalarProductNode.d.ts.map +1 -1
  131. package/lib/tree/nodes/sets/belongsNode.d.ts +11 -5
  132. package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
  133. package/lib/tree/nodes/sets/belongsNode.js +14 -0
  134. package/lib/tree/parsers/affineParser.d.ts.map +1 -1
  135. package/lib/tree/parsers/affineParser.js +0 -1
  136. package/lib/tree/parsers/equationSolutionParser.d.ts +1 -1
  137. package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
  138. package/lib/tree/parsers/vectorParser.d.ts +3 -0
  139. package/lib/tree/parsers/vectorParser.d.ts.map +1 -0
  140. package/lib/tree/parsers/vectorParser.js +13 -0
  141. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AA4C3B,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAoBzC,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
1
+ {"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AA4C3B,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAoBzC,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"expressionNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/expressionNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAoLnE,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}
1
+ {"version":3,"file":"expressionNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/expressionNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAoLnE,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"decimalOrdering.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/decimalOrdering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAgE1D,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC"}
1
+ {"version":3,"file":"decimalOrdering.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/decimalOrdering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAgE1D,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
@@ -63,9 +63,7 @@ export const decimalOrdering = {
63
63
  id: "decimalOrdering",
64
64
  connector: "\\iff",
65
65
  label: "Comparer des nombres décimaux",
66
- levels: [],
67
66
  isSingleStep: true,
68
- sections: [],
69
67
  generator: (nb) => getDistinctQuestions(getDecimalOrderingQuestion, nb),
70
68
  qcmTimer: 60,
71
69
  freeTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC;AA0FF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
1
+ {"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC;AAiGF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
@@ -53,6 +53,12 @@ const getProportionalityTable = () => {
53
53
  const identifiers = { x1, x2, x3, x4, randQuation };
54
54
  return getQuestionFromIdentifiers(identifiers);
55
55
  };
56
+ const getHint = () => {
57
+ return ``;
58
+ };
59
+ const getCorrection = () => {
60
+ return ``;
61
+ };
56
62
  const getQuestionFromIdentifiers = (identifiers) => {
57
63
  const question = {
58
64
  instruction: getInstruction(identifiers),
@@ -1 +1 @@
1
- {"version":3,"file":"proportionalityTableCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTableCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAuDF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAejE,CAAC"}
1
+ {"version":3,"file":"proportionalityTableCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTableCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAiFF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAgBjE,CAAC"}
@@ -2,7 +2,10 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { IntegerConstructor } from "../../../../math/numbers/integer/integer.js";
4
4
  import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
6
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
5
7
  import { shuffle } from "../../../../utils/alea/shuffle.js";
8
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
9
  import { dollarize } from "../../../../utils/latex/dollarize.js";
7
10
  import { mdTable } from "../../../../utils/markdown/mdTable.js";
8
11
  const getInstruction = ({ xValues, yValues }) => {
@@ -16,19 +19,39 @@ ${dataTable}
16
19
 
17
20
  Calculer le coefficient de proportionnalité.`;
18
21
  };
22
+ const getAnswer = (identifiers) => {
23
+ const factor = identifiers.yValues[1] / identifiers.xValues[1];
24
+ const answer = factor.toTree().toTex();
25
+ return answer;
26
+ };
27
+ const getHint = (identifiers) => {
28
+ return `Le coefficient de proportionnalité est le nomber par lequel on multiplie les valeurs de la première ligne pour obtenir les valeurs de la deuxième ligne.`;
29
+ };
30
+ const getCorrection = (identifiers) => {
31
+ const { xValues, yValues } = identifiers;
32
+ const factor = yValues[1] / xValues[1];
33
+ return `Le coefficient de proportionnalité est le nomber par lequel on multiplie les valeurs de la première ligne pour obtenir les valeurs de la deuxième ligne.
34
+
35
+ Pour l'obtenir, on divise une valeur de la deuxième ligne par la valeur correspondante dans la première ligne, par exemple :
36
+
37
+ $$
38
+ ${frac(xValues[0], yValues[0]).toSimplificationTex()}
39
+ $$`;
40
+ };
19
41
  const getProportionalityTableCoefficient = () => {
20
42
  const factor = randint(2, 15);
21
43
  const xValues = IntegerConstructor.randomDifferents(1, 100 / factor, 3).sort((a, b) => a - b);
22
44
  const yValues = xValues.map((x) => x * factor);
23
- const answer = factor.toTree().toTex();
24
45
  const identifiers = { xValues, yValues };
25
46
  const question = {
26
47
  instruction: getInstruction(identifiers),
27
- answer,
48
+ answer: getAnswer(identifiers),
28
49
  keys: [],
29
50
  answerFormat: "tex",
30
51
  identifiers,
31
52
  style: { tableHasNoHeader: true },
53
+ hint: getHint(identifiers),
54
+ correction: getCorrection(identifiers),
32
55
  };
33
56
  return question;
34
57
  };
@@ -41,7 +64,13 @@ const getPropositions = (n, { answer }) => {
41
64
  return shuffle(propositions);
42
65
  };
43
66
  const isAnswerValid = (ans, { answer }) => {
44
- return ans === answer;
67
+ try {
68
+ const parsed = parseAlgebraic(ans);
69
+ return parsed.simplify().toTex() === answer;
70
+ }
71
+ catch (err) {
72
+ return handleVEAError(err);
73
+ }
45
74
  };
46
75
  export const proportionalityTableCoefficient = {
47
76
  id: "proportionalityTableCoefficient",
@@ -57,4 +86,5 @@ export const proportionalityTableCoefficient = {
57
86
  isAnswerValid,
58
87
  subject: "Mathématiques",
59
88
  getInstruction,
89
+ hasHintAndCorrection: true,
60
90
  };
@@ -4,4 +4,5 @@ export * from "./factorisation/index.js";
4
4
  export * from "./inequations/index.js";
5
5
  export * from "./simplifying/index.js";
6
6
  export * from "./systems/index.js";
7
+ export * from "./isolate/index.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
@@ -4,3 +4,4 @@ export * from "./factorisation/index.js";
4
4
  export * from "./inequations/index.js";
5
5
  export * from "./simplifying/index.js";
6
6
  export * from "./systems/index.js";
7
+ export * from "./isolate/index.js";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ // export * from "./isolateVariable.js";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isolateVariable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isolateVariable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/isolateVariable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,83 @@
1
+ // import {
2
+ // Exercise,
3
+ // Proposition,
4
+ // QCMGenerator,
5
+ // Question,
6
+ // QuestionGenerator,
7
+ // VEA,
8
+ // addValidProp,
9
+ // shuffleProps,
10
+ // GetAnswer,
11
+ // GetHint,
12
+ // GetCorrection,
13
+ // GetInstruction,
14
+ // GetKeys,
15
+ // GetQuestionFromIdentifiers,
16
+ // } from '../../../../exercises/exercise.js';
17
+ // import { getDistinctQuestions } from '../../../../exercises/utils/getDistinctQuestions.js';
18
+ // import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
19
+ export {};
20
+ // type Identifiers = {
21
+ // };
22
+ // //1. x+a = b (plus ou moins, droite ou gauche)
23
+ // //2. ax + b = c (plus ou moins, droite ou gauche)
24
+ // //3. a/x = b
25
+ // //4. ax / b = c
26
+ // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
27
+ // const propositions: Proposition[] = [];
28
+ // addValidProp(propositions, answer);
29
+ // while (propositions.length < n) {
30
+ // throw Error("QCM not implemented")
31
+ // }
32
+ // return shuffleProps(propositions, n);
33
+ // };
34
+ // const getAnswer : GetAnswer<Identifiers> = (identifiers)=>{
35
+ // }
36
+ // const getInstruction : GetInstruction<Identifiers> = (identifiers)=>{
37
+ // }
38
+ // const getHint : GetHint<Identifiers> = (identifiers)=>{
39
+ // }
40
+ // const getCorrection : GetCorrection<Identifiers> = (identifiers)=>{
41
+ // }
42
+ // const getKeys : GetKeys<Identifiers> = (identifiers)=>{
43
+ // return []
44
+ // }
45
+ // const isAnswerValid: VEA<Identifiers> = (ans, {answer})=>{
46
+ // try {
47
+ // throw Error("VEA not implemented")
48
+ // } catch(err){
49
+ // return handleVEAError(err)
50
+ // }
51
+ // }
52
+ // const getIsolateVariableQuestion: QuestionGenerator<Identifiers> = (ops)=>{
53
+ // const identifiers: Identifiers = {}
54
+ // return getQuestionFromIdentifiers(identifiers);
55
+ // }
56
+ // const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (identifiers)=>{
57
+ // return {
58
+ // answer: getAnswer(identifiers),
59
+ // instruction: getInstruction(identifiers),
60
+ // keys: getKeys(identifiers),
61
+ // answerFormat: 'tex',
62
+ // identifiers,
63
+ // hint: getHint(identifiers),
64
+ // correction: getCorrection(identifiers)
65
+ // }
66
+ // }
67
+ // export const isolateVariable: Exercise<Identifiers> = {
68
+ // id: 'isolateVariable',
69
+ // connector: "",
70
+ // label: undefined,
71
+ // isSingleStep: true,
72
+ // generator: (nb, opts) => getDistinctQuestions(()=>getIsolateVariableQuestion(opts), nb),
73
+ // qcmTimer: 60,
74
+ // freeTimer: 60,
75
+ // getPropositions,
76
+ // isAnswerValid,
77
+ // subject: "Mathématiques",
78
+ // getInstruction,
79
+ // getHint,
80
+ // getCorrection,
81
+ // getAnswer,
82
+ // getQuestionFromIdentifiers
83
+ // };
@@ -1 +1 @@
1
- {"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IAOjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAGnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAqOF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAkBlD,CAAC"}
1
+ {"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IAOjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAGnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAqOF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAkBlD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"lnDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
1
+ {"version":3,"file":"lnDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+FF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
1
+ {"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+FF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
@@ -4,7 +4,7 @@ import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { round } from "../../../../math/utils/round.js";
5
5
  import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
6
6
  import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
- import { multiply, } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
8
  import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
9
9
  import { shuffle } from "../../../../utils/alea/shuffle.js";
10
10
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
@@ -1 +1 @@
1
- {"version":3,"file":"equaDiffCheckSolutionFirstOrder.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAkHF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAejE,CAAC"}
1
+ {"version":3,"file":"equaDiffCheckSolutionFirstOrder.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAkHF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAejE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAiIF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
1
+ {"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAiIF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAgIF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAqB9C,CAAC"}
1
+ {"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAgIF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAqB9C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"inverseImageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IAIjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA4GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAoBtD,CAAC"}
1
+ {"version":3,"file":"inverseImageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IAIjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAuHF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
@@ -1,11 +1,13 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
3
4
  import { AffineConstructor } from "../../../../math/polynomials/affine.js";
4
5
  import { Polynomial } from "../../../../math/polynomials/polynomial.js";
5
6
  import { randint } from "../../../../math/utils/random/randint.js";
6
7
  import { equationResolutionTex } from "../../../../tree/nodes/equations/equalNode.js";
7
8
  import { add } from "../../../../tree/nodes/operators/addNode.js";
8
9
  import { shuffle } from "../../../../utils/alea/shuffle.js";
10
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
9
11
  const rebuildIdentifiers = (oldIds) => {
10
12
  if (oldIds.coeffs?.length)
11
13
  return oldIds;
@@ -94,15 +96,26 @@ const getPropositions = (n, { answer, coeffs, yValue }) => {
94
96
  return shuffle(propositions);
95
97
  };
96
98
  const isAnswerValid = (ans, { answer }) => {
97
- return [answer, answer.split("=")[1]].includes(ans);
99
+ try {
100
+ const formated = ans.split("=").filter(Boolean);
101
+ if (formated.length === 2) {
102
+ return (formated[0] === "x" && numberVEA(formated[1], answer.split("=")[1]));
103
+ }
104
+ else if (formated.length === 1) {
105
+ return numberVEA(formated[0], answer.split("=")[1]);
106
+ }
107
+ else
108
+ return false;
109
+ }
110
+ catch (err) {
111
+ return handleVEAError(err);
112
+ }
98
113
  };
99
114
  export const inverseImageFunction = {
100
115
  id: "inverseImageFunction",
101
116
  connector: "\\iff",
102
117
  getPropositions,
103
118
  label: "Calculer des antécédents",
104
- levels: ["3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
105
- sections: ["Fonctions"],
106
119
  isSingleStep: true,
107
120
  generator: (nb) => getDistinctQuestions(getInverseImageFunction, nb),
108
121
  qcmTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAiB9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAwHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
1
+ {"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAgB9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAwHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"solveSecondDegreeEquationFromCano.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAkEF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAcnE,CAAC"}
1
+ {"version":3,"file":"solveSecondDegreeEquationFromCano.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAmEF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAcnE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiGF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
1
+ {"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4GF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
@@ -7,6 +7,16 @@ import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
7
7
  import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
8
8
  import { shuffle } from "../../../../../utils/alea/shuffle.js";
9
9
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
10
+ const getHint = (identifiers) => {
11
+ return `Un produit est nul si et seulement si un de ses facteurs est nul.
12
+
13
+ Il faut donc trouver les valeurs de $x$ qui rendent un des facteurs nuls.`;
14
+ };
15
+ const getCorrection = (identifiers) => {
16
+ const { a, b, c } = identifiers;
17
+ const trinom = new Trinom(a, b, c);
18
+ return ``;
19
+ };
10
20
  const getInstruction = (identifiers) => {
11
21
  const { a, b, c } = identifiers;
12
22
  const trinom = new Trinom(a, b, c);
@@ -1 +1 @@
1
- {"version":3,"file":"summitAbscissFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgFF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAkB1D,CAAC"}
1
+ {"version":3,"file":"summitAbscissFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+FF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAkB1D,CAAC"}
@@ -1,22 +1,36 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Rational } from "../../../../../math/numbers/rationals/rational.js";
4
- import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
4
+ import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
5
5
  import { randint } from "../../../../../math/utils/random/randint.js";
6
6
  import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
7
7
  import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
8
8
  import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
10
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
9
11
  import { alignTex } from "../../../../../utils/latex/alignTex.js";
10
- const getSummitAbscissFromDevFormQuestion = () => {
11
- const trinom = TrinomConstructor.random();
12
+ const getInstruction = (identifiers) => {
13
+ const { a, b, c } = identifiers;
14
+ const trinom = new Trinom(a, b, c);
15
+ return `Soit $f(x) = ${trinom
16
+ .toTree()
17
+ .toTex()}$ une fonction polynôme du second degré.
18
+
19
+ Quelle est l'abscisse du sommet de la parabole représentant $f$ ?`;
20
+ };
21
+ const getAnswer = (identifiers) => {
22
+ const { a, b, c } = identifiers;
23
+ const trinom = new Trinom(a, b, c);
12
24
  const alpha = trinom.getAlphaNode();
13
25
  const answer = alpha.toTex();
26
+ return answer;
27
+ };
28
+ const getSummitAbscissFromDevFormQuestion = () => {
29
+ const trinom = TrinomConstructor.random();
14
30
  const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
15
31
  const question = {
16
- answer,
17
- instruction: `Soit $f(x) = ${trinom
18
- .toTree()
19
- .toTex()}$ une fonction polynôme du second degré. Quelle est l'abscisse du sommet de la parabole représentant $f$ ?`,
32
+ answer: getAnswer(identifiers),
33
+ instruction: getInstruction(identifiers),
20
34
  keys: [],
21
35
  answerFormat: "tex",
22
36
  identifiers,
@@ -63,21 +77,20 @@ ${alignTex([
63
77
  ])}
64
78
  `;
65
79
  };
66
- const isAnswerValid = (ans, { a, b, c }) => {
67
- const node = new Rational(-b, 2 * a).simplify().toTree();
68
- const texs = node.toAllValidTexs({
69
- allowFractionToDecimal: true,
70
- allowMinusAnywhereInFraction: true,
71
- });
72
- return texs.includes(ans);
80
+ const isAnswerValid = (ans, { answer, a, b, c }) => {
81
+ try {
82
+ const parsed = parseAlgebraic(ans);
83
+ return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
84
+ }
85
+ catch (err) {
86
+ return handleVEAError(err);
87
+ }
73
88
  };
74
89
  export const summitAbscissFromDevForm = {
75
90
  id: "summitAbscissFromDevForm",
76
91
  connector: "=",
77
92
  label: "Déterminer l'abscisse du sommet d'une parabole en connaissant la forme développée",
78
- levels: ["1rePro", "1reSpé", "1reTech"],
79
93
  isSingleStep: true,
80
- sections: ["Second degré"],
81
94
  generator: (nb) => getDistinctQuestions(getSummitAbscissFromDevFormQuestion, nb),
82
95
  qcmTimer: 60,
83
96
  freeTimer: 60,
@@ -87,4 +100,6 @@ export const summitAbscissFromDevForm = {
87
100
  getHint,
88
101
  getCorrection,
89
102
  subject: "Mathématiques",
103
+ getInstruction,
104
+ getAnswer,
90
105
  };
@@ -1 +1 @@
1
- {"version":3,"file":"summitAbscissFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8CF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
1
+ {"version":3,"file":"summitAbscissFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoFF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
@@ -3,19 +3,52 @@ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinct
3
3
  import { Rational } from "../../../../../math/numbers/rationals/rational.js";
4
4
  import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
5
5
  import { randint } from "../../../../../math/utils/random/randint.js";
6
- const getSummitAbscissFromRootsQuestion = () => {
7
- const trinom = TrinomConstructor.randomNiceRoots(2);
6
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
7
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
8
+ import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
9
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
10
+ const getInstruction = (identifiers) => {
11
+ const { a, b, c } = identifiers;
12
+ const trinom = new Trinom(a, b, c);
13
+ const roots = trinom.getRoots();
14
+ return `Soit $f(x) = ax^2+bx+c$ une fonction polynôme du second degé, dont les racines sont $${roots[0]}$ et $${roots[1]}$.
15
+
16
+ Quelle est l'abscisse du sommet de la parabole représentant $f$ ?`;
17
+ };
18
+ const getAnswer = (identifiers) => {
19
+ const { a, b, c } = identifiers;
20
+ const trinom = new Trinom(a, b, c);
8
21
  const roots = trinom.getRoots();
9
22
  const answer = new Rational(roots[0] + roots[1], 2)
10
23
  .simplify()
11
24
  .toTree()
12
25
  .toTex();
26
+ return answer;
27
+ };
28
+ const getHint = (identifiers) => {
29
+ return `L'abscisse du sommet d'une parabole admettant deux racines est la moyenne des racines.`;
30
+ };
31
+ const getCorrection = (identifiers) => {
32
+ const { a, b, c } = identifiers;
33
+ const trinom = new Trinom(a, b, c);
34
+ const roots = trinom.getRoots();
35
+ return `L'ascisse $\\alpha$ du sommet de la parabole représentant $f$ est la moyenne des racines de $f$ :
36
+
37
+ $$
38
+ \\alpha = ${frac(add(roots[0], roots[1]), 2).toTex()} = ${getAnswer(identifiers)}
39
+ $$`;
40
+ };
41
+ const getSummitAbscissFromRootsQuestion = () => {
42
+ const trinom = TrinomConstructor.randomNiceRoots(2);
43
+ const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
13
44
  const question = {
14
- answer,
15
- instruction: `Soit $f(x) = ax^2+bx+c$ une fonction polynôme du second degé, dont les racines sont $${roots[0]}$ et $${roots[1]}$. Quelle est l'abscisse du sommet de la parabole représentant $f$ ?`,
45
+ answer: getAnswer(identifiers),
46
+ instruction: getInstruction(identifiers),
16
47
  keys: [],
17
48
  answerFormat: "tex",
18
- identifiers: { a: trinom.a, b: trinom.b, c: trinom.c },
49
+ identifiers,
50
+ hint: getHint(identifiers),
51
+ correction: getCorrection(identifiers),
19
52
  };
20
53
  return question;
21
54
  };
@@ -31,25 +64,28 @@ const getPropositions = (n, { answer, a, b, c }) => {
31
64
  return shuffleProps(propositions, n);
32
65
  };
33
66
  const isAnswerValid = (ans, { answer, a, b, c }) => {
34
- const trinom = new Trinom(a, b, c);
35
- const node = trinom.getAlphaNode();
36
- const texs = node.toAllValidTexs({
37
- allowFractionToDecimal: true,
38
- allowMinusAnywhereInFraction: true,
39
- });
40
- return texs.includes(ans);
67
+ try {
68
+ const parsed = parseAlgebraic(ans);
69
+ return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
70
+ }
71
+ catch (err) {
72
+ return handleVEAError(err);
73
+ }
41
74
  };
42
75
  export const summitAbscissFromRoots = {
43
76
  id: "summitAbscissFromRoots",
44
77
  connector: "=",
45
78
  label: "Déterminer l'abscisse du sommet d'une parabole en connaissant ses racines",
46
- levels: ["1reSpé", "1rePro", "1reTech"],
47
79
  isSingleStep: true,
48
- sections: ["Second degré"],
49
80
  generator: (nb) => getDistinctQuestions(getSummitAbscissFromRootsQuestion, nb),
50
81
  qcmTimer: 60,
51
82
  freeTimer: 60,
52
83
  getPropositions,
53
84
  isAnswerValid,
54
85
  subject: "Mathématiques",
86
+ getInstruction,
87
+ getAnswer,
88
+ getHint,
89
+ getCorrection,
90
+ hasHintAndCorrection: true,
55
91
  };
@@ -2,6 +2,7 @@ import { Exercise } from "../../../../exercises/exercise.js";
2
2
  type Identifiers = {
3
3
  xValue: number;
4
4
  yValue: number;
5
+ c: number;
5
6
  };
6
7
  export declare const directionVectorEquation: Exercise<Identifiers>;
7
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"directionVectorEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/directionVectorEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAwHF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
1
+ {"version":3,"file":"directionVectorEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/directionVectorEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;CAEX,CAAC;AA+HF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAgBzD,CAAC"}