math-exercises 3.0.83 → 3.0.85

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 (118) hide show
  1. package/lib/exercises/math/calcul/arithmetics/decimalBoundingOnLine.d.ts +9 -0
  2. package/lib/exercises/math/calcul/arithmetics/decimalBoundingOnLine.d.ts.map +1 -0
  3. package/lib/exercises/math/calcul/arithmetics/decimalBoundingOnLine.js +171 -0
  4. package/lib/exercises/math/calcul/arithmetics/evalFractionExpression.d.ts +9 -0
  5. package/lib/exercises/math/calcul/arithmetics/evalFractionExpression.d.ts.map +1 -0
  6. package/lib/exercises/math/calcul/arithmetics/evalFractionExpression.js +112 -0
  7. package/lib/exercises/math/calcul/arithmetics/index.d.ts +3 -0
  8. package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/arithmetics/index.js +3 -0
  10. package/lib/exercises/math/calcul/arithmetics/simplifyToFraction.d.ts +9 -0
  11. package/lib/exercises/math/calcul/arithmetics/simplifyToFraction.d.ts.map +1 -0
  12. package/lib/exercises/math/calcul/arithmetics/simplifyToFraction.js +168 -0
  13. package/lib/exercises/math/calcul/fractions/fractionForbiddenValue.d.ts +10 -0
  14. package/lib/exercises/math/calcul/fractions/fractionForbiddenValue.d.ts.map +1 -0
  15. package/lib/exercises/math/calcul/fractions/fractionForbiddenValue.js +100 -0
  16. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  17. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  18. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  19. package/lib/exercises/math/calcul/ordering/framing.d.ts.map +1 -1
  20. package/lib/exercises/math/calcul/ordering/framing.js +43 -6
  21. package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
  22. package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +34 -1
  23. package/lib/exercises/math/functions/rationalFraction/rationalFractionForbiddenValue.d.ts.map +1 -1
  24. package/lib/exercises/math/functions/rationalFraction/rationalFractionForbiddenValue.js +26 -1
  25. package/lib/exercises/math/geometry/index.d.ts +1 -0
  26. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  27. package/lib/exercises/math/geometry/index.js +1 -0
  28. package/lib/exercises/math/geometry/intervals/index.d.ts +2 -0
  29. package/lib/exercises/math/geometry/intervals/index.d.ts.map +1 -0
  30. package/lib/exercises/math/geometry/intervals/index.js +1 -0
  31. package/lib/exercises/math/geometry/intervals/intervalOnGraph.d.ts +8 -0
  32. package/lib/exercises/math/geometry/intervals/intervalOnGraph.d.ts.map +1 -0
  33. package/lib/exercises/math/geometry/intervals/intervalOnGraph.js +156 -0
  34. package/lib/exercises/math/probaStat/basicProbas/ballsBasicProbas.d.ts +8 -0
  35. package/lib/exercises/math/probaStat/basicProbas/ballsBasicProbas.d.ts.map +1 -0
  36. package/lib/exercises/math/probaStat/basicProbas/ballsBasicProbas.js +96 -0
  37. package/lib/exercises/math/probaStat/basicProbas/cardBasicProbas.d.ts +10 -0
  38. package/lib/exercises/math/probaStat/basicProbas/cardBasicProbas.d.ts.map +1 -0
  39. package/lib/exercises/math/probaStat/basicProbas/cardBasicProbas.js +153 -0
  40. package/lib/exercises/math/probaStat/basicProbas/diceBasicProbas.d.ts +10 -0
  41. package/lib/exercises/math/probaStat/basicProbas/diceBasicProbas.d.ts.map +1 -0
  42. package/lib/exercises/math/probaStat/basicProbas/diceBasicProbas.js +130 -0
  43. package/lib/exercises/math/probaStat/basicProbas/getComplementaryProbability.d.ts +7 -0
  44. package/lib/exercises/math/probaStat/basicProbas/getComplementaryProbability.d.ts.map +1 -0
  45. package/lib/exercises/math/probaStat/basicProbas/getComplementaryProbability.js +90 -0
  46. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.d.ts +9 -0
  47. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.d.ts.map +1 -0
  48. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.js +109 -0
  49. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +8 -0
  50. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -0
  51. package/lib/exercises/math/probaStat/basicProbas/index.js +7 -0
  52. package/lib/exercises/math/probaStat/basicProbas/mostLeastProbable.d.ts +8 -0
  53. package/lib/exercises/math/probaStat/basicProbas/mostLeastProbable.d.ts.map +1 -0
  54. package/lib/exercises/math/probaStat/basicProbas/mostLeastProbable.js +114 -0
  55. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.d.ts +8 -0
  56. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.d.ts.map +1 -0
  57. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.js +139 -0
  58. package/lib/exercises/math/probaStat/basicStats/index.d.ts +1 -0
  59. package/lib/exercises/math/probaStat/basicStats/index.d.ts.map +1 -1
  60. package/lib/exercises/math/probaStat/basicStats/index.js +1 -0
  61. package/lib/exercises/math/probaStat/basicStats/samplingFrequency.d.ts +7 -0
  62. package/lib/exercises/math/probaStat/basicStats/samplingFrequency.d.ts.map +1 -0
  63. package/lib/exercises/math/probaStat/basicStats/samplingFrequency.js +106 -0
  64. package/lib/exercises/math/probaStat/events/describeEvent.d.ts +15 -0
  65. package/lib/exercises/math/probaStat/events/describeEvent.d.ts.map +1 -0
  66. package/lib/exercises/math/probaStat/events/describeEvent.js +182 -0
  67. package/lib/exercises/math/probaStat/events/eventNotation.d.ts +15 -0
  68. package/lib/exercises/math/probaStat/events/eventNotation.d.ts.map +1 -0
  69. package/lib/exercises/math/probaStat/events/eventNotation.js +156 -0
  70. package/lib/exercises/math/probaStat/events/index.d.ts +3 -0
  71. package/lib/exercises/math/probaStat/events/index.d.ts.map +1 -0
  72. package/lib/exercises/math/probaStat/events/index.js +2 -0
  73. package/lib/exercises/math/probaStat/getQuartileProportionQuestion.d.ts +12 -0
  74. package/lib/exercises/math/probaStat/getQuartileProportionQuestion.d.ts.map +1 -0
  75. package/lib/exercises/math/probaStat/getQuartileProportionQuestion.js +178 -0
  76. package/lib/exercises/math/probaStat/index.d.ts +3 -10
  77. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  78. package/lib/exercises/math/probaStat/index.js +3 -10
  79. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  80. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +35 -52
  81. package/lib/exercises/math/probaStat/stats1var/averageLinearity.d.ts +16 -0
  82. package/lib/exercises/math/probaStat/stats1var/averageLinearity.d.ts.map +1 -0
  83. package/lib/exercises/math/probaStat/stats1var/averageLinearity.js +217 -0
  84. package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.d.ts +8 -0
  85. package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.d.ts.map +1 -0
  86. package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.js +108 -0
  87. package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.d.ts +4 -1
  88. package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.d.ts.map +1 -1
  89. package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.js +23 -9
  90. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.d.ts +9 -0
  91. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.d.ts.map +1 -0
  92. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.js +139 -0
  93. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.d.ts +9 -0
  94. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.d.ts.map +1 -0
  95. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +105 -0
  96. package/lib/exercises/math/probaStat/stats1var/index.d.ts +4 -0
  97. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  98. package/lib/exercises/math/probaStat/stats1var/index.js +4 -0
  99. package/lib/index.d.ts +78 -34
  100. package/lib/index.d.ts.map +1 -1
  101. package/lib/math/geometry/point.d.ts +1 -1
  102. package/lib/math/geometry/point.d.ts.map +1 -1
  103. package/lib/math/geometry/point.js +4 -1
  104. package/lib/playground.d.ts.map +1 -1
  105. package/lib/playground.js +1 -11
  106. package/lib/tree/nodes/functions/absNode.d.ts +2 -2
  107. package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
  108. package/lib/tree/nodes/functions/absNode.js +2 -2
  109. package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -1
  110. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  111. package/lib/tree/nodes/functions/sqrtNode.js +2 -1
  112. package/lib/tree/nodes/numbers/constantNode.d.ts +1 -1
  113. package/lib/tree/nodes/numbers/constantNode.d.ts.map +1 -1
  114. package/lib/tree/nodes/numbers/constantNode.js +2 -1
  115. package/lib/tree/nodes/operators/fractionNode.js +44 -9
  116. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  117. package/lib/tree/nodes/operators/multiplyNode.js +14 -4
  118. package/package.json +1 -1
@@ -0,0 +1,108 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
4
+ import { dollarize } from "../../../../utils/latex/dollarize.js";
5
+ import { mdTable } from "../../../../utils/markdown/mdTable.js";
6
+ import { round } from "../../../../math/utils/round.js";
7
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
8
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
9
+ const getPropositions = (n, { answer }) => {
10
+ const propositions = [];
11
+ addValidProp(propositions, answer);
12
+ while (propositions.length < n) {
13
+ const offset = randfloat(0.1, 1, 2);
14
+ tryToAddWrongProp(propositions, round(answer.unfrenchify() + offset, 2).frenchify());
15
+ }
16
+ return shuffleProps(propositions, n);
17
+ };
18
+ const getAnswer = (identifiers) => {
19
+ const { xValues, yValues } = identifiers;
20
+ const sum = xValues.reduce((sum, v, i) => sum + v * yValues[i], 0);
21
+ const mean = round(sum, 2);
22
+ return mean.frenchify();
23
+ };
24
+ const getInstruction = (identifiers) => {
25
+ const { xValues, yValues } = identifiers;
26
+ return `Un film a été noté par les spectateurs :
27
+
28
+
29
+ ${mdTable([
30
+ ["Note", ...xValues.map((v) => dollarize(v))],
31
+ ["Fréquence", ...yValues.map((v) => dollarize(`${round(v * 100, 2)} \\%`))],
32
+ ])}
33
+
34
+ Quelle est la note moyenne du film ?`;
35
+ };
36
+ const getHint = (identifiers) => {
37
+ return `Pour calculer la moyenne, multiplie chaque valeur $x_i$ par sa fréquence correspondante $f_i$, puis additionne ces produits.`;
38
+ };
39
+ const getCorrection = (identifiers) => {
40
+ const { xValues, yValues } = identifiers;
41
+ const products = xValues.map((v, i) => round(v * yValues[i], 2));
42
+ const total = getAnswer(identifiers);
43
+ return `On calcule les produits des notes par leur fréquence : \n\n
44
+
45
+ ${xValues
46
+ .map((v, i) => `$$
47
+ ${v} \\times ${yValues[i].frenchify()} = ${products[i].frenchify()}
48
+ $$`)
49
+ .join("\n\n")}
50
+
51
+ En additionnant ces produits, on obtient la moyenne $\\overline{x}$ :
52
+
53
+ $$
54
+ \\overline x = ${total}
55
+ $$`;
56
+ };
57
+ const getKeys = (identifiers) => {
58
+ return [];
59
+ };
60
+ const isAnswerValid = (ans, { answer }) => {
61
+ try {
62
+ const ansNode = parseAlgebraic(ans);
63
+ const answerNode = parseAlgebraic(answer);
64
+ return ansNode.simplify().equals(answerNode.simplify());
65
+ }
66
+ catch (err) {
67
+ return handleVEAError(err);
68
+ }
69
+ };
70
+ const getCalculateMeanFromFrequenciesQuestion = (ops) => {
71
+ const xValues = [0, 1, 2, 3, 4];
72
+ const raw = xValues.map(() => Math.random());
73
+ const total = raw.reduce((sum, v) => sum + v, 0);
74
+ const yValues = raw.map((v) => round(v / total, 2));
75
+ const sumRounded = yValues.reduce((sum, v) => sum + v, 0);
76
+ const diff = round(1 - sumRounded, 2);
77
+ yValues[yValues.length - 1] = round(yValues[yValues.length - 1] + diff, 2);
78
+ const identifiers = { xValues, yValues };
79
+ return getQuestionFromIdentifiers(identifiers);
80
+ };
81
+ const getQuestionFromIdentifiers = (identifiers) => {
82
+ return {
83
+ answer: getAnswer(identifiers),
84
+ instruction: getInstruction(identifiers),
85
+ keys: getKeys(identifiers),
86
+ answerFormat: "tex",
87
+ identifiers,
88
+ hint: getHint(identifiers),
89
+ correction: getCorrection(identifiers),
90
+ };
91
+ };
92
+ export const calculateMeanFromFrequencies = {
93
+ id: "calculateMeanFromFrequencies",
94
+ label: "Calculer une moyenne à partir de fréquences",
95
+ isSingleStep: true,
96
+ generator: (nb, opts) => getDistinctQuestions(() => getCalculateMeanFromFrequenciesQuestion(opts), nb),
97
+ qcmTimer: 60,
98
+ freeTimer: 60,
99
+ getPropositions,
100
+ isAnswerValid,
101
+ subject: "Mathématiques",
102
+ getInstruction,
103
+ getHint,
104
+ getCorrection,
105
+ getAnswer,
106
+ getQuestionFromIdentifiers,
107
+ hasHintAndCorrection: true,
108
+ };
@@ -3,6 +3,9 @@ type Identifiers = {
3
3
  indicatorAsked: string;
4
4
  values: number[];
5
5
  };
6
- export declare const choseReasoningForIndicator: Exercise<Identifiers>;
6
+ type Options = {
7
+ indicators: string[];
8
+ };
9
+ export declare const choseReasoningForIndicator: Exercise<Identifiers, Options>;
7
10
  export {};
8
11
  //# sourceMappingURL=choseReasoningForIndicator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"choseReasoningForIndicator.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/choseReasoningForIndicator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAgIF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAa5D,CAAC"}
1
+ {"version":3,"file":"choseReasoningForIndicator.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/choseReasoningForIndicator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA2IF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBrE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
@@ -6,6 +6,16 @@ import { operatorComposition } from "../../../../tree/utilities/operatorComposit
6
6
  import { random } from "../../../../utils/alea/random.js";
7
7
  import { shuffle } from "../../../../utils/alea/shuffle.js";
8
8
  import { average } from "../../../../utils/average.js";
9
+ const options = [
10
+ {
11
+ id: "indicators",
12
+ label: "Indicateurs",
13
+ target: GeneratorOptionTarget.generation,
14
+ type: GeneratorOptionType.multiselect,
15
+ defaultValue: ["Moyenne", "Médiane"],
16
+ values: ["Moyenne", "Médiane"],
17
+ },
18
+ ];
9
19
  const getPropositions = (n, { answer, ...identifiers }) => {
10
20
  const propositions = [];
11
21
  addValidProp(propositions, answer, "raw");
@@ -52,7 +62,7 @@ const getCorrection = (identifiers) => {
52
62
  : `La médiane est la valeur centrale de la série : c'est à dire qu'il y a autant de valeurs inférieures à elle que de valeurs supérieures. Ici, ${getAnswer(identifiers).toLocaleLowerCase()}.
53
63
  `;
54
64
  };
55
- const getChoseReasoningForIndicatorQuestion = (ops) => {
65
+ const getChoseReasoningForIndicatorQuestion = (opts) => {
56
66
  const max = 2 * randint(5, 20);
57
67
  const x = max / 2;
58
68
  let otherValues = [];
@@ -74,18 +84,18 @@ const getChoseReasoningForIndicatorQuestion = (ops) => {
74
84
  shuffled.splice(3, 0, x);
75
85
  const identifiers = {
76
86
  values: shuffled,
77
- indicatorAsked: random(["moyenne", "médiane"]),
87
+ indicatorAsked: random(opts?.indicators ?? ["moyenne", "médiane"]),
78
88
  };
79
- return getQuestionFromIdentifiers(identifiers);
89
+ return getQuestionFromIdentifiers(identifiers, opts);
80
90
  };
81
- const getQuestionFromIdentifiers = (identifiers) => {
91
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
82
92
  const question = {
83
- answer: getAnswer(identifiers),
84
- instruction: getInstruction(identifiers),
93
+ answer: getAnswer(identifiers, opts),
94
+ instruction: getInstruction(identifiers, opts),
85
95
  answerFormat: "raw",
86
96
  identifiers,
87
- hint: getHint(identifiers),
88
- correction: getCorrection(identifiers),
97
+ hint: getHint(identifiers, opts),
98
+ correction: getCorrection(identifiers, opts),
89
99
  };
90
100
  return question;
91
101
  };
@@ -101,4 +111,8 @@ export const choseReasoningForIndicator = {
101
111
  answerType: "QCU",
102
112
  getQuestionFromIdentifiers,
103
113
  hasHintAndCorrection: true,
114
+ options,
115
+ pdfOptions: {
116
+ shouldSpreadPropositions: true,
117
+ },
104
118
  };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ labels: number[];
4
+ serie1: number[];
5
+ serie2: number[];
6
+ };
7
+ export declare const compareSeriesDispersion: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=compareSeriesDispersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compareSeriesDispersion.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/compareSeriesDispersion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA8JF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAqBzD,CAAC"}
@@ -0,0 +1,139 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { round } from "../../../../math/utils/round.js";
6
+ import { standardDeviation } from "../../../../math/utils/stats/standardDeviation.js";
7
+ import { average } from "../../../../utils/average.js";
8
+ const getPropositions = (n, { answer }) => {
9
+ const propositions = [];
10
+ addValidProp(propositions, answer, "raw");
11
+ tryToAddWrongProp(propositions, "Série 1", "raw");
12
+ tryToAddWrongProp(propositions, "Série 2", "raw");
13
+ tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
14
+ return shuffleProps(propositions, n);
15
+ };
16
+ function computeStats(serie, labels, shouldRound = false) {
17
+ const total = serie.reduce((a, b) => a + b, 0);
18
+ const rawMean = serie.reduce((acc, e, i) => acc + e * labels[i], 0) / total;
19
+ const rawVariance = serie.reduce((acc, e, i) => acc + e * Math.pow(labels[i] - rawMean, 2), 0) /
20
+ total;
21
+ const rawEcartType = Math.sqrt(rawVariance);
22
+ if (shouldRound) {
23
+ return {
24
+ total,
25
+ mean: round(rawMean, 2),
26
+ variance: round(rawVariance, 2),
27
+ ecartType: round(rawEcartType, 2),
28
+ };
29
+ }
30
+ return {
31
+ total,
32
+ mean: rawMean,
33
+ variance: rawVariance,
34
+ ecartType: rawEcartType,
35
+ };
36
+ }
37
+ const getAnswer = ({ serie1, serie2, labels }) => {
38
+ const std1 = standardDeviation(serie1);
39
+ const std2 = standardDeviation(serie2);
40
+ return std1 > std2 ? "Série A" : "Série B";
41
+ };
42
+ const getInstruction = () => {
43
+ return `Laquelle des deux séries représentées ci-dessous semble la plus dispersée ?`;
44
+ };
45
+ const getHint = () => {
46
+ return `Observe la répartition des valeurs dans chaque série. Une série est plus dispersée si ses valeurs sont plus éloignées de sa moyenne.`;
47
+ };
48
+ const getCorrection = (identifiers) => {
49
+ const { serie1, serie2, labels } = identifiers;
50
+ const average1 = average(serie1);
51
+ const average2 = average(serie2);
52
+ const result = getAnswer(identifiers);
53
+ const otherSeries = result === "Série A" ? "série B" : "série A";
54
+ return `On observe que les valeurs de la ${otherSeries} sont plus concentrées autour de la moyenne de cette série (qui vaut environ $${round(result === "Série A" ? average2 : average1, 0).frenchify()}$).
55
+
56
+ C'est donc la ${result} qui semble la plus dispersée.
57
+ `;
58
+ };
59
+ const getGGBOptions = ({ labels, serie1, serie2, }) => {
60
+ const serie1Data = serie1.join(",");
61
+ const serie2Data = serie2.join(",");
62
+ const commands = [
63
+ `A = BarChart({0.85,1.85,2.85,3.85}, {${serie1Data}}, 0.3)`,
64
+ `B = BarChart({1.15,2.15,3.15,4.15}, {${serie2Data}}, 0.3)`,
65
+ `SetLabelMode(A, 0)`,
66
+ `SetLabelMode(B, 0)`,
67
+ ...labels.map((l, i) => `Text("\\footnotesize ${l}", (${i + 1}, 2), true, true, 0, -1)`),
68
+ `Text("\\footnotesize Diamètre\\ (en \\ cm)", (3, -3.5), true, true, 0, -1)`,
69
+ `SetColor(A, "#168187")`,
70
+ `SetColor(B, "#376FDE")`,
71
+ ];
72
+ const ggb = new GeogebraConstructor({
73
+ commands,
74
+ gridDistance: [1, 1],
75
+ fontSize: 16,
76
+ lockedAxesRatio: 1 / 13,
77
+ xAxis: {
78
+ showPositive: true,
79
+ hidden: true,
80
+ },
81
+ yAxis: {
82
+ showPositive: true,
83
+ label: "$\\footnotesize Effectif$",
84
+ steps: 10,
85
+ },
86
+ forbidShiftDragZoom: true,
87
+ });
88
+ return ggb.getOptions({ coords: [-0.2, 5.2, 0, 30] });
89
+ };
90
+ const getKeys = (identifiers) => {
91
+ return [];
92
+ };
93
+ const isAnswerValid = (ans, { answer }) => {
94
+ throw Error("VEA not implemented");
95
+ };
96
+ const getCompareSeriesDispersionQuestion = () => {
97
+ const labels = [10, 20, 30, 40];
98
+ const baseValue = randint(10, 25);
99
+ const serie1 = labels.map(() => randint(baseValue - 3, baseValue + 3));
100
+ const serie2 = labels.map(() => randint(1, 35));
101
+ const identifiers = {
102
+ labels,
103
+ serie1,
104
+ serie2,
105
+ };
106
+ return getQuestionFromIdentifiers(identifiers);
107
+ };
108
+ const getQuestionFromIdentifiers = (identifiers) => {
109
+ return {
110
+ answer: getAnswer(identifiers),
111
+ instruction: getInstruction(identifiers),
112
+ keys: getKeys(identifiers),
113
+ answerFormat: "raw",
114
+ identifiers,
115
+ hint: getHint(identifiers),
116
+ correction: getCorrection(identifiers),
117
+ ggbOptions: getGGBOptions(identifiers),
118
+ };
119
+ };
120
+ export const compareSeriesDispersion = {
121
+ id: "compareSeriesDispersion",
122
+ label: "Comparer des écarts-types à partir de diagramme d'effectifs de plusieurs séries",
123
+ isSingleStep: true,
124
+ generator: (nb, opts) => getDistinctQuestions(() => getCompareSeriesDispersionQuestion(opts), nb),
125
+ qcmTimer: 60,
126
+ freeTimer: 60,
127
+ getPropositions,
128
+ isAnswerValid,
129
+ subject: "Mathématiques",
130
+ getHint,
131
+ getCorrection,
132
+ getInstruction,
133
+ getAnswer,
134
+ getGGBOptions,
135
+ hasGeogebra: true,
136
+ getQuestionFromIdentifiers,
137
+ hasHintAndCorrection: true,
138
+ answerType: "QCU",
139
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ xVals: number[];
4
+ yVals: number[];
5
+ x: number;
6
+ };
7
+ export declare const cumulativeSum: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=cumulativeSum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cumulativeSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/cumulativeSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4GF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAiB/C,CAAC"}
@@ -0,0 +1,105 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
7
+ import { dollarize } from "../../../../utils/latex/dollarize.js";
8
+ import { mdTable } from "../../../../utils/markdown/mdTable.js";
9
+ const getPropositions = (n, { answer, ...identifiers }) => {
10
+ const propositions = [];
11
+ const { xVals, yVals, x } = identifiers;
12
+ addValidProp(propositions, answer);
13
+ tryToAddWrongProp(propositions, `${xVals[x]}`);
14
+ tryToAddWrongProp(propositions, `${xVals[x]}`);
15
+ for (let k = 0; k < yVals.length; k++) {
16
+ let sum = 0;
17
+ for (let i = 0; i <= k; i++) {
18
+ sum += yVals[i];
19
+ }
20
+ tryToAddWrongProp(propositions, `${sum}`);
21
+ }
22
+ return shuffleProps(propositions, n);
23
+ };
24
+ const getAnswer = (identifiers) => {
25
+ const { yVals, x } = identifiers;
26
+ let sum = 0;
27
+ for (let i = 0; i <= x; i++) {
28
+ sum += yVals[i];
29
+ }
30
+ return `${sum}`;
31
+ };
32
+ const getInstruction = (identifiers) => {
33
+ const { xVals, yVals, x } = identifiers;
34
+ return `On considère la série statistique suivante :
35
+
36
+ ${mdTable([
37
+ ["Valeur", ...xVals.map((x) => dollarize(x))],
38
+ ["Effectif", ...yVals.map((y) => dollarize(y))],
39
+ ])}
40
+
41
+ Calculez l'effectif cumulé croissant de la valeur $${xVals[x]}$.
42
+ `;
43
+ };
44
+ const getHint = (identifiers) => {
45
+ return `L'effectif cumulé croissant d'une valeur correspond à la somme des effectifs des valeurs inférieures ou égales à cette valeur`;
46
+ };
47
+ const getCorrection = (identifiers) => {
48
+ const { xVals, yVals, x } = identifiers;
49
+ let sum = 0;
50
+ for (let i = 0; i <= x; i++) {
51
+ sum += yVals[i];
52
+ }
53
+ return `L'effectif cumulé croissant de $${xVals[x]}$ correspond à la somme des effectifs des valeurs inférieures ou égales à $${xVals[x]}$ :
54
+
55
+ $$
56
+ ${x > 0
57
+ ? `${operatorComposition(AddNode, yVals.slice(0, x + 1).map((e) => e.toTree())).toTex()} = ${sum}`
58
+ : `${sum}`}
59
+ $$`;
60
+ };
61
+ const isAnswerValid = (ans, { answer }) => {
62
+ return numberVEA(ans, answer);
63
+ };
64
+ const getCumulativeSumQuestion = (ops) => {
65
+ let xVals = [randint(1, 10)];
66
+ let yVals = [randint(1, 10, xVals)];
67
+ for (let i = 1; i < randint(3, 6); i++) {
68
+ xVals.push(xVals[i - 1] + randint(1, 10));
69
+ yVals.push(yVals[i - 1] + randint(1, 10));
70
+ }
71
+ const identifiers = {
72
+ xVals,
73
+ yVals,
74
+ x: randint(1, xVals.length),
75
+ };
76
+ return getQuestionFromIdentifiers(identifiers);
77
+ };
78
+ const getQuestionFromIdentifiers = (identifiers) => {
79
+ return {
80
+ answer: getAnswer(identifiers),
81
+ instruction: getInstruction(identifiers),
82
+ keys: [],
83
+ answerFormat: "tex",
84
+ identifiers,
85
+ hint: getHint(identifiers),
86
+ correction: getCorrection(identifiers),
87
+ };
88
+ };
89
+ export const cumulativeSum = {
90
+ id: "cumulativeSum",
91
+ label: "Calculer des effectifs cumulés croissants",
92
+ isSingleStep: true,
93
+ generator: (nb, opts) => getDistinctQuestions(() => getCumulativeSumQuestion(opts), nb),
94
+ qcmTimer: 60,
95
+ freeTimer: 60,
96
+ getPropositions,
97
+ isAnswerValid,
98
+ subject: "Mathématiques",
99
+ getInstruction,
100
+ getHint,
101
+ getCorrection,
102
+ getAnswer,
103
+ getQuestionFromIdentifiers,
104
+ hasHintAndCorrection: true,
105
+ };
@@ -13,4 +13,8 @@ export * from "./standardDeviationTable.js";
13
13
  export * from "./interquartilesList.js";
14
14
  export * from "./interquartilesTable.js";
15
15
  export * from "./choseReasoningForIndicator.js";
16
+ export * from "./compareSeriesDispersion.js";
17
+ export * from "./averageLinearity.js";
18
+ export * from "./calculateMeanFromFrequencies.js";
19
+ export * from "./cumulativeSum.js";
16
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC"}
@@ -13,3 +13,7 @@ export * from "./standardDeviationTable.js";
13
13
  export * from "./interquartilesList.js";
14
14
  export * from "./interquartilesTable.js";
15
15
  export * from "./choseReasoningForIndicator.js";
16
+ export * from "./compareSeriesDispersion.js";
17
+ export * from "./averageLinearity.js";
18
+ export * from "./calculateMeanFromFrequencies.js";
19
+ export * from "./cumulativeSum.js";
package/lib/index.d.ts CHANGED
@@ -103,6 +103,15 @@ declare const mathExercises: (Exercise<{
103
103
  }, {}> | Exercise<{
104
104
  a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
105
105
  interval: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
106
+ }, {}> | Exercise<{
107
+ expr: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
108
+ x: number;
109
+ }, {}> | Exercise<{
110
+ type: number;
111
+ expr: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
112
+ }, {}> | Exercise<{
113
+ point: import("./math/geometry/point.js").PointIdentifiers;
114
+ bounding: number;
106
115
  }, {}> | Exercise<{
107
116
  integerFirst: boolean;
108
117
  integer: number;
@@ -179,6 +188,11 @@ declare const mathExercises: (Exercise<{
179
188
  a: number;
180
189
  n: number;
181
190
  isSimplified: boolean;
191
+ }, {}> | Exercise<{
192
+ a: number;
193
+ b: number;
194
+ c: number;
195
+ d: number;
182
196
  }, {}> | Exercise<{
183
197
  numbers: number[];
184
198
  }, {}> | Exercise<{
@@ -1559,6 +1573,8 @@ declare const mathExercises: (Exercise<{
1559
1573
  }, {}> | Exercise<{
1560
1574
  triangleIdentifiers: import("./math/geometry/triangles/triangle.js").TriangleIdentifiers;
1561
1575
  angleAsked: number;
1576
+ }, {}> | Exercise<{
1577
+ intervalNodeIdentifiers: import("./tree/nodes/sets/intervalNode.js").IntervalNodeIdentifiers;
1562
1578
  }, {}> | Exercise<{
1563
1579
  coeffs: number[];
1564
1580
  to: "+\\infty" | "-\\infty";
@@ -1754,23 +1770,6 @@ declare const mathExercises: (Exercise<{
1754
1770
  }, {}> | Exercise<{
1755
1771
  kIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1756
1772
  uCoeffs: number[];
1757
- }, {}> | Exercise<{
1758
- kind: "factor";
1759
- a: number;
1760
- operator: "multiplication" | "division" | "soustraction" | "addition";
1761
- factor: number;
1762
- } | {
1763
- kind: "series";
1764
- series: number[];
1765
- operator: "multiplication" | "division" | "soustraction" | "addition";
1766
- factor: number;
1767
- }, {}> | Exercise<{
1768
- repartitions: number[];
1769
- colorAskedIndex: number;
1770
- }, {}> | Exercise<{
1771
- questionType: string;
1772
- value?: string;
1773
- color?: import("./exercises/utils/cardsData.js").CardsColor;
1774
1773
  }, {}> | Exercise<{
1775
1774
  flip: number;
1776
1775
  pA?: number;
@@ -1778,11 +1777,6 @@ declare const mathExercises: (Exercise<{
1778
1777
  pAB?: number;
1779
1778
  pA_B?: number;
1780
1779
  pB_A?: number;
1781
- }, {}> | Exercise<{
1782
- isParityQuestion: boolean;
1783
- isEvenQuestion: boolean;
1784
- nbFaces: number;
1785
- faceAsked: number;
1786
1780
  }, {}> | Exercise<{
1787
1781
  A: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
1788
1782
  B: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
@@ -1838,6 +1832,29 @@ declare const mathExercises: (Exercise<{
1838
1832
  }, {}> | Exercise<{
1839
1833
  indicatorAsked: string;
1840
1834
  values: number[];
1835
+ }, {
1836
+ indicators: string[];
1837
+ }> | Exercise<{
1838
+ labels: number[];
1839
+ serie1: number[];
1840
+ serie2: number[];
1841
+ }, {}> | Exercise<{
1842
+ kind: "factor";
1843
+ a: number;
1844
+ operator: "multiplication" | "division" | "soustraction" | "addition";
1845
+ factor: number;
1846
+ } | {
1847
+ kind: "series";
1848
+ series: number[];
1849
+ operator: "multiplication" | "division" | "soustraction" | "addition";
1850
+ factor: number;
1851
+ }, {}> | Exercise<{
1852
+ xValues: number[];
1853
+ yValues: number[];
1854
+ }, {}> | Exercise<{
1855
+ xVals: number[];
1856
+ yVals: number[];
1857
+ x: number;
1841
1858
  }, {}> | Exercise<{
1842
1859
  xValues: number[];
1843
1860
  yValues: number[];
@@ -1903,6 +1920,8 @@ declare const mathExercises: (Exercise<{
1903
1920
  }> | Exercise<{
1904
1921
  values: number[];
1905
1922
  target: number;
1923
+ }, {}> | Exercise<{
1924
+ samples: number[];
1906
1925
  }, {}> | Exercise<{
1907
1926
  xValuesIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
1908
1927
  yValuesIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
@@ -1916,12 +1935,6 @@ declare const mathExercises: (Exercise<{
1916
1935
  }, {}> | Exercise<{
1917
1936
  xValuesIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
1918
1937
  yValuesIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
1919
- }, {}> | Exercise<{
1920
- labels: string[];
1921
- pValues: number[];
1922
- missingIndex: number;
1923
- }, {}> | Exercise<{
1924
- pA: number;
1925
1938
  }, {}> | Exercise<{
1926
1939
  pA: number;
1927
1940
  pB: number;
@@ -1929,9 +1942,6 @@ declare const mathExercises: (Exercise<{
1929
1942
  pIntersection: number;
1930
1943
  target: "pA" | "pB" | "pUnion" | "pIntersection";
1931
1944
  }, {}> | Exercise<{
1932
- xValues: number[];
1933
- yValues: number[];
1934
- }, {}> | Exercise<MathExercises.Identifiers, {}> | Exercise<{
1935
1945
  total: number;
1936
1946
  distribution: number[];
1937
1947
  observe: boolean;
@@ -1950,9 +1960,43 @@ declare const mathExercises: (Exercise<{
1950
1960
  };
1951
1961
  question: "union" | "intersection" | "comp";
1952
1962
  }, {}> | Exercise<{
1953
- xVals: number[];
1954
- yVals: number[];
1955
- x: number;
1963
+ eventA: {
1964
+ desc: string;
1965
+ isComplementary: boolean;
1966
+ };
1967
+ eventB: {
1968
+ desc: string;
1969
+ isComplementary: boolean;
1970
+ };
1971
+ question: "union" | "intersection" | "comp";
1972
+ }, {}> | Exercise<{
1973
+ repartitions: number[];
1974
+ colorAskedIndex: number;
1975
+ }, {}> | Exercise<{
1976
+ questionType: string;
1977
+ value?: string;
1978
+ color?: import("./exercises/utils/cardsData.js").CardsColor;
1979
+ }, {}> | Exercise<{
1980
+ isParityQuestion: boolean;
1981
+ isEvenQuestion: boolean;
1982
+ nbFaces: number;
1983
+ faceAsked: number;
1984
+ }, {}> | Exercise<{
1985
+ pA: number;
1986
+ }, {}> | Exercise<{
1987
+ labels: string[];
1988
+ pValues: number[];
1989
+ missingIndex: number;
1990
+ }, {}> | Exercise<MathExercises.Identifiers, {}> | Exercise<{
1991
+ a: number;
1992
+ type: number;
1993
+ }, {}> | Exercise<{
1994
+ labels: string[];
1995
+ serie1: number[];
1996
+ serie2: number[];
1997
+ a: number;
1998
+ b: number;
1999
+ isBetween: boolean;
1956
2000
  }, {}> | Exercise<{
1957
2001
  firstValue: number;
1958
2002
  askedRank: number;