math-exercises 3.0.190 → 3.0.191

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 (76) hide show
  1. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts +6 -0
  2. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts.map +1 -0
  3. package/lib/exercises/math/dataRepresentations/scatterPlot/index.js +5 -0
  4. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts +12 -0
  5. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts.map +1 -0
  6. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.js +206 -0
  7. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts +9 -0
  8. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts.map +1 -0
  9. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.js +210 -0
  10. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts +10 -0
  11. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts.map +1 -0
  12. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.js +252 -0
  13. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts +12 -0
  14. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts.map +1 -0
  15. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.js +352 -0
  16. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts +11 -0
  17. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts.map +1 -0
  18. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.js +403 -0
  19. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +1 -1
  20. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -1
  21. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +4 -1
  22. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts +13 -0
  23. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts.map +1 -0
  24. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.js +205 -0
  25. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts +9 -0
  26. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts.map +1 -0
  27. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.js +157 -0
  28. package/lib/exercises/math/functions/affines/affineVariations.d.ts +12 -0
  29. package/lib/exercises/math/functions/affines/affineVariations.d.ts.map +1 -0
  30. package/lib/exercises/math/functions/affines/affineVariations.js +176 -0
  31. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts +8 -0
  32. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts.map +1 -0
  33. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.js +203 -0
  34. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts +12 -0
  35. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts.map +1 -0
  36. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.js +259 -0
  37. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts +9 -0
  38. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts.map +1 -0
  39. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.js +99 -0
  40. package/lib/exercises/math/functions/exponentials/index.d.ts +5 -0
  41. package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/exponentials/index.js +5 -0
  43. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts +10 -0
  44. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts.map +1 -0
  45. package/lib/exercises/math/functions/exponentials/realPowersFraction.js +125 -0
  46. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts +12 -0
  47. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts.map +1 -0
  48. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.js +148 -0
  49. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts +10 -0
  50. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts.map +1 -0
  51. package/lib/exercises/math/functions/exponentials/realPowersPower.js +128 -0
  52. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts +10 -0
  53. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts.map +1 -0
  54. package/lib/exercises/math/functions/exponentials/realPowersProduct.js +128 -0
  55. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts +12 -0
  56. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map +1 -0
  57. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.js +217 -0
  58. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts +10 -0
  59. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts.map +1 -0
  60. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.js +186 -0
  61. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts +14 -0
  62. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts.map +1 -0
  63. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.js +189 -0
  64. package/lib/exercises/math/sequences/geometric/graph/index.d.ts +2 -0
  65. package/lib/exercises/math/sequences/geometric/graph/index.d.ts.map +1 -0
  66. package/lib/exercises/math/sequences/geometric/graph/index.js +1 -0
  67. package/lib/index.d.ts +21 -0
  68. package/lib/index.d.ts.map +1 -1
  69. package/lib/tree/nodes/algebraicNode.d.ts +3 -0
  70. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  71. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  72. package/lib/tree/nodes/operators/fractionNode.js +5 -3
  73. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  74. package/lib/tree/nodes/operators/multiplyNode.js +5 -3
  75. package/lib/tree/nodes/operators/powerNode.js +1 -1
  76. package/package.json +1 -1
@@ -0,0 +1,259 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
4
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { abs } from "../../../../tree/nodes/functions/absNode.js";
7
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
8
+ import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
9
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
10
+ import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
11
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
12
+ import { probaFlip } from "../../../../utils/alea/probaFlip.js";
13
+ import { random } from "../../../../utils/alea/random.js";
14
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
15
+ const createRandomNode = (numberType) => {
16
+ switch (numberType) {
17
+ case "Décimal":
18
+ return coinFlip()
19
+ ? randfloat(-100, 0, randint(1, 7), [0]).toTree()
20
+ : randfloat(1, 100, randint(1, 7), [1]).toTree();
21
+ case "Fraction": {
22
+ if (probaFlip(0.7)) {
23
+ const num = coinFlip()
24
+ ? randint(10_000, 20_000)
25
+ : randint(-20_000, -10_000);
26
+ const den = randint(1, abs(num).evaluate());
27
+ return frac(num, den);
28
+ }
29
+ else {
30
+ const num = coinFlip()
31
+ ? randfloat(1, 200, randint(1, 3), [1])
32
+ : randfloat(-200, -1, randint(1, 3));
33
+ const den = randfloat(1, abs(num).evaluate(), randint(1, 3));
34
+ return frac(num, den);
35
+ }
36
+ }
37
+ case "Réel":
38
+ return random([
39
+ PiNode,
40
+ frac(PiNode, randint(2, 4)),
41
+ sqrt(randfloat(1, 100, randint(1, 5), [1])),
42
+ ]);
43
+ case "Entier":
44
+ default:
45
+ return randint(-100, 100).toTree();
46
+ }
47
+ };
48
+ const getInstruction = (identifiers) => {
49
+ const { pointIds } = identifiers;
50
+ const [point1, point2] = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
51
+ return `Soit $f$ une fonction affine telle que :
52
+
53
+ ${alignTex([point1, point2].map((point) => [
54
+ `f(${point.x.toTex()})`,
55
+ "=",
56
+ point.y.toTex(),
57
+ ]))}
58
+
59
+ Quel est le sens de variations de $f$ sur $\\mathbb{R}$ ?`;
60
+ };
61
+ const getAnswer = (identifiers) => {
62
+ const { pointIds } = identifiers;
63
+ const [point1, point2] = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
64
+ if (NodeComparator.isEqualViaSub(point1.y, point2.y)) {
65
+ return "Constante";
66
+ }
67
+ else {
68
+ const [pointXSmall, pointXBig] = [point1, point2].toSorted((point1, point2) => point1.x.evaluate() - point2.x.evaluate());
69
+ return NodeComparator.compareViaSub(pointXSmall.y, pointXBig.y) === -1
70
+ ? "Strictement croissante"
71
+ : "Strictement décroissante";
72
+ }
73
+ };
74
+ const getHint = () => {
75
+ return `Soit $f$ une fonction affine et $x_{1}$ et $x_{2}$ deux réels distincts tels que :
76
+
77
+ $$
78
+ x_{1}<x_{2}
79
+ $$
80
+
81
+ La fonction $f$ est
82
+
83
+ - strictement croissante si :
84
+
85
+ $$
86
+ f(x_{1})<f(x_{2})
87
+ $$
88
+
89
+ - strictement décroissante si :
90
+
91
+ $$
92
+ f(x_{1})>f(x_{2})
93
+ $$
94
+
95
+ - constante si :
96
+
97
+ $$
98
+ f(x_{1})=f(x_{2})
99
+ $$
100
+
101
+ `;
102
+ };
103
+ const getCorrection = (identifiers) => {
104
+ const { pointIds } = identifiers;
105
+ const [point1, point2] = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
106
+ if (NodeComparator.isEqualViaSub(point1.y, point2.y)) {
107
+ return `On a :
108
+
109
+ $$
110
+ f(${point1.x.toTex()}) = f(${point2.x.toTex()}) = ${point1.y.toTex()}
111
+ $$
112
+
113
+ La fonction $f$ est donc constante sur $\\mathbb{R}$.`;
114
+ }
115
+ else {
116
+ const [pointXSmall, pointXBig] = [point1, point2].toSorted((point1, point2) => point1.x.evaluate() - point2.x.evaluate());
117
+ const valueComp = NodeComparator.compareViaSub(pointXSmall.y, pointXBig.y);
118
+ if (valueComp === -1) {
119
+ return `On a :
120
+
121
+ $$
122
+ ${pointXSmall.x.toTex()} < ${pointXBig.x.toTex()}
123
+ $$
124
+
125
+ et
126
+
127
+ $$
128
+ ${pointXSmall.y.toTex()} < ${pointXBig.y.toTex()}
129
+ $$
130
+
131
+ donc
132
+
133
+ $$
134
+ f(${pointXSmall.x.toTex()}) < f(${pointXBig.x.toTex()})
135
+ $$
136
+
137
+
138
+ La fonction $f$ est donc ${getAnswer(identifiers).toLocaleLowerCase()} sur $\\mathbb{R}$.`;
139
+ }
140
+ else {
141
+ return `On a :
142
+
143
+ $$
144
+ ${pointXSmall.x.toTex()} < ${pointXBig.x.toTex()}
145
+ $$
146
+
147
+ et
148
+
149
+ $$
150
+ ${pointXSmall.y.toTex()} > ${pointXBig.y.toTex()}
151
+ $$
152
+
153
+ donc
154
+
155
+ $$
156
+ f(${pointXSmall.x.toTex()}) > f(${pointXBig.x.toTex()})
157
+ $$
158
+
159
+
160
+ La fonction $f$ est donc ${getAnswer(identifiers).toLocaleLowerCase()} sur $\\mathbb{R}$.`;
161
+ }
162
+ }
163
+ };
164
+ const getPropositions = (n, { answer }) => {
165
+ const propositions = [];
166
+ addValidProp(propositions, answer, "raw");
167
+ tryToAddWrongProp(propositions, "Strictement croissante", "raw");
168
+ tryToAddWrongProp(propositions, "Strictement décroissante", "raw");
169
+ tryToAddWrongProp(propositions, "Constante", "raw");
170
+ tryToAddWrongProp(propositions, "Non monotone", "raw");
171
+ return shuffleProps(propositions, n);
172
+ };
173
+ const getKeys = () => {
174
+ return [];
175
+ };
176
+ const getAffineVariationsFromTwoImagesQuestion = (optsIn) => {
177
+ const arrayedOptions = optsIn ?? optsDefault;
178
+ const typeX1 = random(arrayedOptions.typeX);
179
+ const typeX2 = random(arrayedOptions.typeX);
180
+ const typeY1 = random(arrayedOptions.typeY);
181
+ const typeY2 = random(arrayedOptions.typeY);
182
+ const nodeX1 = createRandomNode(typeX1);
183
+ const nodeX2 = (() => {
184
+ let nodeCandidate;
185
+ do {
186
+ nodeCandidate = createRandomNode(typeX2);
187
+ } while (NodeComparator.isEqualViaSub(nodeCandidate, nodeX1));
188
+ return nodeCandidate;
189
+ })();
190
+ const nodeY1 = createRandomNode(typeY1);
191
+ const nodeY2 = probaFlip(0.9) ? createRandomNode(typeY2) : nodeY1;
192
+ const point1 = new Point("P1", nodeX1, nodeY1);
193
+ const point2 = new Point("P2", nodeX2, nodeY2);
194
+ const identifiers = {
195
+ pointIds: [point1, point2].map((point) => point.toIdentifiers()),
196
+ };
197
+ return getQuestionFromIdentifiers(identifiers);
198
+ };
199
+ const getQuestionFromIdentifiers = (identifiers) => {
200
+ const question = {
201
+ answer: getAnswer(identifiers),
202
+ instruction: getInstruction(identifiers),
203
+ keys: getKeys(identifiers),
204
+ answerFormat: "raw",
205
+ identifiers,
206
+ hint: getHint(identifiers),
207
+ correction: getCorrection(identifiers),
208
+ };
209
+ return question;
210
+ };
211
+ const optsDefault = {
212
+ typeX: ["Entier", "Décimal"],
213
+ typeY: ["Entier", "Décimal"],
214
+ };
215
+ const options = [
216
+ {
217
+ id: "typeX",
218
+ label: "Types de nombres pour les antécédents",
219
+ target: GeneratorOptionTarget.generation,
220
+ type: GeneratorOptionType.multiselect,
221
+ values: ["Entier", "Décimal", "Fraction", "Réel"],
222
+ defaultValue: optsDefault.typeX,
223
+ },
224
+ {
225
+ id: "typeY",
226
+ label: "Types de nombres pour les images",
227
+ target: GeneratorOptionTarget.generation,
228
+ type: GeneratorOptionType.multiselect,
229
+ values: ["Entier", "Décimal", "Fraction", "Réel"],
230
+ defaultValue: optsDefault.typeY,
231
+ },
232
+ ];
233
+ export const affineVariationsFromTwoImages = {
234
+ id: "affineVariationsFromTwoImages",
235
+ label: "Déterminer le sens de variations d'une fonction affine à partir des images de deux réels",
236
+ isSingleStep: true,
237
+ generator: (nb, opts) => getDistinctQuestions(() => getAffineVariationsFromTwoImagesQuestion(opts), nb),
238
+ options,
239
+ validateOptions: (opts) => {
240
+ return {
241
+ valid: !!(opts?.typeX &&
242
+ opts?.typeX.length > 0 &&
243
+ opts?.typeY &&
244
+ opts?.typeY.length > 0),
245
+ message: "Veuillez choisir au moins un type de nombre pour les antécédents et un type de nombre pour les images'.",
246
+ };
247
+ },
248
+ qcmTimer: 60,
249
+ freeTimer: 60,
250
+ getPropositions,
251
+ subject: "Mathématiques",
252
+ getInstruction,
253
+ getHint,
254
+ getCorrection,
255
+ getAnswer,
256
+ answerType: "QCU",
257
+ hasHintAndCorrection: true,
258
+ getQuestionFromIdentifiers,
259
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ aIds: NodeIdentifiers;
5
+ xIds: NodeIdentifiers;
6
+ };
7
+ export declare const exponentialFunctionImage: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=exponentialFunctionImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exponentialFunctionImage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/exponentialFunctionImage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AA2FF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAmB1D,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
4
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
5
+ import { round } from "../../../../math/utils/round.js";
6
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
7
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
8
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
9
+ import { approxOrEqual } from "../../../../utils/latex/approxOrEqual.js";
10
+ const getPropositions = (n, { answer }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer);
13
+ propWhile(propositions, n, () => {
14
+ tryToAddWrongProp(propositions, randfloat(0.1, 5, 2).frenchify());
15
+ });
16
+ return shuffleProps(propositions, n);
17
+ };
18
+ const getAnswer = (identifiers) => {
19
+ const { aIds, xIds } = identifiers;
20
+ const a = reifyAlgebraic(aIds);
21
+ const x = reifyAlgebraic(xIds);
22
+ return round(power(a, x).simplify({ calculatePowers: true }).evaluate(), 2).frenchify();
23
+ };
24
+ const getInstruction = (identifiers) => {
25
+ const { aIds, xIds } = identifiers;
26
+ const a = reifyAlgebraic(aIds);
27
+ const x = reifyAlgebraic(xIds);
28
+ return `Soit $f$ la fonction définie sur $[0; +\\infty[$ par :
29
+
30
+ $$
31
+ f(x) = ${power(a, "x").toTex()}
32
+ $$
33
+
34
+ Calculer $f\\left(${x.toTex()}\\right)$ (donner une valeur arrondie au centième).`;
35
+ };
36
+ const getHint = (identifiers) => {
37
+ const { xIds } = identifiers;
38
+ const x = reifyAlgebraic(xIds);
39
+ return `Utilise la calculatrice, et remplace $x$ par $${x.toTex()}$ dans l'expression de la fonction.`;
40
+ };
41
+ const getCorrection = (identifiers) => {
42
+ const { aIds, xIds } = identifiers;
43
+ const a = reifyAlgebraic(aIds);
44
+ const x = reifyAlgebraic(xIds);
45
+ return `On remplace $x$ par $${x.toTex()}$ dans l'expression de la fonction, puis on utilise la calculatrice :
46
+
47
+ $$
48
+ f(${x.toTex()}) = ${power(a, x).toTex()} ${approxOrEqual(power(a, x).evaluate(), 2).join("")}
49
+ $$`;
50
+ };
51
+ const getKeys = () => {
52
+ return [];
53
+ };
54
+ const isAnswerValid = (ans, { answer }) => {
55
+ try {
56
+ return numberVEA(ans, answer, 2);
57
+ }
58
+ catch (err) {
59
+ return handleVEAError(err);
60
+ }
61
+ };
62
+ const getExponentialFunctionImageQuestion = () => {
63
+ const aIds = randfloat(0.1, 5, 2).toTree().toIdentifiers();
64
+ const xIds = randfloat(0.1, 5, 2).toTree().toIdentifiers();
65
+ const identifiers = {
66
+ aIds,
67
+ xIds,
68
+ };
69
+ return getQuestionFromIdentifiers(identifiers);
70
+ };
71
+ const getQuestionFromIdentifiers = (identifiers) => {
72
+ return {
73
+ answer: getAnswer(identifiers),
74
+ instruction: getInstruction(identifiers),
75
+ keys: getKeys(identifiers),
76
+ answerFormat: "tex",
77
+ identifiers,
78
+ hint: getHint(identifiers),
79
+ correction: getCorrection(identifiers),
80
+ };
81
+ };
82
+ export const exponentialFunctionImage = {
83
+ id: "exponentialFunctionImage",
84
+ connector: "=",
85
+ label: "Calculer l'image d'un nombre par une fonction exponentielle du type $a^x$",
86
+ isSingleStep: true,
87
+ generator: (nb, opts) => getDistinctQuestions(() => getExponentialFunctionImageQuestion(opts), nb),
88
+ qcmTimer: 60,
89
+ freeTimer: 60,
90
+ getPropositions,
91
+ isAnswerValid,
92
+ subject: "Mathématiques",
93
+ getInstruction,
94
+ getHint,
95
+ getCorrection,
96
+ getAnswer,
97
+ getQuestionFromIdentifiers,
98
+ hasHintAndCorrection: true,
99
+ };
@@ -2,4 +2,9 @@ export * from "./exponentialsVariations.js";
2
2
  export * from "./exponentialsRawVariations.js";
3
3
  export * from "./readExponentialFunctionParamsOnGraph.js";
4
4
  export * from "./plausibleExponentialFunctionExpressionFromGraph.js";
5
+ export * from "./exponentialFunctionImage.js";
6
+ export * from "./realPowersProduct.js";
7
+ export * from "./realPowersFraction.js";
8
+ export * from "./realPowersPower.js";
9
+ export * from "./realPowersMixOperations.js";
5
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sDAAsD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sDAAsD,CAAC;AAErE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC"}
@@ -3,3 +3,8 @@ export * from "./exponentialsRawVariations.js";
3
3
  export * from "./readExponentialFunctionParamsOnGraph.js";
4
4
  export * from "./plausibleExponentialFunctionExpressionFromGraph.js";
5
5
  // export * from "./estimateExponentialFunctionImageFromGeometricScatterplot.js";
6
+ export * from "./exponentialFunctionImage.js";
7
+ export * from "./realPowersProduct.js";
8
+ export * from "./realPowersFraction.js";
9
+ export * from "./realPowersPower.js";
10
+ export * from "./realPowersMixOperations.js";
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ aIds: NodeIdentifiers;
5
+ xIds: NodeIdentifiers;
6
+ yIds: NodeIdentifiers;
7
+ };
8
+ export declare const realPowersFraction: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=realPowersFraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realPowersFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/realPowersFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAa7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAoHF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
@@ -0,0 +1,125 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
5
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
9
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
10
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
11
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
12
+ import { doWhile } from "../../../../utils/doWhile.js";
13
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
14
+ import { isInt } from "../../../../utils/isInt.js";
15
+ const getPropositions = (n, { answer, aIds, xIds, yIds }) => {
16
+ const propositions = [];
17
+ addValidProp(propositions, answer);
18
+ const a = reifyAlgebraic(aIds);
19
+ const x = reifyAlgebraic(xIds);
20
+ const y = reifyAlgebraic(yIds);
21
+ tryToAddWrongProp(propositions, power(a, add(x, y)).simplify().toTex());
22
+ tryToAddWrongProp(propositions, power(a, multiply(x, y)).simplify().toTex());
23
+ propWhile(propositions, n, () => {
24
+ tryToAddWrongProp(propositions, power(a, randfloat(0.1, 5, 1)).simplify().toTex());
25
+ });
26
+ return shuffleProps(propositions, n);
27
+ };
28
+ const getAnswer = (identifiers) => {
29
+ const { aIds, xIds, yIds } = identifiers;
30
+ const a = reifyAlgebraic(aIds);
31
+ const x = reifyAlgebraic(xIds);
32
+ const y = reifyAlgebraic(yIds);
33
+ return power(a, substract(x, y)).simplify().toTex();
34
+ };
35
+ const getInstruction = (identifiers) => {
36
+ const { aIds, xIds, yIds } = identifiers;
37
+ const a = reifyAlgebraic(aIds);
38
+ const x = reifyAlgebraic(xIds);
39
+ const y = reifyAlgebraic(yIds);
40
+ return `Écrire sous la forme d'une seule puissance :
41
+
42
+ $$
43
+ ${frac(power(a, x), power(a, y)).toTex()}
44
+ $$`;
45
+ };
46
+ const getHint = () => {
47
+ return `Utilise la propriété suivante : pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
48
+
49
+ $$
50
+ \\frac{a^x}{a^y}= a^{x-y}
51
+ $$`;
52
+ };
53
+ const getCorrection = (identifiers) => {
54
+ const { aIds, xIds, yIds } = identifiers;
55
+ const a = reifyAlgebraic(aIds);
56
+ const x = reifyAlgebraic(xIds);
57
+ const y = reifyAlgebraic(yIds);
58
+ return `Pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
59
+
60
+ $$
61
+ \\frac{a^x}{a^y}= a^{x-y}
62
+ $$
63
+
64
+ Ici, on a donc :
65
+
66
+ $$
67
+ ${frac(power(a, x), power(a, y)).toTex()} = ${power(a, substract(x, y)).toTex()} = ${getAnswer(identifiers)}
68
+ $$`;
69
+ };
70
+ const getKeys = () => {
71
+ return [];
72
+ };
73
+ const isAnswerValid = (ans, { answer }) => {
74
+ try {
75
+ const parsed = parseAlgebraic(ans);
76
+ if (!parsed)
77
+ return false;
78
+ return parsed.simplify({ forbidPowerDivision: true }).toTex() === answer;
79
+ }
80
+ catch (err) {
81
+ return handleVEAError(err);
82
+ }
83
+ };
84
+ const getRealPowersFractionQuestion = () => {
85
+ const a = randfloat(0.1, 5, 1, [1]);
86
+ let x = doWhile(() => randfloat(0.1, 5, 1), (v) => isInt(v));
87
+ let y = randfloat(0.1, 5, 1);
88
+ if (coinFlip())
89
+ [x, y] = [y, x]; //comme ca l'éventuel entier est n'importe ou
90
+ const identifiers = {
91
+ aIds: a.toTree().toIdentifiers(),
92
+ xIds: x.toTree().toIdentifiers(),
93
+ yIds: y.toTree().toIdentifiers(),
94
+ };
95
+ return getQuestionFromIdentifiers(identifiers);
96
+ };
97
+ const getQuestionFromIdentifiers = (identifiers) => {
98
+ return {
99
+ answer: getAnswer(identifiers),
100
+ instruction: getInstruction(identifiers),
101
+ keys: getKeys(identifiers),
102
+ answerFormat: "tex",
103
+ identifiers,
104
+ hint: getHint(identifiers),
105
+ correction: getCorrection(identifiers),
106
+ };
107
+ };
108
+ export const realPowersFraction = {
109
+ id: "realPowersFraction",
110
+ connector: "=",
111
+ label: "Simplifier une division de puissances réelles",
112
+ isSingleStep: true,
113
+ generator: (nb, opts) => getDistinctQuestions(() => getRealPowersFractionQuestion(opts), nb),
114
+ qcmTimer: 60,
115
+ freeTimer: 60,
116
+ getPropositions,
117
+ isAnswerValid,
118
+ subject: "Mathématiques",
119
+ getInstruction,
120
+ getHint,
121
+ getCorrection,
122
+ getAnswer,
123
+ getQuestionFromIdentifiers,
124
+ hasHintAndCorrection: true,
125
+ };
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ aIds: NodeIdentifiers;
5
+ xIds: NodeIdentifiers;
6
+ yIds: NodeIdentifiers;
7
+ zIds: NodeIdentifiers;
8
+ tIds: NodeIdentifiers;
9
+ };
10
+ export declare const realPowersMixOperations: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=realPowersMixOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realPowersMixOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/realPowersMixOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAwIF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAkBzD,CAAC"}