math-exercises 3.0.145 → 3.0.146

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 (92) hide show
  1. package/lib/exercises/math/calcul/addAndSub.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/addAndSub.js +20 -1
  3. package/lib/exercises/math/calcul/index.d.ts +1 -0
  4. package/lib/exercises/math/calcul/index.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/index.js +1 -0
  6. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +2 -0
  7. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/mentalCaluls/index.js +2 -0
  9. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.d.ts.map +1 -1
  10. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +22 -0
  11. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.d.ts +9 -0
  12. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.d.ts.map +1 -0
  13. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.js +152 -0
  14. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.d.ts +15 -0
  15. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.d.ts.map +1 -0
  16. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.js +412 -0
  17. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
  18. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +37 -7
  19. package/lib/exercises/math/calcul/ratio/index.d.ts +2 -0
  20. package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -0
  21. package/lib/exercises/math/calcul/ratio/index.js +2 -0
  22. package/lib/exercises/math/calcul/ratio/partUsingRatio.d.ts +14 -0
  23. package/lib/exercises/math/calcul/ratio/partUsingRatio.d.ts.map +1 -0
  24. package/lib/exercises/math/calcul/ratio/partUsingRatio.js +388 -0
  25. package/lib/exercises/math/calcul/ratio/ratioFromParts.d.ts +10 -0
  26. package/lib/exercises/math/calcul/ratio/ratioFromParts.d.ts.map +1 -0
  27. package/lib/exercises/math/calcul/ratio/ratioFromParts.js +198 -0
  28. package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.d.ts.map +1 -1
  29. package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.js +50 -0
  30. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +1 -1
  31. package/lib/exercises/math/index.d.ts +1 -0
  32. package/lib/exercises/math/index.d.ts.map +1 -1
  33. package/lib/exercises/math/index.js +1 -0
  34. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
  35. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  36. package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
  37. package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.d.ts +10 -0
  38. package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.d.ts.map +1 -0
  39. package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.js +113 -0
  40. package/lib/exercises/math/probaStat/index.d.ts +1 -0
  41. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  42. package/lib/exercises/math/probaStat/index.js +1 -0
  43. package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts +8 -0
  44. package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -0
  45. package/lib/exercises/math/probaStat/stats1var/etendueTable.js +89 -0
  46. package/lib/exercises/math/probaStat/stats1var/index.d.ts +1 -0
  47. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  48. package/lib/exercises/math/probaStat/stats1var/index.js +1 -0
  49. package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.d.ts +8 -0
  50. package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.d.ts.map +1 -0
  51. package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.js +244 -0
  52. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
  53. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -0
  54. package/lib/exercises/math/probaStat/twoStepExperiments/index.js +2 -0
  55. package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.d.ts +8 -0
  56. package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.d.ts.map +1 -0
  57. package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.js +452 -0
  58. package/lib/exercises/math/scratch/index.d.ts +2 -0
  59. package/lib/exercises/math/scratch/index.d.ts.map +1 -0
  60. package/lib/exercises/math/scratch/index.js +1 -0
  61. package/lib/exercises/math/scratch/scratchLoopStepsCount.d.ts +8 -0
  62. package/lib/exercises/math/scratch/scratchLoopStepsCount.d.ts.map +1 -0
  63. package/lib/exercises/math/scratch/scratchLoopStepsCount.js +85 -0
  64. package/lib/exercises/math/scratch/testScratch.d.ts +8 -0
  65. package/lib/exercises/math/scratch/testScratch.d.ts.map +1 -0
  66. package/lib/exercises/math/scratch/testScratch.js +79 -0
  67. package/lib/exercises/math/trigonometry/index.d.ts +3 -0
  68. package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
  69. package/lib/exercises/math/trigonometry/index.js +3 -0
  70. package/lib/exercises/math/trigonometry/trigonometrySideName.d.ts +13 -0
  71. package/lib/exercises/math/trigonometry/trigonometrySideName.d.ts.map +1 -0
  72. package/lib/exercises/math/trigonometry/trigonometrySideName.js +189 -0
  73. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.d.ts +13 -0
  74. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.d.ts.map +1 -0
  75. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.js +290 -0
  76. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.d.ts +18 -0
  77. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.d.ts.map +1 -0
  78. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.js +386 -0
  79. package/lib/index.d.ts +58 -0
  80. package/lib/index.d.ts.map +1 -1
  81. package/lib/latexTester.d.ts.map +1 -1
  82. package/lib/latexTester.js +5 -0
  83. package/lib/math/geometry/triangles/triangle.d.ts +1 -0
  84. package/lib/math/geometry/triangles/triangle.d.ts.map +1 -1
  85. package/lib/math/geometry/triangles/triangle.js +1 -0
  86. package/lib/math/numbers/fractions/isDecimalFraction.d.ts +3 -0
  87. package/lib/math/numbers/fractions/isDecimalFraction.d.ts.map +1 -0
  88. package/lib/math/numbers/fractions/isDecimalFraction.js +14 -0
  89. package/lib/math/polynomials/polynomial.js +1 -1
  90. package/lib/types/keyIds.d.ts +1 -1
  91. package/lib/types/keyIds.d.ts.map +1 -1
  92. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
@@ -24,3 +24,4 @@ export * from "./sampling/index.js";
24
24
  export * from "./dataRepresentations/index.js";
25
25
  export * from "./tests/index.js";
26
26
  export * from "./pcExosInMath.js";
27
+ export * from "./scratch/index.js";
@@ -6,4 +6,5 @@ export * from "./getMissingProbabilityValue.js";
6
6
  export * from "./mostLeastProbable.js";
7
7
  export * from "./rouletteProbas.js";
8
8
  export * from "./possibleValuesForProba.js";
9
+ export * from "./rangeBasicProbas.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
@@ -6,3 +6,4 @@ export * from "./getMissingProbabilityValue.js";
6
6
  export * from "./mostLeastProbable.js";
7
7
  export * from "./rouletteProbas.js";
8
8
  export * from "./possibleValuesForProba.js";
9
+ export * from "./rangeBasicProbas.js";
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ min: number;
4
+ max: number;
5
+ target: number;
6
+ isIncluded: boolean;
7
+ };
8
+ export declare const rangeBasicProbas: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=rangeBasicProbas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rangeBasicProbas.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/rangeBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAqHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
@@ -0,0 +1,113 @@
1
+ import { shuffleProps, tryToAddWrongProp, addValidProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../../math/utils/random/randint.js";
4
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
5
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
6
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
7
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
8
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
9
+ const getInstruction = (identifiers) => {
10
+ const { min, max, target, isIncluded } = identifiers;
11
+ return `Sur un ordinateur, on exécute un programme qui retourne au hasard
12
+ un nombre entier compris entre $${min.frenchify()}$ et $${max.frenchify()}$
13
+ ${isIncluded ? "inclus" : "exclu"}.
14
+
15
+ Quelle est la probabilité que le programme retourne $${target.frenchify()}$ ?`;
16
+ };
17
+ const getAnswerNode = (identifiers) => {
18
+ const { min, max, isIncluded } = identifiers;
19
+ const nbIssues = (isIncluded ? max : max - 1) - min + 1;
20
+ return frac(1, nbIssues);
21
+ };
22
+ const getAnswer = (identifiers) => {
23
+ return getAnswerNode(identifiers).toTex();
24
+ };
25
+ const getHint = () => {
26
+ return `Détermine combien de nombres différents le programme peut retourner.`;
27
+ };
28
+ const getCorrection = (identifiers) => {
29
+ const { min, max, isIncluded, target } = identifiers;
30
+ const nbIssues = (isIncluded ? max : max - 1) - min + 1;
31
+ const answerTex = getAnswer(identifiers);
32
+ return `Entre $${min}$ et $${max}$ ${isIncluded ? "inclus" : "exclu"}, on a les nombres $${min}$, $${min + 1}$, $${min + 2}$, ..., $${max - 2}$, $${max - 1}$${isIncluded ? `, $${max}$` : ``}.
33
+
34
+ Cela fait $${nbIssues}$ issues possibles.
35
+ Il est sous-entendu qu'elles sont toutes équiprobables.
36
+ La probabilité que le programme retourne le nombre $${target}$ est donc $${answerTex}$.`;
37
+ };
38
+ const getPropositions = (n, { answer, ...identifiers }) => {
39
+ const { min, max, isIncluded, target } = identifiers;
40
+ const answerNode = getAnswerNode(identifiers);
41
+ const nbIssues = (isIncluded ? max : max - 1) - min + 1;
42
+ const propositions = [];
43
+ addValidProp(propositions, answerNode.toTex());
44
+ //isIncluded
45
+ [+1, -1]
46
+ .map((offset) => nbIssues + offset)
47
+ .forEach((nbIssuesWrong) => {
48
+ const wrongNode = frac(1, nbIssuesWrong);
49
+ tryToAddWrongProp(propositions, wrongNode.toTex());
50
+ });
51
+ //frac{issue}{nbIssues} + terror
52
+ {
53
+ const nbIssuesTerror = nbIssues + randint(-1, 2);
54
+ const wrongNode = frac(target, nbIssuesTerror);
55
+ tryToAddWrongProp(propositions, wrongNode.toTex());
56
+ }
57
+ //frac{1}{issue}
58
+ {
59
+ if (target !== 0) {
60
+ const wrongNode = frac(1, target);
61
+ tryToAddWrongProp(propositions, wrongNode.toTex());
62
+ }
63
+ else {
64
+ const wrongNode = nbIssues.toTree();
65
+ tryToAddWrongProp(propositions, wrongNode.toTex());
66
+ }
67
+ }
68
+ return shuffleProps(propositions, n);
69
+ };
70
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
71
+ try {
72
+ const nodeAns = parseAlgebraic(ans);
73
+ const nodeAnswer = getAnswerNode(identifiers);
74
+ return substract(nodeAns, nodeAnswer).simplify().evaluate() === 0;
75
+ }
76
+ catch (err) {
77
+ return handleVEAError(err);
78
+ }
79
+ };
80
+ const getBallsBasicProbasQuestion = () => {
81
+ const min = randint(0, 31);
82
+ const max = randint(min + 6, min + 30);
83
+ const target = randint(min, max);
84
+ const isIncluded = coinFlip();
85
+ const identifiers = { min, max, target, isIncluded };
86
+ return getQuestionFromIdentifiers(identifiers);
87
+ };
88
+ const getQuestionFromIdentifiers = (identifiers) => {
89
+ const question = {
90
+ answer: getAnswer(identifiers),
91
+ instruction: getInstruction(identifiers),
92
+ keys: [],
93
+ answerFormat: "tex",
94
+ identifiers,
95
+ hint: getHint(identifiers),
96
+ correction: getCorrection(identifiers),
97
+ };
98
+ return question;
99
+ };
100
+ export const rangeBasicProbas = {
101
+ id: "rangeBasicProbas",
102
+ connector: "=",
103
+ label: "Calculer la probabilité de piocher un nombre entre $a$ et $b$",
104
+ isSingleStep: true,
105
+ generator: (nb) => getDistinctQuestions(getBallsBasicProbasQuestion, nb),
106
+ qcmTimer: 60,
107
+ freeTimer: 60,
108
+ getPropositions,
109
+ isAnswerValid,
110
+ subject: "Mathématiques",
111
+ hasHintAndCorrection: true,
112
+ getQuestionFromIdentifiers,
113
+ };
@@ -15,4 +15,5 @@ export * from "./events/index.js";
15
15
  export * from "./basicProbas/index.js";
16
16
  export * from "./probaAsSumOfProbas.js";
17
17
  export * from "./conditionalProbaWriteFromFrench.js";
18
+ export * from "./twoStepExperiments/index.js";
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC"}
@@ -15,3 +15,4 @@ export * from "./events/index.js";
15
15
  export * from "./basicProbas/index.js";
16
16
  export * from "./probaAsSumOfProbas.js";
17
17
  export * from "./conditionalProbaWriteFromFrench.js";
18
+ export * from "./twoStepExperiments/index.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercise.js";
2
+ type Identifiers = {
3
+ randomValues: number[];
4
+ randomEffectives: number[];
5
+ };
6
+ export declare const etendueTable: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=etendueTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etendueTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/etendueTable.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAuGF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAa9C,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { randint } from "../../../../math/utils/random/randint.js";
2
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
3
+ import { dollarize } from "../../../../utils/latex/dollarize.js";
4
+ import { mdTable } from "../../../../utils/markdown/mdTable.js";
5
+ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercise.js";
6
+ import { getDistinctQuestions } from "../../../utils/getDistinctQuestions.js";
7
+ const getInstruction = ({ randomValues, randomEffectives, }) => {
8
+ return `On considère le tableau d'effectifs suivant :
9
+
10
+ ${mdTable([
11
+ ["Valeur", ...randomValues.map((e) => dollarize(e))],
12
+ ["Effectif", ...randomEffectives.map((e) => dollarize(e))],
13
+ ])}
14
+
15
+ Déterminer l'étendue de cette série de valeurs.`;
16
+ };
17
+ const getAnswer = (identifiers) => {
18
+ const { randomValues } = identifiers;
19
+ return (randomValues[randomValues.length - 1] - randomValues[0]).frenchify();
20
+ };
21
+ const getEtendueTable = () => {
22
+ const getRandomUniqueValues = (count, min, max) => {
23
+ const uniqueValues = new Set();
24
+ let counter = 0;
25
+ while (uniqueValues.size < count) {
26
+ counter++;
27
+ if (counter > 1000)
28
+ throw new Error("Too many iterations in medianWithTable");
29
+ uniqueValues.add(randint(min, max));
30
+ }
31
+ return Array.from(uniqueValues).sort((a, b) => a - b);
32
+ };
33
+ const randomValues = getRandomUniqueValues(5, 1, 20);
34
+ const randomEffectives = [1, 2, 3, 4, 5].map((_el) => randint(1, 6));
35
+ const sortedValues = [];
36
+ for (let i = 0; i < randomEffectives.length; i++)
37
+ for (let j = 0; j < randomEffectives[i]; j++)
38
+ sortedValues.push(randomValues[i]);
39
+ const identifiers = { randomValues, randomEffectives };
40
+ return getQuestionFromIdentifiers(identifiers);
41
+ };
42
+ const getHint = () => {
43
+ return `L'étendue d'une série est la différence entre la plus grande valeur et la plus petite valeur de la série.`;
44
+ };
45
+ const getCorrection = (identifiers) => {
46
+ const { randomValues } = identifiers;
47
+ return `La plus grande valeur de cette série est $${randomValues[randomValues.length - 1]}$ et la plus petite est $${randomValues[0]}$.
48
+
49
+ L'étendue de la série est donc $${randomValues[randomValues.length - 1] - randomValues[0]}$.
50
+ `;
51
+ };
52
+ const getQuestionFromIdentifiers = (identifiers) => {
53
+ const question = {
54
+ instruction: getInstruction(identifiers),
55
+ answer: getAnswer(identifiers),
56
+ keys: [],
57
+ answerFormat: "tex",
58
+ identifiers,
59
+ style: { tableHasNoHeader: true },
60
+ hint: getHint(identifiers),
61
+ correction: getCorrection(identifiers),
62
+ };
63
+ return question;
64
+ };
65
+ const getPropositions = (n, { answer, randomValues }) => {
66
+ const propositions = [];
67
+ addValidProp(propositions, answer);
68
+ propWhile(propositions, n, () => {
69
+ tryToAddWrongProp(propositions, randomValues[randint(0, randomValues.length)] + "");
70
+ });
71
+ return shuffle(propositions);
72
+ };
73
+ const isAnswerValid = (ans, { answer }) => {
74
+ return ans === answer;
75
+ };
76
+ export const etendueTable = {
77
+ id: "etendueTable",
78
+ connector: "=",
79
+ label: "Calcul de l'étendue d'un tableau d'effectifs",
80
+ isSingleStep: false,
81
+ generator: (nb) => getDistinctQuestions(getEtendueTable, nb),
82
+ qcmTimer: 60,
83
+ freeTimer: 60,
84
+ getPropositions,
85
+ isAnswerValid,
86
+ subject: "Mathématiques",
87
+ getQuestionFromIdentifiers,
88
+ hasHintAndCorrection: true,
89
+ };
@@ -20,4 +20,5 @@ export * from "./cumulativeSum.js";
20
20
  export * from "./getQuartileProportionQuestion.js";
21
21
  export * from "./interpretIndicatorsForLists.js";
22
22
  export * from "./plausibilityOfAverage.js";
23
+ export * from "./etendueTable.js";
23
24
  //# 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,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,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;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,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,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,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;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC"}
@@ -20,3 +20,4 @@ export * from "./cumulativeSum.js";
20
20
  export * from "./getQuartileProportionQuestion.js";
21
21
  export * from "./interpretIndicatorsForLists.js";
22
22
  export * from "./plausibilityOfAverage.js";
23
+ export * from "./etendueTable.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercise.js";
2
+ type Identifiers = {
3
+ situationIndex: number;
4
+ values: number[];
5
+ };
6
+ export declare const countIssuesTwoStepExperiment: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=countIssuesTwoStepExperiment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countIssuesTwoStepExperiment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAiB9B,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA0QF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAa9D,CAAC"}
@@ -0,0 +1,244 @@
1
+ import { randint } from "../../../../math/utils/random/randint.js";
2
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercise.js";
3
+ import { getDistinctQuestions } from "../../../utils/getDistinctQuestions.js";
4
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
5
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
6
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
7
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
8
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
9
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
10
+ import { random } from "../../../../utils/alea/random.js";
11
+ const situations = [
12
+ //independent
13
+ //{
14
+ //pulls et pantalons
15
+ {
16
+ instruction: (values) => {
17
+ return `Coralie doit s'habiller en vitesse.
18
+ Elle prend un pull au hasard dans l'armoire qui en contient $${values[0]}$, tous différents.
19
+ Dans la commode où il y a $${values[1]}$ pantalons, tous différents également, elle en attrape un, toujours au hasard.
20
+ Combien cette expérience aléatoire comporte-t-elle d'issues ?`;
21
+ },
22
+ correction: (values) => {
23
+ return `Les issues de cette expérience sont les différentes tenues (pull;pantalon).
24
+ Pour un pull donné, il y a $${values[1]}$ tenues possibles car il y a $${values[1]}$ pantalons possibles.
25
+ Or il y a $${values[0]}$ pulls.
26
+ Le nombre d'issues de cette expérience aléatoire est donc :
27
+
28
+ $$
29
+ ${values[0]} \\times ${values[1]} = ${(values[0] * values[1]).frenchify()}
30
+ $$`;
31
+ },
32
+ randValues: () => {
33
+ return [randint(3, 10), randint(3, 10)];
34
+ },
35
+ answerValue: (values) => values[0] * values[1],
36
+ },
37
+ //magicien: carte et feutre
38
+ {
39
+ instruction: (values) => {
40
+ return `Un magicien demande à quelqu'un du public de choisir une carte au hasard dans un paquet de $${values[0]}$ cartes
41
+ et un feutre pour écrire dessus, parmi $${values[1]}$ feutres de couleurs différentes.
42
+ Combien cette expérience aléatoire comporte-t-elle d'issues ?`;
43
+ },
44
+ correction: (values) => {
45
+ return `Les issues de cette expérience sont les couples (carte;feutre).
46
+ Pour une carte donnée, il y a $${values[1]}$ feutres possibles.
47
+ Or il y a $${values[0]}$ cartes.
48
+ Le nombre d'issues de cette expérience aléatoire est donc :
49
+
50
+ $$
51
+ ${values[0]} \\times ${values[1]} = ${(values[0] * values[1]).frenchify()}
52
+ $$`;
53
+ },
54
+ randValues: () => {
55
+ return [random([32, 52]), randint(5, 11)];
56
+ },
57
+ answerValue: (values) => values[0] * values[1],
58
+ },
59
+ //article et musique: article au hasard, musique au hasard
60
+ {
61
+ instruction: (values) => {
62
+ return `Wassim rentre chez lui après le travail.
63
+ Dans le métro, il demande à son téléphone de lui afficher un article de presse au hasard.
64
+ Ce soir là, il y a $${values[0]}$ articles disponibles.
65
+ Il lui demande aussi un morceau de musique au hasard parmi ses $${values[1]}$ morceaux favoris.
66
+ Combien cette expérience aléatoire comporte-t-elle d'issues ?`;
67
+ },
68
+ correction: (values) => {
69
+ return `Les issues de cette expérience sont les couples (article;morceau).
70
+ Pour un article donné, il y a $${values[1]}$ morceaux possibles pour en accompagner la lecture.
71
+ Or il y a $${values[0]}$ articles.
72
+ Le nombre d'issues de cette expérience aléatoire est donc :
73
+
74
+ $$
75
+ ${values[0]} \\times ${values[1]} = ${(values[0] * values[1]).frenchify()}
76
+ $$`;
77
+ },
78
+ randValues: () => {
79
+ return [random([15, 50]), randint(50, 250)];
80
+ },
81
+ answerValue: (values) => values[0] * values[1],
82
+ },
83
+ //représentants au hasard: fille et garçon
84
+ {
85
+ instruction: (values) => {
86
+ return `Pour représenter la classe à un concours d'orthographe, on choisit au hasard une fille et garçon.
87
+ Il y a $${values[0]}$ filles et $${values[1]}$ garçons dans la classe.
88
+ Combien cette expérience aléatoire comporte-t-elle d'issues ?`;
89
+ },
90
+ correction: (values) => {
91
+ return `Les issues de cette expérience sont les binômes (fille;garçon) envoyés au concours.
92
+ Pour une fille donnée, il y a $${values[1]}$ garçons possibles pour l'accompagner.
93
+ Or il y a $${values[0]}$ filles.
94
+ Le nombre d'issues de cette expérience aléatoire est donc :
95
+
96
+ $$
97
+ ${values[0]} \\times ${values[1]} = ${(values[0] * values[1]).frenchify()}
98
+ $$`;
99
+ },
100
+ randValues: () => {
101
+ return [randint(10, 18), randint(10, 18)];
102
+ },
103
+ answerValue: (values) => values[0] * values[1],
104
+ },
105
+ //sortie restaurant: ville au hasard, restaurant au hasard
106
+ {
107
+ instruction: (values) => {
108
+ return `Un week-end, un couple décide de laisser le hasard décider du restaurant dans lequel ils iront manger.
109
+ L'un des deux tire le nom d'une ville aléatoire dans une liste de $${values[0]}$ noms de villes.
110
+ Et l'autre tire le nom d'un restaurant parmi les $${values[1]}$ meilleurs de la ville tirée précédemment.
111
+ Combien cette expérience aléatoire comporte-t-elle d'issues ?`;
112
+ },
113
+ correction: (values) => {
114
+ return `Les issues de cette expérience sont les couples (ville;restaurant).
115
+ Pour une ville donnée, il y a $${values[1]}$ restaurants possibles.
116
+ Or il y a $${values[0]}$ villes.
117
+ Le nombre d'issues de cette expérience aléatoire est donc :
118
+
119
+ $$
120
+ ${values[0]} \\times ${values[1]} = ${(values[0] * values[1]).frenchify()}
121
+ $$`;
122
+ },
123
+ randValues: () => {
124
+ return [randint(5, 21), randint(3, 6)];
125
+ },
126
+ answerValue: (values) => values[0] * values[1],
127
+ },
128
+ //dnd: déX et déY
129
+ {
130
+ instruction: (values) => {
131
+ return `Frédéric joue à un jeu de rôle. Pour déterminer respectivement la force et la défense de son personnage,
132
+ il doit lancer un dé à $${values[0]}$ faces et un dé à $${values[1]}$ faces.
133
+ Combien cette expérience aléatoire comporte-t-elle d'issues ?`;
134
+ },
135
+ correction: (values) => {
136
+ return `Les issues de cette expérience sont les couples (valeur du premier dé; valeur du deuxième dé).
137
+ Pour un résultat donné du premier dé, il y a $${values[1]}$ résultats différents possibles suite au tirage du second dé.
138
+ Il y a $${values[0]}$ résultats possibles suite au tirage du premier dé.
139
+ Le nombre d'issues de cette expérience aléatoire est donc :
140
+
141
+ $$
142
+ ${values[0]} \\times ${values[1]} = ${(values[0] * values[1]).frenchify()}
143
+ $$`;
144
+ },
145
+ randValues: () => {
146
+ const a = random([4, 6, 10, 12, 20]);
147
+ const b = random([4, 6, 10, 12, 20], [a]);
148
+ return [a, b];
149
+ },
150
+ answerValue: (values) => values[0] * values[1],
151
+ },
152
+ //}
153
+ ];
154
+ const getInstruction = (identifiers) => {
155
+ const { situationIndex, values } = identifiers;
156
+ const situation = situations[situationIndex];
157
+ return situation.instruction(values);
158
+ };
159
+ const getAnswerNode = (identifiers) => {
160
+ const { situationIndex, values } = identifiers;
161
+ const situation = situations[situationIndex];
162
+ return situation.answerValue(values).toTree();
163
+ };
164
+ const getAnswer = (identifiers) => {
165
+ return getAnswerNode(identifiers).toTex();
166
+ };
167
+ const getHint = () => {
168
+ return `Si on choisit une lettre au hasard, puis un chiffre au hasard, cela fait $26\\times 10 = 260$ issues, car il y a $26$ lettres dans l'alphabet, et pour chaque lettre on peut choisir un chiffre entre $0$ et $9$ (ce qui fait $10$ chiffres).
169
+
170
+ Tu peux appliquer ce raisonnement à la situation de l'énoncé.`;
171
+ };
172
+ const getCorrection = (identifiers) => {
173
+ const { situationIndex, values } = identifiers;
174
+ const situation = situations[situationIndex];
175
+ return situation.correction(values);
176
+ };
177
+ const getPropositions = (n, { answer, ...identifiers }) => {
178
+ const { values } = identifiers;
179
+ const answerNode = getAnswerNode(identifiers);
180
+ const propositions = [];
181
+ addValidProp(propositions, answerNode.toTex());
182
+ //a+b
183
+ tryToAddWrongProp(propositions, add(values[0], values[1]).simplify().toTex());
184
+ //a^b
185
+ tryToAddWrongProp(propositions, power(values[0], values[1]).simplify().toTex());
186
+ //b^a
187
+ tryToAddWrongProp(propositions, power(values[1], values[0]).simplify().toTex());
188
+ //a
189
+ tryToAddWrongProp(propositions, values[0].frenchify());
190
+ //frac{1}{nbIssues} (student has not read the question)
191
+ {
192
+ const nbIssues = random([
193
+ answerNode,
194
+ add(values[0], values[1]),
195
+ power(values[0], values[1]),
196
+ power(values[1], values[0]),
197
+ ]);
198
+ const wrongNode = frac(1, nbIssues);
199
+ tryToAddWrongProp(propositions, wrongNode.toTex());
200
+ }
201
+ return shuffleProps(propositions, n);
202
+ };
203
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
204
+ try {
205
+ const nodeAns = parseAlgebraic(ans);
206
+ const nodeAnswer = getAnswerNode(identifiers);
207
+ return substract(nodeAns, nodeAnswer).simplify().evaluate() === 0;
208
+ }
209
+ catch (err) {
210
+ return handleVEAError(err);
211
+ }
212
+ };
213
+ const getCountIssuesTwoStepExperimentQuestion = () => {
214
+ const situationIndex = randint(0, situations.length);
215
+ const situation = situations[situationIndex];
216
+ const values = situation.randValues();
217
+ const identifiers = { situationIndex, values };
218
+ return getQuestionFromIdentifiers(identifiers);
219
+ };
220
+ const getQuestionFromIdentifiers = (identifiers) => {
221
+ const question = {
222
+ instruction: getInstruction(identifiers),
223
+ answer: getAnswer(identifiers),
224
+ keys: [],
225
+ answerFormat: "tex",
226
+ identifiers,
227
+ hint: getHint(identifiers),
228
+ correction: getCorrection(identifiers),
229
+ };
230
+ return question;
231
+ };
232
+ export const countIssuesTwoStepExperiment = {
233
+ id: "countIssuesTwoStepExperiment",
234
+ label: "Compter le nombre d'issues d'une expérience à deux épreuves",
235
+ isSingleStep: true,
236
+ generator: (nb) => getDistinctQuestions(getCountIssuesTwoStepExperimentQuestion, nb),
237
+ qcmTimer: 60,
238
+ freeTimer: 60,
239
+ getPropositions,
240
+ isAnswerValid,
241
+ subject: "Mathématiques",
242
+ hasHintAndCorrection: true,
243
+ getQuestionFromIdentifiers,
244
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./countIssuesTwoStepExperiment.js";
2
+ export * from "./twoStepExperimentProbas.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./countIssuesTwoStepExperiment.js";
2
+ export * from "./twoStepExperimentProbas.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercise.js";
2
+ type Identifiers = {
3
+ situationIndex: number;
4
+ values: number[][];
5
+ };
6
+ export declare const twoStepExperimentProbas: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=twoStepExperimentProbas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twoStepExperimentProbas.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AA0B9B,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CACpB,CAAC;AAyiBF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}