math-exercises 3.0.190 → 3.0.192

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 (125) hide show
  1. package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.d.ts +53 -0
  2. package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.d.ts.map +1 -0
  3. package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.js +543 -0
  4. package/lib/exercises/math/dataRepresentations/barChart/barChartReading.d.ts +94 -0
  5. package/lib/exercises/math/dataRepresentations/barChart/barChartReading.d.ts.map +1 -0
  6. package/lib/exercises/math/dataRepresentations/barChart/barChartReading.js +280 -0
  7. package/lib/exercises/math/dataRepresentations/barChart/index.d.ts +3 -0
  8. package/lib/exercises/math/dataRepresentations/barChart/index.d.ts.map +1 -0
  9. package/lib/exercises/math/dataRepresentations/barChart/index.js +2 -0
  10. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.d.ts +7 -0
  11. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.d.ts.map +1 -0
  12. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.js +223 -0
  13. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.d.ts +9 -0
  14. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.d.ts.map +1 -0
  15. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.js +133 -0
  16. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.d.ts +11 -0
  17. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.d.ts.map +1 -0
  18. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.js +198 -0
  19. package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.d.ts +13 -0
  20. package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.d.ts.map +1 -0
  21. package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.js +192 -0
  22. package/lib/exercises/math/dataRepresentations/boxPlot/index.d.ts +5 -0
  23. package/lib/exercises/math/dataRepresentations/boxPlot/index.d.ts.map +1 -0
  24. package/lib/exercises/math/dataRepresentations/boxPlot/index.js +4 -0
  25. package/lib/exercises/math/dataRepresentations/index.d.ts +4 -7
  26. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  27. package/lib/exercises/math/dataRepresentations/index.js +4 -11
  28. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts +6 -0
  29. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts.map +1 -0
  30. package/lib/exercises/math/dataRepresentations/scatterPlot/index.js +5 -0
  31. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts +12 -0
  32. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts.map +1 -0
  33. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.js +206 -0
  34. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts +9 -0
  35. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts.map +1 -0
  36. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.js +210 -0
  37. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts +10 -0
  38. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts.map +1 -0
  39. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.js +252 -0
  40. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts +12 -0
  41. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts.map +1 -0
  42. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.js +352 -0
  43. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts +11 -0
  44. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts.map +1 -0
  45. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.js +403 -0
  46. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts +7 -0
  47. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts.map +1 -0
  48. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.js +222 -0
  49. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts +7 -0
  50. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts.map +1 -0
  51. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.js +187 -0
  52. package/lib/exercises/math/dataRepresentations/tables/index.d.ts +4 -0
  53. package/lib/exercises/math/dataRepresentations/tables/index.d.ts.map +1 -0
  54. package/lib/exercises/math/dataRepresentations/tables/index.js +3 -0
  55. package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts +8 -0
  56. package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts.map +1 -0
  57. package/lib/exercises/math/dataRepresentations/tables/tableReading.js +109 -0
  58. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts +8 -0
  59. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts.map +1 -0
  60. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.js +145 -0
  61. package/lib/exercises/math/derivation/applications/index.d.ts +1 -0
  62. package/lib/exercises/math/derivation/applications/index.d.ts.map +1 -1
  63. package/lib/exercises/math/derivation/applications/index.js +1 -0
  64. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +1 -1
  65. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -1
  66. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +4 -1
  67. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts +13 -0
  68. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts.map +1 -0
  69. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.js +205 -0
  70. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts +9 -0
  71. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts.map +1 -0
  72. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.js +157 -0
  73. package/lib/exercises/math/functions/affines/affineVariations.d.ts +12 -0
  74. package/lib/exercises/math/functions/affines/affineVariations.d.ts.map +1 -0
  75. package/lib/exercises/math/functions/affines/affineVariations.js +176 -0
  76. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts +8 -0
  77. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts.map +1 -0
  78. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.js +203 -0
  79. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts +12 -0
  80. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts.map +1 -0
  81. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.js +259 -0
  82. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts +9 -0
  83. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts.map +1 -0
  84. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.js +99 -0
  85. package/lib/exercises/math/functions/exponentials/index.d.ts +5 -0
  86. package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
  87. package/lib/exercises/math/functions/exponentials/index.js +5 -0
  88. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts +10 -0
  89. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts.map +1 -0
  90. package/lib/exercises/math/functions/exponentials/realPowersFraction.js +125 -0
  91. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts +12 -0
  92. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts.map +1 -0
  93. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.js +148 -0
  94. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts +10 -0
  95. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts.map +1 -0
  96. package/lib/exercises/math/functions/exponentials/realPowersPower.js +128 -0
  97. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts +10 -0
  98. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts.map +1 -0
  99. package/lib/exercises/math/functions/exponentials/realPowersProduct.js +128 -0
  100. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -1
  101. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +7 -2
  102. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  103. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +131 -61
  104. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts +12 -0
  105. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map +1 -0
  106. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.js +217 -0
  107. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts +10 -0
  108. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts.map +1 -0
  109. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.js +186 -0
  110. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts +14 -0
  111. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts.map +1 -0
  112. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.js +189 -0
  113. package/lib/exercises/math/sequences/geometric/graph/index.d.ts +2 -0
  114. package/lib/exercises/math/sequences/geometric/graph/index.d.ts.map +1 -0
  115. package/lib/exercises/math/sequences/geometric/graph/index.js +1 -0
  116. package/lib/index.d.ts +53 -25
  117. package/lib/index.d.ts.map +1 -1
  118. package/lib/tree/nodes/algebraicNode.d.ts +3 -0
  119. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  120. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  121. package/lib/tree/nodes/operators/fractionNode.js +5 -3
  122. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  123. package/lib/tree/nodes/operators/multiplyNode.js +5 -3
  124. package/lib/tree/nodes/operators/powerNode.js +1 -1
  125. package/package.json +1 -1
@@ -0,0 +1,203 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blues, greenMain, oranges, purples, reds, } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { Point } from "../../../../math/geometry/point.js";
6
+ import { randint } from "../../../../math/utils/random/randint.js";
7
+ import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
8
+ import { random } from "../../../../utils/alea/random.js";
9
+ const getInstruction = () => {
10
+ return `Ci-dessous est tracée la courbe représentative $C_f$ d'une fonction affine $f$.
11
+ Déterminer graphiquement le sens de variation de $f$.`;
12
+ };
13
+ const getAnswer = (identifiers) => {
14
+ const { b, secondPoint } = identifiers;
15
+ const point1 = new Point("P1", 0, b);
16
+ const point2 = new Point("P2", secondPoint[0], secondPoint[1]);
17
+ if (NodeComparator.isEqualViaSub(point1.y, point2.y)) {
18
+ return "Constante";
19
+ }
20
+ else {
21
+ const [pointXSmall, pointXBig] = [point1, point2].toSorted((point1, point2) => point1.x.evaluate() - point2.x.evaluate());
22
+ return NodeComparator.compareViaSub(pointXSmall.y, pointXBig.y) === -1
23
+ ? "Strictement croissante"
24
+ : "Strictement décroissante";
25
+ }
26
+ };
27
+ const getHint = () => {
28
+ return `On prend deux points distincts sur $C_f$.
29
+
30
+ On note $x_{1}$ l'abscisse du point avec l'abscisse la plus petite.
31
+ On note $x_{2}$ l'abscisse du point avec l'abscisse la plus grande.
32
+
33
+ Les coordonnées des deux points sont donc $(x_{1};f(x_{1}))$ et $(x_{2};f(x_{2}))$.
34
+
35
+ La fonction $f$ est
36
+
37
+ - strictement croissante si :
38
+
39
+ $$
40
+ f(x_{1})<f(x_{2})
41
+ $$
42
+
43
+ - strictement décroissante si :
44
+
45
+ $$
46
+ f(x_{1})>f(x_{2})
47
+ $$
48
+
49
+ - constante si :
50
+
51
+ $$
52
+ f(x_{1})=f(x_{2})
53
+ $$
54
+
55
+ `;
56
+ };
57
+ const getCorrection = (identifiers) => {
58
+ const { b, secondPoint } = identifiers;
59
+ const point1 = new Point("P1", 0, b);
60
+ const point2 = new Point("P2", secondPoint[0], secondPoint[1]);
61
+ if (NodeComparator.isEqualViaSub(point1.y, point2.y)) {
62
+ return `On a :
63
+
64
+ $$
65
+ f(${point1.x.toTex()}) = f(${point2.x.toTex()}) = ${point1.y.toTex()}
66
+ $$
67
+
68
+ La fonction $f$ est donc constante sur $\\mathbb{R}$.`;
69
+ }
70
+ else {
71
+ const [pointXSmall, pointXBig] = [point1, point2].toSorted((point1, point2) => point1.x.evaluate() - point2.x.evaluate());
72
+ const valueComp = NodeComparator.compareViaSub(pointXSmall.y, pointXBig.y);
73
+ if (valueComp === -1) {
74
+ return `On a :
75
+
76
+ $$
77
+ ${pointXSmall.x.toTex()} < ${pointXBig.x.toTex()}
78
+ $$
79
+
80
+ et
81
+
82
+ $$
83
+ f(${pointXSmall.x.toTex()}) < f(${pointXBig.x.toTex()})
84
+ $$
85
+
86
+
87
+ La fonction $f$ est donc ${getAnswer(identifiers).toLocaleLowerCase()} sur $\\mathbb{R}$.`;
88
+ }
89
+ else {
90
+ return `On a :
91
+
92
+ $$
93
+ ${pointXSmall.x.toTex()} < ${pointXBig.x.toTex()}
94
+ $$
95
+
96
+ et
97
+
98
+ $$
99
+ f(${pointXSmall.x.toTex()}) > f(${pointXBig.x.toTex()})
100
+ $$
101
+
102
+
103
+ La fonction $f$ est donc ${getAnswer(identifiers).toLocaleLowerCase()} sur $\\mathbb{R}$.`;
104
+ }
105
+ }
106
+ };
107
+ const getCorrectionGGBOptions = (identifiers) => {
108
+ const { b, secondPoint } = identifiers;
109
+ const xMin = Math.min(0, secondPoint[0]);
110
+ const xMax = Math.max(0, secondPoint[0]);
111
+ const yMin = Math.min(b, secondPoint[1]);
112
+ const yMax = Math.max(b, secondPoint[1]);
113
+ const point1 = new Point("P1", 0, b);
114
+ const point2 = new Point("P2", secondPoint[0], secondPoint[1]);
115
+ const [pointXSmall, pointXBig] = [point1, point2].toSorted((point1, point2) => point1.x.evaluate() - point2.x.evaluate());
116
+ const colorButGreen = (() => {
117
+ const colors = [...reds, ...oranges, ...blues, ...purples];
118
+ return random(colors);
119
+ })();
120
+ const commands = [
121
+ `l = Line[(0, ${b}), (${secondPoint[0]}, ${secondPoint[1]})]`,
122
+ `SetColor(l, "${colorButGreen}")`,
123
+ "SetFixed(l, true, false)",
124
+ `v = Vector(${pointXSmall.toMathString()}, ${pointXBig.toMathString()})`,
125
+ `SetLineThickness(v, 10)`,
126
+ `SetColor(v, "${greenMain}")`,
127
+ ];
128
+ const ggb = new GeogebraConstructor({
129
+ commands,
130
+ });
131
+ return ggb.getOptions({
132
+ coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
133
+ });
134
+ };
135
+ const getGGBOptions = (identifiers) => {
136
+ const { b, secondPoint } = identifiers;
137
+ const xMin = Math.min(0, secondPoint[0]);
138
+ const xMax = Math.max(0, secondPoint[0]);
139
+ const yMin = Math.min(b, secondPoint[1]);
140
+ const yMax = Math.max(b, secondPoint[1]);
141
+ const colorButGreen = (() => {
142
+ const colors = [...reds, ...oranges, ...blues, ...purples];
143
+ return random(colors);
144
+ })();
145
+ const commands = [
146
+ `l = Line[(0, ${b}), (${secondPoint[0]}, ${secondPoint[1]})]`,
147
+ `SetColor(l, "${colorButGreen}")`,
148
+ "SetFixed(l, true, false)",
149
+ ];
150
+ const ggb = new GeogebraConstructor({
151
+ commands,
152
+ });
153
+ return ggb.getOptions({
154
+ coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
155
+ });
156
+ };
157
+ const getPropositions = (n, { answer }) => {
158
+ const propositions = [];
159
+ addValidProp(propositions, answer, "raw");
160
+ tryToAddWrongProp(propositions, "Strictement croissante", "raw");
161
+ tryToAddWrongProp(propositions, "Strictement décroissante", "raw");
162
+ tryToAddWrongProp(propositions, "Constante", "raw");
163
+ tryToAddWrongProp(propositions, "Non monotone", "raw");
164
+ return shuffleProps(propositions, n);
165
+ };
166
+ const getAffineVariationsFromGraphQuestion = () => {
167
+ const b = randint(-5, 6);
168
+ const secondPoint = [randint(-5, 6, [0]), randint(-5, 6)];
169
+ const identifiers = { b, secondPoint };
170
+ //[0,b] et [x,y]
171
+ //a = (y-b)/x
172
+ return getQuestionFromIdentifiers(identifiers);
173
+ };
174
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
175
+ const question = {
176
+ instruction: getInstruction(identifiers, opts),
177
+ answer: getAnswer(identifiers, opts),
178
+ keys: [],
179
+ ggbOptions: getGGBOptions(identifiers, opts),
180
+ answerFormat: "tex",
181
+ identifiers,
182
+ hint: getHint(identifiers, opts),
183
+ correction: getCorrection(identifiers, opts),
184
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
185
+ options: opts,
186
+ };
187
+ return question;
188
+ };
189
+ export const affineVariationsFromGraph = {
190
+ id: "affineVariationsFromGraph",
191
+ connector: "=",
192
+ label: "Lire graphiquement le sens de variation d'une fonction affine",
193
+ isSingleStep: true,
194
+ generator: (nb) => getDistinctQuestions(() => getAffineVariationsFromGraphQuestion(), nb),
195
+ qcmTimer: 60,
196
+ freeTimer: 60,
197
+ getPropositions,
198
+ hasGeogebra: true,
199
+ subject: "Mathématiques",
200
+ getQuestionFromIdentifiers,
201
+ hasHintAndCorrection: true,
202
+ answerType: "QCU",
203
+ };
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../math/geometry/point.js";
3
+ type Identifiers = {
4
+ pointIds: PointIdentifiers[];
5
+ };
6
+ type Options = {
7
+ typeX: string;
8
+ typeY: string;
9
+ };
10
+ export declare const affineVariationsFromTwoImages: Exercise<Identifiers, Options>;
11
+ export {};
12
+ //# sourceMappingURL=affineVariationsFromTwoImages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affineVariationsFromTwoImages.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineVariationsFromTwoImages.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AA+CtC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B,CAAC;AAyMF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA+BF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkCxE,CAAC"}
@@ -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"}