math-exercises 2.2.33 → 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 (50) hide show
  1. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +18 -8
  3. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +18 -10
  5. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts +2 -0
  6. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
  7. package/lib/exercises/math/functions/affines/affineAdjustment.js +16 -8
  8. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts +2 -0
  9. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
  10. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +7 -6
  11. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts +2 -0
  12. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -1
  13. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +7 -6
  14. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
  15. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +19 -7
  16. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
  17. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +3 -1
  18. package/lib/exercises/math/percent/globalPercent.d.ts.map +1 -1
  19. package/lib/exercises/math/percent/globalPercent.js +3 -4
  20. package/lib/exercises/math/percent/isTableProportional.d.ts +4 -1
  21. package/lib/exercises/math/percent/isTableProportional.d.ts.map +1 -1
  22. package/lib/exercises/math/percent/isTableProportional.js +13 -9
  23. package/lib/exercises/math/percent/populationEffectifFromSubPopulation.d.ts.map +1 -1
  24. package/lib/exercises/math/percent/populationEffectifFromSubPopulation.js +9 -3
  25. package/lib/exercises/math/percent/reciprocalPercentage.d.ts.map +1 -1
  26. package/lib/exercises/math/percent/reciprocalPercentage.js +3 -4
  27. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  28. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +35 -18
  29. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  30. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +26 -18
  31. package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
  32. package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +17 -9
  33. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  34. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +81 -38
  35. package/lib/exercises/math/probaStat/stats1var/median.d.ts +1 -0
  36. package/lib/exercises/math/probaStat/stats1var/median.d.ts.map +1 -1
  37. package/lib/exercises/math/probaStat/stats1var/median.js +16 -8
  38. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  39. package/lib/exercises/math/probaStat/stats1var/quartiles.js +16 -24
  40. package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
  41. package/lib/exercises/math/probaStat/stats2var/averagePoint.js +18 -10
  42. package/lib/index.d.ts +11 -1
  43. package/lib/index.d.ts.map +1 -1
  44. package/lib/utils/latex/dollarize.d.ts +2 -0
  45. package/lib/utils/latex/dollarize.d.ts.map +1 -0
  46. package/lib/utils/latex/dollarize.js +7 -0
  47. package/lib/utils/markdown/mdTable.d.ts +2 -0
  48. package/lib/utils/markdown/mdTable.d.ts.map +1 -0
  49. package/lib/utils/markdown/mdTable.js +17 -0
  50. package/package.json +1 -1
@@ -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":"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"}
@@ -7,6 +7,29 @@ const rational_1 = require("../../../math/numbers/rationals/rational");
7
7
  const randint_1 = require("../../../math/utils/random/randint");
8
8
  const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
9
9
  const random_1 = require("../../../utils/alea/random");
10
+ const dollarize_1 = require("../../../utils/latex/dollarize");
11
+ const mdTable_1 = require("../../../utils/markdown/mdTable");
12
+ const getInstruction = ({ aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre, event, probaFrac, type, }) => {
13
+ const total = aBarreCapB + aBarreCapBBarre + aCapB + aCapBBarre;
14
+ const aTotal = aCapB + aCapBBarre;
15
+ const bTotal = aCapB + aBarreCapB;
16
+ const aBarreTotal = aBarreCapB + aBarreCapBBarre;
17
+ const bBarreTotal = aBarreCapBBarre + aCapBBarre;
18
+ return `On considère deux événements $A$ et $B$. Le tableau suivant donne le nombre d'issues pour chacun des événements $A\\cap B$, $\\overline A\\cap B$, $A\\cap \\overline B$ et $\\overline A \\cap \\overline B$. Calculer la probabilité $${event}$.
19
+
20
+ ${(0, mdTable_1.mdTable)([
21
+ [" ", "$B$", "$\\overline{B}$", "Total"],
22
+ ["$A$", (0, dollarize_1.dollarize)(aCapB), `$${aCapBBarre}$`, `$${aTotal}$`],
23
+ [
24
+ "$\\overline{A}$",
25
+ (0, dollarize_1.dollarize)(aBarreCapB),
26
+ (0, dollarize_1.dollarize)(aBarreCapBBarre),
27
+ (0, dollarize_1.dollarize)(aBarreTotal),
28
+ ],
29
+ ["Total", (0, dollarize_1.dollarize)(bTotal), (0, dollarize_1.dollarize)(bBarreTotal), (0, dollarize_1.dollarize)(total)],
30
+ ])}
31
+ `;
32
+ };
10
33
  const getProbaFromTableNoContextQuestion = () => {
11
34
  const aCapB = (0, randint_1.randint)(1, 20);
12
35
  const aCapBBarre = (0, randint_1.randint)(1, 20, [aCapB]);
@@ -58,28 +81,21 @@ const getProbaFromTableNoContextQuestion = () => {
58
81
  ]);
59
82
  }
60
83
  const answer = new rational_1.Rational(proba[0], proba[1]).simplify().toTree().toTex();
84
+ const identifiers = {
85
+ aBarreCapB,
86
+ aBarreCapBBarre,
87
+ aCapB,
88
+ aCapBBarre,
89
+ event,
90
+ type,
91
+ probaFrac: proba,
92
+ };
61
93
  const question = {
62
94
  answer,
63
- instruction: `On considère deux événements $A$ et $B$. Le tableau suivant donne le nombre d'issues pour chacun des événements $A\\cap B$, $\\overline A\\cap B$, $A\\cap \\overline B$ et $\\overline A \\cap \\overline B$. Calculer la probabilité $${event}$.
64
-
65
- | | $B$ | $\\overline{B}$| Total
66
- |-|-|-|-|
67
- |$A$|${aCapB}|${aCapBBarre}|${aTotal}|
68
- |$\\overline{A}$|${aBarreCapB}|${aBarreCapBBarre}|${aBarreTotal}|
69
- |Total|${bTotal}|${bBarreTotal}|${total}|
70
-
71
- `,
95
+ instruction: getInstruction(identifiers),
72
96
  keys: [],
73
97
  answerFormat: "tex",
74
- identifiers: {
75
- aBarreCapB,
76
- aBarreCapBBarre,
77
- aCapB,
78
- aCapBBarre,
79
- event,
80
- type,
81
- probaFrac: proba,
82
- },
98
+ identifiers,
83
99
  };
84
100
  return question;
85
101
  };
@@ -114,4 +130,5 @@ exports.probaFromTableNoContext = {
114
130
  getPropositions,
115
131
  isAnswerValid,
116
132
  subject: "Mathématiques",
133
+ getInstruction,
117
134
  };
@@ -1 +1 @@
1
- {"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.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;AAsHF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAe3D,CAAC"}
1
+ {"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.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;AAoIF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAgB3D,CAAC"}
@@ -7,6 +7,20 @@ const rational_1 = require("../../../math/numbers/rationals/rational");
7
7
  const randint_1 = require("../../../math/utils/random/randint");
8
8
  const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
9
9
  const random_1 = require("../../../utils/alea/random");
10
+ const dollarize_1 = require("../../../utils/latex/dollarize");
11
+ const mdTable_1 = require("../../../utils/markdown/mdTable");
12
+ const getInstruction = ({ aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre, event, probaFrac, type, }) => {
13
+ return `Le tableau suivant donne le nombre de filles et de garçons portant des lunettes dans un lycée :
14
+
15
+ ${(0, mdTable_1.mdTable)([
16
+ [" ", "Porte des lunettes", "Ne porte pas de lunettes"],
17
+ ["Filles", (0, dollarize_1.dollarize)(aCapB), (0, dollarize_1.dollarize)(aCapBBarre)],
18
+ ["Garçons", (0, dollarize_1.dollarize)(aBarreCapB), (0, dollarize_1.dollarize)(aBarreCapBBarre)],
19
+ ])}
20
+
21
+ On choisit un élève au hasard. Quelle est la probabilité de tomber sur ${event} ?
22
+ `;
23
+ };
10
24
  const getProbaFromTableWithContextQuestion = () => {
11
25
  const aCapB = (0, randint_1.randint)(1, 20);
12
26
  const aCapBBarre = (0, randint_1.randint)(1, 20);
@@ -63,28 +77,21 @@ const getProbaFromTableWithContextQuestion = () => {
63
77
  break;
64
78
  }
65
79
  const answer = new rational_1.Rational(proba[0], proba[1]).simplify().toTree().toTex();
80
+ const identifiers = {
81
+ aBarreCapB,
82
+ aBarreCapBBarre,
83
+ aCapB,
84
+ aCapBBarre,
85
+ event,
86
+ type,
87
+ probaFrac: proba,
88
+ };
66
89
  const question = {
67
90
  answer,
68
- instruction: `Le tableau suivant donne le nombre de filles et de garçons portant des lunettes dans un lycée :
69
-
70
- | | Porte des lunettes | Ne porte pas de lunettes |
71
- |-------|:----------------------:|----------------------------|
72
- |Filles |${aCapB} |${aCapBBarre}|
73
- |Garçons |${aBarreCapB} |${aBarreCapBBarre} |
74
-
75
- On choisit un élève au hasard. Quelle est la probabilité de tomber sur ${event} ?
76
- `,
91
+ instruction: getInstruction(identifiers),
77
92
  keys: [],
78
93
  answerFormat: "tex",
79
- identifiers: {
80
- aBarreCapB,
81
- aBarreCapBBarre,
82
- aCapB,
83
- aCapBBarre,
84
- event,
85
- type,
86
- probaFrac: proba,
87
- },
94
+ identifiers,
88
95
  };
89
96
  return question;
90
97
  };
@@ -119,4 +126,5 @@ exports.probaFromTableWithContext = {
119
126
  getPropositions,
120
127
  isAnswerValid,
121
128
  subject: "Mathématiques",
129
+ getInstruction,
122
130
  };
@@ -1 +1 @@
1
- {"version":3,"file":"averageWithTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/averageWithTable.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAwEF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
1
+ {"version":3,"file":"averageWithTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/averageWithTable.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAST,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAgFF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAelD,CAAC"}
@@ -4,8 +4,20 @@ exports.averageWithTable = void 0;
4
4
  const randint_1 = require("../../../../math/utils/random/randint");
5
5
  const round_1 = require("../../../../math/utils/round");
6
6
  const shuffle_1 = require("../../../../utils/alea/shuffle");
7
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
8
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
7
9
  const exercise_1 = require("../../../exercise");
8
10
  const getDistinctQuestions_1 = require("../../../utils/getDistinctQuestions");
11
+ const getInstruction = ({ randomEffectives, randomValues, }) => {
12
+ return `On considère le tableau d'effectifs suivant :
13
+
14
+ ${(0, mdTable_1.mdTable)([
15
+ ["Valeur", ...randomValues.map((e) => (0, dollarize_1.dollarize)(e))],
16
+ ["Effectif", ...randomEffectives.map((e) => (0, dollarize_1.dollarize)(e))],
17
+ ])}
18
+
19
+ Calculer la moyenne de cette série de valeurs (arrondir au centième).`;
20
+ };
9
21
  const getAverageWithTableQuestion = () => {
10
22
  const getRandomUniqueValues = (count, min, max) => {
11
23
  const uniqueValues = new Set();
@@ -22,20 +34,15 @@ const getAverageWithTableQuestion = () => {
22
34
  average += randomValues[i] * randomEffectives[i];
23
35
  average /= sumEffectives;
24
36
  average = (0, round_1.round)(average, 2);
37
+ const identifiers = { randomEffectives, randomValues };
25
38
  const answer = (average + "").replace(".", ",");
26
39
  const question = {
27
- instruction: `On considère le tableau d'effectifs suivant :
28
-
29
- | | | | | | |
30
- |-|-|-|-|-|-|
31
- |Valeur|${randomValues[0]}|${randomValues[1]}|${randomValues[2]}|${randomValues[3]}|${randomValues[4]}|
32
- |Effectif|${randomEffectives[0]}|${randomEffectives[1]}|${randomEffectives[2]}|${randomEffectives[3]}|${randomEffectives[4]}|
33
-
34
- Calculer la moyenne de cette série de valeurs (arrondir au centième).`,
40
+ instruction: getInstruction(identifiers),
35
41
  answer,
36
42
  keys: [],
37
43
  answerFormat: "tex",
38
- identifiers: { randomEffectives, randomValues },
44
+ identifiers,
45
+ style: { tableHasNoHeader: true },
39
46
  };
40
47
  return question;
41
48
  };
@@ -66,4 +73,5 @@ exports.averageWithTable = {
66
73
  getPropositions,
67
74
  isAnswerValid,
68
75
  subject: "Mathématiques",
76
+ getInstruction,
69
77
  };
@@ -1 +1 @@
1
- {"version":3,"file":"marginalAndConditionalFrequency.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAmIF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAcjE,CAAC"}
1
+ {"version":3,"file":"marginalAndConditionalFrequency.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAST,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA8KF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAejE,CAAC"}
@@ -4,93 +4,135 @@ exports.marginalAndConditionalFrequency = void 0;
4
4
  const rational_1 = require("../../../../math/numbers/rationals/rational");
5
5
  const randint_1 = require("../../../../math/utils/random/randint");
6
6
  const shuffle_1 = require("../../../../utils/alea/shuffle");
7
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
8
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
7
9
  const exercise_1 = require("../../../exercise");
8
10
  const getDistinctQuestions_1 = require("../../../utils/getDistinctQuestions");
9
- const getAnswer = (rand, x1, x2, x3, x4) => {
11
+ const getFreqStrings = (rand) => {
12
+ let freqString = "";
13
+ let frequence = "";
14
+ switch (rand) {
15
+ case 0:
16
+ freqString = "marginale de $A$";
17
+ frequence = "f(A)";
18
+ break;
19
+ case 1:
20
+ freqString = "marginale de $B$";
21
+ frequence = "f(B)";
22
+ break;
23
+ case 2:
24
+ freqString = "marginale de $C$";
25
+ frequence = "f(C)";
26
+ break;
27
+ case 3:
28
+ freqString = "marginale de $D$";
29
+ frequence = "f(D)";
30
+ break;
31
+ case 4:
32
+ freqString = "conditionnelle de $A$ parmi $C$";
33
+ frequence = "f_C(A)";
34
+ break;
35
+ case 5:
36
+ freqString = "conditionnelle de $A$ parmi $D$";
37
+ frequence = "f_D(A)";
38
+ break;
39
+ case 6:
40
+ freqString = "conditionnelle de $B$ parmi $C$";
41
+ frequence = "f_C(B)";
42
+ break;
43
+ case 7:
44
+ freqString = "conditionnelle de $B$ parmi $D$";
45
+ frequence = "f_D(B)";
46
+ break;
47
+ case 8:
48
+ freqString = "conditionnelle de $C$ parmi $A$";
49
+ frequence = "f_A(C)";
50
+ break;
51
+ case 9:
52
+ freqString = "conditionnelle de $C$ parmi $B$";
53
+ frequence = "f_B(C)";
54
+ break;
55
+ case 10:
56
+ freqString = "conditionnelle de $D$ parmi $A$";
57
+ frequence = "f_A(D)";
58
+ break;
59
+ case 11:
60
+ freqString = "conditionnelle de $D$ parmi $B$";
61
+ frequence = "f_B(D)";
62
+ break;
63
+ default:
64
+ throw Error("error");
65
+ }
66
+ return { freqString, frequence };
67
+ };
68
+ const getInstruction = ({ x1, x2, x3, x4, rand, }) => {
69
+ const { freqString } = getFreqStrings(rand);
70
+ return `On considère le tableau d'effectifs suivant :
71
+
72
+ ${(0, mdTable_1.mdTable)([
73
+ [" ", "$A$", "$B$"],
74
+ ["$C$", (0, dollarize_1.dollarize)(x1), (0, dollarize_1.dollarize)(x2)],
75
+ ["$D$", (0, dollarize_1.dollarize)(x3), (0, dollarize_1.dollarize)(x4)],
76
+ ])}
77
+
78
+ Calculer la fréquence ${freqString}.`;
79
+ };
80
+ const getAnswerNode = (rand, x1, x2, x3, x4) => {
10
81
  const x = x1 + x2 + x3 + x4;
11
82
  let freqString;
12
83
  let frequence;
13
84
  let answer;
14
85
  switch (rand) {
15
86
  case 0:
16
- freqString = "marginale de A";
17
- frequence = "f(A)";
18
87
  answer = new rational_1.Rational(x1 + x3, x).simplify().toTree();
19
88
  break;
20
89
  case 1:
21
- freqString = "marginale de B";
22
- frequence = "f(B)";
23
90
  answer = new rational_1.Rational(x2 + x4, x).simplify().toTree();
24
91
  break;
25
92
  case 2:
26
- freqString = "marginale de C";
27
- frequence = "f(C)";
28
93
  answer = new rational_1.Rational(x1 + x2, x).simplify().toTree();
29
94
  break;
30
95
  case 3:
31
- freqString = "marginale de D";
32
- frequence = "f(D)";
33
96
  answer = new rational_1.Rational(x3 + x4, x).simplify().toTree();
34
97
  break;
35
98
  case 4:
36
- freqString = "conditionnelle de A parmi C";
37
- frequence = "f_C(A)";
38
99
  answer = new rational_1.Rational(x1, x1 + x2).simplify().toTree();
39
100
  break;
40
101
  case 5:
41
- freqString = "conditionnelle de A parmi D";
42
- frequence = "f_D(A)";
43
102
  answer = new rational_1.Rational(x3, x3 + x4).simplify().toTree();
44
103
  break;
45
104
  case 6:
46
- freqString = "conditionnelle de B parmi C";
47
- frequence = "f_C(B)";
48
105
  answer = new rational_1.Rational(x2, x1 + x2).simplify().toTree();
49
106
  break;
50
107
  case 7:
51
- freqString = "conditionnelle de B parmi D";
52
- frequence = "f_D(B)";
53
108
  answer = new rational_1.Rational(x4, x3 + x4).simplify().toTree();
54
109
  break;
55
110
  case 8:
56
- freqString = "conditionnelle de C parmi A";
57
- frequence = "f_A(C)";
58
111
  answer = new rational_1.Rational(x1, x1 + x3).simplify().toTree();
59
112
  break;
60
113
  case 9:
61
- freqString = "conditionnelle de C parmi B";
62
- frequence = "f_B(C)";
63
114
  answer = new rational_1.Rational(x2, x2 + x4).simplify().toTree();
64
115
  break;
65
116
  case 10:
66
- freqString = "conditionnelle de D parmi A";
67
- frequence = "f_A(D)";
68
117
  answer = new rational_1.Rational(x3, x1 + x3).simplify().toTree();
69
118
  break;
70
119
  case 11:
71
- freqString = "conditionnelle de D parmi B";
72
- frequence = "f_B(D)";
73
120
  answer = new rational_1.Rational(x4, x2 + x4).simplify().toTree();
74
121
  break;
75
122
  default:
76
123
  throw Error("error");
77
124
  }
78
- return { answer, freqString, frequence };
125
+ return answer;
79
126
  };
80
127
  const getMarginalAndConditionalFrequency = () => {
81
128
  const [x1, x2, x3, x4] = [1, 2, 3, 4].map((el) => (0, randint_1.randint)(1, 100));
82
129
  const rand = (0, randint_1.randint)(0, 12);
83
- const { freqString, frequence, answer: answerTree, } = getAnswer(rand, x1, x2, x3, x4);
84
- const answer = answerTree.toTex();
130
+ const answerNode = getAnswerNode(rand, x1, x2, x3, x4);
131
+ const answer = answerNode.toTex();
132
+ const identifiers = { rand, x1, x2, x3, x4 };
133
+ const { frequence } = getFreqStrings(rand);
85
134
  const question = {
86
- instruction: `On considère le tableau d'effectifs suivant :
87
-
88
- | |A|B|
89
- |-|-|-|
90
- |C|${x1}|${x2}|
91
- |D|${x3}|${x4}|
92
-
93
- Calculer la fréquence ${freqString}.`,
135
+ instruction: getInstruction(identifiers),
94
136
  startStatement: `${frequence}`,
95
137
  answer,
96
138
  keys: ["f", "cap", "underscore"],
@@ -105,13 +147,13 @@ const getPropositions = (n, { answer, rand, x1, x2, x3, x4 }) => {
105
147
  while (propositions.length < n) {
106
148
  const fakeRand = (0, randint_1.randint)(0, 12);
107
149
  // console.log("marg and cond freq", answer, rand, x1, x2, x3, x4);
108
- const { answer: answerTree } = getAnswer(fakeRand, x1, x2, x3, x4);
150
+ const answerTree = getAnswerNode(fakeRand, x1, x2, x3, x4);
109
151
  (0, exercise_1.tryToAddWrongProp)(propositions, answerTree.toTex());
110
152
  }
111
153
  return (0, shuffle_1.shuffle)(propositions);
112
154
  };
113
155
  const isAnswerValid = (ans, { rand, x1, x2, x3, x4 }) => {
114
- const { answer: answerTree } = getAnswer(rand, x1, x2, x3, x4);
156
+ const answerTree = getAnswerNode(rand, x1, x2, x3, x4);
115
157
  const texs = answerTree.toAllValidTexs({ allowFractionToDecimal: true });
116
158
  return texs.includes(ans);
117
159
  };
@@ -128,4 +170,5 @@ exports.marginalAndConditionalFrequency = {
128
170
  getPropositions,
129
171
  isAnswerValid,
130
172
  subject: "Mathématiques",
173
+ getInstruction,
131
174
  };
@@ -1,6 +1,7 @@
1
1
  import { Exercise } from "../../../exercise";
2
2
  type Identifiers = {
3
3
  randomValues: number[];
4
+ randomEffectives: number[];
4
5
  };
5
6
  export declare const medianWithTable: Exercise<Identifiers>;
6
7
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"median.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/median.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA6EF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
1
+ {"version":3,"file":"median.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/median.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EAST,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAmFF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
@@ -3,8 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.medianWithTable = void 0;
4
4
  const randint_1 = require("../../../../math/utils/random/randint");
5
5
  const shuffle_1 = require("../../../../utils/alea/shuffle");
6
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
7
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
6
8
  const exercise_1 = require("../../../exercise");
7
9
  const getDistinctQuestions_1 = require("../../../utils/getDistinctQuestions");
10
+ const getInstruction = ({ randomValues, randomEffectives, }) => {
11
+ return `On considère le tableau d'effectifs suivant :
12
+
13
+ ${(0, mdTable_1.mdTable)([
14
+ ["Valeur", ...randomValues.map((e) => (0, dollarize_1.dollarize)(e))],
15
+ ["Effectif", ...randomEffectives.map((e) => (0, dollarize_1.dollarize)(e))],
16
+ ])}
17
+
18
+ Calculer la médiane de cette série de valeurs.`;
19
+ };
8
20
  const getMedianWithTable = () => {
9
21
  const getRandomUniqueValues = (count, min, max) => {
10
22
  const uniqueValues = new Set();
@@ -28,19 +40,14 @@ const getMedianWithTable = () => {
28
40
  else {
29
41
  median = sortedValues[middleIndex];
30
42
  }
43
+ const identifiers = { randomValues, randomEffectives };
31
44
  const answer = (median + "").replace(".", ",");
32
45
  const question = {
33
- instruction: `On considère le tableau d'effectifs suivant :
34
-
35
- |Valeur|${randomValues[0]}|${randomValues[1]}|${randomValues[2]}|${randomValues[3]}|${randomValues[4]}|
36
- |-|-|-|-|-|-|
37
- |Effectif|${randomEffectives[0]}|${randomEffectives[1]}|${randomEffectives[2]}|${randomEffectives[3]}|${randomEffectives[4]}|
38
-
39
- Calculer la médiane de cette série de valeurs.`,
46
+ instruction: getInstruction(identifiers),
40
47
  answer,
41
48
  keys: [],
42
49
  answerFormat: "tex",
43
- identifiers: { randomValues },
50
+ identifiers,
44
51
  style: { tableHasNoHeader: true },
45
52
  };
46
53
  return question;
@@ -69,4 +76,5 @@ exports.medianWithTable = {
69
76
  getPropositions,
70
77
  isAnswerValid,
71
78
  subject: "Mathématiques",
79
+ getInstruction,
72
80
  };
@@ -1 +1 @@
1
- {"version":3,"file":"quartiles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/quartiles.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AAI3B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAiGF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAa3C,CAAC"}
1
+ {"version":3,"file":"quartiles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/quartiles.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAST,MAAM,mBAAmB,CAAC;AAI3B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAuFF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAc3C,CAAC"}
@@ -3,8 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.quartiles = void 0;
4
4
  const randint_1 = require("../../../../math/utils/random/randint");
5
5
  const shuffle_1 = require("../../../../utils/alea/shuffle");
6
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
7
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
6
8
  const exercise_1 = require("../../../exercise");
7
9
  const getDistinctQuestions_1 = require("../../../utils/getDistinctQuestions");
10
+ const getInstruction = ({ randomEffectives, randomQuartile, randomValues, }) => {
11
+ return `On considère le tableau d'effectifs suivant :
12
+
13
+ ${(0, mdTable_1.mdTable)([
14
+ ["Valeur", ...randomValues.map((e) => (0, dollarize_1.dollarize)(e))],
15
+ ["Effectif", ...randomEffectives.map((e) => (0, dollarize_1.dollarize)(e))],
16
+ ])}
17
+
18
+ Calculer le ${randomQuartile === 0 ? "premier" : "troisième"} quartile de cette série de valeurs.`;
19
+ };
8
20
  const getQuartiles = () => {
9
21
  const getRandomUniqueValues = (count, min, max) => {
10
22
  const uniqueValues = new Set();
@@ -25,31 +37,10 @@ const getQuartiles = () => {
25
37
  const firstQuartile = sortedValues[firstQuartileIndex - 1];
26
38
  const thirdQuartile = sortedValues[thirdQuartileIndex - 1];
27
39
  const randomQuartile = (0, randint_1.randint)(0, 2);
28
- let quartileToString;
29
- let choosenQuartile;
30
- switch (randomQuartile) {
31
- case 0:
32
- quartileToString = "premier quartile";
33
- choosenQuartile = firstQuartile;
34
- break;
35
- case 1:
36
- quartileToString = "troisième quartile";
37
- choosenQuartile = thirdQuartile;
38
- break;
39
- default:
40
- quartileToString = "troisième quartile";
41
- choosenQuartile = thirdQuartile;
42
- break;
43
- }
44
- const answer = choosenQuartile + "";
40
+ const answer = (randomQuartile === 0 ? firstQuartile : thirdQuartile) + "";
41
+ const identifiers = { randomValues, randomEffectives, randomQuartile };
45
42
  const question = {
46
- instruction: `On considère le tableau d'effectifs suivant :
47
-
48
- |Valeur|${randomValues[0]}|${randomValues[1]}|${randomValues[2]}|${randomValues[3]}|${randomValues[4]}|
49
- |-|-|-|-|-|-|
50
- |Effectif|${randomEffectives[0]}|${randomEffectives[1]}|${randomEffectives[2]}|${randomEffectives[3]}|${randomEffectives[4]}|
51
-
52
- Calculer le ${quartileToString} de cette série de valeurs.`,
43
+ instruction: getInstruction(identifiers),
53
44
  answer,
54
45
  keys: [],
55
46
  answerFormat: "tex",
@@ -82,4 +73,5 @@ exports.quartiles = {
82
73
  getPropositions,
83
74
  isAnswerValid,
84
75
  subject: "Mathématiques",
76
+ getInstruction,
85
77
  };
@@ -1 +1 @@
1
- {"version":3,"file":"averagePoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/averagePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA+DF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAa9C,CAAC"}
1
+ {"version":3,"file":"averagePoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/averagePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAqEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAc9C,CAAC"}
@@ -10,24 +10,31 @@ const randTupleInt_1 = require("../../../../math/utils/random/randTupleInt");
10
10
  const randint_1 = require("../../../../math/utils/random/randint");
11
11
  const pointNode_1 = require("../../../../tree/nodes/geometry/pointNode");
12
12
  const average_1 = require("../../../../utils/average");
13
- const getAveragePointQuestion = () => {
14
- const points = (0, randTupleInt_1.distinctRandTupleInt)(4, 2, { from: -9, to: 10 });
15
- const sortedPoints = points.sort((a, b) => a[0] - b[0]);
16
- const tab = `
17
- |x|${sortedPoints[0][0]}|${sortedPoints[1][0]}|${sortedPoints[2][0]}|${sortedPoints[3][0]}|
18
- |-|-|-|-|-|
19
- |y|${sortedPoints[0][1]}|${sortedPoints[1][1]}|${sortedPoints[2][1]}|${sortedPoints[3][1]}|
20
- `;
21
- const instruction = `On considère la liste de points suivante : ${tab}
13
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
14
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
15
+ const getInstruction = ({ xValues, yValues }) => {
16
+ const tab = (0, mdTable_1.mdTable)([
17
+ ["$x$", ...xValues.map((el) => (0, dollarize_1.dollarize)(el))],
18
+ ["$y$", ...yValues.map((el) => (0, dollarize_1.dollarize)(el))],
19
+ ]);
20
+ return `On considère la liste de points suivante : ${tab}
22
21
 
23
22
  Déterminer les coordonnées du point moyen $G$.
24
23
  `;
24
+ };
25
+ const getAveragePointQuestion = () => {
26
+ const points = (0, randTupleInt_1.distinctRandTupleInt)(4, 2, { from: -9, to: 10 });
27
+ const sortedPoints = points.sort((a, b) => a[0] - b[0]);
25
28
  const xG = (0, frenchify_1.frenchify)((0, average_1.average)(sortedPoints.map((el) => el[0])) + "");
26
29
  const yG = (0, frenchify_1.frenchify)((0, average_1.average)(sortedPoints.map((el) => el[1])) + "");
27
30
  const answer = `\\left(${xG};${yG}\\right)`;
31
+ const identifiers = {
32
+ xValues: sortedPoints.map((el) => el[0]),
33
+ yValues: sortedPoints.map((el) => el[1]),
34
+ };
28
35
  const question = {
29
36
  answer,
30
- instruction,
37
+ instruction: getInstruction(identifiers),
31
38
  keys: ["semicolon"],
32
39
  answerFormat: "tex",
33
40
  identifiers: {
@@ -71,4 +78,5 @@ exports.averagePoint = {
71
78
  getPropositions,
72
79
  isAnswerValid,
73
80
  subject: "Mathématiques",
81
+ getInstruction,
74
82
  };
package/lib/index.d.ts CHANGED
@@ -564,14 +564,20 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
564
564
  G2x: number;
565
565
  G2y: number;
566
566
  G1y: number;
567
+ xValues: number[];
568
+ yValues: number[];
567
569
  }> | import("./exercises/exercise").Exercise<{
568
570
  rSquared: number;
571
+ xValues: number[];
572
+ yValues: number[];
569
573
  }> | import("./exercises/exercise").Exercise<{
570
574
  G1x: number;
571
575
  G2x: number;
572
576
  G2y: number;
573
577
  G1y: number;
574
578
  rSquared: number;
579
+ xValues: number[];
580
+ yValues: number[];
575
581
  }> | import("./exercises/exercise").Exercise<{
576
582
  trinomial: number[];
577
583
  leftbound: number;
@@ -1087,7 +1093,10 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
1087
1093
  }> | import("./exercises/exercise").Exercise<{
1088
1094
  total: number;
1089
1095
  lefties: number;
1090
- }> | import("./exercises/exercise").Exercise<{}> | import("./exercises/exercise").Exercise<{
1096
+ }> | import("./exercises/exercise").Exercise<{
1097
+ xValues: number[];
1098
+ yValues: number[];
1099
+ }> | import("./exercises/exercise").Exercise<{
1091
1100
  evolution: number;
1092
1101
  }> | import("./exercises/exercise").Exercise<{
1093
1102
  TVA: number;
@@ -1198,6 +1207,7 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
1198
1207
  rand: number;
1199
1208
  }> | import("./exercises/exercise").Exercise<{
1200
1209
  randomValues: number[];
1210
+ randomEffectives: number[];
1201
1211
  }> | import("./exercises/exercise").Exercise<{
1202
1212
  sortedValues: number[];
1203
1213
  }> | import("./exercises/exercise").Exercise<{
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA+B,CAAC;AACnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA+B,CAAC;AACnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const dollarize: (text: string | number) => string;
2
+ //# sourceMappingURL=dollarize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dollarize.d.ts","sourceRoot":"","sources":["../../../src/utils/latex/dollarize.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,SAAU,MAAM,GAAG,MAAM,WAE9C,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dollarize = void 0;
4
+ const dollarize = (text) => {
5
+ return `$${text}$`;
6
+ };
7
+ exports.dollarize = dollarize;
@@ -0,0 +1,2 @@
1
+ export declare const mdTable: (rows: (string | number)[][]) => string;
2
+ //# sourceMappingURL=mdTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdTable.d.ts","sourceRoot":"","sources":["../../../src/utils/markdown/mdTable.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,SAAU,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,WASlD,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mdTable = void 0;
4
+ const rowBuilder = (row) => {
5
+ return "|" + row.join("|") + "|";
6
+ };
7
+ const mdTable = (rows) => {
8
+ const width = rows[0].length;
9
+ return `
10
+ <!-- table -->
11
+ ${rowBuilder(rows[0])}
12
+ ${rowBuilder(new Array(width).fill("-"))}
13
+ ${rows.slice(1).map(rowBuilder).join("\n")}
14
+ <!-- !table -->
15
+ `;
16
+ };
17
+ exports.mdTable = mdTable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.2.33",
3
+ "version": "2.2.34",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [