math-exercises 2.2.45 → 2.2.47

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 (95) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsSum.js +1 -1
  2. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +12 -0
  4. package/lib/exercises/math/complex/argumentFromAlgebraicComplex.d.ts.map +1 -1
  5. package/lib/exercises/math/complex/argumentFromAlgebraicComplex.js +4 -5
  6. package/lib/exercises/math/derivation/derivative/sqrtCompositionDerivation.js +1 -1
  7. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
  8. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +35 -19
  9. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.js +3 -3
  10. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.js +3 -3
  11. package/lib/exercises/math/geometry/euclidian/choseMethodToCalculateLength.d.ts +1 -0
  12. package/lib/exercises/math/geometry/euclidian/choseMethodToCalculateLength.d.ts.map +1 -0
  13. package/lib/exercises/math/geometry/euclidian/choseMethodToCalculateLength.js +79 -0
  14. package/lib/exercises/math/geometry/euclidian/index.d.ts +1 -0
  15. package/lib/exercises/math/geometry/euclidian/index.d.ts.map +1 -0
  16. package/lib/exercises/math/geometry/euclidian/index.js +1 -0
  17. package/lib/exercises/math/geometry/index.js +1 -0
  18. package/lib/exercises/math/geometry/pythagore/index.d.ts +1 -0
  19. package/lib/exercises/math/geometry/pythagore/index.d.ts.map +1 -1
  20. package/lib/exercises/math/geometry/pythagore/index.js +1 -0
  21. package/lib/exercises/math/geometry/pythagore/isTriangleRight.d.ts +11 -0
  22. package/lib/exercises/math/geometry/pythagore/isTriangleRight.d.ts.map +1 -0
  23. package/lib/exercises/math/geometry/pythagore/isTriangleRight.js +108 -0
  24. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.d.ts.map +1 -1
  25. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.js +3 -3
  26. package/lib/exercises/math/matrices/matrixInversibilityDomain.js +4 -4
  27. package/lib/exercises/math/percent/reciprocalPercentage.d.ts.map +1 -1
  28. package/lib/exercises/math/percent/reciprocalPercentage.js +32 -17
  29. package/lib/exercises/math/trigonometry/equationCosOnRandomInterval.d.ts.map +1 -1
  30. package/lib/exercises/math/trigonometry/mainAngleMeasure.js +1 -1
  31. package/lib/index.d.ts +6 -0
  32. package/lib/index.d.ts.map +1 -1
  33. package/lib/math/sets/intervals/intervals.d.ts +1 -1
  34. package/lib/math/utils/geometry/pythagoricianTriplets.d.ts +2 -0
  35. package/lib/math/utils/geometry/pythagoricianTriplets.d.ts.map +1 -0
  36. package/lib/math/utils/geometry/pythagoricianTriplets.js +21 -0
  37. package/lib/playground.d.ts.map +1 -1
  38. package/lib/playground.js +4 -5
  39. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  40. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  41. package/lib/tree/nodes/algebraicNode.js +3 -0
  42. package/lib/tree/nodes/complex/complexNode.d.ts +1 -0
  43. package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
  44. package/lib/tree/nodes/complex/complexNode.js +3 -0
  45. package/lib/tree/nodes/equations/equalNode.d.ts +2 -0
  46. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  47. package/lib/tree/nodes/equations/equalNode.js +6 -1
  48. package/lib/tree/nodes/equations/equationSolutionNode.d.ts +1 -0
  49. package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
  50. package/lib/tree/nodes/equations/equationSolutionNode.js +3 -0
  51. package/lib/tree/nodes/equations/multiEqualNode.d.ts +1 -0
  52. package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
  53. package/lib/tree/nodes/equations/multiEqualNode.js +3 -0
  54. package/lib/tree/nodes/functions/integralNode.d.ts +1 -0
  55. package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
  56. package/lib/tree/nodes/functions/integralNode.js +3 -0
  57. package/lib/tree/nodes/geometry/pointNode.d.ts +1 -0
  58. package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
  59. package/lib/tree/nodes/geometry/pointNode.js +3 -0
  60. package/lib/tree/nodes/geometry/vectorNode.d.ts +1 -0
  61. package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
  62. package/lib/tree/nodes/geometry/vectorNode.js +3 -0
  63. package/lib/tree/nodes/inequations/inequationNode.d.ts +1 -0
  64. package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
  65. package/lib/tree/nodes/inequations/inequationNode.js +3 -0
  66. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +1 -0
  67. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
  68. package/lib/tree/nodes/inequations/inequationSolutionNode.js +3 -0
  69. package/lib/tree/nodes/node.d.ts +1 -0
  70. package/lib/tree/nodes/node.d.ts.map +1 -1
  71. package/lib/tree/nodes/numbers/percentNode.d.ts +1 -0
  72. package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
  73. package/lib/tree/nodes/numbers/percentNode.js +3 -0
  74. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  75. package/lib/tree/nodes/operators/multiplyNode.js +4 -0
  76. package/lib/tree/nodes/sets/belongsNode.d.ts +1 -0
  77. package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
  78. package/lib/tree/nodes/sets/belongsNode.js +3 -0
  79. package/lib/tree/nodes/sets/discreteSetNode.d.ts +1 -0
  80. package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
  81. package/lib/tree/nodes/sets/discreteSetNode.js +3 -0
  82. package/lib/tree/nodes/sets/intervalNode.d.ts +1 -0
  83. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  84. package/lib/tree/nodes/sets/intervalNode.js +3 -0
  85. package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -0
  86. package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
  87. package/lib/tree/nodes/sets/unionIntervalNode.js +3 -0
  88. package/lib/tree/parsers/affineParser.js +1 -1
  89. package/lib/tree/parsers/equationSolutionParser.d.ts +3 -0
  90. package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -0
  91. package/lib/tree/parsers/equationSolutionParser.js +29 -0
  92. package/lib/tree/parsers/latexParser.d.ts +4 -1
  93. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  94. package/lib/tree/parsers/latexParser.js +54 -6
  95. package/package.json +1 -1
@@ -47,7 +47,7 @@ const isAnswerValid = (ans, { rational, rational2 }, opts) => {
47
47
  const texs = answerTree.toAllValidTexs();
48
48
  if (allow)
49
49
  try {
50
- const parsed = (0, latexParser_1.parseLatex)(ans).simplify().toTex();
50
+ const parsed = (0, latexParser_1.parseAlgebraic)(ans).simplify().toTex();
51
51
  return texs.includes(parsed);
52
52
  }
53
53
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAclC;;GAEG;AAEH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4EF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
1
+ {"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAgBlC;;GAEG;AAEH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAyFF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
@@ -62,6 +62,18 @@ const getPropositions = (n, { answer, a, b, c, d }) => {
62
62
  return (0, shuffle_1.shuffle)(propositions);
63
63
  };
64
64
  const isAnswerValid = (ans, { a, b, c, d }) => {
65
+ // try {
66
+ // const parsed = equationSolutionParser(ans);
67
+ // if (!parsed) return false;
68
+ // console.log("parsed", parsed.toTex());
69
+ // const solution = new Rational(d - b, a - c).simplify().toTree();
70
+ // const solutionTex = solution.toTex();
71
+ // const decimal = round(solution.evaluate({}), 12).frenchify();
72
+ // const parsedSolution = parsed.simplify().toTex();
73
+ // return solutionTex === parsedSolution || decimal === parsedSolution;
74
+ // } catch (err) {
75
+ // return false;
76
+ // }
65
77
  const solution = new rational_1.Rational(d - b, a - c).simplify().toTree();
66
78
  const answerTree = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([solution]), {
67
79
  opts: { allowFractionToDecimal: true, allowRawRightChildAsSolution: true },
@@ -1 +1 @@
1
- {"version":3,"file":"argumentFromAlgebraicComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/argumentFromAlgebraicComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA4CF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAc9D,CAAC"}
1
+ {"version":3,"file":"argumentFromAlgebraicComplex.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/complex/argumentFromAlgebraicComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA8CF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAc9D,CAAC"}
@@ -5,7 +5,6 @@ const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
6
  const integer_1 = require("../../../math/numbers/integer/integer");
7
7
  const rational_1 = require("../../../math/numbers/rationals/rational");
8
- const remarkableValue_1 = require("../../../math/trigonometry/remarkableValue");
9
8
  const remarkableValues_1 = require("../../../math/trigonometry/remarkableValues");
10
9
  const randint_1 = require("../../../math/utils/random/randint");
11
10
  const complexNode_1 = require("../../../tree/nodes/complex/complexNode");
@@ -14,9 +13,9 @@ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
14
13
  const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
15
14
  const random_1 = require("../../../utils/alea/random");
16
15
  const getArgumentFromAlgebraicComplexQuestion = () => {
17
- const arg = remarkableValue_1.RemarkableValueConstructor.mainInterval();
16
+ const arg = (0, random_1.random)(remarkableValues_1.mainTrigoValues);
18
17
  const factor = (0, random_1.random)([
19
- new integer_1.Integer((0, randint_1.randint)(-5, 6, [0, 1])).toTree(),
18
+ new integer_1.Integer((0, randint_1.randint)(2, 6)).toTree(),
20
19
  rational_1.RationalConstructor.randomIrreductible().toTree(),
21
20
  (0, random_1.random)([new sqrtNode_1.SqrtNode(new numberNode_1.NumberNode(2)), new sqrtNode_1.SqrtNode(new numberNode_1.NumberNode(3))]),
22
21
  ]);
@@ -38,13 +37,13 @@ const getPropositions = (n, { answer }) => {
38
37
  const propositions = [];
39
38
  (0, exercise_1.addValidProp)(propositions, answer);
40
39
  while (propositions.length < n) {
41
- const randomPoint = remarkableValue_1.RemarkableValueConstructor.mainInterval();
40
+ const randomPoint = (0, random_1.random)(remarkableValues_1.mainTrigoValues);
42
41
  (0, exercise_1.tryToAddWrongProp)(propositions, randomPoint.angle.toTex());
43
42
  }
44
43
  return (0, exercise_1.shuffleProps)(propositions, n);
45
44
  };
46
45
  const isAnswerValid = (ans, { arg }) => {
47
- const point = remarkableValues_1.remarkableTrigoValues.find((point) => point.angle.evaluate({}) === arg);
46
+ const point = remarkableValues_1.mainTrigoValues.find((point) => point.angle.evaluate({}) === arg);
48
47
  const texs = point.angle.toAllValidTexs();
49
48
  return texs.includes(ans);
50
49
  };
@@ -39,7 +39,7 @@ const getPropositions = (n, { answer, affineA, affineB }) => {
39
39
  };
40
40
  const isAnswerValid = (ans, { answer, affineA, affineB }) => {
41
41
  try {
42
- const parsed = (0, latexParser_1.parseLatex)(ans);
42
+ const parsed = (0, latexParser_1.parseAlgebraic)(ans);
43
43
  const simplified = parsed.simplify();
44
44
  return simplified.toTex() === answer;
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"affineExpressionFromTwoImages.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionFromTwoImages.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAsFF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAe/D,CAAC"}
1
+ {"version":3,"file":"affineExpressionFromTwoImages.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionFromTwoImages.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA2GF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAgB/D,CAAC"}
@@ -7,32 +7,27 @@ const rational_1 = require("../../../../math/numbers/rationals/rational");
7
7
  const affine_1 = require("../../../../math/polynomials/affine");
8
8
  const randint_1 = require("../../../../math/utils/random/randint");
9
9
  const addNode_1 = require("../../../../tree/nodes/operators/addNode");
10
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
10
11
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
11
12
  const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
12
13
  const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
13
14
  const shuffle_1 = require("../../../../utils/alea/shuffle");
14
- const getAffineExpressionFromTwoImagesQuestion = () => {
15
- const [xA, yA] = [1, 2].map((el) => (0, randint_1.randint)(-9, 10));
16
- const xB = (0, randint_1.randint)(-9, 10, [xA]);
17
- const yB = (0, randint_1.randint)(-9, 10);
18
- const a = new rational_1.Rational(yB - yA, xB - xA).simplify().toTree();
19
- //yA = axA+b donc b = yA-axA
15
+ const alignTex_1 = require("../../../../utils/latex/alignTex");
16
+ const getCorrection = (identifiers) => {
17
+ const { xA, xB, yA, yB } = identifiers;
18
+ const a = new fractionNode_1.FractionNode(new substractNode_1.SubstractNode(yB.toTree(), yA.toTree()), new substractNode_1.SubstractNode(xB.toTree(), xA.toTree()));
19
+ const aSimplified = a.simplify();
20
20
  const b = new substractNode_1.SubstractNode(yA.toTree(), new multiplyNode_1.MultiplyNode(a, xA.toTree())).simplify();
21
21
  const answer = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(a, new variableNode_1.VariableNode("x")), b)
22
22
  .simplify({ forceDistributeFractions: true })
23
23
  .toTex();
24
- const question = {
25
- instruction: `Soit $f$ une fonction affine telle que $f(${xA}) = ${yA}$ et $f(${xB}) = ${yB}$.
24
+ return `On calcule d'abord le taux d'accroissement $a$ :
26
25
 
27
- Quelle est l'expression algébrique de $f$ ?`,
28
- startStatement: "a",
29
- answer,
30
- hint: "Calcule d'abord le taux d'accroissement de $f$ en utilisant la formule $a = \\frac{y_2-y_1}{x_2-x_1}$. Ensuite, utilise les coordonnées d'un des deux points pour déterminer l'ordonnée à l'origine.",
31
- correction: `On calcule d'abord le taux d'accroissement $a$ :
32
-
33
- $$
34
- a = \\frac{y_2-y_1}{x_2-x_1} = \\frac{${yB}-${yA}}{${xB}-${xA}} = ${a.toTex()}
35
- $$
26
+ ${(0, alignTex_1.alignTex)([
27
+ ["a", "=", `\\frac{y_2-y_1}{x_2-x_1}`],
28
+ ["", "=", `${a.toTex()}`],
29
+ ["", "=", `${aSimplified.toTex()}`],
30
+ ])}
36
31
 
37
32
  Il faut ensuite trouver l'ordonnée à l'origine $b$. On sait que $f(${xA}) = ${yA}$. Or pour tout $x$ réel, on a $f(x) = ax+b$.
38
33
 
@@ -49,10 +44,30 @@ b = ${new substractNode_1.SubstractNode(yA.toTree(), new multiplyNode_1.Multiply
49
44
  $$
50
45
 
51
46
  Ainsi, $f(x) = ${answer}$.
52
- `,
47
+ `;
48
+ };
49
+ const getAffineExpressionFromTwoImagesQuestion = () => {
50
+ const [xA, yA] = [1, 2].map((el) => (0, randint_1.randint)(-9, 10));
51
+ const xB = (0, randint_1.randint)(-9, 10, [xA]);
52
+ const yB = (0, randint_1.randint)(-9, 10);
53
+ const a = new rational_1.Rational(yB - yA, xB - xA).simplify().toTree();
54
+ //yA = axA+b donc b = yA-axA
55
+ const b = new substractNode_1.SubstractNode(yA.toTree(), new multiplyNode_1.MultiplyNode(a, xA.toTree())).simplify();
56
+ const answer = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(a, new variableNode_1.VariableNode("x")), b)
57
+ .simplify({ forceDistributeFractions: true })
58
+ .toTex();
59
+ const identifiers = { xA, xB, yA, yB };
60
+ const question = {
61
+ instruction: `Soit $f$ une fonction affine telle que $f(${xA}) = ${yA}$ et $f(${xB}) = ${yB}$.
62
+
63
+ Quelle est l'expression algébrique de $f$ ?`,
64
+ startStatement: "a",
65
+ answer,
66
+ hint: "Calcule d'abord le taux d'accroissement de $f$ en utilisant la formule $a = \\frac{y_2-y_1}{x_2-x_1}$. Ensuite, utilise les coordonnées d'un des deux points pour déterminer l'ordonnée à l'origine.",
67
+ correction: getCorrection(identifiers),
53
68
  answerFormat: "tex",
54
69
  keys: ["x"],
55
- identifiers: { xA, xB, yA, yB },
70
+ identifiers,
56
71
  };
57
72
  return question;
58
73
  };
@@ -89,4 +104,5 @@ exports.affineExpressionFromTwoImages = {
89
104
  isAnswerValid,
90
105
  subject: "Mathématiques",
91
106
  hasHintAndCorrection: true,
107
+ getCorrection,
92
108
  };
@@ -16,7 +16,7 @@ const random_1 = require("../../../../utils/alea/random");
16
16
  const getPropositions = (n, { answer, absciss, abscissTex, abscissType, axisUnit, oneUnitTex }) => {
17
17
  const propositions = [];
18
18
  (0, exercise_1.addValidProp)(propositions, answer);
19
- const unitNode = (0, latexParser_1.parseLatex)(oneUnitTex);
19
+ const unitNode = (0, latexParser_1.parseAlgebraic)(oneUnitTex);
20
20
  while (propositions.length < n) {
21
21
  const coeff = (0, randint_1.randint)(-6, 7, [0, 1]);
22
22
  (0, exercise_1.tryToAddWrongProp)(propositions, new multiplyNode_1.MultiplyNode(unitNode, coeff.toTree()).simplify().toTex());
@@ -61,8 +61,8 @@ const getKeys = (identifiers) => {
61
61
  };
62
62
  const isAnswerValid = (ans, { answer, abscissTex }) => {
63
63
  try {
64
- const answerNode = (0, latexParser_1.parseLatex)(ans);
65
- const node = (0, latexParser_1.parseLatex)(abscissTex);
64
+ const answerNode = (0, latexParser_1.parseAlgebraic)(ans);
65
+ const node = (0, latexParser_1.parseAlgebraic)(abscissTex);
66
66
  return Math.abs(node.evaluate({}) - answerNode.evaluate({})) < 0.00001;
67
67
  }
68
68
  catch (err) {
@@ -16,7 +16,7 @@ const random_1 = require("../../../../utils/alea/random");
16
16
  const getPropositions = (n, { answer, absciss, abscissTex, abscissType, axisUnit, oneUnitTex }) => {
17
17
  const propositions = [];
18
18
  (0, exercise_1.addValidProp)(propositions, answer);
19
- const unitNode = (0, latexParser_1.parseLatex)(oneUnitTex);
19
+ const unitNode = (0, latexParser_1.parseAlgebraic)(oneUnitTex);
20
20
  while (propositions.length < n) {
21
21
  const coeff = (0, randint_1.randint)(2, 10);
22
22
  (0, exercise_1.tryToAddWrongProp)(propositions, new multiplyNode_1.MultiplyNode(unitNode, coeff.toTree()).simplify().toTex());
@@ -62,8 +62,8 @@ const getKeys = (identifiers) => {
62
62
  };
63
63
  const isAnswerValid = (ans, { answer, abscissTex }) => {
64
64
  try {
65
- const answerNode = (0, latexParser_1.parseLatex)(ans);
66
- const node = (0, latexParser_1.parseLatex)(abscissTex);
65
+ const answerNode = (0, latexParser_1.parseAlgebraic)(ans);
66
+ const node = (0, latexParser_1.parseAlgebraic)(abscissTex);
67
67
  return Math.abs(node.evaluate({}) - answerNode.evaluate({})) < 0.00001;
68
68
  }
69
69
  catch (err) {
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=choseMethodToCalculateLength.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choseMethodToCalculateLength.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/choseMethodToCalculateLength.ts"],"names":[],"mappings":""}
@@ -0,0 +1,79 @@
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
+ // type Identifiers = {
20
+ // type: "pythagore" | "thalès" | "trigo";
21
+ // };
22
+ // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
23
+ // const propositions: Proposition[] = [];
24
+ // addValidProp(propositions, answer, "raw");
25
+ // tryToAddWrongProp(propositions, "Le théorème de Pythagore", "raw");
26
+ // tryToAddWrongProp(propositions, "Le théorème de Thalès", "raw");
27
+ // tryToAddWrongProp(propositions, "La trigonométrie", "raw");
28
+ // return shuffleProps(propositions, n);
29
+ // };
30
+ // const getAnswer: GetAnswer<Identifiers> = (identifiers) => {
31
+ // switch (identifiers.type) {
32
+ // case "pythagore":
33
+ // return "Le théorème de Pythagore";
34
+ // case "thalès":
35
+ // return "Le théorème de Thalès";
36
+ // case "trigo":
37
+ // return "La trigonométrie";
38
+ // }
39
+ // };
40
+ // const getInstruction: GetInstruction<Identifiers> = (identifiers) => {};
41
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
42
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
43
+ // const getKeys: GetKeys<Identifiers> = (identifiers) => {
44
+ // return [];
45
+ // };
46
+ // const isAnswerValid: VEA<Identifiers> = (ans, { answer }) => {
47
+ // throw Error("VEA not implemented");
48
+ // };
49
+ // const getChoseMethodToCalculateLengthQuestion: QuestionGenerator<
50
+ // Identifiers
51
+ // > = () => {
52
+ // const identifiers: Identifiers = {};
53
+ // const question: Question<Identifiers> = {
54
+ // answer: getAnswer(identifiers),
55
+ // instruction: getInstruction(identifiers),
56
+ // keys: getKeys(identifiers),
57
+ // answerFormat: "tex",
58
+ // identifiers,
59
+ // hint: getHint(identifiers),
60
+ // correction: getCorrection(identifiers),
61
+ // };
62
+ // return question;
63
+ // };
64
+ // export const choseMethodToCalculateLength: Exercise<Identifiers> = {
65
+ // id: "choseMethodToCalculateLength",
66
+ // connector: "",
67
+ // label: undefined,
68
+ // isSingleStep: true,
69
+ // generator: (nb: number) =>
70
+ // getDistinctQuestions(getChoseMethodToCalculateLengthQuestion, nb),
71
+ // qcmTimer: 60,
72
+ // freeTimer: 60,
73
+ // getPropositions,
74
+ // isAnswerValid,
75
+ // subject: "Mathématiques",
76
+ // getHint,
77
+ // getCorrection,
78
+ // getAnswer,
79
+ // };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -25,3 +25,4 @@ __exportStar(require("./volumes"), exports);
25
25
  // export * from "./triangles";
26
26
  __exportStar(require("./euclidianConstructions"), exports);
27
27
  __exportStar(require("./shapes"), exports);
28
+ // export * from "./euclidian";
@@ -1,3 +1,4 @@
1
1
  export * from "./pythagore";
2
2
  export * from "./pythagoreCalcul";
3
+ export * from "./isTriangleRight";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./pythagore"), exports);
18
18
  __exportStar(require("./pythagoreCalcul"), exports);
19
+ __exportStar(require("./isTriangleRight"), exports);
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ type Identifiers = {
3
+ isRight: boolean;
4
+ a: number;
5
+ b: number;
6
+ c: number;
7
+ vertices: string[];
8
+ };
9
+ export declare const isTriangleRight: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=isTriangleRight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isTriangleRight.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/isTriangleRight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAyGF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAiBjD,CAAC"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTriangleRight = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const pythagoricianTriplets_1 = require("../../../../math/utils/geometry/pythagoricianTriplets");
7
+ const round_1 = require("../../../../math/utils/round");
8
+ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
9
+ const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
10
+ const coinFlip_1 = require("../../../../utils/alea/coinFlip");
11
+ const random_1 = require("../../../../utils/alea/random");
12
+ const doWhile_1 = require("../../../../utils/doWhile");
13
+ const alignTex_1 = require("../../../../utils/latex/alignTex");
14
+ const randomLetter_1 = require("../../../../utils/strings/randomLetter");
15
+ const getPropositions = (n, { answer }) => {
16
+ const propositions = [];
17
+ (0, exercise_1.addValidProp)(propositions, answer, "raw");
18
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Oui", "raw");
19
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Non", "raw");
20
+ (0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir", "raw");
21
+ return (0, exercise_1.shuffleProps)(propositions, n);
22
+ };
23
+ const getAnswer = (identifiers) => {
24
+ return identifiers.isRight ? "Oui" : "Non";
25
+ };
26
+ const getInstruction = (identifiers) => {
27
+ const triangleName = identifiers.vertices.join("");
28
+ const sides = identifiers.vertices.map((vertex, index) => vertex + identifiers.vertices[(index + 1) % 3]);
29
+ return `Soit $${triangleName}$ un triangle avec $${sides[0]} = ${identifiers.a.frenchify()}$, $${sides[1]} = ${identifiers.b.frenchify()}$ et $${sides[2]} = ${identifiers.c.frenchify()}$. Le triangle $${triangleName}$ est-il rectangle ?`;
30
+ };
31
+ const getHint = (identifiers) => {
32
+ return `Si la somme des carrés des côtés est égale au carré de l'hypoténuse, alors le triangle est rectangle, d'après la réciproque du théorème de Pythagore. Si ce n'est pas le cas, alors le triangle n'est pas rectangle, d'après le théorème de Pythagore. L'hypoténuse est toujours le côté le plus grand dans un triangle.`;
33
+ };
34
+ const getCorrection = (identifiers) => {
35
+ const hypo = Math.max(identifiers.a, identifiers.b, identifiers.c);
36
+ const sides = [identifiers.a, identifiers.b, identifiers.c].filter((e) => e !== hypo);
37
+ return `La somme des carrés des côtés est égale à :
38
+
39
+ ${(0, alignTex_1.alignTex)([
40
+ [
41
+ new addNode_1.AddNode(new powerNode_1.SquareNode(sides[0].toTree()), new powerNode_1.SquareNode(sides[1].toTree())).toTex(),
42
+ "=",
43
+ (0, round_1.round)(sides[0] ** 2, 6).frenchify() +
44
+ "+" +
45
+ (0, round_1.round)(sides[1] ** 2, 6).frenchify(),
46
+ ],
47
+ ["", "=", (0, round_1.round)(sides[0] ** 2 + sides[1] ** 2, 6).frenchify()],
48
+ ])}
49
+
50
+ Le carré de l'hypoténuse vaut :
51
+
52
+ $$
53
+ ${new powerNode_1.SquareNode(hypo.toTree()).toTex()} = ${(0, round_1.round)(hypo ** 2, 6).frenchify()}
54
+ $$
55
+
56
+ ${identifiers.isRight
57
+ ? "La somme des carrés des côtés est donc égale au carré de l'hypoténuse. D'après la réciproque du théorème de Pythagore, le triangle est donc rectangle."
58
+ : "La somme des carrés des côtés n'est donc pas égale au carré de l'hypoténuse. D'après le théorème de Pythagore, le triangle n'est donc pas rectangle."}`;
59
+ };
60
+ const getKeys = (identifiers) => {
61
+ return [];
62
+ };
63
+ const isAnswerValid = (ans, { answer }) => {
64
+ throw Error("VEA not implemented");
65
+ };
66
+ const getIsTriangleRightQuestion = () => {
67
+ const isRight = (0, coinFlip_1.coinFlip)();
68
+ const startVertix = (0, randomLetter_1.randomLetter)(true, ["Y", "Z"]);
69
+ const vertices = [
70
+ startVertix,
71
+ String.fromCharCode(startVertix.charCodeAt(0) + 1),
72
+ String.fromCharCode(startVertix.charCodeAt(0) + 2),
73
+ ];
74
+ const triplet = (0, random_1.random)(pythagoricianTriplets_1.pythagoricianTriplets);
75
+ const coeff = (0, random_1.random)([1, 2, 3, 4, 0.1, 0.2, 0.4, 0.5]);
76
+ let [a, b, c] = triplet.map((e) => (0, round_1.round)(e * coeff, 4));
77
+ if (!isRight) {
78
+ c = (0, doWhile_1.doWhile)(() => (0, round_1.round)(coeff * (triplet[2] + (0, random_1.random)([-1, 1])), 4), (x) => x === a || x === b);
79
+ }
80
+ const identifiers = { isRight, vertices, a, b, c };
81
+ const question = {
82
+ answer: getAnswer(identifiers),
83
+ instruction: getInstruction(identifiers),
84
+ keys: getKeys(identifiers),
85
+ answerFormat: "tex",
86
+ identifiers,
87
+ hint: getHint(identifiers),
88
+ correction: getCorrection(identifiers),
89
+ };
90
+ return question;
91
+ };
92
+ exports.isTriangleRight = {
93
+ id: "isTriangleRight",
94
+ connector: "\\iff",
95
+ label: "Déterminer si un triangle est rectangle via Pythagore",
96
+ isSingleStep: true,
97
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIsTriangleRightQuestion, nb),
98
+ qcmTimer: 60,
99
+ freeTimer: 60,
100
+ getPropositions,
101
+ isAnswerValid,
102
+ subject: "Mathématiques",
103
+ getHint,
104
+ getCorrection,
105
+ getAnswer,
106
+ hasHintAndCorrection: true,
107
+ answerType: "QCU",
108
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"scalarProductViaCos.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAyDF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
1
+ {"version":3,"file":"scalarProductViaCos.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAyDF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
@@ -3,18 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scalarProductViaCos = void 0;
4
4
  const exercise_1 = require("../../../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../../../exercises/utils/getDistinctQuestions");
6
- const remarkableValue_1 = require("../../../../../math/trigonometry/remarkableValue");
7
6
  const remarkableValues_1 = require("../../../../../math/trigonometry/remarkableValues");
8
7
  const randint_1 = require("../../../../../math/utils/random/randint");
9
8
  const numberNode_1 = require("../../../../../tree/nodes/numbers/numberNode");
10
9
  const multiplyNode_1 = require("../../../../../tree/nodes/operators/multiplyNode");
11
10
  const randomLetter_1 = require("../../../../../utils/strings/randomLetter");
12
11
  const shuffle_1 = require("../../../../../utils/alea/shuffle");
12
+ const random_1 = require("../../../../../utils/alea/random");
13
13
  //|u| |v| cos(u,v)
14
14
  const getScalarProductViaCosQuestion = () => {
15
15
  const AB = (0, randint_1.randint)(1, 10);
16
16
  const AC = (0, randint_1.randint)(1, 10);
17
- const trigo = remarkableValue_1.RemarkableValueConstructor.mainInterval();
17
+ const trigo = (0, random_1.random)(remarkableValues_1.mainTrigoValues);
18
18
  const answer = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(AB * AC), trigo.cos)
19
19
  .simplify()
20
20
  .toTex();
@@ -40,7 +40,7 @@ const getPropositions = (n, { answer, AB, AC, trigoPoint }) => {
40
40
  (0, exercise_1.tryToAddWrongProp)(propositions, new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(AB * AC), trigo.sin).simplify().toTex());
41
41
  const coeff = new numberNode_1.NumberNode(AB * AC);
42
42
  while (propositions.length < n) {
43
- const trigoValue = remarkableValue_1.RemarkableValueConstructor.mainInterval();
43
+ const trigoValue = (0, random_1.random)(remarkableValues_1.mainTrigoValues);
44
44
  (0, exercise_1.tryToAddWrongProp)(propositions, new multiplyNode_1.MultiplyNode(coeff, trigoValue.sin).simplify().toTex());
45
45
  }
46
46
  return (0, shuffle_1.shuffle)(propositions);
@@ -66,10 +66,10 @@ const getMatrixInversibilityDomainQuestion = () => {
66
66
  const getPropositions = (n, { answer, a, b, c, d }) => {
67
67
  const propositions = [];
68
68
  (0, exercise_1.addValidProp)(propositions, answer);
69
- const aTree = (0, latexParser_1.parseLatex)(a);
70
- const bTree = (0, latexParser_1.parseLatex)(b);
71
- const cTree = (0, latexParser_1.parseLatex)(c);
72
- const dTree = (0, latexParser_1.parseLatex)(d);
69
+ const aTree = (0, latexParser_1.parseAlgebraic)(a);
70
+ const bTree = (0, latexParser_1.parseAlgebraic)(b);
71
+ const cTree = (0, latexParser_1.parseAlgebraic)(c);
72
+ const dTree = (0, latexParser_1.parseAlgebraic)(d);
73
73
  const det = new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(aTree, dTree), new multiplyNode_1.MultiplyNode(bTree, cTree)).simplify();
74
74
  (0, exercise_1.tryToAddWrongProp)(propositions, unionIntervalNode_1.UnionIntervalNodeBuilder.realMinus(det).toTex());
75
75
  while (propositions.length < n) {
@@ -1 +1 @@
1
- {"version":3,"file":"reciprocalPercentage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/reciprocalPercentage.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAMxB,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAsFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
1
+ {"version":3,"file":"reciprocalPercentage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/reciprocalPercentage.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAST,MAAM,gBAAgB,CAAC;AAMxB,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AA2GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
@@ -8,27 +8,18 @@ const shuffle_1 = require("../../../utils/alea/shuffle");
8
8
  const coinFlip_1 = require("../../../utils/alea/coinFlip");
9
9
  const round_1 = require("../../../math/utils/round");
10
10
  const percentParser_1 = require("../../../tree/parsers/percentParser");
11
- const getReciprocalPercentageQuestion = () => {
12
- const randPercent = (0, randint_1.randint)(1, 50);
11
+ const getCorrection = (identifiers) => {
13
12
  let ans = 0;
14
- const isUp = (0, coinFlip_1.coinFlip)();
15
- let instruction = `Le prix d'un article subit une ${isUp ? "hausse" : "baisse"} de $${randPercent}\\%$. Quelle évolution devra-t-il subir pour revenir à son prix initial (arrondir au centième de pourcentage) ?`;
16
- ans = isUp
17
- ? (1 / (1 + randPercent / 100) - 1) * 100
18
- : (1 / (1 - randPercent / 100) - 1) * 100;
13
+ const { isUp, randPercent } = identifiers;
14
+ ans = identifiers.isUp
15
+ ? (1 / (1 + identifiers.randPercent / 100) - 1) * 100
16
+ : (1 / (1 - identifiers.randPercent / 100) - 1) * 100;
19
17
  const answer = `${(ans > 0
20
18
  ? "+" + (0, round_1.round)(ans, 2)
21
19
  : "" + (0, round_1.round)(ans, 2)).replace(".", ",")}\\%`;
22
- const cm = (0, round_1.round)(1 + (isUp ? randPercent / 100 : -randPercent / 100), 4);
20
+ const cm = (0, round_1.round)(1 + (identifiers.isUp ? identifiers.randPercent / 100 : -randPercent / 100), 4);
23
21
  const recipCm = (0, round_1.round)(1 / cm, 4);
24
- const question = {
25
- instruction,
26
- answer,
27
- keys: ["percent"],
28
- answerFormat: "tex",
29
- identifiers: { isUp, randPercent },
30
- hint: `Calcule le coefficient multiplicateur associé à une ${isUp ? "hausse" : "baisse"} de $${randPercent}\\%$. Puis, calcule le coefficient multiplicateur réciproque : c'est l'inverse du coefficient multiplicateur. Il ne reste alors plus qu'à transformer le coefficient multiplicateur réciproque en taux d'évolution.`,
31
- correction: `Le coefficient multiplicateur correspondant à une ${isUp ? "hausse" : "baisse"} de $${randPercent}\\%$ est :
22
+ return `Le coefficient multiplicateur correspondant à une ${isUp ? "hausse" : "baisse"} de $${randPercent}\\%$ est :
32
23
 
33
24
  $$
34
25
  1${isUp ? "+" : "-"}\\frac{${randPercent}}{100} = ${cm.frenchify()}
@@ -47,7 +38,30 @@ $$
47
38
  $$
48
39
 
49
40
  Ainsi, le taux d'évolution permettant de revenir au prix initial est de $${answer}$.
50
- `,
41
+ `;
42
+ };
43
+ const getReciprocalPercentageQuestion = () => {
44
+ const randPercent = (0, randint_1.randint)(1, 50);
45
+ let ans = 0;
46
+ const isUp = (0, coinFlip_1.coinFlip)();
47
+ let instruction = `Le prix d'un article subit une ${isUp ? "hausse" : "baisse"} de $${randPercent}\\%$. Quelle évolution devra-t-il subir pour revenir à son prix initial (arrondir au centième de pourcentage) ?`;
48
+ ans = isUp
49
+ ? (1 / (1 + randPercent / 100) - 1) * 100
50
+ : (1 / (1 - randPercent / 100) - 1) * 100;
51
+ const answer = `${(ans > 0
52
+ ? "+" + (0, round_1.round)(ans, 2)
53
+ : "" + (0, round_1.round)(ans, 2)).replace(".", ",")}\\%`;
54
+ const cm = (0, round_1.round)(1 + (isUp ? randPercent / 100 : -randPercent / 100), 4);
55
+ const recipCm = (0, round_1.round)(1 / cm, 4);
56
+ const identifiers = { isUp, randPercent };
57
+ const question = {
58
+ instruction,
59
+ answer,
60
+ keys: ["percent"],
61
+ answerFormat: "tex",
62
+ identifiers: { isUp, randPercent },
63
+ hint: `Calcule le coefficient multiplicateur associé à une ${isUp ? "hausse" : "baisse"} de $${randPercent}\\%$. Puis, calcule le coefficient multiplicateur réciproque : c'est l'inverse du coefficient multiplicateur. Il ne reste alors plus qu'à transformer le coefficient multiplicateur réciproque en taux d'évolution.`,
64
+ correction: getCorrection(identifiers),
51
65
  };
52
66
  return question;
53
67
  };
@@ -82,4 +96,5 @@ exports.reciprocalPercentage = {
82
96
  isAnswerValid,
83
97
  subject: "Mathématiques",
84
98
  hasHintAndCorrection: true,
99
+ getCorrection,
85
100
  };
@@ -1 +1 @@
1
- {"version":3,"file":"equationCosOnRandomInterval.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/equationCosOnRandomInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAqBlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AA6HF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAgB7D,CAAC"}
1
+ {"version":3,"file":"equationCosOnRandomInterval.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/equationCosOnRandomInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAmBlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AA6HF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAgB7D,CAAC"}
@@ -56,7 +56,7 @@ const getKeys = (identifiers) => {
56
56
  const isAnswerValid = (ans, { answer, degree }) => {
57
57
  const value = remarkableValues_1.mainTrigoValues.find((e) => e.degree === degree);
58
58
  try {
59
- const parsed = (0, latexParser_1.parseLatex)(ans);
59
+ const parsed = (0, latexParser_1.parseAlgebraic)(ans);
60
60
  const simplified = parsed.simplify().toTex();
61
61
  return simplified === answer;
62
62
  // return value.angle.toAllValidTexs().includes(ans);
package/lib/index.d.ts CHANGED
@@ -915,6 +915,12 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
915
915
  }, {}> | import("./exercises/exercise").Exercise<{
916
916
  square: number;
917
917
  sideLengths: number[];
918
+ }, {}> | import("./exercises/exercise").Exercise<{
919
+ isRight: boolean;
920
+ a: number;
921
+ b: number;
922
+ c: number;
923
+ vertices: string[];
918
924
  }, {}> | import("./exercises/exercise").Exercise<{
919
925
  vertices: string[];
920
926
  }, {}> | import("./exercises/exercise").Exercise<{