math-exercises 3.0.77 → 3.0.78

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 (48) hide show
  1. package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.d.ts +10 -0
  2. package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.d.ts.map +1 -0
  3. package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.js +112 -0
  4. package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.d.ts +8 -0
  5. package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.d.ts.map +1 -0
  6. package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.js +123 -0
  7. package/lib/exercises/math/calcul/arithmetics/index.d.ts +3 -0
  8. package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/arithmetics/index.js +3 -0
  10. package/lib/exercises/math/calcul/arithmetics/sqrtInequality.d.ts +10 -0
  11. package/lib/exercises/math/calcul/arithmetics/sqrtInequality.d.ts.map +1 -0
  12. package/lib/exercises/math/calcul/arithmetics/sqrtInequality.js +160 -0
  13. package/lib/exercises/math/calcul/sign/absoluteNumber.js +1 -1
  14. package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
  15. package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +5 -1
  16. package/lib/exercises/math/functions/basics/graphicEquation.d.ts.map +1 -1
  17. package/lib/exercises/math/functions/basics/graphicEquation.js +33 -1
  18. package/lib/exercises/math/functions/basics/twoFunctionsEquation.d.ts.map +1 -1
  19. package/lib/exercises/math/functions/basics/twoFunctionsEquation.js +27 -0
  20. package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts.map +1 -1
  21. package/lib/exercises/math/functions/variations/varTableExtremaReading.js +23 -8
  22. package/lib/exercises/math/geometry/angles/index.d.ts +1 -0
  23. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
  24. package/lib/exercises/math/geometry/angles/index.js +1 -0
  25. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts +8 -0
  26. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts.map +1 -0
  27. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.js +92 -0
  28. package/lib/exercises/math/probaStat/checkEquiprobability.d.ts +9 -0
  29. package/lib/exercises/math/probaStat/checkEquiprobability.d.ts.map +1 -0
  30. package/lib/exercises/math/probaStat/checkEquiprobability.js +129 -0
  31. package/lib/exercises/math/probaStat/index.d.ts +2 -0
  32. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  33. package/lib/exercises/math/probaStat/index.js +2 -0
  34. package/lib/exercises/math/probaStat/mostLeastProbable.d.ts +8 -0
  35. package/lib/exercises/math/probaStat/mostLeastProbable.d.ts.map +1 -0
  36. package/lib/exercises/math/probaStat/mostLeastProbable.js +114 -0
  37. package/lib/exercises/math/sets/index.d.ts +1 -0
  38. package/lib/exercises/math/sets/index.d.ts.map +1 -1
  39. package/lib/exercises/math/sets/index.js +1 -0
  40. package/lib/exercises/math/sets/subsetsOfKnownSets.d.ts +8 -0
  41. package/lib/exercises/math/sets/subsetsOfKnownSets.d.ts.map +1 -0
  42. package/lib/exercises/math/sets/subsetsOfKnownSets.js +99 -0
  43. package/lib/index.d.ts +21 -0
  44. package/lib/index.d.ts.map +1 -1
  45. package/lib/latexTester.js +2 -0
  46. package/lib/tests/pdfExo.test.d.ts.map +1 -1
  47. package/lib/tests/pdfExo.test.js +2 -2
  48. package/package.json +1 -1
@@ -29,12 +29,26 @@ const getInstruction = (identifiers) => {
29
29
  : `Sur l'intervalle $${interval.toTex()}$, quel est le ${type} de la fonction $f$ ?`}`;
30
30
  return instruction;
31
31
  };
32
- // const getHint: GetHint<Identifiers> = (identifiers) => {
33
- // return "";
34
- // };
35
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
36
- // return "";
37
- // };
32
+ const getHint = (identifiers) => {
33
+ return `Le minimum d'une fonction $f$ sur un intervalle $[a;b]$ est la plus petite valeur de $f(x)$ pour $x$ appartenant à $[a;b]$. On dit alors que le minimum de $f$ sur $[a;b]$ est $f(x)$, atteint en $x$.
34
+
35
+ Le maximum d'une fonction $f$ sur un intervalle $[a;b]$ est la plus grande valeur de $f(x)$ pour $x$ appartenant à $[a;b]$. On dit alors que le maximum de $f$ sur $[a;b]$ est $f(x)$, atteint en $x$.
36
+ `;
37
+ };
38
+ const getCorrection = (identifiers) => {
39
+ const { intervalXIndexes, isAskingMin, isAskingX, xValues, yValues } = identifiers;
40
+ const type = isAskingMin ? "minimum" : "maximum";
41
+ const type2 = isAskingMin ? "petite" : "grande";
42
+ const interval = new IntervalNode(identifiers.xValues[identifiers.intervalXIndexes[0]].toTree(), identifiers.xValues[identifiers.intervalXIndexes[1]].toTree(), ClosureType.FF);
43
+ const x = xValues[yValues.indexOf((isAskingMin ? Math.min : Math.max)(...yValues.slice(intervalXIndexes[0], intervalXIndexes[1] + 1)))].frenchify();
44
+ const y = yValues[yValues.indexOf((isAskingMin ? Math.min : Math.max)(...yValues.slice(intervalXIndexes[0], intervalXIndexes[1] + 1)))].frenchify();
45
+ return `On cherche la plus ${type2} valeur de $f(x)$ (deuxième ligne) pour les valeurs de $x$ allant de $${interval.a.toTex()}$ à $${interval.b.toTex()}$ (première ligne). On lit que cette valeur est $${y}$, atteinte pour $x = ${x}$.
46
+
47
+ ${identifiers.isAskingX
48
+ ? `Sur l'intervalle $${interval.toTex()}$, le ${type} de la fonction $f$ est donc atteint pour $x = ${x}$.`
49
+ : `Sur l'intervalle $${interval.toTex()}$, le ${type} de la fonction $f$ est donc $${y}$.`}
50
+ `;
51
+ };
38
52
  const getGGBOptions = (identifiers) => {
39
53
  const xValues = identifiers.xValues;
40
54
  const yValues = identifiers.yValues;
@@ -103,8 +117,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
103
117
  keys: getKeys(identifiers),
104
118
  answerFormat: "tex",
105
119
  identifiers,
106
- // hint: getHint(identifiers),
107
- // correction: getCorrection(identifiers),
120
+ hint: getHint(identifiers),
121
+ correction: getCorrection(identifiers),
108
122
  ggbOptions: getGGBOptions(identifiers),
109
123
  };
110
124
  return question;
@@ -121,4 +135,5 @@ export const varTableExtremaReading = {
121
135
  subject: "Mathématiques",
122
136
  getQuestionFromIdentifiers,
123
137
  hasGeogebra: true,
138
+ hasHintAndCorrection: true,
124
139
  };
@@ -1,2 +1,3 @@
1
1
  export * from "./recognizeAngleType.js";
2
+ export * from "./parallelogramFourthAngle.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from "./recognizeAngleType.js";
2
+ export * from "./parallelogramFourthAngle.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ doubleAngle: number;
4
+ singleAngle: number;
5
+ };
6
+ export declare const parallelogramFourthAngle: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=parallelogramFourthAngle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelogramFourthAngle.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/parallelogramFourthAngle.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA4FF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAkB1D,CAAC"}
@@ -0,0 +1,92 @@
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 { degreeParser } from "../../../../tree/parsers/degreeParser.js";
5
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
+ const getPropositions = (n, { answer, singleAngle, doubleAngle }) => {
7
+ const propositions = [];
8
+ addValidProp(propositions, answer);
9
+ tryToAddWrongProp(propositions, `${singleAngle}^{\\circ}`);
10
+ tryToAddWrongProp(propositions, `${doubleAngle}^{\\circ}`);
11
+ tryToAddWrongProp(propositions, `${360 - singleAngle}^{\\circ}`);
12
+ tryToAddWrongProp(propositions, `${360 - doubleAngle}^{\\circ}`);
13
+ tryToAddWrongProp(propositions, `${360 - singleAngle - doubleAngle}^{\\circ}`);
14
+ tryToAddWrongProp(propositions, `${Math.abs(180 - 2 * singleAngle - doubleAngle)}^{\\circ}`);
15
+ return shuffleProps(propositions, n);
16
+ };
17
+ const getAnswer = (identifiers) => {
18
+ const { singleAngle, doubleAngle } = identifiers;
19
+ const fourthAngle = 360 - singleAngle - 2 * doubleAngle;
20
+ return `${fourthAngle}^{\\circ}`;
21
+ };
22
+ const getInstruction = (identifiers) => {
23
+ return `Un parallélogramme a deux angles de mesure $${identifiers.doubleAngle}^{\\circ}$ et un angle de mesure $${identifiers.singleAngle}^{\\circ}$.
24
+
25
+ Quelle est la mesure de son quatrième angle ?`;
26
+ };
27
+ const getHint = (identifiers) => {
28
+ return `La somme des angles d'un parallélogramme est égale à $360°$.`;
29
+ };
30
+ const getCorrection = (identifiers) => {
31
+ const { singleAngle, doubleAngle } = identifiers;
32
+ const sum = singleAngle + 2 * doubleAngle;
33
+ return `La somme des angles d'un parallélogramme est égale à $360°$. Ici, la somme des trois angles connus vaut :
34
+
35
+ $$
36
+ ${singleAngle}^{\\circ} + 2\\times ${doubleAngle}^{\\circ} = ${sum}^{\\circ}
37
+ $$
38
+
39
+ Le quatrième angle vaut donc :
40
+
41
+ $$
42
+ 360^{\\circ} - ${sum}^{\\circ} = ${singleAngle} ^{\\circ}
43
+ $$`;
44
+ };
45
+ const isAnswerValid = (ans, { answer }) => {
46
+ try {
47
+ return degreeParser(ans) === answer;
48
+ }
49
+ catch (err) {
50
+ return handleVEAError(err);
51
+ }
52
+ };
53
+ const getParallelogramFourthAngleQuestion = (ops) => {
54
+ const doubleAngle = randint(10, 170);
55
+ const singleAngle = 180 - doubleAngle;
56
+ const identifiers = {
57
+ singleAngle,
58
+ doubleAngle,
59
+ };
60
+ return getQuestionFromIdentifiers(identifiers);
61
+ };
62
+ const getKeys = (identifiers) => {
63
+ return ["degree"];
64
+ };
65
+ const getQuestionFromIdentifiers = (identifiers) => {
66
+ return {
67
+ answer: getAnswer(identifiers),
68
+ instruction: getInstruction(identifiers),
69
+ keys: getKeys(identifiers),
70
+ answerFormat: "tex",
71
+ identifiers,
72
+ hint: getHint(identifiers),
73
+ correction: getCorrection(identifiers),
74
+ };
75
+ };
76
+ export const parallelogramFourthAngle = {
77
+ id: "parallelogramFourthAngle",
78
+ label: "Déterminer le $4$ème angle d'un parallélogramme en connaissant les $3$ autres",
79
+ isSingleStep: true,
80
+ generator: (nb, opts) => getDistinctQuestions(() => getParallelogramFourthAngleQuestion(opts), nb),
81
+ qcmTimer: 60,
82
+ freeTimer: 60,
83
+ getPropositions,
84
+ isAnswerValid,
85
+ subject: "Mathématiques",
86
+ getInstruction,
87
+ getHint,
88
+ getCorrection,
89
+ getAnswer,
90
+ getQuestionFromIdentifiers,
91
+ hasHintAndCorrection: true,
92
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ total: number;
4
+ distribution: number[];
5
+ observe: boolean;
6
+ };
7
+ export declare const checkEquiprobability: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=checkEquiprobability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkEquiprobability.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/checkEquiprobability.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAsIF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
@@ -0,0 +1,129 @@
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 { frac } from "../../../tree/nodes/operators/fractionNode.js";
5
+ import { coinFlip } from "../../../utils/alea/coinFlip.js";
6
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
7
+ const getPropositions = (n, { answer }) => {
8
+ const propositions = [];
9
+ addValidProp(propositions, answer, "raw");
10
+ const wrong = answer === "Oui" ? "Non" : "Oui";
11
+ tryToAddWrongProp(propositions, wrong, "raw");
12
+ tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
13
+ return shuffleProps(propositions, n);
14
+ };
15
+ const getAnswer = (identifiers) => {
16
+ const { observe, distribution } = identifiers;
17
+ if (observe) {
18
+ return "Oui";
19
+ }
20
+ else {
21
+ return distribution.every((v) => v === distribution[0]) ? "Oui" : "Non";
22
+ }
23
+ };
24
+ const getInstruction = ({ total, distribution, observe, }) => {
25
+ const colors = ["rouges", "vertes", "bleues", "jaunes"];
26
+ const colorLines = distribution
27
+ .map((count, i) => `$${count}$ cartes sont ${colors[i]}`)
28
+ .join(", ");
29
+ return `Un jeu est constitué de $${total}$ cartes numérotées de $1$ à $${total}$.
30
+
31
+ ${colorLines}.
32
+
33
+ On tire une carte au hasard.
34
+
35
+ On observe ${observe ? "le numéro" : "la couleur"} de la carte tirée.
36
+
37
+ Les issues sont-elles équiprobables ?`;
38
+ };
39
+ const getHint = ({ observe }) => {
40
+ if (observe) {
41
+ return `Pense à combien de cartes portent chaque numéro.
42
+ Y a-t-il autant de cartes pour chaque numéro possible ?`;
43
+ }
44
+ else {
45
+ return `Regarde le nombre de cartes de chaque couleur.
46
+ A-t-on autant de chances d'obtenir toutes les couleurs ?`;
47
+ }
48
+ };
49
+ const getCorrection = ({ total, distribution, observe, }) => {
50
+ const colors = ["rouge", "vert", "bleu", "jaune"];
51
+ const probs = distribution
52
+ .map((count, i) => `$$
53
+ P(\\text{${colors[i]}}) = ${frac(count, total).toTex()}
54
+ $$`)
55
+ .join("\n \n");
56
+ const explanation = observe
57
+ ? `Chaque carte a un numéro distinct entre $1$ et $${total}$, donc chaque numéro a une probabilité d'être tiré égale à $${frac(1, total).toTex()}$.
58
+ Toutes les issues sont donc équiprobables.`
59
+ : `Les probabilités associées à chaque couleur sont : \n\n ${probs} \n\n
60
+ ${distribution.every((v) => v === distribution[0])
61
+ ? "Puisqu'il y autant de cartes de chaque couleur, les issues sont équiprobables."
62
+ : "Les couleurs n'ont pas toutes le même nombre de cartes, donc les issues ne sont pas équiprobables."}`;
63
+ return `${explanation}`;
64
+ };
65
+ const getKeys = (identifiers) => {
66
+ return [];
67
+ };
68
+ const isAnswerValid = (ans, { answer }) => {
69
+ try {
70
+ return ans === answer;
71
+ }
72
+ catch (err) {
73
+ return handleVEAError(err);
74
+ }
75
+ };
76
+ const getCheckEquiprobabilityQuestion = (ops) => {
77
+ let total;
78
+ let distribution;
79
+ const isEquiprobable = coinFlip();
80
+ const observe = coinFlip();
81
+ if (isEquiprobable) {
82
+ total = 4 * randint(10, 30);
83
+ const value = total / 4;
84
+ distribution = [value, value, value, value];
85
+ }
86
+ else {
87
+ total = randint(30, 61);
88
+ const a = randint(2, total - 6);
89
+ const b = randint(2, total - a - 4);
90
+ const c = randint(2, total - a - b - 2);
91
+ const d = total - a - b - c;
92
+ distribution = [a, b, c, d];
93
+ }
94
+ const identifiers = {
95
+ total,
96
+ distribution,
97
+ observe,
98
+ };
99
+ return getQuestionFromIdentifiers(identifiers);
100
+ };
101
+ const getQuestionFromIdentifiers = (identifiers) => {
102
+ return {
103
+ answer: getAnswer(identifiers),
104
+ instruction: getInstruction(identifiers),
105
+ keys: getKeys(identifiers),
106
+ answerFormat: "tex",
107
+ identifiers,
108
+ hint: getHint(identifiers),
109
+ correction: getCorrection(identifiers),
110
+ };
111
+ };
112
+ export const checkEquiprobability = {
113
+ id: "checkEquiprobability",
114
+ label: "Reconnaître une situation équiprobable",
115
+ isSingleStep: true,
116
+ generator: (nb, opts) => getDistinctQuestions(() => getCheckEquiprobabilityQuestion(opts), nb),
117
+ qcmTimer: 60,
118
+ freeTimer: 60,
119
+ getPropositions,
120
+ isAnswerValid,
121
+ subject: "Mathématiques",
122
+ getInstruction,
123
+ getHint,
124
+ getCorrection,
125
+ getAnswer,
126
+ getQuestionFromIdentifiers,
127
+ hasHintAndCorrection: true,
128
+ answerType: "QCU",
129
+ };
@@ -16,4 +16,6 @@ export * from "./getMissingProbabilityValue.js";
16
16
  export * from "./getComplementaryProbability.js";
17
17
  export * from "./unionIntersectionProba.js";
18
18
  export * from "./calculateMeanFromFrequencies.js";
19
+ export * from "./mostLeastProbable.js";
20
+ export * from "./checkEquiprobability.js";
19
21
  //# 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,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,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,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,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,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
@@ -16,3 +16,5 @@ export * from "./getMissingProbabilityValue.js";
16
16
  export * from "./getComplementaryProbability.js";
17
17
  export * from "./unionIntersectionProba.js";
18
18
  export * from "./calculateMeanFromFrequencies.js";
19
+ export * from "./mostLeastProbable.js";
20
+ export * from "./checkEquiprobability.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
3
+ export type Identifiers = {
4
+ numericValues: NodeIdentifiers[];
5
+ isMax: boolean;
6
+ };
7
+ export declare const mostLeastProbable: Exercise<Identifiers>;
8
+ //# sourceMappingURL=mostLeastProbable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mostLeastProbable.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/mostLeastProbable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AA2HF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAkBnD,CAAC"}
@@ -0,0 +1,114 @@
1
+ import { addValidProp, tryToAddWrongProp, shuffleProps, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { RationalConstructor } from "../../../math/numbers/rationals/rational.js";
4
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
5
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
6
+ import { coinFlip } from "../../../utils/alea/coinFlip.js";
7
+ import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
8
+ import { round } from "../../../math/utils/round.js";
9
+ import { approxOrEqual } from "../../../utils/latex/approxOrEqual.js";
10
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
11
+ const getPropositions = (n, { answer }) => {
12
+ const allLabels = ["J", "R", "V"];
13
+ const props = [];
14
+ addValidProp(props, answer);
15
+ for (const label of allLabels) {
16
+ tryToAddWrongProp(props, label);
17
+ }
18
+ return shuffleProps(props, n);
19
+ };
20
+ const getAnswer = ({ numericValues, isMax }) => {
21
+ const numericValuesParsed = numericValues.map((v) => reifyAlgebraic(v).evaluate());
22
+ const targetValue = isMax
23
+ ? Math.max(...numericValuesParsed)
24
+ : Math.min(...numericValuesParsed);
25
+ const index = numericValuesParsed.indexOf(targetValue);
26
+ return ["J", "R", "V"][index];
27
+ };
28
+ const getInstruction = ({ numericValues, isMax, }) => {
29
+ const labels = ["$J$", "$R$", "$V$"];
30
+ const displayValues = numericValues.map((v, i) => {
31
+ if (labels[i] === "$R$") {
32
+ const pct = round(reifyAlgebraic(v).evaluate() * 100, 6);
33
+ return `${pct.frenchify()}\\%`;
34
+ }
35
+ else {
36
+ return reifyAlgebraic(v).toTex();
37
+ }
38
+ });
39
+ const header = `Une expérience aléatoire a trois issues : ${labels.join(", ")}.
40
+
41
+ Leurs probabilités sont respectivement $${displayValues[0]}$ , $${displayValues[1]}$ et $${displayValues[2]}$.\n\n`;
42
+ return header + `Quelle issue est la ${isMax ? "plus" : "moins"} probable ?`;
43
+ };
44
+ const getHint = () => {
45
+ return "Convertis les probabilités dans le même format pour les comparer.";
46
+ };
47
+ const getCorrection = ({ numericValues, isMax, }) => {
48
+ const fraction = reifyAlgebraic(numericValues[0]);
49
+ const percent = reifyAlgebraic(numericValues[1]);
50
+ const evaluatedValues = numericValues.map((v) => round(reifyAlgebraic(v).evaluate(), 2));
51
+ const sortedAsc = [...evaluatedValues].sort((a, b) => a - b);
52
+ const target = isMax ? "plus" : "moins";
53
+ const result = getAnswer({ numericValues, isMax });
54
+ return `On convertit le pourcentage et la fraction en nombres décimaux (éventuellement avec une valeur approchée) pour pouvoir les comparer :
55
+
56
+ - $${fraction.toTex()} ${approxOrEqual(fraction.evaluate(), 2).join("")}$
57
+
58
+ - $${multiply(percent, 100).simplify().toTex()}\\% = ${percent.toTex()}$
59
+
60
+ Puisque $${sortedAsc
61
+ .map((e) => e.frenchify())
62
+ .join("\\leq")}$, l'issue la ${target} probable est donc $${result}$.`;
63
+ };
64
+ const getKeys = () => [];
65
+ const isAnswerValid = (ans, { answer }) => {
66
+ try {
67
+ return ans.trim() === answer;
68
+ }
69
+ catch (err) {
70
+ return handleVEAError(err);
71
+ }
72
+ };
73
+ const getMostLeastProbableQuestion = (opts) => {
74
+ let numericValues = [];
75
+ do {
76
+ numericValues = [
77
+ RationalConstructor.randomIrreductibleProba().toTree(),
78
+ randfloat(0.1, 0.9, 2).toTree(),
79
+ randfloat(0.1, 0.9, 2).toTree(),
80
+ ];
81
+ } while (numericValues.some((e, i) => numericValues.some((e2, i2) => i2 !== i && round(e2.evaluate(), 2) === round(e.evaluate(), 2))));
82
+ const isMax = coinFlip();
83
+ return getQuestionFromIdentifiers({
84
+ numericValues: numericValues.map((e) => e.toIdentifiers()),
85
+ isMax,
86
+ });
87
+ };
88
+ const getQuestionFromIdentifiers = (identifiers) => ({
89
+ answer: getAnswer(identifiers),
90
+ instruction: getInstruction(identifiers),
91
+ keys: getKeys(identifiers),
92
+ answerFormat: "tex",
93
+ identifiers,
94
+ hint: getHint(identifiers),
95
+ correction: getCorrection(identifiers),
96
+ });
97
+ export const mostLeastProbable = {
98
+ id: "mostLeastProbable",
99
+ label: "Identifier l'issue la plus ou la moins probable",
100
+ isSingleStep: true,
101
+ generator: (nb, opts) => getDistinctQuestions(() => getMostLeastProbableQuestion(opts), nb),
102
+ qcmTimer: 60,
103
+ freeTimer: 60,
104
+ getPropositions,
105
+ isAnswerValid,
106
+ subject: "Mathématiques",
107
+ getInstruction,
108
+ getHint,
109
+ getCorrection,
110
+ getAnswer,
111
+ getQuestionFromIdentifiers,
112
+ hasHintAndCorrection: true,
113
+ answerType: "QCU",
114
+ };
@@ -1,4 +1,5 @@
1
1
  export * from "./intervals/index.js";
2
2
  export * from "./setBelonging.js";
3
3
  export * from "./nameOfNumberSets.js";
4
+ export * from "./subsetsOfKnownSets.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./intervals/index.js";
2
2
  export * from "./setBelonging.js";
3
3
  export * from "./nameOfNumberSets.js";
4
+ export * from "./subsetsOfKnownSets.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ subset: number;
4
+ set: number;
5
+ };
6
+ export declare const subsetsOfKnownSets: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=subsetsOfKnownSets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subsetsOfKnownSets.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/subsetsOfKnownSets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAiGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAiBpD,CAAC"}
@@ -0,0 +1,99 @@
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
+ const getPropositions = (n, { answer }) => {
5
+ const propositions = [];
6
+ addValidProp(propositions, answer);
7
+ tryToAddWrongProp(propositions, "\\subset");
8
+ tryToAddWrongProp(propositions, "\\not\\subset");
9
+ return shuffleProps(propositions, n);
10
+ };
11
+ const getAnswer = (identifiers) => {
12
+ const { subset, set } = identifiers;
13
+ return set > subset ? "\\subset" : "\\not\\subset";
14
+ };
15
+ const caseToTex = (set) => {
16
+ switch (set) {
17
+ case 0:
18
+ return "\\mathbb{N}";
19
+ case 1:
20
+ return "\\mathbb{Z}";
21
+ case 2:
22
+ return "\\mathbb{D}";
23
+ case 3:
24
+ return "\\mathbb{Q}";
25
+ case 4:
26
+ default:
27
+ return "\\mathbb{R}";
28
+ }
29
+ };
30
+ const getInstruction = (identifiers) => {
31
+ const { subset, set } = identifiers;
32
+ return `Compléter par le bon symbole :
33
+
34
+ $$
35
+ ${caseToTex(subset)} \\ \\ldots \\ ${caseToTex(set)}
36
+ $$
37
+
38
+ Le symbole $\\subset$ signifie "est inclus dans" et le symbole $\\not\\subset$ signifie "n'est pas inclus dans".`;
39
+ };
40
+ const getHint = (identifiers) => {
41
+ return `- $\\mathbb{N}$ est l'ensemble des nombres entiers naturels (nombres entiers positifs).
42
+ - $\\mathbb{Z}$ est l'ensemble des nombres entiers relatifs (nombres entiers positis et négatifs).
43
+ - $\\mathbb{R}$ est l'ensemble des nombres réels.
44
+ - $\\mathbb{D}$ est l'ensemble des nombres décimaux (nombres avec un nombre fini de chiffres apres la virgule).
45
+ - $\\mathbb{Q}$ est l'ensemble des nombres rationnels (nombres qui peuvent s'écrire sous la forme d'une fraction de deux entiers).
46
+ `;
47
+ };
48
+ const getCorrection = (identifiers) => {
49
+ const { set, subset } = identifiers;
50
+ const answer = getAnswer(identifiers);
51
+ return `Voici les inclusions dans l'ordre des ensembles de nombres :
52
+
53
+ $$
54
+ \\mathbb{N} \\subset \\mathbb{Z} \\subset \\mathbb{D} \\subset \\mathbb{Q} \\subset \\mathbb{R}
55
+ $$
56
+
57
+ ${answer === "\\subset"
58
+ ? `
59
+ On a donc :
60
+
61
+ $$
62
+ ${caseToTex(subset)} ${getAnswer(identifiers)} ${caseToTex(set)}
63
+ $$`
64
+ : `On a donc $${caseToTex(set)} \\subset ${caseToTex(subset)}$, mais $${caseToTex(subset)} \\not\\subset ${caseToTex(set)}$. `}`;
65
+ };
66
+ const getSubsetsOfKnownSetsQuestion = (ops) => {
67
+ const subset = randint(0, 6);
68
+ const set = randint(0, 6, [subset]);
69
+ const identifiers = { subset, set };
70
+ return getQuestionFromIdentifiers(identifiers);
71
+ };
72
+ const getQuestionFromIdentifiers = (identifiers) => {
73
+ return {
74
+ answer: getAnswer(identifiers),
75
+ instruction: getInstruction(identifiers),
76
+ keys: [],
77
+ answerFormat: "tex",
78
+ identifiers,
79
+ hint: getHint(identifiers),
80
+ correction: getCorrection(identifiers),
81
+ };
82
+ };
83
+ export const subsetsOfKnownSets = {
84
+ id: "subsetsOfKnownSets",
85
+ label: "Inclusions des ensembles de nombres",
86
+ answerType: "QCU",
87
+ isSingleStep: true,
88
+ generator: (nb, opts) => getDistinctQuestions(() => getSubsetsOfKnownSetsQuestion(opts), nb),
89
+ qcmTimer: 60,
90
+ freeTimer: 60,
91
+ getPropositions,
92
+ subject: "Mathématiques",
93
+ getInstruction,
94
+ getHint,
95
+ getCorrection,
96
+ getAnswer,
97
+ getQuestionFromIdentifiers,
98
+ hasHintAndCorrection: true,
99
+ };
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Exercise, Question } from "./exercises/exercise.js";
2
+ import * as MathExercises from "./exercises/math/index.js";
2
3
  import "./prototypesEnhancement.js";
3
4
  import { parseAlgebraic } from "./tree/parsers/latexParser.js";
4
5
  declare const mathExercises: (Exercise<{
@@ -84,6 +85,16 @@ declare const mathExercises: (Exercise<{
84
85
  }, {}> | Exercise<{
85
86
  a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
86
87
  b: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
88
+ }, {}> | Exercise<{
89
+ expression: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
90
+ }, {}> | Exercise<{
91
+ twoSided: boolean;
92
+ a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
93
+ b?: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
94
+ }, {}> | Exercise<{
95
+ a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
96
+ b: number;
97
+ c: number;
87
98
  }, {}> | Exercise<{
88
99
  integerFirst: boolean;
89
100
  integer: number;
@@ -1449,6 +1460,9 @@ declare const mathExercises: (Exercise<{
1449
1460
  angleType: string;
1450
1461
  angleIndex: number;
1451
1462
  apexIndex: number;
1463
+ }, {}> | Exercise<{
1464
+ doubleAngle: number;
1465
+ singleAngle: number;
1452
1466
  }, {}> | Exercise<{
1453
1467
  lines: {
1454
1468
  pointA: number[];
@@ -1891,6 +1905,10 @@ declare const mathExercises: (Exercise<{
1891
1905
  }, {}> | Exercise<{
1892
1906
  xValues: number[];
1893
1907
  yValues: number[];
1908
+ }, {}> | Exercise<MathExercises.Identifiers, {}> | Exercise<{
1909
+ total: number;
1910
+ distribution: number[];
1911
+ observe: boolean;
1894
1912
  }, {}> | Exercise<{
1895
1913
  firstValue: number;
1896
1914
  askedRank: number;
@@ -2029,6 +2047,9 @@ declare const mathExercises: (Exercise<{
2029
2047
  }, {}> | Exercise<{
2030
2048
  isQuestionAboutNotation: boolean;
2031
2049
  caseNumber: number;
2050
+ }, {}> | Exercise<{
2051
+ subset: number;
2052
+ set: number;
2032
2053
  }, {}> | Exercise<{
2033
2054
  x: number;
2034
2055
  y: number;