math-exercises 3.0.187 → 3.0.189

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 (149) hide show
  1. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts.map +1 -1
  2. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +22 -6
  3. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -1
  4. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +16 -8
  5. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -1
  6. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +44 -37
  7. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts +9 -0
  8. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map +1 -0
  9. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.js +155 -0
  10. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +1 -0
  11. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
  12. package/lib/exercises/math/derivation/derivativeNumber/index.js +1 -0
  13. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +80 -29
  15. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
  16. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +30 -2
  17. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
  18. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +59 -16
  19. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
  20. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +23 -9
  21. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
  22. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +2 -7
  23. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
  24. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +18 -68
  25. package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts.map +1 -1
  26. package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.js +27 -35
  27. package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts +8 -0
  28. package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts.map +1 -0
  29. package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.js +129 -0
  30. package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.d.ts +8 -0
  31. package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.d.ts.map +1 -0
  32. package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.js +108 -0
  33. package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts +8 -0
  34. package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts.map +1 -0
  35. package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.js +92 -0
  36. package/lib/exercises/math/functions/affines/adjustment/index.d.ts +4 -0
  37. package/lib/exercises/math/functions/affines/adjustment/index.d.ts.map +1 -0
  38. package/lib/exercises/math/functions/affines/adjustment/index.js +3 -0
  39. package/lib/exercises/math/functions/affines/index.d.ts +2 -4
  40. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  41. package/lib/exercises/math/functions/affines/index.js +2 -4
  42. package/lib/exercises/math/functions/affines/situations/affineFromExercise.d.ts +10 -0
  43. package/lib/exercises/math/functions/affines/situations/affineFromExercise.d.ts.map +1 -0
  44. package/lib/exercises/math/functions/affines/situations/affineFromExercise.js +219 -0
  45. package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.d.ts +10 -0
  46. package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.d.ts.map +1 -0
  47. package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.js +69 -0
  48. package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.d.ts +10 -0
  49. package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.d.ts.map +1 -0
  50. package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.js +133 -0
  51. package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.d.ts +10 -0
  52. package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.d.ts.map +1 -0
  53. package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.js +229 -0
  54. package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.d.ts +10 -0
  55. package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.d.ts.map +1 -0
  56. package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.js +166 -0
  57. package/lib/exercises/math/functions/affines/situations/affineSituationVariation.d.ts +9 -0
  58. package/lib/exercises/math/functions/affines/situations/affineSituationVariation.d.ts.map +1 -0
  59. package/lib/exercises/math/functions/affines/situations/affineSituationVariation.js +78 -0
  60. package/lib/exercises/math/functions/affines/situations/index.d.ts +6 -0
  61. package/lib/exercises/math/functions/affines/situations/index.d.ts.map +1 -0
  62. package/lib/exercises/math/functions/affines/situations/index.js +5 -0
  63. package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts +1 -0
  64. package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
  65. package/lib/exercises/math/functions/sign/equationFromSignTable.js +60 -33
  66. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts +6 -4
  67. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts.map +1 -1
  68. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.js +160 -63
  69. package/lib/exercises/math/functions/sign/readSignTable.d.ts +4 -1
  70. package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -1
  71. package/lib/exercises/math/functions/sign/readSignTable.js +32 -9
  72. package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +6 -4
  73. package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -1
  74. package/lib/exercises/math/functions/sign/signTableFromGraph.js +160 -57
  75. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts +9 -0
  76. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts.map +1 -0
  77. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.js +135 -0
  78. package/lib/exercises/math/percent/evolutions/index.d.ts +1 -0
  79. package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
  80. package/lib/exercises/math/percent/evolutions/index.js +1 -0
  81. package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts +9 -0
  82. package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts.map +1 -0
  83. package/lib/exercises/math/powers/equationOnePlusTPowerN.js +118 -0
  84. package/lib/exercises/math/powers/estimateNthRoot.d.ts +13 -0
  85. package/lib/exercises/math/powers/estimateNthRoot.d.ts.map +1 -0
  86. package/lib/exercises/math/powers/estimateNthRoot.js +126 -0
  87. package/lib/exercises/math/powers/index.d.ts +3 -0
  88. package/lib/exercises/math/powers/index.d.ts.map +1 -1
  89. package/lib/exercises/math/powers/index.js +3 -0
  90. package/lib/exercises/math/powers/solveNthRootEquation.d.ts +9 -0
  91. package/lib/exercises/math/powers/solveNthRootEquation.d.ts.map +1 -0
  92. package/lib/exercises/math/powers/solveNthRootEquation.js +111 -0
  93. package/lib/exercises/math/probaStat/randomVariable/index.d.ts +1 -7
  94. package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
  95. package/lib/exercises/math/probaStat/randomVariable/index.js +1 -7
  96. package/lib/exercises/math/probaStat/randomVariable/situations/index.d.ts +8 -0
  97. package/lib/exercises/math/probaStat/randomVariable/situations/index.d.ts.map +1 -0
  98. package/lib/exercises/math/probaStat/randomVariable/situations/index.js +7 -0
  99. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts +11 -0
  100. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts.map +1 -0
  101. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.js +112 -0
  102. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.d.ts +9 -0
  103. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.d.ts.map +1 -0
  104. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.js +176 -0
  105. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.d.ts +8 -0
  106. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.d.ts.map +1 -0
  107. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.js +94 -0
  108. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.d.ts +9 -0
  109. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.d.ts.map +1 -0
  110. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.js +166 -0
  111. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.d.ts +8 -0
  112. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.d.ts.map +1 -0
  113. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.js +133 -0
  114. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.d.ts +8 -0
  115. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.d.ts.map +1 -0
  116. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.js +211 -0
  117. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.d.ts +8 -0
  118. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.d.ts.map +1 -0
  119. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.js +113 -0
  120. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.d.ts +41 -0
  121. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.d.ts.map +1 -0
  122. package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.js +173 -0
  123. package/lib/exercises/math/python/list/pyListMutationMix.d.ts.map +1 -1
  124. package/lib/exercises/math/python/list/pyListMutationMix.js +11 -6
  125. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
  126. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +2 -2
  127. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +1 -1
  128. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +1 -1
  129. package/lib/exercises/vea/percentVEA.d.ts +6 -1
  130. package/lib/exercises/vea/percentVEA.d.ts.map +1 -1
  131. package/lib/exercises/vea/percentVEA.js +15 -1
  132. package/lib/index.d.ts +78 -33
  133. package/lib/index.d.ts.map +1 -1
  134. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  135. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +5 -8
  136. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
  137. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
  138. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +1 -3
  139. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
  140. package/lib/math/utils/sequences/situations/seqGeometricSituations.js +8 -10
  141. package/lib/tests/questionTest.d.ts.map +1 -1
  142. package/lib/tests/questionTest.js +8 -0
  143. package/lib/tree/nodes/sets/closure.d.ts +1 -0
  144. package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
  145. package/lib/tree/nodes/sets/closure.js +12 -0
  146. package/lib/tree/utilities/nodeUtils.d.ts +2 -0
  147. package/lib/tree/utilities/nodeUtils.d.ts.map +1 -1
  148. package/lib/tree/utilities/nodeUtils.js +40 -0
  149. package/package.json +1 -1
@@ -0,0 +1,211 @@
1
+ import { addValidProp, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
4
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
5
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
6
+ import { DiscreteSetNode } from "../../../../../tree/nodes/sets/discreteSetNode.js";
7
+ import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
8
+ import { shuffle } from "../../../../../utils/alea/shuffle.js";
9
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
10
+ import { buildRandomVariableSituation, getRandomVariableSituation, } from "./randomVariableSituations.js";
11
+ const getAnswer = (identifiers) => {
12
+ const { params } = identifiers;
13
+ const va = getRandomVariableSituation(params).getVA();
14
+ return new DiscreteSetNode(va.xValues).simplify().toTex();
15
+ };
16
+ const getPropositions = (_n, { answer, params }) => {
17
+ const propositions = [];
18
+ addValidProp(propositions, answer);
19
+ switch (params.id) {
20
+ case "coin":
21
+ tryToAddWrongProp(propositions, new DiscreteSetNode([params.a.toTree(), params.b.toTree()])
22
+ .simplify()
23
+ .toTex());
24
+ tryToAddWrongProp(propositions, new DiscreteSetNode(["\\text{Pile}".toTree(), "\\text{Face}".toTree()])
25
+ .simplify()
26
+ .toTex());
27
+ tryToAddWrongProp(propositions, new DiscreteSetNode([params.a.toTree(), (-params.b).toTree()])
28
+ .simplify()
29
+ .toTex());
30
+ tryToAddWrongProp(propositions, new DiscreteSetNode([params.a.toTree(), params.b.toTree()])
31
+ .simplify()
32
+ .toTex());
33
+ break;
34
+ case "urne":
35
+ tryToAddWrongProp(propositions, new DiscreteSetNode([
36
+ "\\text{Blanche}".toTree(),
37
+ "\\text{Rouge}".toTree(),
38
+ "\\text{Noire}".toTree(),
39
+ ])
40
+ .simplify()
41
+ .toTex());
42
+ tryToAddWrongProp(propositions, new DiscreteSetNode([
43
+ params.b.toTree(),
44
+ params.r.toTree(),
45
+ params.n.toTree(),
46
+ ])
47
+ .simplify()
48
+ .toTex());
49
+ tryToAddWrongProp(propositions, new DiscreteSetNode([
50
+ params.gb.toTree(),
51
+ params.gr.toTree(),
52
+ (-params.gn).toTree(),
53
+ ])
54
+ .simplify()
55
+ .toTex());
56
+ break;
57
+ case "diceMultiple": {
58
+ const allValues = [...Array(params.n).keys()].map((i) => i + 1);
59
+ const multiples = [];
60
+ for (let i = 1; i < params.n; i++) {
61
+ if (i % params.winningMultiple === 0) {
62
+ multiples.push(i);
63
+ }
64
+ }
65
+ tryToAddWrongProp(propositions, new DiscreteSetNode(multiples.map((m) => m.toTree()))
66
+ .simplify()
67
+ .toTex());
68
+ tryToAddWrongProp(propositions, new DiscreteSetNode(allValues.map((v) => v.toTree()))
69
+ .simplify()
70
+ .toTex());
71
+ tryToAddWrongProp(propositions, new DiscreteSetNode([params.gain.toTree(), params.loss.toTree()])
72
+ .simplify()
73
+ .toTex());
74
+ }
75
+ }
76
+ return shuffle(propositions);
77
+ };
78
+ const getInstruction = (identifiers) => {
79
+ const { params } = identifiers;
80
+ const context = getRandomVariableSituation(params).getContext();
81
+ return (context +
82
+ `
83
+
84
+ Quel est l'ensemble des valeurs possibles pour $X$ ?`);
85
+ };
86
+ const getHint = (identifiers) => {
87
+ const { params } = identifiers;
88
+ switch (params.id) {
89
+ case "coin":
90
+ return `La variable aléatoire $X$ donne le gain algébrique du joueur (c'est à dire un gain qui peut être négatif si le joueur perd des points) en fonction du résultat de ses lancers. Les valeurs $x_i$ qu'elle prend sont donc les valeurs de gain (ou de perte) possibles.`;
91
+ case "urne":
92
+ return `La variable aléatoire $X$ donne le gain algébrique du joueur (c'est à dire un gain qui peut être négatif si le joueur perd de l'argent) en fonction de la boule qu'il a tirée. Les valeurs $x_i$ qu'elle prend sont donc les valeurs de gain (ou de perte) possibles.`;
93
+ case "diceMultiple":
94
+ return `La variable aléatoire $X$ donne le gain algébrique du joueur (c'est à dire un gain qui peut être négatif si le joueur perd de l'argent) en fonction de la face obtenue. Les valeurs $x_i$ qu'elle prend sont donc les valeurs de gain (ou de perte) possibles.`;
95
+ case "cards":
96
+ return `La variable aléatoire $X$ donne le gain algébrique du joueur (c'est à dire un gain qui peut être négatif si le joueur perd de l'argent) en fonction de la carte qu'il a tirée. Les valeurs $x_i$ qu'elle prend sont donc les valeurs de gain (ou de perte) possibles.`;
97
+ // case "diceSum":
98
+ // return `Chaque dé peut valoir $1$, $2$, $3$ ou $4$. Cela créé donc $16$ résultats possibles, par exemple $1+1=2$, $3+4=7$, etc... Détermine tous les résultats possibles.`;
99
+ }
100
+ };
101
+ const getCorrection = (identifiers) => {
102
+ const { params } = identifiers;
103
+ switch (params.id) {
104
+ case "coin":
105
+ return `On liste toutes les issues possibles :
106
+
107
+ - $2$ piles : le gain du joueur est alors $${multiply(2, params.a).toSimplificationTex()}$ points.
108
+ - $1$ pile, $1$ face : le gain du joueur est alors $${substract(params.a, params.b).toSimplificationTex()}$ points.
109
+ - $2$ faces: le gain du joueur est alors $${opposite(multiply(2, params.b)).toSimplificationTex()}$ points.
110
+
111
+ L'ensemble des valeurs possibles pour $X$ est donc :
112
+
113
+ $$
114
+ ${getAnswer(identifiers)}
115
+ $$
116
+ `;
117
+ case "urne":
118
+ return `Le gain pour chaque tirage vaut :
119
+
120
+ - $${params.gb}$ si on tire une boule blanche ;
121
+ - $${params.gr}$ si on tire une boule rouge ;
122
+ - $${params.gn}$ si on tire une boule noire.
123
+
124
+ L'ensemble des valeurs possibles pour $X$ est donc :
125
+
126
+ $$
127
+ ${getAnswer(identifiers)}
128
+ $$`;
129
+ case "diceMultiple":
130
+ return `Si on obtient un multiple de $${params.winningMultiple}$, on gagne $${params.gain}\\ €$, donc $X$ vaut $${params.gain}$ dans ce cas. Sinon, on perd $${params.loss}\\ €$, donc $X$ vaut $-${params.loss}$.
131
+
132
+ L'ensemble des valeurs possibles pour $X$ est donc :
133
+
134
+ $$
135
+ ${getAnswer(identifiers)}
136
+ $$`;
137
+ case "cards":
138
+ return `Le gain pour chaque tirage vaut :
139
+
140
+ - $${params.gAs}$ si on tire un as ;
141
+ - $${params.gFigure}$ si on tire une figure ;
142
+ - $${params.gOther}$ si on tire une autre carte.
143
+
144
+ L'ensemble des valeurs possibles pour $X$ est donc :
145
+
146
+ $$
147
+ ${getAnswer(identifiers)}
148
+ $$`;
149
+ // case "diceSum": {
150
+ // const results = [["\\ ", "1", "2", "3", "4"], ["1"], ["2"], ["3"], ["4"]];
151
+ // for (let i = 1; i < 5; i++) {
152
+ // for (let j = 1; j < 5; j++) {
153
+ // results[i][j] = (i + j).frenchify();
154
+ // }
155
+ // }
156
+ // return `Voici tous les résultats possibles en fonction du résultat de chaque dé :
157
+ // ${mdTable(results, true)}
158
+ // Les valeurs possibles pour $X$ sont donc :
159
+ // ${mdTable(getAnswerTable(identifiers), true)}`;
160
+ // }
161
+ }
162
+ };
163
+ const getKeys = () => {
164
+ return ["lbrace", "semicolon", "rbrace"];
165
+ };
166
+ const isAnswerValid = (ans, { answer }) => {
167
+ try {
168
+ const parsed = discreteSetParser(ans);
169
+ if (!parsed)
170
+ return false;
171
+ return parsed.simplify().toTex() === answer;
172
+ }
173
+ catch (err) {
174
+ return handleVEAError(err);
175
+ }
176
+ };
177
+ const getRandomVariableSituationValuesQuestion = () => {
178
+ const params = buildRandomVariableSituation();
179
+ const identifiers = {
180
+ params,
181
+ };
182
+ return getQuestionFromIdentifiers(identifiers);
183
+ };
184
+ const getQuestionFromIdentifiers = (identifiers) => {
185
+ return {
186
+ answer: getAnswer(identifiers),
187
+ instruction: getInstruction(identifiers),
188
+ keys: getKeys(identifiers),
189
+ answerFormat: "tex",
190
+ identifiers,
191
+ hint: getHint(identifiers),
192
+ correction: getCorrection(identifiers),
193
+ };
194
+ };
195
+ export const randomVariableSituationValues = {
196
+ id: "randomVariableSituationValues",
197
+ label: "Donner l'ensemble des valeurs possibles d'une variable aléatoire avec contexte",
198
+ isSingleStep: true,
199
+ generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationValuesQuestion(opts), nb),
200
+ qcmTimer: 60,
201
+ freeTimer: 60,
202
+ isAnswerValid,
203
+ getAnswer,
204
+ subject: "Mathématiques",
205
+ getInstruction,
206
+ getHint,
207
+ getCorrection,
208
+ getPropositions,
209
+ getQuestionFromIdentifiers,
210
+ hasHintAndCorrection: true,
211
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { RandomVariableSituationParams } from "./randomVariableSituations.js";
3
+ type Identifiers = {
4
+ params: RandomVariableSituationParams;
5
+ };
6
+ export declare const randomVariableSituationVariance: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=randomVariableSituationVariance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomVariableSituationVariance.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;CACvC,CAAC;AA4GF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAqBjE,CAAC"}
@@ -0,0 +1,113 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { rationalVEA } from "../../../../../exercises/vea/rationalVEA.js";
4
+ import { RationalConstructor } from "../../../../../math/numbers/rationals/rational.js";
5
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
6
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
7
+ import { buildRandomVariableSituation, getRandomVariableSituation, } from "./randomVariableSituations.js";
8
+ const getPropositions = (n, { answer }) => {
9
+ const propositions = [];
10
+ addValidProp(propositions, answer);
11
+ propWhile(propositions, n, () => {
12
+ tryToAddWrongProp(propositions, RationalConstructor.randomIrreductibleWithSign().toTree().toTex());
13
+ });
14
+ return shuffleProps(propositions, n);
15
+ };
16
+ const getAnswer = (identifiers) => {
17
+ const { params } = identifiers;
18
+ const va = getRandomVariableSituation(params).getVA();
19
+ return va.getVariance().simplify().toTex();
20
+ };
21
+ const getInstruction = (identifiers) => {
22
+ const { params } = identifiers;
23
+ const context = getRandomVariableSituation(params).getContext();
24
+ return (context +
25
+ `
26
+
27
+ Que vaut la variance $V(X)$ de $X$ ?
28
+
29
+ Donner la valeur exacte ou une valeur arrondie au centième.`);
30
+ };
31
+ const getHint = () => {
32
+ return `Dresse la loi de probabilité de $X$. Pour cela, détermine les valeurs possibles $x_i$ que peut prendre $X$, puis pour chaque valeur, calcule la probabilité $p_i$ associée.
33
+
34
+ Tu peux alors calculer l'espérance de $X$ par la formule :
35
+
36
+ $$
37
+ E(X) = x_1\\times p_1 + \\ldots + x_n\\times p_n
38
+ $$
39
+
40
+ La variance $V(X)$ s'obtient par la formule :
41
+
42
+ $$
43
+ V(X) = p_1(x_1-E(X))^2 + \\ldots + p_n(x_n-E(X))^2
44
+ $$
45
+ `;
46
+ };
47
+ const getCorrection = (identifiers) => {
48
+ const { params } = identifiers;
49
+ const va = getRandomVariableSituation(params).getVA();
50
+ return `On dresse la loi de probabilité de $X$ :
51
+
52
+ ${va.getLawMdTable()}
53
+
54
+ Puis on calcule l'espérance :
55
+
56
+ ${alignTex([
57
+ ["E(X)", "=", va.getAverage().toTex()],
58
+ ["", "=", va.getAverage().simplify().toTex()],
59
+ ])}
60
+
61
+ Enfin, on calcule la variance :
62
+
63
+ ${alignTex([
64
+ ["V(X)", "=", va.getVariance().toTex()],
65
+ ["", "=", va.getVariance().simplify().toTex()],
66
+ ])}`;
67
+ };
68
+ const getKeys = () => {
69
+ return [];
70
+ };
71
+ const isAnswerValid = (ans, { answer }) => {
72
+ try {
73
+ return rationalVEA(ans, answer);
74
+ }
75
+ catch (err) {
76
+ return handleVEAError(err);
77
+ }
78
+ };
79
+ const getRandomVariableSituationAverageQuestion = () => {
80
+ const params = buildRandomVariableSituation();
81
+ const identifiers = {
82
+ params,
83
+ };
84
+ return getQuestionFromIdentifiers(identifiers);
85
+ };
86
+ const getQuestionFromIdentifiers = (identifiers) => {
87
+ return {
88
+ answer: getAnswer(identifiers),
89
+ instruction: getInstruction(identifiers),
90
+ keys: getKeys(identifiers),
91
+ answerFormat: "tex",
92
+ identifiers,
93
+ hint: getHint(identifiers),
94
+ correction: getCorrection(identifiers),
95
+ };
96
+ };
97
+ export const randomVariableSituationVariance = {
98
+ id: "randomVariableSituationVariance",
99
+ connector: "=",
100
+ label: "Calculer la variance $V(X)$ d'une variable aléatoire dans un contexte",
101
+ isSingleStep: true,
102
+ generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationAverageQuestion(opts), nb),
103
+ qcmTimer: 60,
104
+ freeTimer: 60,
105
+ getPropositions,
106
+ isAnswerValid,
107
+ subject: "Mathématiques",
108
+ getHint,
109
+ getCorrection,
110
+ getAnswer,
111
+ getQuestionFromIdentifiers,
112
+ hasHintAndCorrection: true,
113
+ };
@@ -0,0 +1,41 @@
1
+ import { RandomVariable } from "../../../../../math/probability/randomVariable.js";
2
+ type UrneParams = {
3
+ b: number;
4
+ r: number;
5
+ n: number;
6
+ gb: number;
7
+ gr: number;
8
+ gn: number;
9
+ };
10
+ type CoinParams = {
11
+ b: number;
12
+ a: number;
13
+ n: number;
14
+ };
15
+ type DiceMultipleParams = {
16
+ n: number;
17
+ winningMultiple: number;
18
+ gain: number;
19
+ loss: number;
20
+ };
21
+ type CardsParams = {
22
+ gAs: number;
23
+ gFigure: number;
24
+ gOther: number;
25
+ };
26
+ export type RandomVariableSituationParams = (UrneParams & {
27
+ id: "urne";
28
+ }) | (CoinParams & {
29
+ id: "coin";
30
+ }) | (DiceMultipleParams & {
31
+ id: "diceMultiple";
32
+ }) | (CardsParams & {
33
+ id: "cards";
34
+ });
35
+ export declare const getRandomVariableSituation: (params: RandomVariableSituationParams) => {
36
+ getContext: () => string;
37
+ getVA: () => RandomVariable;
38
+ };
39
+ export declare const buildRandomVariableSituation: () => RandomVariableSituationParams;
40
+ export {};
41
+ //# sourceMappingURL=randomVariableSituations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomVariableSituations.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAU1E,KAAK,UAAU,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAsDF,KAAK,UAAU,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmEF,KAAK,kBAAkB,GAAG;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkCF,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA4BF,MAAM,MAAM,6BAA6B,GACrC,CAAC,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7B,CAAC,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7B,CAAC,kBAAkB,GAAG;IAAE,EAAE,EAAE,cAAc,CAAA;CAAE,CAAC,GAC7C,CAAC,WAAW,GAAG;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAIpC,eAAO,MAAM,0BAA0B,GACrC,QAAQ,6BAA6B;;;CActC,CAAC;AAEF,eAAO,MAAM,4BAA4B,QACnC,6BAkBH,CAAC"}
@@ -0,0 +1,173 @@
1
+ import { RandomVariable } from "../../../../../math/probability/randomVariable.js";
2
+ import { randint } from "../../../../../math/utils/random/randint.js";
3
+ import { randTupleInt } from "../../../../../math/utils/random/randTupleInt.js";
4
+ import { binom } from "../../../../../tree/nodes/operators/binomialCoefficientNode.js";
5
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
6
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { power } from "../../../../../tree/nodes/operators/powerNode.js";
8
+ import { random } from "../../../../../utils/alea/random.js";
9
+ import { pluralize } from "../../../../../utils/strings/pluralize.js";
10
+ const getUrneRandomParams = () => {
11
+ const [b, r, n] = randTupleInt(3, {
12
+ from: 1,
13
+ to: 5,
14
+ allDifferent: false,
15
+ });
16
+ const [gb, gr] = randTupleInt(2, {
17
+ from: 1,
18
+ to: 10,
19
+ allDifferent: true,
20
+ });
21
+ const gn = randint(-10, 0);
22
+ return { b, r, n, gb, gr, gn };
23
+ };
24
+ const getUrneSituation = (params) => {
25
+ const { b, r, n, gb, gr, gn } = params;
26
+ return {
27
+ getContext: () => {
28
+ const getWord = (g) => g > 0 ? `rapporte $${g}\\ €$` : `fait perdre $${Math.abs(g)}\\ €$`;
29
+ return `Une urne contient $${b}$ ${pluralize("boule", b)} ${pluralize("blanche", b)}, $${r}$ ${pluralize("boule", r)} ${pluralize("rouge", r)} et $${n}$ ${pluralize("boule", r)} ${pluralize("noire", n)}. On tire au hasard une boule de l'urne. Tirer une boule blanche ${getWord(gb)}, une boule rouge ${getWord(gr)} et une boule noire ${getWord(gn)}. La variable aléatoire $X$ associe à chaque tirage le gain algébrique du joueur.`;
30
+ },
31
+ getVA: () => {
32
+ const total = b + r + n;
33
+ const sorted = [
34
+ { gain: gb, eff: b },
35
+ { gain: gr, eff: r },
36
+ { gain: gn, eff: r },
37
+ ].sort((a, b) => a.gain - b.gain);
38
+ return new RandomVariable(sorted.map((s) => s.gain), sorted.map((s) => frac(s.eff, total).simplify()));
39
+ },
40
+ };
41
+ };
42
+ const getCoinRandomParams = () => {
43
+ const n = 2;
44
+ let a, b;
45
+ do {
46
+ a = randint(1, 10);
47
+ b = randint(1, 10);
48
+ } while (2 * a === a - b || -2 * b === a - b);
49
+ return { a, b, n };
50
+ };
51
+ const getCoinSituation = (params) => {
52
+ const { a, b, n } = params;
53
+ return {
54
+ getContext: () => {
55
+ return `On lance $${n}$ fois d'affilée une pièce de monnaie bien équilibrée. Chaque pile rapporte $${a}$ ${pluralize("point", a)} et chaque face fait perdre $${b}$ ${pluralize("point", b)}. La variable aléatoire $X$ associe à chaque tirage le gain algébrique du joueur.`;
56
+ },
57
+ // values k(a+b)−nb pourk = 0;...n;
58
+ // P(X = k(a+b)-nb) = (k parmi n) (1/2)^n
59
+ getVA: () => {
60
+ const values = [];
61
+ const probas = [];
62
+ for (let i = 0; i < n + 1; i++) {
63
+ const value = (a + b) * i - n * b;
64
+ values.push(value);
65
+ probas.push(multiply(binom(n, i), power(frac(1, 2), n)).simplify());
66
+ }
67
+ return new RandomVariable(values, probas);
68
+ },
69
+ };
70
+ };
71
+ const getDiceMultipleRandomParams = () => {
72
+ const n = 6;
73
+ const winningMultiple = random([2, 3]);
74
+ const gain = randint(1, 10);
75
+ const loss = randint(1, 10);
76
+ return { n, gain, loss, winningMultiple };
77
+ };
78
+ const getDiceMultipleSituation = (params) => {
79
+ const { gain, loss, n, winningMultiple } = params;
80
+ return {
81
+ getContext: () => {
82
+ return `Un jeu consiste à lancer un dé bien équilibré à $${n}$ faces. On gagne $${gain}\\ €$ si on obtient un multiple de $${winningMultiple}$, et on perd $${loss}\\ €$ sinon.`;
83
+ },
84
+ // values k(a+b)−nb pourk = 0;...n;
85
+ // P(X = k(a+b)-nb) = (k parmi n) (1/2)^n
86
+ getVA: () => {
87
+ const values = [-loss, gain];
88
+ let multiples = 0;
89
+ for (let i = 2; i <= n; i++) {
90
+ if (i % winningMultiple === 0) {
91
+ multiples++;
92
+ }
93
+ }
94
+ return new RandomVariable(values, [
95
+ frac(n - multiples, n).simplify(),
96
+ frac(multiples, n).simplify(),
97
+ ]);
98
+ },
99
+ };
100
+ };
101
+ const getCardsRandomParams = () => {
102
+ const gAs = randint(5, 10);
103
+ const gFigure = randint(1, gAs);
104
+ const gOther = randint(-10, 0);
105
+ return { gAs, gFigure, gOther };
106
+ };
107
+ const getCardsSituation = (params) => {
108
+ const { gAs, gFigure, gOther } = params;
109
+ return {
110
+ getContext: () => {
111
+ return `Un jeu consiste à tirer au hasard une carte dans un jeu de $52$ cartes. Si on tire un as, on gagne $${gAs}\\ €$; si on tire une figure, on gagne $${gFigure}\\ €$; dans les autres cas, on perd $${Math.abs(gOther)}\\ €$.`;
112
+ },
113
+ // values k(a+b)−nb pourk = 0;...n;
114
+ // P(X = k(a+b)-nb) = (k parmi n) (1/2)^n
115
+ getVA: () => {
116
+ return new RandomVariable([gOther, gFigure, gAs], [frac(52 - 16, 52).simplify(), frac(12, 52).simplify(), frac(1, 13)]);
117
+ },
118
+ };
119
+ };
120
+ // | (DiceSumParams & { id: "diceSum" });
121
+ export const getRandomVariableSituation = (params) => {
122
+ switch (params.id) {
123
+ case "coin":
124
+ return getCoinSituation(params);
125
+ case "urne":
126
+ return getUrneSituation(params);
127
+ case "diceMultiple":
128
+ return getDiceMultipleSituation(params);
129
+ case "cards":
130
+ return getCardsSituation(params);
131
+ // case "diceSum":
132
+ // return getDiceSumSituation(params);
133
+ }
134
+ };
135
+ export const buildRandomVariableSituation = () => {
136
+ const id = random(["urne", "coin", "diceMultiple", "cards"]);
137
+ switch (id) {
138
+ case "coin":
139
+ return { ...getCoinRandomParams(), id: "coin" };
140
+ case "urne":
141
+ return { ...getUrneRandomParams(), id: "urne" };
142
+ case "diceMultiple":
143
+ return { ...getDiceMultipleRandomParams(), id: "diceMultiple" };
144
+ case "cards":
145
+ return { ...getCardsRandomParams(), id: "cards" };
146
+ // case "diceSum":
147
+ // return { ...getDiceSumRandomParams(), id: "diceSum" };
148
+ }
149
+ };
150
+ // {
151
+ // //param nbFaces; g_2, g_3, g_4, g_5, g_6
152
+ // label:
153
+ // "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.",
154
+ // },
155
+ // {
156
+ // //param b;r , gb;gr
157
+ // label:
158
+ // "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.",
159
+ // },
160
+ // {
161
+ // },
162
+ // {
163
+ // label:
164
+ // ,
165
+ // },
166
+ // {
167
+ // label:
168
+ // "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.",
169
+ // },
170
+ // {
171
+ // label:
172
+ // "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.",
173
+ // },
@@ -1 +1 @@
1
- {"version":3,"file":"pyListMutationMix.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/python/list/pyListMutationMix.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAyIrC,KAAK,MAAM,CAAC,CAAC,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,MAAM,CAAC,CAAC,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,MAAM,CAAC,CAAC,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,IACd,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAChC,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAChC,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAErC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,EAAE,CAAC;IACvB,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;CACxC,CAAC;AAsbF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAanD,CAAC"}
1
+ {"version":3,"file":"pyListMutationMix.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/python/list/pyListMutationMix.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAyIrC,KAAK,MAAM,CAAC,CAAC,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,MAAM,CAAC,CAAC,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,MAAM,CAAC,CAAC,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,IACd,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAChC,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAChC,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAErC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,EAAE,CAAC;IACvB,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;CACxC,CAAC;AAoaF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAanD,CAAC"}
@@ -265,21 +265,26 @@ const getPropositions = (n, { answer, ...identifiers }) => {
265
265
  };
266
266
  return getAnswer(identifiersWrong);
267
267
  }
268
+ function checkAndTryToAddWrongProp(str) {
269
+ if (!str.includes("undefined")) {
270
+ tryToAddWrongProp(propositions, codifyChunk(str), "raw");
271
+ }
272
+ }
268
273
  //indexAsked-1
269
274
  {
270
- tryToAddWrongProp(propositions, codifyChunk(createAnswerWrong((index) => index - 1)), "raw");
275
+ checkAndTryToAddWrongProp(createAnswerWrong((index) => index - 1));
271
276
  }
272
277
  //indexAsked+1
273
278
  {
274
- tryToAddWrongProp(propositions, codifyChunk(createAnswerWrong((index) => index + 1)), "raw");
279
+ checkAndTryToAddWrongProp(createAnswerWrong((index) => index + 1));
275
280
  }
276
281
  //student: lst[index]=value -> lst[value]=index
277
282
  if (typeof value === "number") {
278
- tryToAddWrongProp(propositions, codifyChunk(createAnswerWrong(() => value, () => index)), "raw");
283
+ checkAndTryToAddWrongProp(createAnswerWrong(() => value, () => index));
279
284
  }
280
285
  //-indexAsked
281
286
  {
282
- tryToAddWrongProp(propositions, codifyChunk(createAnswerWrong((index) => -index)), "raw");
287
+ checkAndTryToAddWrongProp(createAnswerWrong((index) => -index));
283
288
  }
284
289
  //append
285
290
  {
@@ -289,13 +294,13 @@ const getPropositions = (n, { answer, ...identifiers }) => {
289
294
  return { ...instruction, type: "append" };
290
295
  }),
291
296
  };
292
- tryToAddWrongProp(propositions, codifyChunk(getAnswer(identifiersWrong)), "raw");
297
+ checkAndTryToAddWrongProp(getAnswer(identifiersWrong));
293
298
  }
294
299
  //filler
295
300
  {
296
301
  propWhile(propositions, n, () => {
297
302
  const identifiersWrong = createRandomIdentifiers();
298
- tryToAddWrongProp(propositions, codifyChunk(getAnswer(identifiersWrong)), "raw");
303
+ checkAndTryToAddWrongProp(getAnswer(identifiersWrong));
299
304
  });
300
305
  }
301
306
  return shuffleProps(propositions, n);
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticFindRecurrenceFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAW1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;CACtD,CAAC;AAiRF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,4CAA4C,EAAE,QAAQ,CACjE,WAAW,EACX,OAAO,CAoBR,CAAC"}
1
+ {"version":3,"file":"arithmeticFindRecurrenceFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAW1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;CACtD,CAAC;AAmRF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,4CAA4C,EAAE,QAAQ,CACjE,WAAW,EACX,OAAO,CAoBR,CAAC"}
@@ -24,7 +24,7 @@ const getAnswerNode = (identifiers, opts) => {
24
24
  const firstRank = opts?.firstTermRankOne ? 1 : 0;
25
25
  const { situationIndex, initial, reason } = identifiers;
26
26
  const situation = situations[situationIndex];
27
- return situation.variationFindRecurrenceFormula.getAnswerNode(initial, reason, firstRank);
27
+ return situation.variationFindRecurrenceFormula.getAnswerNode(initial, reason, firstRank, situation.digitsValue);
28
28
  };
29
29
  const getAnswer = (identifiers, optsIn) => {
30
30
  const opts = optsIn ?? optsDefault;
@@ -42,7 +42,7 @@ const getCorrection = (identifiers, optsIn) => {
42
42
  const firstRank = opts?.firstTermRankOne ? 1 : 0;
43
43
  const { situationIndex, initial, reason } = identifiers;
44
44
  const situation = situations[situationIndex];
45
- return situation.variationFindRecurrenceFormula.getCorrectionStuff(initial, reason, firstRank).str;
45
+ return situation.variationFindRecurrenceFormula.getCorrectionStuff(initial, reason, firstRank, situation.digitsValue).str;
46
46
  };
47
47
  const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
48
48
  const opts = optsIn ?? optsDefault;
@@ -220,7 +220,7 @@ const createRandomIdentifiersRaw = (opts) => {
220
220
  }
221
221
  })();
222
222
  const rank1 = randint(firstRank + 1, 5);
223
- const rank2 = rank1 + randint(1, 5);
223
+ const rank2 = rank1 + 1;
224
224
  function valueForRank(initial, reason, rank) {
225
225
  return initial * Math.pow(reason, rank);
226
226
  }
@@ -235,7 +235,7 @@ const options = [generatorOptionFirstTermRankOne];
235
235
  export const geometricFindRandomTermFromTwoConsecutiveTerms = {
236
236
  id: "geometricFindRandomTermFromTwoConsecutiveTerms",
237
237
  connector: "=",
238
- label: "Connaissant deux termes consécutifs d'une suite géométrique, en donner une formule générale",
238
+ label: "Connaissant deux termes consécutifs d'une suite géométrique, calculer un autre terme",
239
239
  isSingleStep: true,
240
240
  generator: (nb, opts) => getDistinctQuestions(() => getGeometricFindRandomTermFromTwoConsecutiveTermsQuestion(opts), nb),
241
241
  options,
@@ -1,2 +1,7 @@
1
- export {};
1
+ /**
2
+ *
3
+ * @param ans élève, % accepté ou non
4
+ * @param answer doit être sous forme x%
5
+ */
6
+ export declare const percentVEA: (ans: string, answer: string) => boolean;
2
7
  //# sourceMappingURL=percentVEA.d.ts.map