math-exercises 3.0.145 → 3.0.147

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 (113) hide show
  1. package/lib/exercises/math/calcul/addAndSub.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/addAndSub.js +20 -1
  3. package/lib/exercises/math/calcul/index.d.ts +1 -0
  4. package/lib/exercises/math/calcul/index.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/index.js +1 -0
  6. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +2 -0
  7. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/mentalCaluls/index.js +2 -0
  9. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.d.ts.map +1 -1
  10. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +22 -0
  11. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.d.ts +9 -0
  12. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.d.ts.map +1 -0
  13. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.js +152 -0
  14. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.d.ts +15 -0
  15. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.d.ts.map +1 -0
  16. package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.js +412 -0
  17. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
  18. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +37 -7
  19. package/lib/exercises/math/calcul/ratio/index.d.ts +2 -0
  20. package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -0
  21. package/lib/exercises/math/calcul/ratio/index.js +2 -0
  22. package/lib/exercises/math/calcul/ratio/partUsingRatio.d.ts +14 -0
  23. package/lib/exercises/math/calcul/ratio/partUsingRatio.d.ts.map +1 -0
  24. package/lib/exercises/math/calcul/ratio/partUsingRatio.js +388 -0
  25. package/lib/exercises/math/calcul/ratio/ratioFromParts.d.ts +10 -0
  26. package/lib/exercises/math/calcul/ratio/ratioFromParts.d.ts.map +1 -0
  27. package/lib/exercises/math/calcul/ratio/ratioFromParts.js +198 -0
  28. package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.d.ts.map +1 -1
  29. package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.js +50 -0
  30. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +1 -1
  31. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts +6 -1
  32. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  33. package/lib/exercises/math/functions/affines/affineExpressionReading.js +166 -52
  34. package/lib/exercises/math/functions/affines/drawAffineFromLitExp.d.ts +5 -1
  35. package/lib/exercises/math/functions/affines/drawAffineFromLitExp.d.ts.map +1 -1
  36. package/lib/exercises/math/functions/affines/drawAffineFromLitExp.js +59 -17
  37. package/lib/exercises/math/functions/basics/graphicInequation.js +1 -1
  38. package/lib/exercises/math/functions/index.d.ts +1 -0
  39. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  40. package/lib/exercises/math/functions/index.js +1 -0
  41. package/lib/exercises/math/functions/linear/index.d.ts +3 -0
  42. package/lib/exercises/math/functions/linear/index.d.ts.map +1 -0
  43. package/lib/exercises/math/functions/linear/index.js +2 -0
  44. package/lib/exercises/math/functions/linear/linearFromExercise.d.ts +9 -0
  45. package/lib/exercises/math/functions/linear/linearFromExercise.d.ts.map +1 -0
  46. package/lib/exercises/math/functions/linear/linearFromExercise.js +355 -0
  47. package/lib/exercises/math/functions/linear/linearFromPercentageEvolution.d.ts +8 -0
  48. package/lib/exercises/math/functions/linear/linearFromPercentageEvolution.d.ts.map +1 -0
  49. package/lib/exercises/math/functions/linear/linearFromPercentageEvolution.js +233 -0
  50. package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.d.ts.map +1 -1
  51. package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.js +2 -5
  52. package/lib/exercises/math/index.d.ts +1 -0
  53. package/lib/exercises/math/index.d.ts.map +1 -1
  54. package/lib/exercises/math/index.js +1 -0
  55. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
  56. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  57. package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
  58. package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.d.ts +10 -0
  59. package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.d.ts.map +1 -0
  60. package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.js +113 -0
  61. package/lib/exercises/math/probaStat/index.d.ts +1 -0
  62. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  63. package/lib/exercises/math/probaStat/index.js +1 -0
  64. package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts +8 -0
  65. package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -0
  66. package/lib/exercises/math/probaStat/stats1var/etendueTable.js +89 -0
  67. package/lib/exercises/math/probaStat/stats1var/index.d.ts +1 -0
  68. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  69. package/lib/exercises/math/probaStat/stats1var/index.js +1 -0
  70. package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.d.ts +8 -0
  71. package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.d.ts.map +1 -0
  72. package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.js +244 -0
  73. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
  74. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -0
  75. package/lib/exercises/math/probaStat/twoStepExperiments/index.js +2 -0
  76. package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.d.ts +8 -0
  77. package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.d.ts.map +1 -0
  78. package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.js +452 -0
  79. package/lib/exercises/math/scratch/index.d.ts +2 -0
  80. package/lib/exercises/math/scratch/index.d.ts.map +1 -0
  81. package/lib/exercises/math/scratch/index.js +1 -0
  82. package/lib/exercises/math/scratch/scratchLoopStepsCount.d.ts +8 -0
  83. package/lib/exercises/math/scratch/scratchLoopStepsCount.d.ts.map +1 -0
  84. package/lib/exercises/math/scratch/scratchLoopStepsCount.js +85 -0
  85. package/lib/exercises/math/scratch/testScratch.d.ts +8 -0
  86. package/lib/exercises/math/scratch/testScratch.d.ts.map +1 -0
  87. package/lib/exercises/math/scratch/testScratch.js +79 -0
  88. package/lib/exercises/math/trigonometry/index.d.ts +3 -0
  89. package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
  90. package/lib/exercises/math/trigonometry/index.js +3 -0
  91. package/lib/exercises/math/trigonometry/trigonometrySideName.d.ts +13 -0
  92. package/lib/exercises/math/trigonometry/trigonometrySideName.d.ts.map +1 -0
  93. package/lib/exercises/math/trigonometry/trigonometrySideName.js +189 -0
  94. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.d.ts +13 -0
  95. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.d.ts.map +1 -0
  96. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.js +290 -0
  97. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.d.ts +18 -0
  98. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.d.ts.map +1 -0
  99. package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.js +386 -0
  100. package/lib/index.d.ts +76 -3
  101. package/lib/index.d.ts.map +1 -1
  102. package/lib/latexTester.d.ts.map +1 -1
  103. package/lib/latexTester.js +5 -0
  104. package/lib/math/geometry/triangles/triangle.d.ts +1 -0
  105. package/lib/math/geometry/triangles/triangle.d.ts.map +1 -1
  106. package/lib/math/geometry/triangles/triangle.js +1 -0
  107. package/lib/math/numbers/fractions/isDecimalFraction.d.ts +3 -0
  108. package/lib/math/numbers/fractions/isDecimalFraction.d.ts.map +1 -0
  109. package/lib/math/numbers/fractions/isDecimalFraction.js +14 -0
  110. package/lib/math/polynomials/polynomial.js +1 -1
  111. package/lib/types/keyIds.d.ts +1 -1
  112. package/lib/types/keyIds.d.ts.map +1 -1
  113. package/package.json +1 -1
@@ -1,8 +1,13 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Options = {
3
+ isLinear: boolean;
4
+ };
2
5
  type Identifiers = {
6
+ isLinear: boolean;
3
7
  b: number;
4
8
  secondPoint: number[];
5
9
  };
6
- export declare const affineExpressionReading: Exercise<Identifiers>;
10
+ export declare const affineExpressionReading: Exercise<Identifiers, Options>;
11
+ export declare const linearExpressionReading: Exercise<Identifiers, Options>;
7
12
  export {};
8
13
  //# sourceMappingURL=affineExpressionReading.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AA8KF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
1
+ {"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAiTF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBlE,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBlE,CAAC"}
@@ -6,6 +6,7 @@ import { Rational } from "../../../../math/numbers/rationals/rational.js";
6
6
  import { AffineConstructor } from "../../../../math/polynomials/affine.js";
7
7
  import { randint } from "../../../../math/utils/random/randint.js";
8
8
  import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
9
+ import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
9
10
  import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
10
11
  import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
11
12
  import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
@@ -14,8 +15,16 @@ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
14
15
  import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
15
16
  import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
16
17
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
17
- const getInstruction = () => {
18
- return `Ci-dessous est tracée la courbe représentative d'une fonction affine $f$. Déterminer graphiquement l'expression algébrique de $f(x)$.`;
18
+ const rebuildIdentifiers = (oldIds) => {
19
+ const newIds = Object.assign({}, oldIds, {
20
+ isLinear: false,
21
+ });
22
+ return newIds;
23
+ };
24
+ const getInstruction = (_, opts) => {
25
+ return `Ci-dessous est tracée la courbe représentative d'une fonction ${opts?.isLinear ? "linéaire" : "affine"} $f$.
26
+ Déterminer graphiquement l'expression algébrique de $f(x)$.
27
+ (Écrire la réponse sous la forme "$f(x)=$...")`;
19
28
  };
20
29
  const getGGBOptions = (identifiers) => {
21
30
  const { b, secondPoint } = identifiers;
@@ -35,8 +44,25 @@ const getGGBOptions = (identifiers) => {
35
44
  coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
36
45
  });
37
46
  };
38
- const getHint = () => {
39
- return `L'expression algébrique d'une fonction affine est de la forme :
47
+ const getHint = (_, opts) => {
48
+ if (opts?.isLinear) {
49
+ return `L'expression algébrique d'une fonction linéaire est de la forme :
50
+
51
+ $$
52
+ f(x) = ax
53
+ $$
54
+
55
+ $a$ est le coefficient directeur. Pour le lire, repère un point $A(x_A;y_A)$ de la droite, qui n'est pas l'origine.
56
+
57
+ Alors :
58
+
59
+ $$
60
+ a = \\frac{y_A}{x_A}
61
+ $$
62
+ `;
63
+ }
64
+ else {
65
+ return `L'expression algébrique d'une fonction affine est de la forme :
40
66
 
41
67
  $$
42
68
  f(x) = ax+b
@@ -49,10 +75,33 @@ $a$ est le coefficient directeur. Pour le déterminer, on repère deux points $A
49
75
  $$
50
76
  a = \\frac{y_B-y_A}{x_B-x_A}
51
77
  $$`;
78
+ }
52
79
  };
53
- const getCorrection = (identifiers) => {
80
+ const getCorrection = (identifiers, opts) => {
54
81
  const { b, secondPoint } = identifiers;
55
- return `On lit graphiquement que l'ordonnée à l'origine est $${b}$ : c'est l'ordonnée du point d'abscisse $0$ appartenant à la droite.
82
+ if (opts?.isLinear) {
83
+ return `La droite passe par l'origine. La fonction est donc une fonction linéaire. $f$ est donc de la forme :
84
+
85
+ $$
86
+ f(x) = ax
87
+ $$
88
+
89
+ Pour trouver $a$, on repère que le point de coordonnées $(${secondPoint[0].frenchify()};${secondPoint[1].frenchify()})$ appartient à la droite.
90
+
91
+ On a donc :
92
+
93
+ $$
94
+ a = ${frac(secondPoint[1], secondPoint[0]).toSimplificationTex()}
95
+ $$
96
+
97
+ L'expression algébrique de la fonction $f$ est donc :
98
+
99
+ $$
100
+ ${getAnswer(identifiers)}
101
+ $$`;
102
+ }
103
+ else {
104
+ return `On lit graphiquement que l'ordonnée à l'origine est $${b}$ : c'est l'ordonnée du point d'abscisse $0$ appartenant à la droite.
56
105
 
57
106
  Pour trouver $a$, on repère que la droite passe par le point de coordonnées $(${secondPoint[0]};${secondPoint[1]})$. On a alors :
58
107
 
@@ -65,6 +114,7 @@ L'expression algébrique de la fonction $f$ est donc :
65
114
  $$
66
115
  ${getAnswer(identifiers)}
67
116
  $$`;
117
+ }
68
118
  };
69
119
  const getAnswer = (identifiers) => {
70
120
  const { b, secondPoint } = identifiers;
@@ -74,51 +124,68 @@ const getAnswer = (identifiers) => {
74
124
  const answer = new EqualNode(new VariableNode("f(x)"), new AddNode(new MultiplyNode(leadingCoeff, new VariableNode("x")), new NumberNode(b)).simplify({ forceDistributeFractions: true, forbidFactorize: true })).toTex();
75
125
  return answer;
76
126
  };
77
- const getAffineExpressionReadingQuestion = () => {
78
- const b = randint(-5, 6);
79
- const secondPoint = [randint(-5, 6, [0]), randint(-5, 6)];
80
- const identifiers = { b, secondPoint };
81
- //[0,b] et [x,y]
82
- //a = (y-b)/x
83
- return getQuestionFromIdentifiers(identifiers);
84
- };
85
- const getQuestionFromIdentifiers = (identifiers) => {
86
- const question = {
87
- answer: getAnswer(identifiers),
88
- instruction: getInstruction(identifiers),
89
- keys: ["fx", "equal", "x"],
90
- ggbOptions: getGGBOptions(identifiers),
91
- answerFormat: "tex",
92
- identifiers,
93
- hint: getHint(identifiers),
94
- correction: getCorrection(identifiers),
95
- };
96
- return question;
97
- };
98
- const getPropositions = (n, { answer, b, secondPoint }) => {
99
- const propositions = [];
100
- addValidProp(propositions, answer);
101
- const wrongAs = [];
102
- if (secondPoint[1] - b !== 0)
103
- wrongAs.push(new Rational(secondPoint[0], secondPoint[1] - b).simplify().toTree());
104
- if (secondPoint[0] !== 0)
105
- wrongAs.push(new Rational(secondPoint[1] + b, secondPoint[0]).simplify().toTree());
106
- if (secondPoint[1] + b !== 0)
107
- wrongAs.push(new Rational(secondPoint[0], secondPoint[1] + b).simplify().toTree());
108
- if (b !== 0)
109
- wrongAs.push(new Rational(secondPoint[1] - secondPoint[0], b).simplify().toTree());
110
- const fx = new VariableNode("f(x)");
111
- const x = new VariableNode("x");
112
- wrongAs.forEach((coeff) => {
113
- tryToAddWrongProp(propositions, new EqualNode(fx, new AddNode(new MultiplyNode(coeff, x), new NumberNode(b)).simplify({
114
- forceDistributeFractions: true,
115
- forbidFactorize: true,
116
- })).toTex());
117
- });
118
- propWhile(propositions, n, () => {
119
- tryToAddWrongProp(propositions, new EqualNode(fx, AffineConstructor.random().toTree()).toTex());
120
- });
121
- return shuffleProps(propositions, n);
127
+ const getPropositions = (n, { answer, b, secondPoint, isLinear }) => {
128
+ // if (opts?.isLinear) {
129
+ if (isLinear) {
130
+ const a = new Rational(secondPoint[1] - b, secondPoint[0])
131
+ .simplify()
132
+ .toTree();
133
+ const propositions = [];
134
+ addValidProp(propositions, answer);
135
+ const wrongSecondPoints = [-1, 0, 1].flatMap((offsetX) => [-1, 0, 1]
136
+ .filter((offsetY) => offsetX !== 0 && offsetY !== 0 && secondPoint[0] + offsetX !== 0)
137
+ .map((offsetY) => {
138
+ return [secondPoint[0] + offsetX, secondPoint[1] + offsetY];
139
+ }));
140
+ const wrongAs = [
141
+ frac(1, a).simplify(),
142
+ opposite(a),
143
+ frac(1, opposite(a)),
144
+ ...wrongSecondPoints.map((secondPoint) => {
145
+ const leadingCoeff = new Rational(secondPoint[1], secondPoint[0])
146
+ .simplify()
147
+ .toTree();
148
+ return leadingCoeff;
149
+ }),
150
+ ];
151
+ const fx = new VariableNode("f(x)");
152
+ const x = new VariableNode("x");
153
+ wrongAs.forEach((coeff) => {
154
+ tryToAddWrongProp(propositions, new EqualNode(fx, new MultiplyNode(coeff, x).simplify({
155
+ forceDistributeFractions: true,
156
+ forbidFactorize: true,
157
+ })).toTex());
158
+ });
159
+ propWhile(propositions, n, () => {
160
+ tryToAddWrongProp(propositions, new EqualNode(fx, AffineConstructor.random().toTree()).toTex());
161
+ });
162
+ return shuffleProps(propositions, n);
163
+ }
164
+ else {
165
+ const propositions = [];
166
+ addValidProp(propositions, answer);
167
+ const wrongAs = [];
168
+ if (secondPoint[1] - b !== 0)
169
+ wrongAs.push(new Rational(secondPoint[0], secondPoint[1] - b).simplify().toTree());
170
+ if (secondPoint[0] !== 0)
171
+ wrongAs.push(new Rational(secondPoint[1] + b, secondPoint[0]).simplify().toTree());
172
+ if (secondPoint[1] + b !== 0)
173
+ wrongAs.push(new Rational(secondPoint[0], secondPoint[1] + b).simplify().toTree());
174
+ if (b !== 0)
175
+ wrongAs.push(new Rational(secondPoint[1] - secondPoint[0], b).simplify().toTree());
176
+ const fx = new VariableNode("f(x)");
177
+ const x = new VariableNode("x");
178
+ wrongAs.forEach((coeff) => {
179
+ tryToAddWrongProp(propositions, new EqualNode(fx, new AddNode(new MultiplyNode(coeff, x), new NumberNode(b)).simplify({
180
+ forceDistributeFractions: true,
181
+ forbidFactorize: true,
182
+ })).toTex());
183
+ });
184
+ propWhile(propositions, n, () => {
185
+ tryToAddWrongProp(propositions, new EqualNode(fx, AffineConstructor.random().toTree()).toTex());
186
+ });
187
+ return shuffleProps(propositions, n);
188
+ }
122
189
  };
123
190
  const isAnswerValid = (ans, { answer }) => {
124
191
  try {
@@ -140,12 +207,58 @@ const isAnswerValid = (ans, { answer }) => {
140
207
  return handleVEAError(err);
141
208
  }
142
209
  };
210
+ const getAffineExpressionReadingQuestion = (opts) => {
211
+ const isLinear = opts?.isLinear ?? false;
212
+ let b;
213
+ let secondPoint;
214
+ if (opts?.isLinear) {
215
+ b = 0;
216
+ secondPoint = [randint(-5, 6, [0]), randint(-5, 6, [0])];
217
+ }
218
+ else {
219
+ b = randint(-5, 6);
220
+ secondPoint = [randint(-5, 6, [0]), randint(-5, 6)];
221
+ }
222
+ const identifiers = { b, secondPoint, isLinear };
223
+ //[0,b] et [x,y]
224
+ //a = (y-b)/x
225
+ return getQuestionFromIdentifiers(identifiers, opts);
226
+ };
227
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
228
+ const question = {
229
+ answer: getAnswer(identifiers, opts),
230
+ instruction: getInstruction(identifiers, opts),
231
+ keys: ["fx", "equal", "x"],
232
+ ggbOptions: getGGBOptions(identifiers, opts),
233
+ answerFormat: "tex",
234
+ identifiers,
235
+ hint: getHint(identifiers, opts),
236
+ correction: getCorrection(identifiers, opts),
237
+ options: opts,
238
+ };
239
+ return question;
240
+ };
143
241
  export const affineExpressionReading = {
144
242
  id: "affineExpressionReading",
145
243
  connector: "=",
146
244
  label: "Lire graphiquement l'expression d'une fonction affine",
147
245
  isSingleStep: true,
148
- generator: (nb) => getDistinctQuestions(getAffineExpressionReadingQuestion, nb),
246
+ generator: (nb) => getDistinctQuestions(() => getAffineExpressionReadingQuestion({ isLinear: false }), nb),
247
+ qcmTimer: 60,
248
+ freeTimer: 60,
249
+ getPropositions,
250
+ isAnswerValid,
251
+ hasGeogebra: true,
252
+ subject: "Mathématiques",
253
+ getQuestionFromIdentifiers,
254
+ hasHintAndCorrection: true,
255
+ };
256
+ export const linearExpressionReading = {
257
+ id: "linearExpressionReading",
258
+ connector: "=",
259
+ label: "Lire graphiquement l'expression d'une fonction linéaire",
260
+ isSingleStep: true,
261
+ generator: (nb) => getDistinctQuestions(() => getAffineExpressionReadingQuestion({ isLinear: true }), nb),
149
262
  qcmTimer: 60,
150
263
  freeTimer: 60,
151
264
  getPropositions,
@@ -154,4 +267,5 @@ export const affineExpressionReading = {
154
267
  subject: "Mathématiques",
155
268
  getQuestionFromIdentifiers,
156
269
  hasHintAndCorrection: true,
270
+ rebuildIdentifiers: rebuildIdentifiers,
157
271
  };
@@ -1,9 +1,13 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Options = {
3
+ isLinear: boolean;
4
+ };
2
5
  type Identifiers = {
3
6
  correctA: number;
4
7
  correctB: number;
5
8
  nameFunc: string;
6
9
  };
7
- export declare const drawAffineFromLitExp: Exercise<Identifiers>;
10
+ export declare const drawAffineFromLitExp: Exercise<Identifiers, Options>;
11
+ export declare const drawLinearFromLitExp: Exercise<Identifiers, Options>;
8
12
  export {};
9
13
  //# sourceMappingURL=drawAffineFromLitExp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawAffineFromLitExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/drawAffineFromLitExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAwHF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC"}
1
+ {"version":3,"file":"drawAffineFromLitExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/drawAffineFromLitExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAarC,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAkJF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB/D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwB/D,CAAC"}
@@ -18,18 +18,31 @@ $$
18
18
  ${nameFunc}(x) = ${affine.toTex()}
19
19
  $$`;
20
20
  };
21
- const getHint = () => {
22
- return `Détermine un premier point par lequel passe la droite en utilisant l'ordonnée à l'origine de la droite. Puis à l'aide du coefficient directeur, détermine un second point à partir du premier point.`;
21
+ const getHint = (identifiers, opts) => {
22
+ const { nameFunc } = identifiers;
23
+ if (opts?.isLinear) {
24
+ return `Calcule combien vaut $${nameFunc}(0)$, $${nameFunc}(1)$ et place les points correspondants. Puis trace la droite.`;
25
+ }
26
+ else {
27
+ return `Détermine un premier point par lequel passe la droite en utilisant l'ordonnée à l'origine de la droite. Puis à l'aide du coefficient directeur, détermine un second point à partir du premier point.`;
28
+ }
23
29
  };
24
- const getCorrection = (identifiers) => {
30
+ const getCorrection = (identifiers, opts) => {
25
31
  const { correctA, correctB } = identifiers;
26
32
  const affine = new Affine(correctA, correctB);
27
- return `Le terme constant dans l'expression $ ${affine.toTex()} $ est $${correctB}$.
28
- L'ordonnée à l'origine de la droite est donc $${correctB}$.
33
+ return `${(() => {
34
+ if (opts?.isLinear) {
35
+ return `On a affaire à une fonction linéaire.`;
36
+ }
37
+ else {
38
+ return `Le terme constant dans l'expression $ ${affine.toTex()} $ est $${correctB}$.`;
39
+ }
40
+ })()}
41
+ L'ordonnée à l'origine de la droite est donc $${correctB}$.
29
42
  La droite passe par le point de coordonnées $(0;${correctB})$.
30
43
 
31
44
  Le nombre qui multiplie $x$ dans l'expression $ ${affine.toTex()} $ est $${correctA}$.
32
- Le coefficient directeur de $d$ est par conséquent $${correctA}$. Donc, à partir du point $(0;${correctB})$, si l'on augmente l'abscisse de $1$ unité, l'ordonnée ${correctA < 0 ? "diminue" : "augmente"} de $${correctA}$ unité(s). La droite passe donc par le point de coordonnées $(1; ${correctB + correctA})$.
45
+ Le coefficient directeur de $d$ est par conséquent $${correctA}$. Donc, à partir du point $(0;${correctB})$, si l'on augmente l'abscisse de $1$ unité, l'ordonnée ${correctA < 0 ? "diminue" : "augmente"} de $${Math.abs(correctA)}$ unité(s). La droite passe donc par le point de coordonnées $(1; ${correctB + correctA})$.
33
46
 
34
47
  On place donc les deux points de coordonnées $(0; ${correctB})$ et $(1; ${correctB + correctA})$, puis on trace la droite passant par ces deux points.`;
35
48
  };
@@ -83,27 +96,56 @@ const getPoint = (command, pointName) => {
83
96
  const y = +splitted[1].replace(")", "");
84
97
  return new Point(pointName, x.toTree(), y.toTree());
85
98
  };
86
- const getDrawAffineFromLitExpQuestion = () => {
87
- const affine = AffineConstructor.random({ min: -3, max: 3 });
99
+ const getDrawAffineFromLitExpQuestion = (opts) => {
100
+ let affine;
101
+ if (opts?.isLinear) {
102
+ affine = AffineConstructor.random({ min: -5, max: 5 }, { min: 0, max: 0 });
103
+ }
104
+ else {
105
+ affine = AffineConstructor.random({ min: -3, max: 3 });
106
+ }
88
107
  const nameFunc = random(["f", "g", "h"]);
89
108
  const identifiers = { correctA: affine.a, correctB: affine.b, nameFunc };
90
- return getQuestionFromIdentifiers(identifiers);
109
+ return getQuestionFromIdentifiers(identifiers, opts);
91
110
  };
92
- const getQuestionFromIdentifiers = (identifiers) => {
111
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
93
112
  return {
94
- ggbAnswer: getGGBAnswer(identifiers),
95
- instruction: getInstruction(identifiers),
96
- studentGgbOptions: getStudentGGBOptions(identifiers),
113
+ ggbAnswer: getGGBAnswer(identifiers, opts),
114
+ instruction: getInstruction(identifiers, opts),
115
+ studentGgbOptions: getStudentGGBOptions(identifiers, opts),
97
116
  identifiers,
98
- hint: getHint(identifiers),
99
- correction: getCorrection(identifiers),
117
+ hint: getHint(identifiers, opts),
118
+ correction: getCorrection(identifiers, opts),
119
+ options: opts,
100
120
  };
101
121
  };
102
122
  export const drawAffineFromLitExp = {
103
123
  id: "drawAffineFromLitExp",
104
- label: "Tracer une fonction affine via son expression algébrique",
124
+ label: "Tracer la représentation graphique d'une fonction affine via son expression algébrique",
105
125
  isSingleStep: true,
106
- generator: (nb, opts) => getDistinctQuestions(() => getDrawAffineFromLitExpQuestion(opts), nb),
126
+ generator: (nb) => getDistinctQuestions(() => getDrawAffineFromLitExpQuestion({ isLinear: false }), nb),
127
+ ggbTimer: 60,
128
+ isGGBAnswerValid,
129
+ subject: "Mathématiques",
130
+ getHint,
131
+ getInstruction,
132
+ getCorrection,
133
+ getGGBAnswer,
134
+ getStudentGGBOptions,
135
+ answerType: "GGB",
136
+ getQuestionFromIdentifiers,
137
+ hasHintAndCorrection: true,
138
+ };
139
+ export const drawLinearFromLitExp = {
140
+ id: "drawLinearFromLitExp",
141
+ label: "Tracer la représentation graphique d'une fonction linéaire via son expression algébrique",
142
+ isSingleStep: true,
143
+ generator: (nb) =>
144
+ // getDistinctQuestions(
145
+ // () => getDrawAffineFromLitExpQuestion({ isLinear: true }),
146
+ // nb,
147
+ // ),
148
+ [...Array(nb).keys()].map(() => getDrawAffineFromLitExpQuestion({ isLinear: true })),
107
149
  ggbTimer: 60,
108
150
  isGGBAnswerValid,
109
151
  subject: "Mathématiques",
@@ -121,7 +121,7 @@ const getHint = (identifiers) => {
121
121
  : isStrict
122
122
  ? "strictement inférieure"
123
123
  : "inférieure";
124
- return `Lit toutes les valeurs de $x$ pour lesquelles $f(x)$ est ${word} à $${yValue.frenchify()}$.`;
124
+ return `Lis toutes les valeurs de $x$ pour lesquelles $f(x)$ est ${word} à $${yValue.frenchify()}$.`;
125
125
  };
126
126
  const getCorrection = (identifiers) => {
127
127
  //trace droit y = y, lit x sous
@@ -15,4 +15,5 @@ export * from "./variations/index.js";
15
15
  export * from "./sqrt/index.js";
16
16
  export * from "./inverse/index.js";
17
17
  export * from "./composition/index.js";
18
+ export * from "./linear/index.js";
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
@@ -15,3 +15,4 @@ export * from "./variations/index.js";
15
15
  export * from "./sqrt/index.js";
16
16
  export * from "./inverse/index.js";
17
17
  export * from "./composition/index.js";
18
+ export * from "./linear/index.js";
@@ -0,0 +1,3 @@
1
+ export * from "./linearFromExercise.js";
2
+ export * from "./linearFromPercentageEvolution.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/linear/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./linearFromExercise.js";
2
+ export * from "./linearFromPercentageEvolution.js";
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ situationIndex: number;
4
+ x1: number;
5
+ y1: number;
6
+ };
7
+ export declare const linearFromExercise: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=linearFromExercise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linearFromExercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/linear/linearFromExercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAsCrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAuWF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}