math-exercises 2.2.32 → 2.2.34

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 (65) hide show
  1. package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +18 -8
  4. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +18 -10
  6. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts +2 -0
  7. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
  8. package/lib/exercises/math/functions/affines/affineAdjustment.js +16 -8
  9. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts +2 -0
  10. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
  11. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +7 -6
  12. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts +2 -0
  13. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -1
  14. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +7 -6
  15. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
  16. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +19 -7
  17. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
  18. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +3 -1
  19. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.d.ts.map +1 -1
  20. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.js +2 -6
  21. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.d.ts.map +1 -1
  22. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.js +2 -6
  23. package/lib/exercises/math/percent/globalPercent.d.ts.map +1 -1
  24. package/lib/exercises/math/percent/globalPercent.js +3 -4
  25. package/lib/exercises/math/percent/isTableProportional.d.ts +4 -1
  26. package/lib/exercises/math/percent/isTableProportional.d.ts.map +1 -1
  27. package/lib/exercises/math/percent/isTableProportional.js +13 -9
  28. package/lib/exercises/math/percent/populationEffectifFromSubPopulation.d.ts.map +1 -1
  29. package/lib/exercises/math/percent/populationEffectifFromSubPopulation.js +9 -3
  30. package/lib/exercises/math/percent/reciprocalPercentage.d.ts.map +1 -1
  31. package/lib/exercises/math/percent/reciprocalPercentage.js +3 -4
  32. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  33. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +35 -18
  34. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  35. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +26 -18
  36. package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
  37. package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +17 -9
  38. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  39. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +81 -38
  40. package/lib/exercises/math/probaStat/stats1var/median.d.ts +1 -0
  41. package/lib/exercises/math/probaStat/stats1var/median.d.ts.map +1 -1
  42. package/lib/exercises/math/probaStat/stats1var/median.js +16 -8
  43. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  44. package/lib/exercises/math/probaStat/stats1var/quartiles.js +16 -24
  45. package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
  46. package/lib/exercises/math/probaStat/stats2var/averagePoint.js +18 -10
  47. package/lib/exercises/math/trigonometry/equationCosOnRandomInterval.d.ts +8 -0
  48. package/lib/exercises/math/trigonometry/equationCosOnRandomInterval.d.ts.map +1 -0
  49. package/lib/exercises/math/trigonometry/equationCosOnRandomInterval.js +104 -0
  50. package/lib/exercises/math/trigonometry/equationSinOnRandomInterval.d.ts +8 -0
  51. package/lib/exercises/math/trigonometry/equationSinOnRandomInterval.d.ts.map +1 -0
  52. package/lib/exercises/math/trigonometry/equationSinOnRandomInterval.js +104 -0
  53. package/lib/exercises/math/trigonometry/index.js +1 -0
  54. package/lib/index.d.ts +11 -1
  55. package/lib/index.d.ts.map +1 -1
  56. package/lib/math/trigonometry/remarkableValues.d.ts +10 -0
  57. package/lib/math/trigonometry/remarkableValues.d.ts.map +1 -1
  58. package/lib/math/trigonometry/remarkableValues.js +12 -1
  59. package/lib/utils/latex/dollarize.d.ts +2 -0
  60. package/lib/utils/latex/dollarize.d.ts.map +1 -0
  61. package/lib/utils/latex/dollarize.js +7 -0
  62. package/lib/utils/markdown/mdTable.d.ts +2 -0
  63. package/lib/utils/markdown/mdTable.d.ts.map +1 -0
  64. package/lib/utils/markdown/mdTable.js +17 -0
  65. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAST,MAAM,mBAAmB,CAAC;AAsD3B,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAsDF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAa9C,CAAC"}
1
+ {"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAST,MAAM,mBAAmB,CAAC;AAoD3B,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAsDF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAa9C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAMlC,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;AAmEF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
1
+ {"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAQlC,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;AA0EF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
@@ -6,6 +6,18 @@ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQ
6
6
  const integer_1 = require("../../../../math/numbers/integer/integer");
7
7
  const randint_1 = require("../../../../math/utils/random/randint");
8
8
  const shuffle_1 = require("../../../../utils/alea/shuffle");
9
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
10
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
11
+ const getInstruction = ({ x1, x2, x3, x4 }) => {
12
+ return `On considère le tableau de proportionnalité suivant :
13
+
14
+ ${(0, mdTable_1.mdTable)([
15
+ [(0, dollarize_1.dollarize)(x1), (0, dollarize_1.dollarize)(x3)],
16
+ [(0, dollarize_1.dollarize)(x2), (0, dollarize_1.dollarize)(x4)],
17
+ ])}
18
+
19
+ Déterminer le nombre manquant.`;
20
+ };
9
21
  const getProportionalityTable = () => {
10
22
  const fact = (0, randint_1.randint)(2, 10);
11
23
  let [x1, x2] = integer_1.IntegerConstructor.randomDifferents(1, 100 / fact, 2);
@@ -30,19 +42,16 @@ const getProportionalityTable = () => {
30
42
  x4 = "?";
31
43
  break;
32
44
  }
45
+ const identifiers = { x1, x2, x3, x4, randQuation };
33
46
  const question = {
34
- instruction: `On considère le tableau de proportionnalité suivant :
35
-
36
- | | |
37
- |-|-|
38
- |${x1}|${x3}|
39
- |${x2}|${x4}|
40
-
41
- Déterminer le nombre manquant.`,
47
+ instruction: getInstruction(identifiers),
42
48
  answer: answer,
43
49
  keys: [],
44
50
  answerFormat: "tex",
45
51
  identifiers: { randQuation, x1, x2, x3, x4 },
52
+ style: {
53
+ tableHasNoHeader: true,
54
+ },
46
55
  };
47
56
  return question;
48
57
  };
@@ -70,4 +79,5 @@ exports.proportionalityTable = {
70
79
  getPropositions,
71
80
  isAnswerValid,
72
81
  subject: "Mathématiques",
82
+ getInstruction,
73
83
  };
@@ -1 +1 @@
1
- {"version":3,"file":"proportionalityTableCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTableCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAoDF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAcjE,CAAC"}
1
+ {"version":3,"file":"proportionalityTableCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTableCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAQlC,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"}
@@ -6,25 +6,32 @@ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQ
6
6
  const integer_1 = require("../../../../math/numbers/integer/integer");
7
7
  const randint_1 = require("../../../../math/utils/random/randint");
8
8
  const shuffle_1 = require("../../../../utils/alea/shuffle");
9
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
10
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
11
+ const getInstruction = ({ xValues, yValues }) => {
12
+ let dataTable = (0, mdTable_1.mdTable)([
13
+ xValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify())),
14
+ yValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify())),
15
+ ]);
16
+ return `On considère le tableau de proportionnalité suivant :
17
+
18
+ ${dataTable}
19
+
20
+ Calculer le coefficient de proportionnalité.`;
21
+ };
9
22
  const getProportionalityTableCoefficient = () => {
10
23
  const factor = (0, randint_1.randint)(2, 15);
11
24
  const xValues = integer_1.IntegerConstructor.randomDifferents(1, 100 / factor, 3).sort((a, b) => a - b);
12
25
  const yValues = xValues.map((x) => x * factor);
13
- let dataTable = `
14
- | ${xValues.join(" | ")} |
15
- |-|-|-|
16
- | ${yValues.map((n) => n.frenchify()).join(" | ")} |
17
- `;
18
- const instruction = `On considère le tableau de proportionnalité suivant : ${dataTable}
19
-
20
- \n Calculer le coefficient de proportionnalité.`;
21
26
  const answer = factor.toTree().toTex();
27
+ const identifiers = { xValues, yValues };
22
28
  const question = {
23
- instruction,
29
+ instruction: getInstruction(identifiers),
24
30
  answer,
25
31
  keys: [],
26
32
  answerFormat: "tex",
27
- identifiers: { xValues, yValues },
33
+ identifiers,
34
+ style: { tableHasNoHeader: true },
28
35
  };
29
36
  return question;
30
37
  };
@@ -52,4 +59,5 @@ exports.proportionalityTableCoefficient = {
52
59
  getPropositions,
53
60
  isAnswerValid,
54
61
  subject: "Mathématiques",
62
+ getInstruction,
55
63
  };
@@ -4,6 +4,8 @@ type Identifiers = {
4
4
  G2x: number;
5
5
  G2y: number;
6
6
  G1y: number;
7
+ xValues: number[];
8
+ yValues: number[];
7
9
  };
8
10
  export declare const affineAdjustmentExercise: Exercise<Identifiers>;
9
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"affineAdjustment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAuJF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
1
+ {"version":3,"file":"affineAdjustment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA2JF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAe1D,CAAC"}
@@ -11,6 +11,18 @@ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
11
11
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
12
  const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
13
13
  const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
14
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
15
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
16
+ const getInstruction = ({ xValues, yValues }) => {
17
+ let dataTable = (0, mdTable_1.mdTable)([
18
+ ["$x$", ...xValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify()))],
19
+ ["$y$", ...yValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify()))],
20
+ ]);
21
+ return `On considère la série statistique ci-dessous. Déterminez l'équation de la droite d'ajustement obtenue par la méthode des moindres carrés.
22
+
23
+ ${dataTable}
24
+ `;
25
+ };
14
26
  function generateLinearData(n) {
15
27
  const slope = (0, randint_1.randint)(-500, 500, [0]) / 100;
16
28
  const intercept = (0, randint_1.randint)(100, 5000) / 100;
@@ -41,18 +53,13 @@ const getAffineAdjustmentQuestion = () => {
41
53
  const b = G2y - a * G2x;
42
54
  const bfixed = (0, round_1.round)(b, 1);
43
55
  const answer = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true })).toTex();
44
- let dataTable = `
45
- | $x$ | ${xValues.map((n) => n.frenchify()).join(" | ")} |
46
- |-|-|-|-|-|-|-|
47
- | $y$ | ${yValues.map((n) => n.frenchify()).join(" | ")} |
48
- `;
56
+ const identifiers = { G1x, G2x, G1y, G2y, xValues, yValues };
49
57
  const question = {
50
58
  answer: answer,
51
- instruction: `On considère la série statistique ci-dessous. Déterminez l'équation de la droite d'ajustement obtenue par la méthode des moindres carrés. ${dataTable}
52
- `,
59
+ instruction: getInstruction(identifiers),
53
60
  keys: ["equal", "y", "x", "a", "b"],
54
61
  answerFormat: "tex",
55
- identifiers: { G1x, G2x, G1y, G2y },
62
+ identifiers,
56
63
  style: { tableHasNoHeader: true },
57
64
  };
58
65
  return question;
@@ -103,4 +110,5 @@ exports.affineAdjustmentExercise = {
103
110
  getPropositions,
104
111
  isAnswerValid,
105
112
  subject: "Mathématiques",
113
+ getInstruction,
106
114
  };
@@ -5,6 +5,8 @@ type Identifiers = {
5
5
  G2y: number;
6
6
  G1y: number;
7
7
  rSquared: number;
8
+ xValues: number[];
9
+ yValues: number[];
8
10
  };
9
11
  export declare const affineAdjustmentCompleteExercise: Exercise<Identifiers>;
10
12
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"affineAdjustmentComplete.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustmentComplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAqLF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAelE,CAAC"}
1
+ {"version":3,"file":"affineAdjustmentComplete.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustmentComplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAmLF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAelE,CAAC"}
@@ -12,6 +12,8 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
12
  const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
13
13
  const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
14
14
  const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
15
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
16
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
15
17
  function generateLinearData(n) {
16
18
  const slope = (0, randint_1.randint)(-500, 500, [0]) / 100;
17
19
  const intercept = (0, randint_1.randint)(100, 5000) / 100;
@@ -58,18 +60,17 @@ const getAffineAdjustmentCompleteQuestion = () => {
58
60
  const bfixed = (0, round_1.round)(b, 1);
59
61
  const answerEq = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true })).toTex();
60
62
  const answerR = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), rSquared.toTree()).toTex();
61
- let dataTable = `
62
- | $x$ | ${xValues.join(" | ")} |
63
- |-|-|-|-|-|-|-|
64
- | $y$ | ${yValues.map((n) => n.frenchify()).join(" | ")} |
65
- `;
63
+ let dataTable = (0, mdTable_1.mdTable)([
64
+ ["$x$", ...xValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify()))],
65
+ ["$y$", ...yValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify()))],
66
+ ]);
66
67
  const question = {
67
68
  answer: `${answerEq}\\newline ${answerR}`,
68
69
  instruction: `On considère la série statistique ci-dessous. A l'aide de la calculatrice, déterminer l'équation de la droite d'ajustement et la valeur du coefficient de détermination. Arrondir au centième. ${dataTable}
69
70
  `,
70
71
  keys: [],
71
72
  answerFormat: "tex",
72
- identifiers: { G1x, G2x, G1y, G2y, rSquared },
73
+ identifiers: { G1x, G2x, G1y, G2y, rSquared, xValues, yValues },
73
74
  style: { tableHasNoHeader: true },
74
75
  };
75
76
  return question;
@@ -1,6 +1,8 @@
1
1
  import { Exercise } from "../../../../exercises/exercise";
2
2
  type Identifiers = {
3
3
  rSquared: number;
4
+ xValues: number[];
5
+ yValues: number[];
4
6
  };
5
7
  export declare const affineAdjustmentRsquaredExercise: Exercise<Identifiers>;
6
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"affineAdjustmentRsquared.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustmentRsquared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA6HF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAclE,CAAC"}
1
+ {"version":3,"file":"affineAdjustmentRsquared.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustmentRsquared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA2HF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAclE,CAAC"}
@@ -9,6 +9,8 @@ const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
9
9
  const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
10
10
  const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
11
11
  const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
12
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
13
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
12
14
  function generateLinearData(n) {
13
15
  const slope = (0, randint_1.randint)(-500, 500, [0]) / 100;
14
16
  const intercept = (0, randint_1.randint)(100, 5000) / 100;
@@ -46,18 +48,17 @@ const getAffineAdjustmentRsquaredQuestion = () => {
46
48
  const yValues = data.map((point) => (0, round_1.round)(point.y, 1));
47
49
  const rSquared = calculateRSquared(xValues, yValues);
48
50
  const answer = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), rSquared.toTree()).toTex();
49
- let dataTable = `
50
- | $x$ | ${xValues.join(" | ")} |
51
- |-|-|-|-|-|-|-|
52
- | $y$ | ${yValues.map((n) => n.frenchify()).join(" | ")} |
53
- `;
51
+ let dataTable = (0, mdTable_1.mdTable)([
52
+ ["$x$", ...xValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify()))],
53
+ ["$y$", ...yValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify()))],
54
+ ]);
54
55
  const question = {
55
56
  answer: answer,
56
57
  instruction: `On considère la série statistique ci-dessous. Déterminez la valeur du coefficient de détermination. ${dataTable}
57
58
  `,
58
59
  keys: ["R", "equal"],
59
60
  answerFormat: "tex",
60
- identifiers: { rSquared },
61
+ identifiers: { rSquared, xValues, yValues },
61
62
  style: { tableHasNoHeader: true },
62
63
  };
63
64
  return question;
@@ -1 +1 @@
1
- {"version":3,"file":"inverseImageFunctionTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAgFF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
1
+ {"version":3,"file":"inverseImageFunctionTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA8FF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAe3D,CAAC"}
@@ -8,6 +8,17 @@ const randint_1 = require("../../../../math/utils/random/randint");
8
8
  const arrayHasSameElement_1 = require("../../../../utils/arrays/arrayHasSameElement");
9
9
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
10
10
  const random_1 = require("../../../../utils/alea/random");
11
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
12
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
13
+ const getInstruction = ({ imageValues, isAskingImage, value, xValues, }) => {
14
+ return `Ci-dessous est donné le tableau de valeurs d'une fonction $f$. Déterminer ${isAskingImage ? `l'image de` : `le ou les antécédents de`} $${value}$ par $f$.
15
+
16
+ ${(0, mdTable_1.mdTable)([
17
+ ["$x$", ...xValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify()))],
18
+ ["$f(x)$", ...imageValues.map((n) => (0, dollarize_1.dollarize)(n.frenchify()))],
19
+ ])}
20
+ `;
21
+ };
11
22
  const getInverseImageFunctionTableQuestion = () => {
12
23
  const xValues = (0, randTupleInt_1.randTupleInt)(5, {
13
24
  from: -10,
@@ -27,15 +38,15 @@ const getInverseImageFunctionTableQuestion = () => {
27
38
  : xValues
28
39
  .filter((el, index) => yValues[index] === valueAsked)
29
40
  .join("\\text{ et }")) + "";
30
- const instruction = `Ci-dessous est donné le tableau de valeurs d'une fonction $f$. Déterminer ${isAskingImage ? `l'image de` : `le ou les antécédents de`} $${valueAsked}$ par $f$.
31
-
32
- |$x$|${xValues.map((value) => `$${value}$`).join("|")}|
33
- |-|-|-|-|-|-|
34
- |$f(x)$|${yValues.map((value) => `$${value}$`).join("|")}|
35
- `;
41
+ const identifiers = {
42
+ xValues,
43
+ imageValues: yValues,
44
+ isAskingImage,
45
+ value: valueAsked,
46
+ };
36
47
  const question = {
37
48
  answer,
38
- instruction,
49
+ instruction: getInstruction(identifiers),
39
50
  keys: ["et"],
40
51
  answerFormat: "tex",
41
52
  style: { tableHasNoHeader: true },
@@ -81,4 +92,5 @@ exports.inverseImageFunctionTable = {
81
92
  getPropositions,
82
93
  isAnswerValid,
83
94
  subject: "Mathématiques",
95
+ getInstruction,
84
96
  };
@@ -1 +1 @@
1
- {"version":3,"file":"cartesianEquationOfLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/cartesianEquationOfLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAclC,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;AAgOF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
1
+ {"version":3,"file":"cartesianEquationOfLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/cartesianEquationOfLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAclC,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;AAqOF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
@@ -114,7 +114,9 @@ const isValidFormat = (ans) => {
114
114
  if (!ans.includes("="))
115
115
  return false;
116
116
  const splitted = ans.split("=");
117
- if (splitted.length !== 2 || splitted[1] !== "0")
117
+ if (splitted.length !== 2 ||
118
+ splitted[1] !== "0" ||
119
+ (!splitted[0].includes("x") && !splitted[0].includes("y")))
118
120
  return false;
119
121
  return true;
120
122
  };
@@ -1 +1 @@
1
- {"version":3,"file":"readAbscissOnLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/readAbscissOnLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAUvD,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA2JF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
1
+ {"version":3,"file":"readAbscissOnLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/readAbscissOnLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAWvD,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAuJF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
@@ -61,13 +61,9 @@ const getKeys = (identifiers) => {
61
61
  };
62
62
  const isAnswerValid = (ans, { answer, abscissTex }) => {
63
63
  try {
64
+ const answerNode = (0, latexParser_1.parseLatex)(ans);
64
65
  const node = (0, latexParser_1.parseLatex)(abscissTex);
65
- return node
66
- .toAllValidTexs({
67
- allowFractionToDecimal: true,
68
- allowMinusAnywhereInFraction: true,
69
- })
70
- .includes(ans);
66
+ return Math.abs(node.evaluate({}) - answerNode.evaluate({})) < 0.00001;
71
67
  }
72
68
  catch (err) {
73
69
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"readAbscissOnSemiLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/readAbscissOnSemiLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAUvD,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA4JF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
1
+ {"version":3,"file":"readAbscissOnSemiLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/readAbscissOnSemiLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAUvD,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwJF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
@@ -62,13 +62,9 @@ const getKeys = (identifiers) => {
62
62
  };
63
63
  const isAnswerValid = (ans, { answer, abscissTex }) => {
64
64
  try {
65
+ const answerNode = (0, latexParser_1.parseLatex)(ans);
65
66
  const node = (0, latexParser_1.parseLatex)(abscissTex);
66
- return node
67
- .toAllValidTexs({
68
- allowFractionToDecimal: true,
69
- allowMinusAnywhereInFraction: true,
70
- })
71
- .includes(ans);
67
+ return Math.abs(node.evaluate({}) - answerNode.evaluate({})) < 0.00001;
72
68
  }
73
69
  catch (err) {
74
70
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"globalPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/globalPercent.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAMxB,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAyFF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAe/C,CAAC"}
1
+ {"version":3,"file":"globalPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/globalPercent.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAOxB,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAwFF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAe/C,CAAC"}
@@ -6,6 +6,7 @@ const exercise_1 = require("../../exercise");
6
6
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
7
7
  const shuffle_1 = require("../../../utils/alea/shuffle");
8
8
  const round_1 = require("../../../math/utils/round");
9
+ const percentParser_1 = require("../../../tree/parsers/percentParser");
9
10
  const getGlobalPercentQuestion = () => {
10
11
  const tab = ["hausse", "baisse"];
11
12
  let ans = 1;
@@ -66,10 +67,8 @@ const getPropositions = (n, { answer }) => {
66
67
  return (0, shuffle_1.shuffle)(propositions);
67
68
  };
68
69
  const isAnswerValid = (ans, { answer }) => {
69
- const allowedTex = [answer];
70
- if (answer[0] !== "-")
71
- allowedTex.push("+" + answer);
72
- return allowedTex.includes(ans);
70
+ const parsed = (0, percentParser_1.percentParser)(ans);
71
+ return parsed === answer.replace("+", "");
73
72
  };
74
73
  exports.globalPercent = {
75
74
  id: "globalPercent",
@@ -1,5 +1,8 @@
1
1
  import { Exercise } from "../../../exercises/exercise";
2
- type Identifiers = {};
2
+ type Identifiers = {
3
+ xValues: number[];
4
+ yValues: number[];
5
+ };
3
6
  export declare const isTableProportional: Exercise<Identifiers>;
4
7
  export {};
5
8
  //# sourceMappingURL=isTableProportional.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isTableProportional.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/isTableProportional.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG,EAAE,CAAC;AA8DtB,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAerD,CAAC"}
1
+ {"version":3,"file":"isTableProportional.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/isTableProportional.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AA+D5D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAgBrD,CAAC"}
@@ -6,6 +6,15 @@ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQues
6
6
  const randTupleInt_1 = require("../../../math/utils/random/randTupleInt");
7
7
  const randint_1 = require("../../../math/utils/random/randint");
8
8
  const coinFlip_1 = require("../../../utils/alea/coinFlip");
9
+ const dollarize_1 = require("../../../utils/latex/dollarize");
10
+ const mdTable_1 = require("../../../utils/markdown/mdTable");
11
+ const getInstruction = ({ xValues, yValues }) => {
12
+ return `Le tableau ci-dessous est-il un tableau de proportionnalité ?
13
+
14
+ ${(0, mdTable_1.mdTable)([xValues.map((v) => (0, dollarize_1.dollarize)(v)), yValues.map((v) => (0, dollarize_1.dollarize)(v))])}
15
+
16
+ `;
17
+ };
9
18
  const getIsTableProportionalQuestion = () => {
10
19
  const xValues = (0, randTupleInt_1.randTupleInt)(3, {
11
20
  from: 1,
@@ -17,20 +26,14 @@ const getIsTableProportionalQuestion = () => {
17
26
  const yValues = isProportionnal
18
27
  ? xValues.map((value) => value * coeff)
19
28
  : xValues.map((value) => value * (0, randint_1.randint)(2, 5));
29
+ const identifiers = { xValues, yValues };
20
30
  const question = {
21
31
  answer: isProportionnal ? "Oui" : "Non",
22
- instruction: `On considère le tableau ci-dessous. Est-ce un tableau de proportionnalité
23
- |${xValues.map((value) => `$${value}$`).join("|")}|
24
- |-|-|-|
25
- |${yValues.map((value) => `$${value}$`).join("|")}|
26
- `,
32
+ instruction: getInstruction(identifiers),
27
33
  keys: [],
28
34
  answerFormat: "raw",
29
35
  style: { tableHasNoHeader: true },
30
- identifiers: {
31
- xValues,
32
- yValues,
33
- },
36
+ identifiers,
34
37
  hint: "Pour passer de la ligne du haut à la ligne du bas, multiplie-t-on toujours par le même nombre ? Si oui, alors c'est un tableau de proportionnalité.",
35
38
  correction: `On divise les nombres de la deuxième ligne par les nombres de la première ligne. Si on obtient toujours le même résultat, alors c'est un tableau de proportionnalité.
36
39
 
@@ -72,4 +75,5 @@ exports.isTableProportional = {
72
75
  answerType: "QCU",
73
76
  subject: "Mathématiques",
74
77
  hasHintAndCorrection: true,
78
+ getInstruction,
75
79
  };
@@ -1 +1 @@
1
- {"version":3,"file":"populationEffectifFromSubPopulation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/populationEffectifFromSubPopulation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA6IF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAiBrE,CAAC"}
1
+ {"version":3,"file":"populationEffectifFromSubPopulation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/populationEffectifFromSubPopulation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAgJF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAiBrE,CAAC"}
@@ -8,6 +8,7 @@ const randint_1 = require("../../../math/utils/random/randint");
8
8
  const round_1 = require("../../../math/utils/round");
9
9
  const numberParser_1 = require("../../../tree/parsers/numberParser");
10
10
  const coinFlip_1 = require("../../../utils/alea/coinFlip");
11
+ const mdTable_1 = require("../../../utils/markdown/mdTable");
11
12
  const getPropositions = (n, { answer, contextType, subPopulationEffectif, subPopulationPercent }) => {
12
13
  const propositions = [];
13
14
  (0, exercise_1.addValidProp)(propositions, answer);
@@ -51,9 +52,14 @@ const getCorrection = (identifiers) => {
51
52
 
52
53
  Pour cela, on peut faire un produit en croix :
53
54
 
54
- |$?$|$100\\%$|
55
- |-|-|
56
- |$${identifiers.subPopulationEffectif}$|$${identifiers.subPopulationPercent.frenchify()}\\%$|
55
+ ${(0, mdTable_1.mdTable)([
56
+ ["$?$", "$100\\%$"],
57
+ [
58
+ `$${identifiers.subPopulationEffectif}$`,
59
+ `$${identifiers.subPopulationPercent.frenchify()}\\%$`,
60
+ ],
61
+ ])}
62
+
57
63
 
58
64
  Pour trouver la valeur manquante, il faut donc faire le calcul suivant :
59
65
 
@@ -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;AAKxB,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAiFF,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,EAQT,MAAM,gBAAgB,CAAC;AAMxB,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAgFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
@@ -7,6 +7,7 @@ const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
7
7
  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
+ const percentParser_1 = require("../../../tree/parsers/percentParser");
10
11
  const getReciprocalPercentageQuestion = () => {
11
12
  const randPercent = (0, randint_1.randint)(1, 50);
12
13
  let ans = 0;
@@ -58,10 +59,8 @@ const getPropositions = (n, { answer }) => {
58
59
  return (0, shuffle_1.shuffle)(propositions);
59
60
  };
60
61
  const isAnswerValid = (ans, { answer }) => {
61
- const allowedTex = [answer];
62
- if (answer[0] === "+")
63
- allowedTex.push(answer.slice(1));
64
- return allowedTex.includes(ans);
62
+ const parsed = (0, percentParser_1.percentParser)(ans);
63
+ return parsed === answer.replace("+", "");
65
64
  };
66
65
  exports.reciprocalPercentage = {
67
66
  id: "reciprocalPercentage",
@@ -1 +1 @@
1
- {"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAmHF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
1
+ {"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAyIF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAgBzD,CAAC"}