math-exercises 3.0.102 → 3.0.104

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 (71) hide show
  1. package/lib/exercises/math/curve/sqrtCurvePoint.d.ts.map +1 -1
  2. package/lib/exercises/math/curve/sqrtCurvePoint.js +4 -2
  3. package/lib/exercises/math/curve/squareCurvePoint.d.ts.map +1 -1
  4. package/lib/exercises/math/curve/squareCurvePoint.js +4 -2
  5. package/lib/exercises/math/functions/sign/equationFromSignTable.js +1 -1
  6. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.d.ts.map +1 -1
  7. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.js +10 -2
  8. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
  9. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +3 -2
  10. package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.d.ts.map +1 -1
  11. package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.js +8 -1
  12. package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.js +6 -7
  13. package/lib/exercises/math/geometry/vectors/parallelogram/parallelogramCriterion.js +1 -1
  14. package/lib/exercises/math/geometry/vectors/vectorCoordinatesFromTwoPoints.d.ts.map +1 -1
  15. package/lib/exercises/math/geometry/vectors/vectorCoordinatesFromTwoPoints.js +33 -10
  16. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.d.ts.map +1 -1
  17. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +39 -9
  18. package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +1 -1
  19. package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +1 -1
  20. package/lib/exercises/math/probaStat/basicProbas/ballsBasicProbas.js +1 -1
  21. package/lib/exercises/math/probaStat/basicProbas/cardBasicProbas.d.ts.map +1 -1
  22. package/lib/exercises/math/probaStat/basicProbas/cardBasicProbas.js +1 -3
  23. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.d.ts.map +1 -1
  24. package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.js +5 -3
  25. package/lib/exercises/math/probaStat/events/describeEvent.d.ts.map +1 -1
  26. package/lib/exercises/math/probaStat/events/describeEvent.js +4 -10
  27. package/lib/exercises/math/probaStat/events/eventNotation.d.ts.map +1 -1
  28. package/lib/exercises/math/probaStat/events/eventNotation.js +4 -10
  29. package/lib/exercises/math/probaStat/issuesCountingForCards.js +1 -1
  30. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  31. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +5 -3
  32. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  33. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +10 -2
  34. package/lib/exercises/math/probaStat/stats1var/averageLinearity.d.ts.map +1 -1
  35. package/lib/exercises/math/probaStat/stats1var/averageLinearity.js +5 -4
  36. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.d.ts.map +1 -1
  37. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.js +14 -32
  38. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts +1 -1
  39. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts.map +1 -1
  40. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +115 -94
  41. package/lib/exercises/math/probaStat/stats1var/interquartilesList.d.ts.map +1 -1
  42. package/lib/exercises/math/probaStat/stats1var/interquartilesList.js +1 -0
  43. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
  44. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +1 -0
  45. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  46. package/lib/exercises/math/probaStat/stats1var/quartiles.js +1 -0
  47. package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
  48. package/lib/exercises/math/probaStat/stats1var/quartilesList.js +1 -0
  49. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
  50. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +1 -1
  51. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.js +1 -1
  52. package/lib/exercises/math/python/variableType.js +1 -1
  53. package/lib/exercises/math/python/whileLoop.d.ts.map +1 -1
  54. package/lib/exercises/math/python/whileLoop.js +1 -0
  55. package/lib/exercises/math/python/whileLoopCount.js +2 -2
  56. package/lib/exercises/math/sampling/samplingFrequency.d.ts.map +1 -1
  57. package/lib/exercises/math/sampling/samplingFrequency.js +1 -3
  58. package/lib/exercises/math/sequences/genericSequenceVariations.js +3 -3
  59. package/lib/exercises/math/sequences/sequencePlot.js +1 -1
  60. package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.js +1 -1
  61. package/lib/index.d.ts +1 -1
  62. package/lib/math/probability/binomial.d.ts +1 -0
  63. package/lib/math/probability/binomial.d.ts.map +1 -1
  64. package/lib/math/probability/binomial.js +20 -0
  65. package/lib/math/utils/stats/gaussianWithNoise.d.ts +3 -0
  66. package/lib/math/utils/stats/gaussianWithNoise.d.ts.map +1 -0
  67. package/lib/math/utils/stats/gaussianWithNoise.js +9 -0
  68. package/lib/playground.d.ts +5 -0
  69. package/lib/playground.d.ts.map +1 -1
  70. package/lib/playground.js +8 -1
  71. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../math/utils/random/randint.js";
4
+ import { round } from "../../../../math/utils/round.js";
4
5
  import { add } from "../../../../tree/nodes/operators/addNode.js";
5
- import { divide } from "../../../../tree/nodes/operators/divideNode.js";
6
6
  import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
7
  import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
8
  import { substract } from "../../../../tree/nodes/operators/substractNode.js";
@@ -70,7 +70,7 @@ const getAnswer = (identifiers) => {
70
70
  return multiply(moyenne, factor).simplify().toTex();
71
71
  case "division":
72
72
  default:
73
- return frac(moyenne, factor).simplify().toTex();
73
+ return round(moyenne / factor, 4).frenchify();
74
74
  }
75
75
  };
76
76
  const getInstruction = (identifiers) => {
@@ -134,7 +134,7 @@ const getCorrection = (identifiers) => {
134
134
  break;
135
135
  case "division":
136
136
  default:
137
- latexFormula = `${divide(moyenne, factor).toTex()} = ${frac(moyenne, factor).toTex()}`;
137
+ latexFormula = `${frac(moyenne, factor).toTex()} = ${round(moyenne / factor, 4).frenchify()}`;
138
138
  break;
139
139
  }
140
140
  return `Il y a eu une ${operator} de $${factor.frenchify()}$ sur les valeurs de la série, donc la moyenne devient :
@@ -146,7 +146,7 @@ $$`;
146
146
  const isAnswerValid = (ans, { answer }) => {
147
147
  try {
148
148
  const parsed = parseAlgebraic(ans);
149
- return parsed.simplify().toTex() === answer;
149
+ return parsed.simplify({ fractionsToDecimal: true }).toTex() === answer;
150
150
  }
151
151
  catch (err) {
152
152
  return handleVEAError(err);
@@ -214,4 +214,5 @@ export const averageLinearity = {
214
214
  getAnswer,
215
215
  getQuestionFromIdentifiers,
216
216
  hasHintAndCorrection: true,
217
+ shouldHaveCalculator: true,
217
218
  };
@@ -1 +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"}
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;AAerC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA+HF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAqBzD,CAAC"}
@@ -1,42 +1,23 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
5
  import { randint } from "../../../../math/utils/random/randint.js";
5
6
  import { round } from "../../../../math/utils/round.js";
6
- import { standardDeviation } from "../../../../math/utils/stats/standardDeviation.js";
7
- import { average } from "../../../../utils/average.js";
7
+ import { gaussianWithNoise } from "../../../../math/utils/stats/gaussianWithNoise.js";
8
+ import { standardDeviationWithEffectifs, } from "../../../../math/utils/stats/standardDeviation.js";
9
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
+ import { averageWithEffectifs } from "../../../../utils/average.js";
8
11
  const getPropositions = (n, { answer }) => {
9
12
  const propositions = [];
10
13
  addValidProp(propositions, answer, "raw");
11
14
  tryToAddWrongProp(propositions, "Série A", "raw");
12
15
  tryToAddWrongProp(propositions, "Série B", "raw");
13
- tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
14
16
  return shuffleProps(propositions, n);
15
17
  };
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
18
  const getAnswer = ({ serie1, serie2, labels }) => {
38
- const std1 = standardDeviation(serie1);
39
- const std2 = standardDeviation(serie2);
19
+ const std1 = standardDeviationWithEffectifs(labels, serie1);
20
+ const std2 = standardDeviationWithEffectifs(labels, serie2);
40
21
  return std1 > std2 ? "Série A" : "Série B";
41
22
  };
42
23
  const getInstruction = () => {
@@ -47,8 +28,8 @@ const getHint = () => {
47
28
  };
48
29
  const getCorrection = (identifiers) => {
49
30
  const { serie1, serie2, labels } = identifiers;
50
- const average1 = average(serie1);
51
- const average2 = average(serie2);
31
+ const average1 = averageWithEffectifs(labels, serie1);
32
+ const average2 = averageWithEffectifs(labels, serie2);
52
33
  const result = getAnswer(identifiers);
53
34
  const otherSeries = result === "Série A" ? "série B" : "série A";
54
35
  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()}$).
@@ -96,12 +77,13 @@ const isAnswerValid = (ans, { answer }) => {
96
77
  const getCompareSeriesDispersionQuestion = () => {
97
78
  const labels = [10, 20, 30, 40];
98
79
  const baseValue = randint(10, 25);
99
- const serie1 = labels.map(() => randint(baseValue - 3, baseValue + 3));
100
- const serie2 = labels.map(() => randint(1, 35));
80
+ const firstIsAnswer = coinFlip();
81
+ const wrong = labels.map(() => randint(baseValue - 3, baseValue + 3));
82
+ const right = gaussianWithNoise(4, randfloat(0.1, 0.9).toTree()).map((e) => Math.min(e * 60, 30));
101
83
  const identifiers = {
102
84
  labels,
103
- serie1,
104
- serie2,
85
+ serie1: firstIsAnswer ? right : wrong,
86
+ serie2: firstIsAnswer ? wrong : right,
105
87
  };
106
88
  return getQuestionFromIdentifiers(identifiers);
107
89
  };
@@ -3,7 +3,7 @@ type Identifiers = {
3
3
  labels: string[];
4
4
  serie1: number[];
5
5
  serie2: number[];
6
- a: number;
6
+ a?: number;
7
7
  b: number;
8
8
  isBetween: boolean;
9
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getQuartileProportionQuestion.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,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;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAwMF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}
1
+ {"version":3,"file":"getQuartileProportionQuestion.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAoOF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../math/utils/random/randint.js";
4
+ import { randTupleInt } from "../../../../math/utils/random/randTupleInt.js";
4
5
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
5
6
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
7
  import { dollarize } from "../../../../utils/latex/dollarize.js";
@@ -13,30 +14,16 @@ const getPropositions = (n, { answer }) => {
13
14
  return shuffleProps(propositions, n);
14
15
  };
15
16
  const getAnswer = ({ serie1, serie2, a, b, isBetween, }) => {
16
- const mainSeries = serie1.includes(b) ? serie1 : serie2;
17
- const otherSeries = mainSeries === serie1 ? serie2 : serie1;
18
- const indexOfB = mainSeries.indexOf(b);
19
- const indexOfA = mainSeries.indexOf(a);
20
- const diff = indexOfB - indexOfA + 1;
21
- let count = 0;
22
- for (let idx = 0; idx < otherSeries.length; idx++) {
23
- const val = otherSeries[idx];
24
- if (isBetween) {
25
- if ((val >= a || otherSeries[idx + 1] > a) &&
26
- (val <= b || otherSeries[idx - 1] < b)) {
27
- count++;
28
- }
29
- }
30
- else {
31
- if (val < b) {
32
- count++;
33
- }
34
- }
17
+ if (isBetween) {
18
+ const serie1Space = serie1.indexOf(b) - serie1.indexOf(a);
19
+ const serie2Space = serie2.indexOf(b) - serie2.indexOf(a);
20
+ return serie1Space > serie2Space ? "Série $1$" : "Série $2$";
21
+ }
22
+ else {
23
+ const serie1Index = serie1.indexOf(b);
24
+ const serie2Index = serie2.indexOf(b);
25
+ return serie1Index < serie2Index ? "Série $1$" : "Série $2$";
35
26
  }
36
- const mainSeriesText = mainSeries === serie1 ? "Série $1$" : "Série $2$";
37
- const otherSeriesText = mainSeries === serie1 ? "Série $2$" : "Série $1$";
38
- const condition = isBetween ? diff >= count : indexOfB < count;
39
- return condition ? mainSeriesText : otherSeriesText;
40
27
  };
41
28
  const getInstruction = ({ labels, serie1, serie2, a, b, isBetween, }) => {
42
29
  const question = isBetween
@@ -60,63 +47,29 @@ Les quartiles permettent de découper une série en quatre parties égales :
60
47
  };
61
48
  const getCorrection = (identifiers) => {
62
49
  const { labels, serie1, serie2, a, b, isBetween } = identifiers;
63
- const isBInSerie1 = serie1.includes(b);
64
- const mainSeries = isBInSerie1 ? serie1 : serie2;
65
- const otherSeries = isBInSerie1 ? serie2 : serie1;
66
- const mainSeriesLabel = isBInSerie1 ? "série $1$" : "série $2$";
67
- const otherSeriesLabel = isBInSerie1 ? "série $2$" : "série $1$";
68
- const indexOfA = mainSeries.indexOf(a);
69
- const indexOfB = mainSeries.indexOf(b);
70
- let i = 0;
71
- for (let idx = 0; idx < otherSeries.length; idx++) {
72
- const val = otherSeries[idx];
73
- if (isBetween) {
74
- if ((val >= a || otherSeries[idx + 1] > a) &&
75
- (val <= b || otherSeries[idx - 1] < b)) {
76
- i++;
77
- }
78
- }
79
- else {
80
- if (val < b) {
81
- i++;
82
- }
83
- }
50
+ const labelDollarized = labels.map((l, i) => i === 1 || i === 3 ? dollarize(l) : l);
51
+ if (isBetween) {
52
+ const serie1BIndex = serie1.indexOf(b);
53
+ const serie2BIndex = serie2.indexOf(b);
54
+ const serie1AIndex = serie1.indexOf(a);
55
+ const serie2AIndex = serie2.indexOf(a);
56
+ const serie1Space = serie1BIndex - serie1AIndex;
57
+ const serie2Space = serie2BIndex - serie2AIndex;
58
+ return `Dans la série $1$, ${labelDollarized[serie1AIndex]} $=${a}$, et ${labelDollarized[serie1BIndex]} $=${b}$, donc $${serie1Space * 25} \\%$ des valeurs sont comprises entre $${a}$ et $${b}$.
59
+
60
+ Dans la série $2$, ${labelDollarized[serie2AIndex]} $=${a}$, et ${labelDollarized[serie2BIndex]} $=${b}$, donc $${serie2Space * 25} \\%$ des valeurs sont comprises entre $${a}$ et $${b}$.
61
+
62
+ C'est donc la ${serie2Space < serie1Space ? "série $1$" : "série $2$"} qui a la plus grande proportion de valeurs supérieures à $${b}$.`;
84
63
  }
85
- const quartilePercentages = [0, 25, 50, 75, 100];
86
- const labelA = labels[indexOfA];
87
- const labelB = labels[indexOfB];
88
- const valueA = a;
89
- const valueB = b;
90
- const diff = indexOfB - indexOfA + 1;
91
- const percentageBetween = quartilePercentages[diff - 1];
92
- const percentageAbove = 100 - quartilePercentages[indexOfB];
93
- const answer = getAnswer(identifiers);
94
- const answerFormatted = answer === "Série $1$" ? "série $1$" : "série $2$";
95
- const decideWord = answerFormatted === mainSeriesLabel ? "moins" : "plus";
96
- const proportionB = isBetween
97
- ? `$${percentageBetween}\\%$ des valeurs sont entre $${valueA}$ et $${valueB}$.\n\n`
98
- : `$${percentageAbove}\\%$ des valeurs sont supérieures à $${valueB}$.\n\n`;
99
- const proportionOther = i === 0
100
- ? `Il n'y a aucune valeur dans l'intervalle $[${valueA}; ${valueB}]$.\n\n`
101
- : isBetween
102
- ? `${decideWord} $${percentageBetween}\\%$ des valeurs sont entre $${valueA}$ et $${valueB}$.\n\n`
103
- : `${otherSeries[indexOfB] > valueB ? "plus" : "moins"} de $${100 - quartilePercentages[i - 1]}\\%$ des valeurs sont supérieures à $${valueB}$.\n\n`;
104
- const comparison = isBetween
105
- ? `La ${answer} a donc une proportion plus grande de valeurs dans l'intervalle.`
106
- : `La ${answer} a donc une proportion plus grande de valeurs supérieures à $${valueB}$.`;
107
- return isBetween
108
- ? `On peut estimer cette proportion en observant la position des valeurs $${valueA}$ et $${valueB}$ dans chaque série :
64
+ else {
65
+ const serie1Index = serie1.indexOf(b);
66
+ const serie2Index = serie2.indexOf(b);
67
+ return `Dans la série $1$, ${labelDollarized[serie1Index]} $=${b}$, donc $${100 - serie1Index * 25} \\%$ des valeurs sont supérieures à $${b}$.
109
68
 
110
- - Dans la ${mainSeriesLabel}, on a $${labelA} = ${valueA}$ et $${labelB} = ${valueB}$, donc ${proportionB}
111
- - Dans la ${otherSeriesLabel}, on a $${labelA} = ${otherSeries[indexOfA]}$ et $${labelB} = ${otherSeries[indexOfB]}$, donc ${proportionOther}
112
-
113
- ${comparison}`
114
- : `On peut estimer cette proportion en observant la position de la valeur $${valueB}$ dans chaque série :
115
-
116
- - Dans la ${mainSeriesLabel}, on a $${labelB} = ${valueB}$, donc ${proportionB}
117
- - Dans la ${otherSeriesLabel}, on a $${labelB} = ${otherSeries[indexOfB]}$, ${proportionOther}
118
-
119
- ${comparison}`;
69
+ Dans la série $2$, ${labelDollarized[serie2Index]} $=${b}$, donc $${100 - serie2Index * 25} \\%$ des valeurs sont supérieures à $${b}$.
70
+
71
+ C'est donc la ${serie1Index < serie2Index ? "série $1$" : "série $2$"} qui a la plus grande proportion de valeurs supérieures à $${b}$.`;
72
+ }
120
73
  };
121
74
  const getKeys = () => [];
122
75
  const isAnswerValid = (ans, { answer }) => {
@@ -127,25 +80,93 @@ const isAnswerValid = (ans, { answer }) => {
127
80
  return handleVEAError(err);
128
81
  }
129
82
  };
130
- const makeQuartileSeries = (min, exclude) => {
131
- const serie = [min];
132
- for (let i = 0; i < 4; i++) {
133
- const prev = serie[serie.length - 1];
134
- serie.push(randint(prev + 1, prev + 6, exclude));
135
- }
136
- return serie;
137
- };
138
83
  const getGetQuartileProportionQuestionQuestion = () => {
139
84
  const labels = ["Min", "Q_1", "Méd", "Q_3", "Max"];
140
- const min = randint(0, 10);
141
- const serie1 = makeQuartileSeries(min);
142
- const serie2 = makeQuartileSeries(min, serie1);
85
+ let a = undefined;
86
+ let b;
87
+ let serie1;
88
+ let serie2;
143
89
  const isBetween = coinFlip();
144
- const chosenSerie = coinFlip() ? serie1 : serie2;
145
- const indexOfA = randint(0, serie1.length - (isBetween ? 1 : 2));
146
- const a = chosenSerie[indexOfA];
147
- const indexOfB = randint(indexOfA + 1, isBetween ? chosenSerie.length : chosenSerie.length - 1);
148
- const b = chosenSerie[indexOfB];
90
+ if (isBetween) {
91
+ const serie1Indexes = randTupleInt(2, {
92
+ from: 0,
93
+ to: 5,
94
+ allDifferent: true,
95
+ }).sort((a, b) => a - b);
96
+ let serie2Indexes = [];
97
+ do {
98
+ serie2Indexes = randTupleInt(2, {
99
+ from: 0,
100
+ to: 5,
101
+ allDifferent: true,
102
+ }).sort((a, b) => a - b);
103
+ } while (serie2Indexes[1] - serie2Indexes[0] ===
104
+ serie1Indexes[1] - serie1Indexes[0] ||
105
+ (serie1Indexes[0] === serie2Indexes[0] &&
106
+ serie1Indexes[1] === serie2Indexes[1]));
107
+ a = randint(5, 20);
108
+ b = randint(a + 5, 30);
109
+ const serie1Prev = randTupleInt(serie1Indexes[0], {
110
+ from: 1,
111
+ to: a,
112
+ allDifferent: true,
113
+ }).sort((a, b) => a - b);
114
+ const serie1Between = randTupleInt(serie1Indexes[1] - serie1Indexes[0] - 1, {
115
+ from: a + 1,
116
+ to: b,
117
+ allDifferent: true,
118
+ }).sort((a, b) => a - b);
119
+ const serie1End = randTupleInt(4 - serie1Indexes[1], {
120
+ from: b + 1,
121
+ to: 40,
122
+ allDifferent: true,
123
+ }).sort((a, b) => a - b);
124
+ const serie2Prev = randTupleInt(serie2Indexes[0], {
125
+ from: 1,
126
+ to: a,
127
+ allDifferent: true,
128
+ }).sort((a, b) => a - b);
129
+ const serie2Between = randTupleInt(serie2Indexes[1] - serie2Indexes[0] - 1, {
130
+ from: a + 1,
131
+ to: b,
132
+ allDifferent: true,
133
+ }).sort((a, b) => a - b);
134
+ const serie2End = randTupleInt(4 - serie2Indexes[1], {
135
+ from: b + 1,
136
+ to: 40,
137
+ allDifferent: true,
138
+ }).sort((a, b) => a - b);
139
+ serie1 = [...serie1Prev, a, ...serie1Between, b, ...serie1End];
140
+ serie2 = [...serie2Prev, a, ...serie2Between, b, ...serie2End];
141
+ }
142
+ else {
143
+ b = randint(5, 20);
144
+ //build les deux series avec a ayant un index <4 et différents
145
+ const serie1Index = randint(0, 4);
146
+ const serie2Index = randint(0, 4, [serie1Index]);
147
+ const serie1Prev = randTupleInt(serie1Index, {
148
+ from: 1,
149
+ to: b,
150
+ allDifferent: true,
151
+ }).sort((a, b) => a - b);
152
+ const serie2Prev = randTupleInt(serie2Index, {
153
+ from: 1,
154
+ to: b,
155
+ allDifferent: true,
156
+ }).sort((a, b) => a - b);
157
+ const serie1Next = randTupleInt(4 - serie1Index, {
158
+ from: b + 1,
159
+ to: 30,
160
+ allDifferent: true,
161
+ }).sort((a, b) => a - b);
162
+ const serie2Next = randTupleInt(4 - serie2Index, {
163
+ from: b + 1,
164
+ to: 30,
165
+ allDifferent: true,
166
+ }).sort((a, b) => a - b);
167
+ serie1 = [...serie1Prev, b, ...serie1Next];
168
+ serie2 = [...serie2Prev, b, ...serie2Next];
169
+ }
149
170
  const identifiers = { labels, serie1, serie2, a, b, isBetween };
150
171
  return getQuestionFromIdentifiers(identifiers);
151
172
  };
@@ -1 +1 @@
1
- {"version":3,"file":"interquartilesList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/interquartilesList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAyFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
1
+ {"version":3,"file":"interquartilesList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/interquartilesList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAyFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
@@ -87,4 +87,5 @@ export const interquartilesList = {
87
87
  subject: "Mathématiques",
88
88
  getQuestionFromIdentifiers,
89
89
  hasHintAndCorrection: true,
90
+ shouldHaveCalculator: true,
90
91
  };
@@ -1 +1 @@
1
- {"version":3,"file":"interquartilesTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/interquartilesTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAqHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
1
+ {"version":3,"file":"interquartilesTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/interquartilesTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAqHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAerD,CAAC"}
@@ -110,4 +110,5 @@ export const interquartilesTable = {
110
110
  subject: "Mathématiques",
111
111
  hasHintAndCorrection: true,
112
112
  getQuestionFromIdentifiers,
113
+ shouldHaveCalculator: true,
113
114
  };
@@ -1 +1 @@
1
- {"version":3,"file":"quartiles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/quartiles.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,QAAQ,EAaT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA6HF,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":"AAYA,OAAO,EACL,QAAQ,EAaT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA6HF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAc3C,CAAC"}
@@ -112,4 +112,5 @@ export const quartiles = {
112
112
  subject: "Mathématiques",
113
113
  getQuestionFromIdentifiers,
114
114
  hasHintAndCorrection: true,
115
+ shouldHaveCalculator: true,
115
116
  };
@@ -1 +1 @@
1
- {"version":3,"file":"quartilesList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/quartilesList.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAgGF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAa/C,CAAC"}
1
+ {"version":3,"file":"quartilesList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/quartilesList.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAgGF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAc/C,CAAC"}
@@ -94,4 +94,5 @@ export const quartilesList = {
94
94
  subject: "Mathématiques",
95
95
  getQuestionFromIdentifiers,
96
96
  hasHintAndCorrection: true,
97
+ shouldHaveCalculator: true,
97
98
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fineAdjustementExercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/fineAdjustementExercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAM5C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;CAChD,CAAC;AAyIF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
1
+ {"version":3,"file":"fineAdjustementExercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/fineAdjustementExercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAM5C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;CAChD,CAAC;AA0IF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
@@ -83,7 +83,7 @@ const getPropositions = (n, { answer, isJustified }) => {
83
83
  let randomNb;
84
84
  while (propositions.length < n) {
85
85
  randomNb = randfloat(0, 0.5, 2);
86
- tryToAddWrongProp(propositions, `Un ajustement affine est justifié. Le coefficient de détermination vaut ${randomNb}`);
86
+ tryToAddWrongProp(propositions, `Un ajustement affine est justifié. Le coefficient de détermination vaut ${randomNb}`, "raw");
87
87
  }
88
88
  return shuffleProps(propositions, n);
89
89
  };
@@ -40,7 +40,7 @@ Par quoi faut-il remplacer les trois points ?
40
40
  def boucle(a):
41
41
  for num in range(${iterations}):
42
42
  a=...
43
- return a
43
+ return a
44
44
  \`\`\`
45
45
  `;
46
46
  };
@@ -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"}
@@ -25,9 +25,7 @@ const getInstruction = (identifiers) => {
25
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
@@ -2061,7 +2061,7 @@ declare const mathExercises: (Exercise<{
2061
2061
  labels: string[];
2062
2062
  serie1: number[];
2063
2063
  serie2: number[];
2064
- a: number;
2064
+ a?: number;
2065
2065
  b: number;
2066
2066
  isBetween: boolean;
2067
2067
  }, {}> | Exercise<{
@@ -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"}