math-exercises 3.0.101 → 3.0.103

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 (124) hide show
  1. package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.js +1 -1
  2. package/lib/exercises/math/curve/sqrtCurvePoint.d.ts.map +1 -1
  3. package/lib/exercises/math/curve/sqrtCurvePoint.js +7 -5
  4. package/lib/exercises/math/curve/squareCurvePoint.d.ts.map +1 -1
  5. package/lib/exercises/math/curve/squareCurvePoint.js +4 -2
  6. package/lib/exercises/math/dataRepresentations/barChartReading.d.ts +1 -1
  7. package/lib/exercises/math/dataRepresentations/barChartReading.js +1 -1
  8. package/lib/exercises/math/functions/basics/imageFunction.d.ts.map +1 -1
  9. package/lib/exercises/math/functions/basics/imageFunction.js +8 -8
  10. package/lib/exercises/math/functions/sign/equationFromSignTable.js +1 -1
  11. package/lib/exercises/math/functions/sqrt/compareSqrtValues.js +1 -1
  12. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.d.ts.map +1 -1
  13. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.js +10 -2
  14. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
  15. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +3 -2
  16. package/lib/exercises/math/geometry/index.d.ts +1 -0
  17. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  18. package/lib/exercises/math/geometry/index.js +1 -0
  19. package/lib/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.d.ts +8 -0
  20. package/lib/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.d.ts.map +1 -0
  21. package/lib/exercises/math/geometry/optimisation/geometryExtremaReadingOnGraph.js +145 -0
  22. package/lib/exercises/math/geometry/optimisation/index.d.ts +4 -0
  23. package/lib/exercises/math/geometry/optimisation/index.d.ts.map +1 -0
  24. package/lib/exercises/math/geometry/optimisation/index.js +3 -0
  25. package/lib/exercises/math/geometry/optimisation/lengthIntervalOnPicture.d.ts +8 -0
  26. package/lib/exercises/math/geometry/optimisation/lengthIntervalOnPicture.d.ts.map +1 -0
  27. package/lib/exercises/math/geometry/optimisation/lengthIntervalOnPicture.js +93 -0
  28. package/lib/exercises/math/geometry/optimisation/lengthWithXOnPicture.d.ts +8 -0
  29. package/lib/exercises/math/geometry/optimisation/lengthWithXOnPicture.d.ts.map +1 -0
  30. package/lib/exercises/math/geometry/optimisation/lengthWithXOnPicture.js +99 -0
  31. package/lib/exercises/math/geometry/pythagore/index.d.ts +1 -0
  32. package/lib/exercises/math/geometry/pythagore/index.d.ts.map +1 -1
  33. package/lib/exercises/math/geometry/pythagore/index.js +1 -1
  34. package/lib/exercises/math/geometry/pythagore/triangleHeight.d.ts.map +1 -1
  35. package/lib/exercises/math/geometry/pythagore/triangleHeight.js +78 -32
  36. package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.d.ts.map +1 -1
  37. package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.js +8 -1
  38. package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.js +6 -7
  39. package/lib/exercises/math/geometry/vectors/parallelogram/parallelogramCriterion.js +1 -1
  40. package/lib/exercises/math/geometry/vectors/vectorCoordinatesFromTwoPoints.d.ts.map +1 -1
  41. package/lib/exercises/math/geometry/vectors/vectorCoordinatesFromTwoPoints.js +33 -10
  42. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.d.ts.map +1 -1
  43. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +39 -9
  44. package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +1 -1
  45. package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +1 -1
  46. package/lib/exercises/math/probaStat/basicProbas/ballsBasicProbas.js +1 -1
  47. package/lib/exercises/math/probaStat/basicProbas/cardBasicProbas.d.ts.map +1 -1
  48. package/lib/exercises/math/probaStat/basicProbas/cardBasicProbas.js +1 -3
  49. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.d.ts.map +1 -1
  50. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.js +5 -3
  51. package/lib/exercises/math/probaStat/events/describeEvent.d.ts.map +1 -1
  52. package/lib/exercises/math/probaStat/events/describeEvent.js +5 -11
  53. package/lib/exercises/math/probaStat/events/eventNotation.d.ts.map +1 -1
  54. package/lib/exercises/math/probaStat/events/eventNotation.js +5 -11
  55. package/lib/exercises/math/probaStat/issuesCountingForCards.js +1 -1
  56. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  57. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +5 -3
  58. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  59. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +10 -2
  60. package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.js +4 -4
  61. package/lib/exercises/math/probaStat/stats1var/averageLinearity.d.ts.map +1 -1
  62. package/lib/exercises/math/probaStat/stats1var/averageLinearity.js +5 -4
  63. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.d.ts.map +1 -1
  64. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.js +14 -32
  65. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +1 -1
  66. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +1 -1
  67. package/lib/exercises/math/probaStat/stats1var/interquartilesList.d.ts.map +1 -1
  68. package/lib/exercises/math/probaStat/stats1var/interquartilesList.js +4 -3
  69. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
  70. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +23 -7
  71. package/lib/exercises/math/probaStat/stats1var/median.js +1 -1
  72. package/lib/exercises/math/probaStat/stats1var/medianList.js +1 -1
  73. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  74. package/lib/exercises/math/probaStat/stats1var/quartiles.js +1 -0
  75. package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
  76. package/lib/exercises/math/probaStat/stats1var/quartilesList.js +1 -0
  77. package/lib/exercises/math/probaStat/stats1var/standardDeviationList.js +4 -4
  78. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +4 -4
  79. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
  80. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +1 -1
  81. package/lib/exercises/math/probaStat/unionIntersectionProba.js +1 -1
  82. package/lib/exercises/math/python/inOutCalcul.js +1 -1
  83. package/lib/exercises/math/python/index.d.ts +6 -0
  84. package/lib/exercises/math/python/index.d.ts.map +1 -1
  85. package/lib/exercises/math/python/index.js +6 -0
  86. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts +9 -0
  87. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts.map +1 -0
  88. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.js +129 -0
  89. package/lib/exercises/math/python/pythonIfStatementCompletion.d.ts +8 -0
  90. package/lib/exercises/math/python/pythonIfStatementCompletion.d.ts.map +1 -0
  91. package/lib/exercises/math/python/pythonIfStatementCompletion.js +114 -0
  92. package/lib/exercises/math/python/pythonRangeCompletion.d.ts +9 -0
  93. package/lib/exercises/math/python/pythonRangeCompletion.d.ts.map +1 -0
  94. package/lib/exercises/math/python/pythonRangeCompletion.js +105 -0
  95. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.d.ts +8 -0
  96. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.d.ts.map +1 -0
  97. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.js +89 -0
  98. package/lib/exercises/math/python/pythonWhileStatementCompletion.d.ts +7 -0
  99. package/lib/exercises/math/python/pythonWhileStatementCompletion.d.ts.map +1 -0
  100. package/lib/exercises/math/python/pythonWhileStatementCompletion.js +87 -0
  101. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts +8 -0
  102. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts.map +1 -0
  103. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.js +120 -0
  104. package/lib/exercises/math/python/variableType.js +1 -1
  105. package/lib/exercises/math/python/whileLoop.d.ts.map +1 -1
  106. package/lib/exercises/math/python/whileLoop.js +1 -0
  107. package/lib/exercises/math/python/whileLoopCount.js +2 -2
  108. package/lib/exercises/math/sampling/samplingFrequency.d.ts.map +1 -1
  109. package/lib/exercises/math/sampling/samplingFrequency.js +2 -4
  110. package/lib/exercises/math/sequences/genericSequenceVariations.js +3 -3
  111. package/lib/exercises/math/sequences/sequencePlot.js +1 -1
  112. package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.js +1 -1
  113. package/lib/index.d.ts +32 -0
  114. package/lib/index.d.ts.map +1 -1
  115. package/lib/math/probability/binomial.d.ts +1 -0
  116. package/lib/math/probability/binomial.d.ts.map +1 -1
  117. package/lib/math/probability/binomial.js +20 -0
  118. package/lib/math/utils/stats/gaussianWithNoise.d.ts +3 -0
  119. package/lib/math/utils/stats/gaussianWithNoise.d.ts.map +1 -0
  120. package/lib/math/utils/stats/gaussianWithNoise.js +9 -0
  121. package/lib/playground.d.ts +5 -0
  122. package/lib/playground.d.ts.map +1 -1
  123. package/lib/playground.js +8 -1
  124. package/package.json +1 -1
@@ -0,0 +1,120 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../math/utils/random/randint.js";
4
+ import { random } from "../../../utils/alea/random.js";
5
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
6
+ const getPropositions = (n, { answer, operation, coeff }) => {
7
+ const propositions = [];
8
+ addValidProp(propositions, answer, "raw");
9
+ tryToAddWrongProp(propositions, `\`${operation}${coeff}\``, "raw");
10
+ tryToAddWrongProp(propositions, `\`x>1500\``, "raw");
11
+ tryToAddWrongProp(propositions, `\`${coeff}\``, "raw");
12
+ return shuffleProps(propositions, n);
13
+ };
14
+ const getAnswer = (identifiers) => {
15
+ return `\`x${identifiers.operation}${identifiers.coeff}\``;
16
+ };
17
+ const getInstruction = (identifiers) => {
18
+ const { coeff, operation } = identifiers;
19
+ let word = "";
20
+ if (operation === "*") {
21
+ if (coeff === 2)
22
+ word = "doubler ce nombre";
23
+ else if (coeff === 3)
24
+ word = "tripler ce nombre";
25
+ else
26
+ word = `multiplier ce nombre par $${coeff}$`;
27
+ }
28
+ else {
29
+ word = `additionner $${coeff}$ à ce nombre`;
30
+ }
31
+ return `On considère la fonction en Python ci-dessous. Cette fonction doit permettre, pour un paramètre \`x\` saisi en entrée, de déterminer combien de fois on doit ${word} pour qu'il dépasse $1500$.
32
+
33
+ Par quoi faut-il remplacer les trois points ?
34
+
35
+ \`\`\`
36
+ def boucle(x):
37
+ compt=0
38
+ while x<1500:
39
+ x=...
40
+ compt=compt+1
41
+ return compt
42
+ \`\`\`
43
+ `;
44
+ };
45
+ const getHint = (identifiers) => {
46
+ const { coeff, operation } = identifiers;
47
+ return `Sers-toi de cet exemple : en Python, si l'on veut diviser une variable \`a\` par $2$, on écrit :
48
+
49
+ \`\`\`
50
+ a = a/2
51
+ \`\`\``;
52
+ };
53
+ const getCorrection = (identifiers) => {
54
+ const { coeff, operation } = identifiers;
55
+ let word = "";
56
+ if (operation === "*") {
57
+ if (coeff === 2)
58
+ word = "doubler `x` ";
59
+ else if (coeff === 3)
60
+ word = "tripler `x`";
61
+ else
62
+ word = `multiplier \`x\` par $${coeff}$`;
63
+ }
64
+ else {
65
+ word = `additionner $${coeff}$ à \`x\``;
66
+ }
67
+ return `On veut ${word} à chaque exécution de la boucle \`while\`. En python, cela se traduit par :
68
+
69
+ \`\`\`
70
+ x=x${operation}${coeff}
71
+ \`\`\`
72
+ `;
73
+ };
74
+ const getKeys = (identifiers) => {
75
+ return ["x", "sup", "inf", "equal"];
76
+ };
77
+ const isAnswerValid = (ans, { answer }) => {
78
+ try {
79
+ return ans === answer;
80
+ }
81
+ catch (err) {
82
+ return handleVEAError(err);
83
+ }
84
+ };
85
+ const getPythonWhileStatementCompletionQuestion = (ops) => {
86
+ const identifiers = {
87
+ operation: random(["+", "*"]),
88
+ coeff: randint(2, 11),
89
+ };
90
+ return getQuestionFromIdentifiers(identifiers);
91
+ };
92
+ const getQuestionFromIdentifiers = (identifiers) => {
93
+ return {
94
+ answer: getAnswer(identifiers),
95
+ instruction: getInstruction(identifiers),
96
+ keys: getKeys(identifiers),
97
+ answerFormat: "raw",
98
+ identifiers,
99
+ hint: getHint(identifiers),
100
+ correction: getCorrection(identifiers),
101
+ };
102
+ };
103
+ export const pythonWhileStatementOperationCompletion = {
104
+ id: "pythonWhileStatementOperationCompletion",
105
+ label: "Compléter une instruction dans une boucle `while` en Python",
106
+ isSingleStep: true,
107
+ generator: (nb, opts) => getDistinctQuestions(() => getPythonWhileStatementCompletionQuestion(opts), nb, 15),
108
+ qcmTimer: 60,
109
+ freeTimer: 60,
110
+ getPropositions,
111
+ isAnswerValid,
112
+ subject: "Mathématiques",
113
+ getInstruction,
114
+ getHint,
115
+ getCorrection,
116
+ getQuestionFromIdentifiers,
117
+ hasHintAndCorrection: true,
118
+ answerType: "QCU",
119
+ maxAllowedQuestions: 15,
120
+ };
@@ -100,7 +100,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
100
100
  };
101
101
  export const variableType = {
102
102
  id: "variableType",
103
- label: "Déterminer le type dune variable en Python",
103
+ label: "Déterminer le type d'une variable en Python",
104
104
  isSingleStep: true,
105
105
  generator: (nb, opts) => getDistinctQuestions(() => getVariableTypeQuestion(opts), nb),
106
106
  qcmTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"whileLoop.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/whileLoop.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgIF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAY3C,CAAC"}
1
+ {"version":3,"file":"whileLoop.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/whileLoop.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiIF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAY3C,CAAC"}
@@ -18,6 +18,7 @@ const getInstruction = (identifiers) => {
18
18
  const { a, initialValue, opIndex, step, x } = identifiers;
19
19
  const op = operations[opIndex];
20
20
  return `Qu'affichera le programme suivant ?
21
+
21
22
  \`\`\`
22
23
  a = ${a}
23
24
  n = ${initialValue}
@@ -11,7 +11,7 @@ def boucle(x):
11
11
  return x
12
12
  \`\`\`
13
13
 
14
- Si l'on saisit la commande boucle($${inputValue}$), combien de fois la boucle s'exécute-t-elle ?`;
14
+ Si l'on saisit la commande \`boucle(${inputValue})\`, combien de fois la boucle s'exécute-t-elle ?`;
15
15
  };
16
16
  const getAnswer = ({ inputValue, threshold }) => {
17
17
  let x = inputValue;
@@ -53,7 +53,7 @@ const getQuestionFromIdentifiers = (identifiers) => ({
53
53
  hint: getHint(identifiers),
54
54
  correction: getCorrection(identifiers),
55
55
  keys: [],
56
- answerFormat: "raw",
56
+ answerFormat: "tex",
57
57
  identifiers,
58
58
  });
59
59
  const getPyWhileLoopCountQuestion = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"samplingFrequency.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sampling/samplingFrequency.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAwGF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAoBnD,CAAC"}
1
+ {"version":3,"file":"samplingFrequency.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sampling/samplingFrequency.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAsGF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAoBnD,CAAC"}
@@ -22,12 +22,10 @@ const getAnswer = (identifiers) => {
22
22
  };
23
23
  const getInstruction = (identifiers) => {
24
24
  const length = identifiers.samples.length;
25
- return `Ce graphique donne les fréquences $${length}$ échantillons d'une expérience aléatoire. Estimer la probabilité de l'évènement $A$.`;
25
+ return `Ce graphique donne les fréquences de $${length}$ échantillons d'une expérience aléatoire. Estimer la probabilité de l'évènement $A$.`;
26
26
  };
27
27
  const getHint = (identifiers) => {
28
- return `Chaque échantillon donne une valeur approximative proche de la probabilité réelle.
29
-
30
- Tu peux estimer cette probabilité en déterminant graphiquement la moyenne des fréquences des échantillons.`;
28
+ return `Tu peux estimer la probabilité de $A$ en déterminant graphiquement la moyenne des fréquences des échantillons.`;
31
29
  };
32
30
  const getCorrection = (identifiers) => {
33
31
  const { samples } = identifiers;
@@ -5,9 +5,9 @@ import { randint } from "../../../math/utils/random/randint.js";
5
5
  const getInstruction = (identifiers) => {
6
6
  const { coeffs } = identifiers;
7
7
  const u = new Polynomial(coeffs, "n");
8
- return `Soit $u$ la suite définie par $u_n = ${u
9
- .toTree()
10
- .toTex()}$. Quel est le sens de variations de $u$ ?`;
8
+ return `Soit $u$ la suite définie par $u_n = ${u.toTree().toTex()}$.
9
+
10
+ Quel est le sens de variations de $u$ ?`;
11
11
  };
12
12
  const getAnswer = (identifiers) => {
13
13
  const { coeffs } = identifiers;
@@ -80,7 +80,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
80
80
  instruction: getInstruction(identifiers),
81
81
  ggbOptions: getGGBOptions(identifiers),
82
82
  keys: [],
83
- answerFormat: "raw",
83
+ answerFormat: "tex",
84
84
  identifiers,
85
85
  hint: getHint(identifiers),
86
86
  correction: getCorrection(identifiers),
@@ -57,7 +57,7 @@ La tension $U_{DC}$ aux bornes de la diode est $${uDC}$ $V$.
57
57
 
58
58
  La tension $U_{ED}$ aux bornes du conducteur ohmique est $${uED} \\ \\textrm{V}$.
59
59
 
60
- Cacluler la tension de la pile $U_{AB}$.
60
+ Calculer la tension de la pile $U_{AB}$.
61
61
 
62
62
  ${schema}`;
63
63
  case "UED":
package/lib/index.d.ts CHANGED
@@ -1381,6 +1381,10 @@ declare const mathExercises: (Exercise<{
1381
1381
  shape: "square" | "rectangle";
1382
1382
  side: number;
1383
1383
  side2?: number;
1384
+ }, {}> | Exercise<{
1385
+ isEqui: boolean;
1386
+ side: number;
1387
+ base?: number;
1384
1388
  }, {}> | Exercise<{
1385
1389
  ratio: number;
1386
1390
  triangleIdentifiers: import("./math/geometry/triangles/triangle.js").TriangleIdentifiers;
@@ -1751,6 +1755,15 @@ declare const mathExercises: (Exercise<{
1751
1755
  }, {}> | Exercise<{
1752
1756
  triangleIdentifiers: import("./math/geometry/triangles/triangle.js").TriangleIdentifiers;
1753
1757
  angleAsked: number;
1758
+ }, {}> | Exercise<{
1759
+ perimeter: number;
1760
+ askingX: boolean;
1761
+ }, {}> | Exercise<{
1762
+ shape: number;
1763
+ side: number;
1764
+ }, {}> | Exercise<{
1765
+ shape: number;
1766
+ side: number;
1754
1767
  }, {}> | Exercise<{
1755
1768
  coeffs: number[];
1756
1769
  to: "+\\infty" | "-\\infty";
@@ -2511,6 +2524,25 @@ declare const mathExercises: (Exercise<{
2511
2524
  a: number;
2512
2525
  b: number;
2513
2526
  opName: string;
2527
+ }, {}> | Exercise<{
2528
+ coeff: number;
2529
+ iterations: number;
2530
+ operation: string;
2531
+ }, {}> | Exercise<{
2532
+ ineq: string;
2533
+ coeff: number;
2534
+ }, {}> | Exercise<{
2535
+ threshold: number;
2536
+ }, {}> | Exercise<{
2537
+ operation: string;
2538
+ coeff: number;
2539
+ }, {}> | Exercise<{
2540
+ coeff: number;
2541
+ iterations: number;
2542
+ operation: string;
2543
+ }, {}> | Exercise<{
2544
+ m: number;
2545
+ p: number;
2514
2546
  }, {}> | Exercise<{
2515
2547
  p: number;
2516
2548
  n: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
@@ -3,6 +3,7 @@ export declare class Binomial {
3
3
  n: number;
4
4
  p: AlgebraicNode;
5
5
  constructor(n: number, p: AlgebraicNode);
6
+ equals(k: number): number;
6
7
  sup(k: number): number;
7
8
  inf(k: number): number;
8
9
  ineq(a: number, b: number): number;
@@ -1 +1 @@
1
- {"version":3,"file":"binomial.d.ts","sourceRoot":"","sources":["../../../src/math/probability/binomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKlE,qBAAa,QAAQ;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,aAAa,CAAC;gBACL,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa;IAKvC,GAAG,CAAC,CAAC,EAAE,MAAM;IAWb,GAAG,CAAC,CAAC,EAAE,MAAM;IAWb,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;CAW1B"}
1
+ {"version":3,"file":"binomial.d.ts","sourceRoot":"","sources":["../../../src/math/probability/binomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKlE,qBAAa,QAAQ;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,aAAa,CAAC;gBACL,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa;IAoBvC,MAAM,CAAC,CAAC,EAAE,MAAM;IAQhB,GAAG,CAAC,CAAC,EAAE,MAAM;IAWb,GAAG,CAAC,CAAC,EAAE,MAAM;IAWb,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;CAW1B"}
@@ -7,6 +7,26 @@ export class Binomial {
7
7
  this.n = n;
8
8
  this.p = p;
9
9
  }
10
+ // //ex sample([1,2,3]) renvoit un échantillon [v_i] où v_i = nb de fois où on a obtenu i succès avec B(n,p)
11
+ // sample(values: number[]) {
12
+ // const proba = this.p.evaluate();
13
+ // const res = [];
14
+ // for (const v of values) {
15
+ // let count = 0;
16
+ // for (let i = 0; i < this.n; i++) {
17
+ // const success = Math.random() < proba;
18
+ // success && count++;
19
+ // }
20
+ // v === count && res.push(count);
21
+ // }
22
+ // return res;
23
+ // }
24
+ equals(k) {
25
+ const proba = this.p.evaluate();
26
+ return (combinations(k, this.n) *
27
+ Math.pow(proba, k) *
28
+ Math.pow(1 - proba, this.n - k));
29
+ }
10
30
  sup(k) {
11
31
  const proba = this.p.evaluate();
12
32
  return sum(k, this.n, (i) => combinations(i, this.n) *
@@ -0,0 +1,3 @@
1
+ import { AlgebraicNode } from "../../../tree/nodes/algebraicNode.js";
2
+ export declare const gaussianWithNoise: (n: number, p: AlgebraicNode) => number[];
3
+ //# sourceMappingURL=gaussianWithNoise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gaussianWithNoise.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/stats/gaussianWithNoise.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,eAAO,MAAM,iBAAiB,MAAO,MAAM,KAAK,aAAa,aAO5D,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Binomial } from "../../../math/probability/binomial.js";
2
+ export const gaussianWithNoise = (n, p) => {
3
+ const binomial = new Binomial(n, p);
4
+ const res = [];
5
+ for (let i = 0; i < n; i++) {
6
+ res.push(binomial.equals(i));
7
+ }
8
+ return res;
9
+ };
@@ -1,2 +1,7 @@
1
1
  export declare const playground: () => void;
2
+ /***
3
+ *
4
+ * !!TODO
5
+ * - j'ai l'impression que opposite(3).simplify() et numberNode(-3) ne passent pas "equals", j'ai du mal à comprendre pourquoi alors que opposite(3) se simplifie bien en numberNode
6
+ */
2
7
  //# sourceMappingURL=playground.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAwCA,eAAO,MAAM,UAAU,YAAW,CAAC"}
1
+ {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAwCA,eAAO,MAAM,UAAU,YAEtB,CAAC;AAEF;;;;GAIG"}
package/lib/playground.js CHANGED
@@ -1 +1,8 @@
1
- export const playground = () => { };
1
+ export const playground = () => {
2
+ // console.log(opposite(3).simplify());
3
+ };
4
+ /***
5
+ *
6
+ * !!TODO
7
+ * - j'ai l'impression que opposite(3).simplify() et numberNode(-3) ne passent pas "equals", j'ai du mal à comprendre pourquoi alors que opposite(3) se simplifie bien en numberNode
8
+ */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.101",
4
+ "version": "3.0.103",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [