math-exercises 3.0.167 → 3.0.168

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 (100) hide show
  1. package/lib/exercises/math/derivation/variations/index.d.ts +1 -0
  2. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
  3. package/lib/exercises/math/derivation/variations/index.js +2 -0
  4. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts +2 -0
  5. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts.map +1 -0
  6. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.js +203 -0
  7. package/lib/exercises/math/derivation/variations/signVarTableTrinom.d.ts +9 -0
  8. package/lib/exercises/math/derivation/variations/signVarTableTrinom.d.ts.map +1 -0
  9. package/lib/exercises/math/derivation/variations/signVarTableTrinom.js +148 -0
  10. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
  11. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +1 -4
  12. package/lib/exercises/math/functions/index.d.ts +1 -0
  13. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  14. package/lib/exercises/math/functions/index.js +1 -0
  15. package/lib/exercises/math/functions/inverse/compareInverseValues.d.ts.map +1 -1
  16. package/lib/exercises/math/functions/inverse/compareInverseValues.js +1 -10
  17. package/lib/exercises/math/functions/periodicity/index.d.ts +2 -0
  18. package/lib/exercises/math/functions/periodicity/index.d.ts.map +1 -0
  19. package/lib/exercises/math/functions/periodicity/index.js +1 -0
  20. package/lib/exercises/math/functions/trinoms/equation/index.d.ts +2 -0
  21. package/lib/exercises/math/functions/trinoms/equation/index.d.ts.map +1 -1
  22. package/lib/exercises/math/functions/trinoms/equation/index.js +2 -0
  23. package/lib/exercises/math/functions/trinoms/equation/secondDegreeEquationWithRightMember.d.ts +11 -0
  24. package/lib/exercises/math/functions/trinoms/equation/secondDegreeEquationWithRightMember.d.ts.map +1 -0
  25. package/lib/exercises/math/functions/trinoms/equation/secondDegreeEquationWithRightMember.js +205 -0
  26. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -1
  27. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.js +78 -13
  28. package/lib/exercises/math/functions/trinoms/equation/solveBisquaredEquation.d.ts +9 -0
  29. package/lib/exercises/math/functions/trinoms/equation/solveBisquaredEquation.d.ts.map +1 -0
  30. package/lib/exercises/math/functions/trinoms/equation/solveBisquaredEquation.js +223 -0
  31. package/lib/exercises/math/functions/trinoms/equation/trinomSelectEquationWithoutDeltaNeeded.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/trinoms/equation/trinomSelectEquationWithoutDeltaNeeded.js +3 -1
  33. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.js +1 -0
  35. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
  36. package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +27 -1
  37. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts +4 -1
  38. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts.map +1 -1
  39. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.js +133 -11
  40. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts +4 -1
  41. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.js +135 -14
  43. package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.d.ts +9 -0
  44. package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.d.ts.map +1 -0
  45. package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.js +123 -0
  46. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts +1 -0
  47. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts.map +1 -1
  48. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.js +1 -0
  49. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPerpendicularLine.js +1 -1
  50. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +2 -2
  51. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts +1 -1
  52. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  53. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +17 -11
  54. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts.map +1 -1
  55. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +25 -14
  56. package/lib/exercises/math/probaStat/randomVariable/randomVariableValues.d.ts +2 -0
  57. package/lib/exercises/math/probaStat/randomVariable/randomVariableValues.d.ts.map +1 -0
  58. package/lib/exercises/math/probaStat/randomVariable/randomVariableValues.js +83 -0
  59. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts +12 -0
  60. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -0
  61. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +30 -0
  62. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -1
  63. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +1 -1
  64. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
  65. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +35 -0
  66. package/lib/exercises/math/sequences/index.js +1 -0
  67. package/lib/exercises/math/sequences/limits/index.d.ts +2 -0
  68. package/lib/exercises/math/sequences/limits/index.d.ts.map +1 -0
  69. package/lib/exercises/math/sequences/limits/index.js +1 -0
  70. package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts +2 -0
  71. package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts.map +1 -0
  72. package/lib/exercises/math/sequences/limits/sequenceLimitReading.js +163 -0
  73. package/lib/exercises/math/trigonometry/circle/areReelsOnTheSameTrigoCirclePoint.js +2 -2
  74. package/lib/exercises/vea/numberVEA.d.ts +1 -1
  75. package/lib/exercises/vea/numberVEA.d.ts.map +1 -1
  76. package/lib/exercises/vea/numberVEA.js +7 -2
  77. package/lib/exercises/vea/signLineVEA.d.ts +8 -0
  78. package/lib/exercises/vea/signLineVEA.d.ts.map +1 -0
  79. package/lib/exercises/vea/signLineVEA.js +9 -0
  80. package/lib/exercises/vea/signTableVEA.d.ts +2 -0
  81. package/lib/exercises/vea/signTableVEA.d.ts.map +1 -0
  82. package/lib/exercises/vea/signTableVEA.js +5 -0
  83. package/lib/exercises/vea/varLineVEA.d.ts +8 -0
  84. package/lib/exercises/vea/varLineVEA.d.ts.map +1 -0
  85. package/lib/exercises/vea/varLineVEA.js +44 -0
  86. package/lib/exercises/vea/varSignTableVEA.d.ts +2 -0
  87. package/lib/exercises/vea/varSignTableVEA.d.ts.map +1 -0
  88. package/lib/exercises/vea/varSignTableVEA.js +8 -0
  89. package/lib/exercises/vea/varTableVEA.d.ts +2 -0
  90. package/lib/exercises/vea/varTableVEA.d.ts.map +1 -0
  91. package/lib/exercises/vea/varTableVEA.js +6 -0
  92. package/lib/exercises/vea/xTableLineVEA.d.ts +8 -0
  93. package/lib/exercises/vea/xTableLineVEA.d.ts.map +1 -0
  94. package/lib/exercises/vea/xTableLineVEA.js +18 -0
  95. package/lib/index.d.ts +24 -3
  96. package/lib/index.d.ts.map +1 -1
  97. package/lib/math/polynomials/polynomial.d.ts +1 -1
  98. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  99. package/lib/math/polynomials/polynomial.js +4 -2
  100. package/package.json +1 -1
@@ -54,12 +54,16 @@ const getProbaFromTableNoContextQuestion = (opts) => {
54
54
  const bBarreTotal = aBarreCapBBarre + aCapBBarre;
55
55
  let event = "";
56
56
  let proba = [];
57
- const types = opts?.forbidConditionnal
58
- ? ["singleEvent", "intersection", "union"]
59
- : ["singleEvent", "intersection", "union", "conditionnal"];
60
- const type = random(types);
57
+ const allowedTypes = opts?.probaTypes ?? [
58
+ "$P(A)$",
59
+ "$P(A\\cap B)$",
60
+ "$P(A\\cup B)$",
61
+ "$P_A(B)$",
62
+ ];
63
+ // "$P(A)$", "$P(A\\cap B)$", "$P(A\\cup B)$", "$P_A(B)$"
64
+ const type = random(allowedTypes);
61
65
  switch (type) {
62
- case "singleEvent":
66
+ case "$P(A)$":
63
67
  [event, proba] = random([
64
68
  ["P(A)", [aTotal, total]],
65
69
  ["P(B)", [bTotal, total]],
@@ -67,7 +71,7 @@ const getProbaFromTableNoContextQuestion = (opts) => {
67
71
  ["P(\\overline B)", [bBarreTotal, total]],
68
72
  ]);
69
73
  break;
70
- case "intersection":
74
+ case "$P(A\\cap B)$":
71
75
  [event, proba] = random([
72
76
  ["P(A\\cap B)", [aCapB, total]],
73
77
  ["P(\\overline A\\cap B)", [aBarreCapB, total]],
@@ -75,7 +79,7 @@ const getProbaFromTableNoContextQuestion = (opts) => {
75
79
  ["P(\\overline A \\cap \\overline B)", [aBarreCapBBarre, total]],
76
80
  ]);
77
81
  break;
78
- case "union":
82
+ case "$P(A\\cup B)$":
79
83
  [event, proba] = random([
80
84
  ["P(A\\cup B)", [total - aBarreCapBBarre, total]],
81
85
  ["P(A\\cup \\overline B)", [total - aBarreCapB, total]],
@@ -83,7 +87,7 @@ const getProbaFromTableNoContextQuestion = (opts) => {
83
87
  ["P(\\overline A \\cup \\overline B)", [total - aCapB, total]],
84
88
  ]);
85
89
  break;
86
- case "conditionnal":
90
+ case "$P_A(B)$":
87
91
  [event, proba] = random([
88
92
  ["P_A(B)", [aCapB, aTotal]],
89
93
  ["P_A(\\overline B)", [aCapBBarre, aTotal]],
@@ -250,10 +254,12 @@ const getPropositions = (n, { answer, aBarreCapB, aBarreCapBBarre, aCapB, aCapBB
250
254
  };
251
255
  const options = [
252
256
  {
253
- id: "forbidConditionnal",
254
- label: "Ne pas utiliser les probabilités conditionnelles",
257
+ id: "probaTypes",
258
+ label: "Type de probabilité demandée",
255
259
  target: GeneratorOptionTarget.generation,
256
- type: GeneratorOptionType.checkbox,
260
+ type: GeneratorOptionType.multiselect,
261
+ values: ["$P(A)$", "$P(A\\cap B)$", "$P(A\\cup B)$", "$P_A(B)$"],
262
+ defaultValue: ["$P(A)$", "$P(A\\cap B)$", "$P(A\\cup B)$", "$P_A(B)$"],
257
263
  },
258
264
  ];
259
265
  const isAnswerValid = (ans, { answer, ...identifiers }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"findValueForFairRandomVariable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B,CAAC;AA0HF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAmBhE,CAAC"}
1
+ {"version":3,"file":"findValueForFairRandomVariable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B,CAAC;AAgJF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAmBhE,CAAC"}
@@ -8,7 +8,6 @@ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
8
8
  import { add } from "../../../../tree/nodes/operators/addNode.js";
9
9
  import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
10
10
  import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
11
- import { coinFlip } from "../../../../utils/alea/coinFlip.js";
12
11
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
13
12
  import { mdTable } from "../../../../utils/markdown/mdTable.js";
14
13
  const getPropositions = (n, { answer }) => {
@@ -72,9 +71,30 @@ const isAnswerValid = (ans, { answer }) => {
72
71
  return handleVEAError(err);
73
72
  }
74
73
  };
74
+ const _generateZeroMeanByLastValue = (n, valueRange = 10, minProb = 0) => {
75
+ // 1) probabilités positives puis normalisation
76
+ const raw = Array.from({ length: n }, () => round(Math.random(), 3));
77
+ const sumRaw = raw.reduce((a, b) => a + b, 0);
78
+ // on injecte un plancher minProb si demandé (simple et robuste)
79
+ // p_i = minProb + (1 - n*minProb) * raw_i/sumRaw
80
+ const scale = 1 - n * minProb;
81
+ const probs = raw.map((r) => round(minProb + scale * (r / sumRaw), 3));
82
+ // 2) tirer n-1 valeurs
83
+ const values = [];
84
+ for (let i = 0; i < n - 1; i++) {
85
+ values.push(round((Math.random() * 2 - 1) * valueRange, 3));
86
+ }
87
+ // 3) calculer la dernière valeur pour forcer Σ p_i v_i = 0
88
+ let partial = 0;
89
+ for (let i = 0; i < n - 1; i++)
90
+ partial += probs[i] * values[i];
91
+ const lastValue = -partial / probs[n - 1];
92
+ values.push(lastValue);
93
+ return values.map((v, i) => ({ value: v.toTree(), prob: probs[i].toTree() }));
94
+ };
75
95
  const getFindProbaForFairGameQuestion = () => {
76
96
  const xValues = [
77
- 0,
97
+ randint(-10, 0),
78
98
  randint(1, 5),
79
99
  randint(5, 10),
80
100
  5 * randint(10, 20),
@@ -88,18 +108,9 @@ const getFindProbaForFairGameQuestion = () => {
88
108
  ];
89
109
  const left = round(1 - probas.reduce((acc, curr) => acc + curr, 0), 4);
90
110
  probas.unshift(left);
91
- const xNodes = xValues.map((e) => e.toTree());
92
- const yNodes = probas.map((e) => e.toTree());
93
- const isXMissing = coinFlip();
94
- if (isXMissing) {
95
- xNodes[randint(0, xValues.length)] = "x".toTree();
96
- }
97
- else {
98
- yNodes[randint(0, xValues.length)] = "x".toTree();
99
- }
100
111
  const identifiers = {
101
- valuesIds: xNodes.map((e) => e.toIdentifiers()),
102
- probasIds: yNodes.map((e) => e.toIdentifiers()),
112
+ valuesIds: xValues.map((e) => e.toTree().toIdentifiers()),
113
+ probasIds: probas.map((e) => e.toTree().toIdentifiers()),
103
114
  };
104
115
  return getQuestionFromIdentifiers(identifiers);
105
116
  };
@@ -124,7 +135,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
124
135
  export const findValueForFairRandomVariable = {
125
136
  id: "findValueForFairRandomVariable",
126
137
  connector: "=",
127
- label: "Compléter la loi de probabilité d'une variable aléatoire pour rendre un jeu équitable",
138
+ label: "Compléter la loi de probabilité d'une variable aléatoire pour rendre un jeu équitable (espérance nulle)",
128
139
  isSingleStep: true,
129
140
  generator: (nb, opts) => getDistinctQuestions(() => getFindProbaForFairGameQuestion(opts), nb),
130
141
  qcmTimer: 60,
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=randomVariableValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomVariableValues.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/randomVariableValues.ts"],"names":[],"mappings":""}
@@ -0,0 +1,83 @@
1
+ // import {
2
+ // Exercise,
3
+ // Proposition,
4
+ // QCMGenerator,
5
+ // Question,
6
+ // QuestionGenerator,
7
+ // VEA,
8
+ // addValidProp,
9
+ // shuffleProps,
10
+ // GetAnswer,
11
+ // GetHint,
12
+ // GetCorrection,
13
+ // GetInstruction,
14
+ // GetKeys,
15
+ // GetQuestionFromIdentifiers,
16
+ // propWhile,
17
+ // } from "../../../../exercises/exercise.js";
18
+ // import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
19
+ // import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
20
+ export {};
21
+ // type Identifiers = {};
22
+ // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
23
+ // const propositions: Proposition[] = [];
24
+ // addValidProp(propositions, answer);
25
+ // propWhile(propositions, n, () => {
26
+ // throw Error("QCM not implemented");
27
+ // });
28
+ // return shuffleProps(propositions, n);
29
+ // };
30
+ // const getAnswer: GetAnswer<Identifiers> = (identifiers) => {};
31
+ // const getInstruction: GetInstruction<Identifiers> = (identifiers) => {
32
+ // return `Une urne contient $b$ boules blanches, $r$ boules rouges et $n$ boules noires. On tire au hasard une boule de l'urne. Chaque couleur donne un gain algébrique donné (aléatoire). La variable aléatoire X associe à chaque tirage le gain algébrique du joueur. `;
33
+ // };
34
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
35
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
36
+ // const getKeys: GetKeys<Identifiers> = (identifiers) => {
37
+ // return [];
38
+ // };
39
+ // const isAnswerValid: VEA<Identifiers> = (ans, { answer }) => {
40
+ // try {
41
+ // throw Error("VEA not implemented");
42
+ // } catch (err) {
43
+ // return handleVEAError(err);
44
+ // }
45
+ // };
46
+ // const getRandomVariableValuesQuestion: QuestionGenerator<Identifiers> = (
47
+ // ops,
48
+ // ) => {
49
+ // const identifiers: Identifiers = {};
50
+ // return getQuestionFromIdentifiers(identifiers);
51
+ // };
52
+ // const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (
53
+ // identifiers,
54
+ // ) => {
55
+ // return {
56
+ // answer: getAnswer(identifiers),
57
+ // instruction: getInstruction(identifiers),
58
+ // keys: getKeys(identifiers),
59
+ // answerFormat: "tex",
60
+ // identifiers,
61
+ // hint: getHint(identifiers),
62
+ // correction: getCorrection(identifiers),
63
+ // };
64
+ // };
65
+ // export const randomVariableValues: Exercise<Identifiers> = {
66
+ // id: "randomVariableValues",
67
+ // connector: "",
68
+ // label: undefined,
69
+ // isSingleStep: true,
70
+ // generator: (nb, opts) =>
71
+ // getDistinctQuestions(() => getRandomVariableValuesQuestion(opts), nb),
72
+ // qcmTimer: 60,
73
+ // freeTimer: 60,
74
+ // getPropositions,
75
+ // isAnswerValid,
76
+ // subject: "Mathématiques",
77
+ // getInstruction,
78
+ // getHint,
79
+ // getCorrection,
80
+ // getAnswer,
81
+ // getQuestionFromIdentifiers,
82
+ // hasHintAndCorrection: true,
83
+ // };
@@ -0,0 +1,12 @@
1
+ export declare const situations: ({
2
+ id: string;
3
+ label: string;
4
+ xis: never[];
5
+ pis: never[];
6
+ } | {
7
+ label: string;
8
+ id?: undefined;
9
+ xis?: undefined;
10
+ pis?: undefined;
11
+ })[];
12
+ //# sourceMappingURL=randomVariableSituations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomVariableSituations.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;IAqCtB,CAAC"}
@@ -0,0 +1,30 @@
1
+ export const situations = [
2
+ {
3
+ id: "",
4
+ //params b,r,n ; gb,gr,gn
5
+ label: "Une urne contient $b$ boules blanches, $r$ boules rouges et $n$ boules noires. On tire au hasard une boule de l'urne. Chaque couleur donne un gain algébrique donné (aléatoire). La variable aléatoire X associe à chaque tirage le gain algébrique du joueur. ",
6
+ xis: [],
7
+ pis: [],
8
+ },
9
+ {
10
+ //param nbFaces; g_2, g_3, g_4, g_5, g_6
11
+ label: "On lance un dé équilibré à 12 faces (ou 4 ou 6 ou 20. Paramétrable ?). On gagne g_2€ pour chaque multiple de 2, g_3€ pour chaque multiples de 3 ... g_6€ pour chaque multiple de 6. Les gains sont cumulables. X donne le gain total du joueur.",
12
+ },
13
+ {
14
+ //param b;r , gb;gr
15
+ label: "Une urne contient b boules rouges blanches et r boules rouges. On tire deux boules successivement et avec remise (ou sans remise : paramétrable). Une boule rouge rapporte x points, une boule noire en fait perdre y. La varialbe aléatoire X associe à chaque tirage le est le gain algébrique du joueur.",
16
+ },
17
+ {
18
+ //param n; gp,gf
19
+ label: "On lance n fois d'affilée une pièce de monnaie (n entre 1 et 4). Chaque pile rapporte a points et chaque face fait perdre b points. La variable aléatoire X associe à chaque tirage le gain algébrique du joueur.",
20
+ },
21
+ {
22
+ label: "On lance deux dès équilibrés à 6 faces (ou 4, ou 12, ou 20) et on fait la somme des points. La variable aléatoire X associe à chaque tirage le gain algébrique du joueur.",
23
+ },
24
+ {
25
+ label: "On lance deux dès équilibrés à 6 faces (ou 4, ou 12, ou 20) et on fait la différence des points. La variable aléatoire X associe à chaque tirage le gain algébrique du joueur.",
26
+ },
27
+ {
28
+ label: "On lance deux dès équilibrés à 6 faces (ou 4, ou 12, ou 20) et on fait la CL... des points. La variable aléatoire X associe à chaque tirage le gain algébrique du joueur.",
29
+ },
30
+ ];
@@ -1 +1 @@
1
- {"version":3,"file":"headsOrTailsTwiceOutcomes.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAS9B,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AA6NF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
1
+ {"version":3,"file":"headsOrTailsTwiceOutcomes.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAS9B,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AA8NF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
@@ -124,7 +124,7 @@ const getPropositions = (n, { answer }) => {
124
124
  [0, 1],
125
125
  [0, 1],
126
126
  ]);
127
- const arrStr = arrOutcome.map(([v1, v2]) => `(${arrStrOutcomeSmall[v1]};${arrStrOutcomeSmall[v2]})`);
127
+ const arrStr = arrOutcome.map(([v1, v2]) => `\\left(${arrStrOutcomeSmall[v1]};${arrStrOutcomeSmall[v2]}\\right)`);
128
128
  arrStr.forEach((str) => {
129
129
  tryToAddWrongProp(propositions, str);
130
130
  });
@@ -1 +1 @@
1
- {"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA0GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAYtD,CAAC"}
1
+ {"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA2JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { addValidProp, propWhile, 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
6
  import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
6
7
  import { power } from "../../../../tree/nodes/operators/powerNode.js";
@@ -25,6 +26,37 @@ const getStartStatement = (identifiers) => {
25
26
  const { askedRank } = identifiers;
26
27
  return `u_{${askedRank}}`;
27
28
  };
29
+ const getHint = () => {
30
+ return `Puisque $u$ est une suite géométrique, alors pour passer d'un terme au suivant, on doit multiplier par la raison $q$.`;
31
+ };
32
+ const getCorrection = (identifiers) => {
33
+ const { reason, startValue, startRank, askedRank } = identifiers;
34
+ const un1 = round(startValue * reason, 4);
35
+ const un2 = round(un1 * reason, 4);
36
+ const un3 = round(un2 * reason, 4);
37
+ return `Puisque $u$ est une suite géométrique, alors pour passer d'un terme au suivant, on doit multiplier par la raison $q$.
38
+
39
+ On a donc :
40
+
41
+ $$
42
+ u_{${startRank + 1}} = ${multiply(`u_{${startRank}}`, reason).toTex()} = ${un1.frenchify()}
43
+ $$
44
+
45
+ ${askedRank > startRank + 1
46
+ ? `
47
+ $$
48
+ u_{${startRank + 2}} = ${multiply(`u_{${startRank + 1}}`, reason).toTex()} = ${un2.frenchify()}
49
+ $$`
50
+ : ""}
51
+
52
+ ${askedRank > startRank + 2
53
+ ? `
54
+ $$
55
+ u_{${startRank + 1}} = ${multiply(`u_{${startRank}}`, reason).toTex()} = ${un3.frenchify()}
56
+ $$`
57
+ : ""}
58
+ `;
59
+ };
28
60
  const getQuestionFromIdentifiers = (identifiers) => {
29
61
  const question = {
30
62
  instruction: getInstruction(identifiers),
@@ -33,6 +65,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
33
65
  keys: ["u", "underscore", "equal"],
34
66
  answerFormat: "tex",
35
67
  identifiers,
68
+ hint: getHint(identifiers),
69
+ correction: getCorrection(identifiers),
36
70
  };
37
71
  return question;
38
72
  };
@@ -90,4 +124,5 @@ export const geometricReasonUsage = {
90
124
  isAnswerValid,
91
125
  subject: "Mathématiques",
92
126
  getQuestionFromIdentifiers,
127
+ hasHintAndCorrection: true,
93
128
  };
@@ -7,3 +7,4 @@ export * from "./sequenceEvaluation.js";
7
7
  export * from "./sequencePlot.js";
8
8
  export * from "./graph/index.js";
9
9
  export * from "./notation/index.js";
10
+ // export * from "./limits/index.js";
@@ -0,0 +1,2 @@
1
+ export * from "./sequenceLimitReading.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/limits/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./sequenceLimitReading.js";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sequenceLimitReading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequenceLimitReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/limits/sequenceLimitReading.ts"],"names":[],"mappings":""}
@@ -0,0 +1,163 @@
1
+ // import {
2
+ // Exercise,
3
+ // Proposition,
4
+ // QCMGenerator,
5
+ // QuestionGenerator,
6
+ // VEA,
7
+ // addValidProp,
8
+ // shuffleProps,
9
+ // GetAnswer,
10
+ // GetHint,
11
+ // GetCorrection,
12
+ // GetInstruction,
13
+ // GetKeys,
14
+ // GetGGBOptions,
15
+ // GetQuestionFromIdentifiers,
16
+ // propWhile,
17
+ // tryToAddWrongProp,
18
+ // } from "../../../../exercises/exercise.js";
19
+ // import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
20
+ // import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
21
+ // import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
22
+ // import { Point } from "../../../../math/geometry/point.js";
23
+ // import { AffineConstructor } from "../../../../math/polynomials/affine.js";
24
+ // import { randint } from "../../../../math/utils/random/randint.js";
25
+ // import {
26
+ // NodeIdentifiers,
27
+ // reifyAlgebraic,
28
+ // } from "../../../../tree/nodes/nodeConstructor.js";
29
+ // import { add } from "../../../../tree/nodes/operators/addNode.js";
30
+ // import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
31
+ // import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
32
+ export {};
33
+ // type Identifiers = {
34
+ // formula: NodeIdentifiers;
35
+ // type: number;
36
+ // };
37
+ // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
38
+ // const propositions: Proposition[] = [];
39
+ // addValidProp(propositions, answer);
40
+ // tryToAddWrongProp(propositions, "\\text{Aucun}");
41
+ // propWhile(propositions, n, () => {
42
+ // throw Error("QCM not implemented");
43
+ // });
44
+ // return shuffleProps(propositions, n);
45
+ // };
46
+ // const getAnswer: GetAnswer<Identifiers> = (identifiers) => {
47
+ // const { formula, type } = identifiers;
48
+ // const u = reifyAlgebraic(formula);
49
+ // switch (type) {
50
+ // case 0:
51
+ // default: {
52
+ // const value = u.toDetailedEvaluation({ n: (100).toTree() }).evaluate();
53
+ // if (value > 0) return "+\\infty";
54
+ // return "-\\infty";
55
+ // }
56
+ // }
57
+ // };
58
+ // const getInstruction: GetInstruction<Identifiers> = () => {
59
+ // return `Ci-dessous est tracé le nuage de points représentant une suite $u$.
60
+ // Quelle semble être la limite de la suite $u$ quand $n$ tend vers $+\\infty$ ? Si elle n'en a pas, on écrira "Aucun".`;
61
+ // };
62
+ // const getHint: GetHint<Identifiers> = () => {
63
+ // return `Observe les termes de la suite lorsque $n$ devient très grand. Si ces termes semblent se rapprocher d'une certaine valeur, alors on peut conjecturer que cette valeur est la limite de la suite. Cette valeur peut être $+\\infty$ ou $-\\infty$.`;
64
+ // };
65
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
66
+ // return ``;
67
+ // };
68
+ // const getGGBOptions: GetGGBOptions<Identifiers> = (identifiers) => {
69
+ // const { formula } = identifiers;
70
+ // const u = reifyAlgebraic(formula);
71
+ // const values = Array.from({ length: 50 }).map((_, index) => {
72
+ // return u.toDetailedEvaluation({ n: index.toTree() }).evaluate();
73
+ // });
74
+ // const points = values.map((v, i) => new Point(`A_{${i}}`, i, v));
75
+ // const ggb = new GeogebraConstructor({
76
+ // commands: points.flatMap((e) =>
77
+ // e.toGGBCommand({
78
+ // showLabel: false,
79
+ // size: 3,
80
+ // }),
81
+ // ),
82
+ // lockedAxesRatio: false,
83
+ // });
84
+ // const yMin = Math.min(-1, Math.min(...values.slice(0, 10))) - 2;
85
+ // const yMax = Math.max(1, Math.max(...values.slice(0, 10))) + 2;
86
+ // return ggb.getOptions({
87
+ // coords: [-1, 10, yMin, yMax],
88
+ // });
89
+ // };
90
+ // const getKeys: GetKeys<Identifiers> = () => {
91
+ // return ["aucun"];
92
+ // };
93
+ // const isAnswerValid: VEA<Identifiers> = (ans, { answer }) => {
94
+ // try {
95
+ // if (answer.includes("\\infty")) return ans === answer;
96
+ // return numberVEA(ans, answer, undefined, 0.3);
97
+ // } catch (err) {
98
+ // return handleVEAError(err);
99
+ // }
100
+ // };
101
+ // const getSequenceLimitReadingQuestion: QuestionGenerator<Identifiers> = () => {
102
+ // const type = randint(10);
103
+ // let formula: NodeIdentifiers;
104
+ // switch (type) {
105
+ // case 0:
106
+ // formula = AffineConstructor.random(undefined, undefined, "n")
107
+ // .toTree()
108
+ // .toIdentifiers();
109
+ // break;
110
+ // case 1:
111
+ // default:
112
+ // {
113
+ // const k = randint(-10, 10);
114
+ // formula = add(frac(1, add("n", 1)), k).toIdentifiers();
115
+ // }
116
+ // break;
117
+ // }
118
+ // const identifiers: Identifiers = {
119
+ // formula,
120
+ // type,
121
+ // };
122
+ // //0: affine
123
+ // //1: 1/n+k
124
+ // //2: an+b/cn+d
125
+ // //3: exp
126
+ // //4:
127
+ // //styles:
128
+ // //exp, lineaire, alternée, exp décroissant, anarchique
129
+ // return getQuestionFromIdentifiers(identifiers);
130
+ // };
131
+ // const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (
132
+ // identifiers,
133
+ // ) => {
134
+ // return {
135
+ // answer: getAnswer(identifiers),
136
+ // instruction: getInstruction(identifiers),
137
+ // keys: getKeys(identifiers),
138
+ // answerFormat: "tex",
139
+ // identifiers,
140
+ // hint: getHint(identifiers),
141
+ // correction: getCorrection(identifiers),
142
+ // ggbOptions: getGGBOptions(identifiers),
143
+ // };
144
+ // };
145
+ // export const sequenceLimitReading: Exercise<Identifiers> = {
146
+ // id: "sequenceLimitReading",
147
+ // label: "Conjecturer graphiquement la limite d'une suite",
148
+ // isSingleStep: true,
149
+ // generator: (nb, opts) =>
150
+ // getDistinctQuestions(() => getSequenceLimitReadingQuestion(opts), nb),
151
+ // qcmTimer: 60,
152
+ // freeTimer: 60,
153
+ // getPropositions,
154
+ // isAnswerValid,
155
+ // subject: "Mathématiques",
156
+ // getHint,
157
+ // getCorrection,
158
+ // getInstruction,
159
+ // getAnswer,
160
+ // getGGBOptions,
161
+ // hasGeogebra: true,
162
+ // getQuestionFromIdentifiers,
163
+ // };
@@ -12,7 +12,7 @@ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
12
12
  import { random } from "../../../../utils/alea/random.js";
13
13
  const getPropositions = (n, { answer }) => {
14
14
  const propositions = [];
15
- addValidProp(propositions, answer);
15
+ addValidProp(propositions, answer, "raw");
16
16
  tryToAddWrongProp(propositions, "Oui", "raw");
17
17
  tryToAddWrongProp(propositions, "Non", "raw");
18
18
  tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
@@ -82,7 +82,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
82
82
  answer: getAnswer(identifiers),
83
83
  instruction: getInstruction(identifiers),
84
84
  keys: [],
85
- answerFormat: "tex",
85
+ answerFormat: "raw",
86
86
  identifiers,
87
87
  hint: getHint(identifiers),
88
88
  correction: getCorrection(identifiers),
@@ -1,2 +1,2 @@
1
- export declare const numberVEA: (studentAns: string, answer: string, roundTo?: number) => boolean;
1
+ export declare const numberVEA: (studentAns: string, answer: string, roundTo?: number, margin?: number) => boolean;
2
2
  //# sourceMappingURL=numberVEA.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"numberVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/numberVEA.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GACpB,YAAY,MAAM,EAClB,QAAQ,MAAM,EACd,UAAU,MAAM,YAKjB,CAAC"}
1
+ {"version":3,"file":"numberVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/numberVEA.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GACpB,YAAY,MAAM,EAClB,QAAQ,MAAM,EACd,UAAU,MAAM,EAChB,SAAS,MAAM,YAShB,CAAC"}
@@ -1,7 +1,12 @@
1
1
  import { numberParser } from "../../tree/parsers/numberParser.js";
2
- export const numberVEA = (studentAns, answer, roundTo) => {
2
+ export const numberVEA = (studentAns, answer, roundTo, margin) => {
3
3
  const parsed = numberParser(studentAns, roundTo);
4
4
  if (!parsed)
5
5
  return false;
6
- return parsed === answer;
6
+ if (margin === undefined) {
7
+ return parsed === answer;
8
+ }
9
+ else {
10
+ return Math.abs(parsed.unfrenchify() - answer.unfrenchify()) < margin;
11
+ }
7
12
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param ans ligne des signes du student
4
+ * @param answerTable ligne des signes de la réponse
5
+ * cette fonction ne check que la ligne des signes
6
+ */
7
+ export declare const signLineVEA: (ans: string[], answerTable: string[]) => boolean;
8
+ //# sourceMappingURL=signLineVEA.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signLineVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/signLineVEA.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,EAAE,aAAa,MAAM,EAAE,YAE/D,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ *
3
+ * @param ans ligne des signes du student
4
+ * @param answerTable ligne des signes de la réponse
5
+ * cette fonction ne check que la ligne des signes
6
+ */
7
+ export const signLineVEA = (ans, answerTable) => {
8
+ return ans.slice(1).every((cell, i) => cell === answerTable[i + 1]);
9
+ };
@@ -0,0 +1,2 @@
1
+ export declare const signTableVEA: (ans: string[][], answerTable: string[][]) => boolean;
2
+ //# sourceMappingURL=signTableVEA.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signTableVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/signTableVEA.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,EAAE,EAAE,EAAE,aAAa,MAAM,EAAE,EAAE,YAIpE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { signLineVEA } from "./signLineVEA.js";
2
+ import { xTableLineVEA } from "./xTableLineVEA.js";
3
+ export const signTableVEA = (ans, answerTable) => {
4
+ return (xTableLineVEA(ans[0], answerTable[0]) && signLineVEA(ans[1], answerTable[1]));
5
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param ans lignes des variations du student
4
+ * @param answerTable lignes de variations de la réponse
5
+ * cette fonction ne check que la ligne des variations
6
+ */
7
+ export declare const varLineVEA: (ans: string[][], answerTable: string[][]) => boolean;
8
+ //# sourceMappingURL=varLineVEA.d.ts.map