math-exercises 3.0.38 → 3.0.39

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 (69) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +1 -1
  2. package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/fractions/simplifyFraction.js +37 -0
  4. package/lib/exercises/math/calcul/rounding/rounding.d.ts +8 -5
  5. package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/rounding/rounding.js +63 -31
  7. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
  8. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.js +60 -7
  9. package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
  10. package/lib/exercises/math/functions/affines/leadingCoefficient.js +42 -4
  11. package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts.map +1 -1
  12. package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.js +49 -0
  13. package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.js +1 -1
  14. package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.js +1 -1
  15. package/lib/exercises/math/functions/trinoms/roots/rootsProduct.js +1 -1
  16. package/lib/exercises/math/functions/trinoms/roots/rootsSum.js +1 -1
  17. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +1 -1
  18. package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.d.ts.map +1 -1
  19. package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.js +0 -2
  20. package/lib/exercises/math/geometry/vectors/chasles.d.ts.map +1 -1
  21. package/lib/exercises/math/geometry/vectors/chasles.js +0 -2
  22. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.d.ts +1 -0
  23. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.d.ts.map +1 -1
  24. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.js +32 -14
  25. package/lib/exercises/math/probaStat/diceBasicProbas.js +1 -1
  26. package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
  27. package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.js +43 -8
  28. package/lib/exercises/math/sequences/arithmetic/arithmeticFindReasonRandomRange.d.ts.map +1 -1
  29. package/lib/exercises/math/sequences/arithmetic/arithmeticFindReasonRandomRange.js +0 -2
  30. package/lib/exercises/math/sequences/arithmetic/arithmeticReasonUsage.d.ts.map +1 -1
  31. package/lib/exercises/math/sequences/arithmetic/arithmeticReasonUsage.js +51 -8
  32. package/lib/geogebra/geogebraConstructor.d.ts +3 -1
  33. package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
  34. package/lib/geogebra/geogebraConstructor.js +5 -2
  35. package/lib/index.d.ts +5 -1
  36. package/lib/index.d.ts.map +1 -1
  37. package/lib/latexTester.js +1 -0
  38. package/lib/math/numbers/integer/integer.d.ts +1 -1
  39. package/lib/math/numbers/rationals/rational.d.ts +1 -0
  40. package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
  41. package/lib/math/numbers/rationals/rational.js +3 -0
  42. package/lib/math/utils/stats/generateAffineCloud.js +1 -1
  43. package/lib/playground.d.ts.map +1 -1
  44. package/lib/playground.js +5 -3
  45. package/lib/tests/pdfExo.test.d.ts.map +1 -1
  46. package/lib/tests/pdfExo.test.js +2 -2
  47. package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -2
  48. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  49. package/lib/tree/nodes/functions/sqrtNode.d.ts +2 -1
  50. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  51. package/lib/tree/nodes/functions/sqrtNode.js +47 -2
  52. package/lib/tree/nodes/node.d.ts +1 -0
  53. package/lib/tree/nodes/node.d.ts.map +1 -1
  54. package/lib/tree/nodes/numbers/numberNode.d.ts +1 -1
  55. package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
  56. package/lib/tree/nodes/numbers/numberNode.js +1 -1
  57. package/lib/tree/nodes/operators/addNode.d.ts +1 -0
  58. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  59. package/lib/tree/nodes/operators/addNode.js +6 -0
  60. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
  61. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  62. package/lib/tree/nodes/operators/fractionNode.js +1 -1
  63. package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
  64. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  65. package/lib/tree/nodes/operators/multiplyNode.js +7 -0
  66. package/lib/utils/iterators/dualReturn.d.ts +2 -0
  67. package/lib/utils/iterators/dualReturn.d.ts.map +1 -0
  68. package/lib/utils/iterators/dualReturn.js +19 -0
  69. package/package.json +1 -1
@@ -61,7 +61,7 @@ ${alignTex([
61
61
  ],
62
62
  [
63
63
  "=",
64
- frac(orderedNums[0] * coeff + orderedNums[1], orderedDenums[1]).toSimplificationString(),
64
+ frac(orderedNums[0] * coeff + orderedNums[1], orderedDenums[1]).toSimplificationTex(),
65
65
  ],
66
66
  ])}`;
67
67
  };
@@ -1 +1 @@
1
- {"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAgEF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAWlD,CAAC"}
1
+ {"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAgGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}
@@ -1,7 +1,11 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
4
+ import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
5
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
6
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
4
7
  import { shuffle } from "../../../../utils/alea/shuffle.js";
8
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
5
9
  const getStatementNode = (identifiers) => {
6
10
  const { num, denum } = identifiers;
7
11
  const rational = new Rational(num, denum).toTree();
@@ -24,6 +28,32 @@ const getAnswer = (identifiers) => {
24
28
  const answer = rational.simplify().toTree().toTex();
25
29
  return answer;
26
30
  };
31
+ const getHint = (identifiers) => {
32
+ return `Détermine le plus grand diviseur commun à $${identifiers.num}$ et $${identifiers.denum}$.
33
+
34
+ On peut alors simpfier la fraction par ce nombre.`;
35
+ };
36
+ const getCorrection = (identifiers) => {
37
+ const { num, denum } = identifiers;
38
+ const pgcd = gcd(num, denum);
39
+ const numDiv = num / pgcd;
40
+ const denumDiv = denum / pgcd;
41
+ return `Le plus grand diviseur commun à $${num}$ et $${denum}$ est $${pgcd}$.
42
+
43
+ En effet, on a $${num} = ${numDiv} \\times ${pgcd}$ et $${denum} = ${denumDiv} \\times ${pgcd}$.
44
+
45
+ On peut donc simplfier la fraction par $${pgcd}$ :
46
+
47
+ ${alignTex([
48
+ [
49
+ frac(num, denum).toTex(),
50
+ "=",
51
+ frac(multiply(numDiv, pgcd.toTree({ toTexOptions: { cancel: true } })), multiply(denumDiv, pgcd.toTree({ toTexOptions: { cancel: true } }))).toTex(),
52
+ ],
53
+ ["", "=", getAnswer(identifiers)],
54
+ ])}
55
+ `;
56
+ };
27
57
  const getSimplifyFraction = () => {
28
58
  const rational = RationalConstructor.randomSimplifiable(10);
29
59
  const identifiers = { num: rational.num, denum: rational.denum };
@@ -34,6 +64,8 @@ const getSimplifyFraction = () => {
34
64
  keys: [],
35
65
  answerFormat: "tex",
36
66
  identifiers,
67
+ hint: getHint(identifiers),
68
+ correction: getCorrection(identifiers),
37
69
  };
38
70
  return question;
39
71
  };
@@ -65,4 +97,9 @@ export const simplifyFraction = {
65
97
  getPropositions,
66
98
  isAnswerValid,
67
99
  subject: "Mathématiques",
100
+ getAnswer,
101
+ getInstruction,
102
+ getCorrection,
103
+ getHint,
104
+ hasHintAndCorrection: true,
68
105
  };
@@ -1,22 +1,25 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Options = {
3
+ precisionAsked: number;
4
+ };
2
5
  type Identifiers = {
3
6
  precisionAsked: number;
4
7
  decimal: number;
5
8
  precision: number;
6
9
  };
7
- export declare const roundToUnit: Exercise<Identifiers>;
10
+ export declare const roundToUnit: Exercise<Identifiers, Options>;
8
11
  /**
9
12
  * arrondi à l'unité
10
13
  */
11
- export declare const roundToDixieme: Exercise<Identifiers>;
14
+ export declare const roundToDixieme: Exercise<Identifiers, Options>;
12
15
  /**
13
16
  * arrondi à l'unité
14
17
  */
15
- export declare const roundToCentieme: Exercise<Identifiers>;
18
+ export declare const roundToCentieme: Exercise<Identifiers, Options>;
16
19
  /**
17
20
  * arrondi à l'unité
18
21
  */
19
- export declare const roundToMillieme: Exercise<Identifiers>;
20
- export declare const allRoundings: Exercise<Identifiers>;
22
+ export declare const roundToMillieme: Exercise<Identifiers, Options>;
23
+ export declare const allRoundings: Exercise<Identifiers, Options>;
21
24
  export {};
22
25
  //# sourceMappingURL=rounding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rounding.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/rounding.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AA6ErC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAgDF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAe7C,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAehD,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAkB9C,CAAC"}
1
+ {"version":3,"file":"rounding.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/rounding.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAwBrC,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA4HF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBtD,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBzD,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB1D,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB1D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBvD,CAAC"}
@@ -16,39 +16,61 @@ const instructions = [
16
16
  "Arrondir au centième :",
17
17
  "Arrondir au millième :",
18
18
  ];
19
- const getRoundQuestions = (opts) => {
20
- 244.8895;
21
- const precisionAsked = opts?.precisionAsked || 0;
22
- const precision = randint(precisionAsked + 1, precisionAsked + 5);
23
- const dec = DecimalConstructor.random(0, 1000, precision);
19
+ const getInstruction = (identifiers, opts) => {
20
+ const { precisionAsked } = identifiers;
21
+ const dec = new Decimal(identifiers.decimal);
24
22
  const decTex = dec.toTree().toTex();
23
+ return `${instructions[precisionAsked]} $${decTex}$`;
24
+ };
25
+ const getAnswer = (identifiers, opts) => {
26
+ const { precisionAsked } = identifiers;
27
+ const dec = new Decimal(identifiers.decimal);
25
28
  const answer = dec.round(precisionAsked).toTree().toTex();
29
+ return answer;
30
+ };
31
+ const getHint = (identifiers, opts) => {
32
+ const { precisionAsked } = identifiers;
33
+ return `Pour arrondir ${ranksWithAu[precisionAsked]}, on regarde le chiffre des ${ranks[precisionAsked + 1]}s. S'il est inférieur à $5$, on arrondit ${ranksWithAu[precisionAsked]} inférieur. S'il est supérieur ou égal à $5$, on arrondit ${ranksWithAu[precisionAsked]} supérieur.`;
34
+ };
35
+ const getCorrection = (identifiers, opts) => {
36
+ const { precisionAsked } = identifiers;
37
+ const dec = new Decimal(identifiers.decimal);
38
+ const decTex = dec.toTree().toTex();
39
+ const answer = getAnswer(identifiers, opts);
26
40
  const figureToLookAt = dec.getDigitAtRank(-(precisionAsked + 1));
27
- const question = {
28
- instruction: `${instructions[precisionAsked]} $${decTex}$`,
29
- startStatement: decTex,
30
- answer,
31
- keys: [],
32
- answerFormat: "tex",
33
- identifiers: {
34
- precisionAsked,
35
- decimal: dec.value,
36
- precision,
37
- },
38
- hint: `Pour arrondir ${ranksWithAu[precisionAsked]}, on regarde le chiffre des ${ranks[precisionAsked + 1]}s. S'il est inférieur à $5$, on arrondit ${ranksWithAu[precisionAsked]} inférieur. S'il est supérieur à $5$, on arrondit ${ranksWithAu[precisionAsked]} supérieur.`,
39
- correction: `Le chiffre des ${ranks[precisionAsked + 1]}s est $${figureToLookAt}$.
41
+ return `Le chiffre des ${ranks[precisionAsked + 1]}s est $${figureToLookAt}$.
40
42
 
41
43
  ${figureToLookAt < 5
42
- ? `Puisque $${figureToLookAt}$ est inférieur à $5$, on arrondit ${ranksWithAu[precisionAsked]} inférieur.
44
+ ? `Puisque $${figureToLookAt}$ est inférieur à $5$, on arrondit ${ranksWithAu[precisionAsked]} inférieur.
43
45
 
44
46
  Ainsi, en arrondissant ${ranksWithAu[precisionAsked]}, on a $${decTex} \\approx ${answer}$`
45
- : `Puisque $${figureToLookAt}$ est supérieur à $5$, on arrondit ${ranksWithAu[precisionAsked]} supérieur.
47
+ : `Puisque $${figureToLookAt}$ est supérieur ou égal à $5$, on arrondit ${ranksWithAu[precisionAsked]} supérieur.
46
48
 
47
49
  Ainsi, en arrondissant ${ranksWithAu[precisionAsked]}, on a
48
50
 
49
51
  $$
50
52
  ${decTex} \\approx ${answer}
51
- $$`}`,
53
+ $$`}`;
54
+ };
55
+ const getRoundQuestions = (opts) => {
56
+ const precisionAsked = opts?.precisionAsked || 0;
57
+ const precision = randint(precisionAsked + 1, precisionAsked + 5);
58
+ const dec = DecimalConstructor.random(0, 1000, precision);
59
+ const decTex = dec.toTree().toTex();
60
+ const identifiers = {
61
+ precisionAsked,
62
+ decimal: dec.value,
63
+ precision,
64
+ };
65
+ const question = {
66
+ instruction: getInstruction(identifiers, opts),
67
+ startStatement: decTex,
68
+ answer: getAnswer(identifiers, opts),
69
+ keys: [],
70
+ answerFormat: "tex",
71
+ identifiers,
72
+ hint: getHint(identifiers, opts),
73
+ correction: getCorrection(identifiers, opts),
52
74
  };
53
75
  return question;
54
76
  };
@@ -82,8 +104,6 @@ export const roundToUnit = {
82
104
  id: "roundToUnit",
83
105
  connector: "\\approx",
84
106
  label: "Arrondir à l'unité",
85
- levels: ["6ème", "5ème", "CAP", "2ndPro", "1rePro"],
86
- sections: ["Calculs"],
87
107
  isSingleStep: true,
88
108
  generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: 0 }), nb),
89
109
  qcmTimer: 60,
@@ -92,6 +112,10 @@ export const roundToUnit = {
92
112
  isAnswerValid,
93
113
  subject: "Mathématiques",
94
114
  hasHintAndCorrection: true,
115
+ getInstruction,
116
+ getAnswer,
117
+ getCorrection,
118
+ getHint,
95
119
  };
96
120
  /**
97
121
  * arrondi à l'unité
@@ -100,8 +124,6 @@ export const roundToDixieme = {
100
124
  id: "roundToDixieme",
101
125
  connector: "\\approx",
102
126
  label: "Arrondir au dixième",
103
- levels: ["6ème", "5ème", "CAP", "2ndPro", "1rePro"],
104
- sections: ["Calculs"],
105
127
  isSingleStep: true,
106
128
  generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: 1 }), nb),
107
129
  qcmTimer: 60,
@@ -110,6 +132,10 @@ export const roundToDixieme = {
110
132
  isAnswerValid,
111
133
  subject: "Mathématiques",
112
134
  hasHintAndCorrection: true,
135
+ getInstruction,
136
+ getAnswer,
137
+ getCorrection,
138
+ getHint,
113
139
  };
114
140
  /**
115
141
  * arrondi à l'unité
@@ -118,8 +144,6 @@ export const roundToCentieme = {
118
144
  id: "roundToCentieme",
119
145
  connector: "\\approx",
120
146
  label: "Arrondir au centième",
121
- levels: ["6ème", "5ème", "CAP", "2ndPro", "1rePro"],
122
- sections: ["Calculs"],
123
147
  isSingleStep: true,
124
148
  generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: 2 }), nb),
125
149
  qcmTimer: 60,
@@ -128,6 +152,10 @@ export const roundToCentieme = {
128
152
  isAnswerValid,
129
153
  subject: "Mathématiques",
130
154
  hasHintAndCorrection: true,
155
+ getInstruction,
156
+ getAnswer,
157
+ getCorrection,
158
+ getHint,
131
159
  };
132
160
  /**
133
161
  * arrondi à l'unité
@@ -136,8 +164,6 @@ export const roundToMillieme = {
136
164
  id: "roundToMillieme",
137
165
  connector: "\\approx",
138
166
  label: "Arrondir au millième",
139
- levels: ["6ème", "5ème", "CAP", "2ndPro", "1rePro"],
140
- sections: ["Calculs"],
141
167
  isSingleStep: true,
142
168
  generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: 3 }), nb),
143
169
  qcmTimer: 60,
@@ -146,13 +172,15 @@ export const roundToMillieme = {
146
172
  isAnswerValid,
147
173
  subject: "Mathématiques",
148
174
  hasHintAndCorrection: true,
175
+ getInstruction,
176
+ getAnswer,
177
+ getCorrection,
178
+ getHint,
149
179
  };
150
180
  export const allRoundings = {
151
181
  id: "allRoundings",
152
182
  connector: "\\approx",
153
183
  label: "Arrondir un nombre décimal",
154
- levels: ["6ème", "5ème", "CAP", "2ndPro", "1rePro"],
155
- sections: ["Calculs"],
156
184
  isSingleStep: true,
157
185
  generator: (nb) => getDistinctQuestions(() => getRoundQuestions({ precisionAsked: randint(0, 4) }), nb),
158
186
  qcmTimer: 60,
@@ -161,4 +189,8 @@ export const allRoundings = {
161
189
  isAnswerValid,
162
190
  subject: "Mathématiques",
163
191
  hasHintAndCorrection: true,
192
+ getInstruction,
193
+ getAnswer,
194
+ getCorrection,
195
+ getHint,
164
196
  };
@@ -1 +1 @@
1
- {"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IAOjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAGnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAqKF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAelD,CAAC"}
1
+ {"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IAOjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAGnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAqOF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAkBlD,CAAC"}
@@ -6,11 +6,13 @@ import { randint } from "../../../../math/utils/random/randint.js";
6
6
  import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
7
7
  import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
8
  import { square } from "../../../../tree/nodes/operators/powerNode.js";
9
+ import { monom } from "../../../../tree/nodes/polynomials/monomNode.js";
9
10
  import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
10
11
  import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
11
12
  import { random } from "../../../../utils/alea/random.js";
12
13
  import { shuffle } from "../../../../utils/alea/shuffle.js";
13
14
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
15
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
14
16
  const rebuildIdentifiers = (oldids) => {
15
17
  if (oldids.variable)
16
18
  return oldids;
@@ -63,13 +65,59 @@ const getHint = (identifiers) => {
63
65
  const { coeffs, order, variable } = identifiers;
64
66
  return `Additionne les termes en $${variable}^2$ entre eux, puis les termes en $${variable}$ entre eux, et enfin les nombres entre eux.`;
65
67
  };
66
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
67
- // const { coeffs, order, variable } = identifiers;
68
- // return `On additionne les termes en $${variable}^2$ entre eux, puis les termes en $${variable}$ entre eux, et enfin les nombres entre eux.
69
- // - ${coeffs[2].length<2 ? `` : ``}
70
- // -
71
- // - `
72
- // };
68
+ const getCorrection = (identifiers) => {
69
+ const { coeffs, order, variable } = identifiers;
70
+ const x2Count = coeffs[2].length;
71
+ const xCount = coeffs[1].length;
72
+ const nbCount = coeffs[0].length;
73
+ const xSimp = xCount === 0
74
+ ? ""
75
+ : xCount === 1
76
+ ? `$${monom(coeffs[1][0], 1, {
77
+ variable,
78
+ }).toTex()}$ est le seul terme en $${variable}$, on ne peut donc l'additionner avec aucun autre terme.`
79
+ : `On additionne les $${xCount}$ termes en $${variable}$ :
80
+
81
+ $$
82
+ ${operatorComposition(AddNode, coeffs[1].map((c) => monom(c, 1, { variable }).toTree())).toSimplificationTex()}
83
+ $$`;
84
+ const x2Simp = x2Count === 0
85
+ ? ""
86
+ : x2Count === 1
87
+ ? `$${monom(coeffs[2][0], 2, {
88
+ variable,
89
+ }).toTex()}$ est le seul terme en $${square(variable).toTex()}$, on ne peut donc l'additionner avec aucun autre terme.`
90
+ : `On additionne les $${x2Count}$ termes en $${square(variable).toTex()}$ :
91
+
92
+ $$
93
+ ${operatorComposition(AddNode, coeffs[2].map((c) => monom(c, 2, { variable }).toTree())).toSimplificationTex()}
94
+ $$`;
95
+ const nbSimp = nbCount === 0
96
+ ? ""
97
+ : nbCount === 1
98
+ ? `$${coeffs[0][0]}$ est le seul nombre, on ne peut donc l'additionner avec aucun autre terme.`
99
+ : `On additionne les $${nbCount}$ nombres entre eux :
100
+
101
+ $$
102
+ ${operatorComposition(AddNode, coeffs[0].map((c) => c.toTree())).toSimplificationTex()}
103
+ $$`;
104
+ return `On additionne les termes en $${variable}^2$ entre eux, puis les termes en $${variable}$ entre eux, et enfin les nombres entre eux.
105
+
106
+ ${x2Count > 0 ? `- ${x2Simp}` : ""}
107
+
108
+ ${xCount > 0 ? `- ${xSimp}` : ""}
109
+
110
+ ${nbCount > 0 ? `- ${nbSimp}` : ""}
111
+
112
+
113
+ Ainsi, on obtient :
114
+
115
+ ${alignTex([
116
+ ["", getStartStatement(identifiers)],
117
+ ["=", getAnswer(identifiers)],
118
+ ])}
119
+ `;
120
+ };
73
121
  const getReduceExpression = () => {
74
122
  const rand = randint(0, 7);
75
123
  let polynome1;
@@ -106,6 +154,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
106
154
  keys: [identifiers.variable],
107
155
  answerFormat: "tex",
108
156
  identifiers,
157
+ hint: getHint(identifiers),
158
+ correction: getCorrection(identifiers),
109
159
  };
110
160
  return question;
111
161
  };
@@ -162,4 +212,7 @@ export const reduceExpression = {
162
212
  getAnswer,
163
213
  getInstruction,
164
214
  getQuestionFromIdentifiers,
215
+ getHint,
216
+ getCorrection,
217
+ hasHintAndCorrection: true,
165
218
  };
@@ -1 +1 @@
1
- {"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAiFF,KAAK,OAAO,GAAG;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAYF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB7D,CAAC"}
1
+ {"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAkHF,KAAK,OAAO,GAAG;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAYF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB7D,CAAC"}
@@ -3,14 +3,35 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
3
3
  import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
4
4
  import { randomColor } from "../../../../geogebra/colors.js";
5
5
  import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
6
- import { Rational } from "../../../../math/numbers/rationals/rational.js";
6
+ import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
7
7
  import { randint } from "../../../../math/utils/random/randint.js";
8
8
  import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
9
9
  import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
10
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
11
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
12
  import { shuffle } from "../../../../utils/alea/shuffle.js";
11
13
  const getInstruction = (identifiers) => {
12
14
  return "Déterminer le coefficient directeur de la droite représentée ci-dessous : ";
13
15
  };
16
+ const getHint = (identifiers) => {
17
+ return `Le coefficient directeur d'une droite passant par deux points $A(x_A; y_A)$ et $B(x_B; y_B)$ est :
18
+
19
+ $$
20
+ \\frac{y_B - y_A}{x_B - x_A}
21
+ $$
22
+
23
+ Repère donc deux points appartenant à la droite, et utilise cette formule.`;
24
+ };
25
+ const getCorrection = (identifiers) => {
26
+ const { xA, yA, xB, yB } = identifiers;
27
+ return `On lit graphiquement que la droite passe par les deux points $A(${xA},${yA})$ et $B(${xB},${yB})$.
28
+
29
+ Le coefficient directeur est donc :
30
+
31
+ $$
32
+ ${frac(substract(yB, yA), substract(xB, xA)).toSimplificationTex()}
33
+ $$`;
34
+ };
14
35
  const getAnswer = (identifiers) => {
15
36
  const { xA, yA, xB, yB } = identifiers;
16
37
  const a = frac(yB - yA, xB - xA).simplify();
@@ -32,7 +53,13 @@ const getGGBOptions = (identifiers) => {
32
53
  commands,
33
54
  });
34
55
  return ggb.getOptions({
35
- coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
56
+ coords: ggb.getAdaptedCoords({
57
+ xMin,
58
+ xMax,
59
+ yMin,
60
+ yMax,
61
+ ratio: 2,
62
+ }),
36
63
  });
37
64
  };
38
65
  const getLeadingCoefficientQuestion = (opts) => {
@@ -43,8 +70,14 @@ const getLeadingCoefficientQuestion = (opts) => {
43
70
  }
44
71
  else
45
72
  [xA, yA] = [1, 2].map((el) => randint(-5, 6));
46
- xB = xA > 0 ? randint(xA - 4, 6, [xA]) : randint(-4, xA + 5, [xA]); // l'écart entre les deux points ne soit pas grand
47
- yB = yA > 0 ? randint(yA - 4, 6) : randint(-4, yA + 5);
73
+ const aIsInt = coinFlip();
74
+ const a = aIsInt
75
+ ? [randint(-3, 3, [0])]
76
+ : RationalConstructor.randomIrreductible(5).toArray();
77
+ xB = xA + (aIsInt ? 1 : a[0]);
78
+ yB = yA + (aIsInt ? a[0] : a[1]);
79
+ // xB = xA > 0 ? randint(xA - 4, 6, [xA]) : randint(-4, xA + 5, [xA]); // l'écart entre les deux points ne soit pas grand
80
+ // yB = yA > 0 ? randint(yA - 4, 6) : randint(-4, yA + 5);
48
81
  const identifiers = { xA, xB, yA, yB };
49
82
  const question = {
50
83
  instruction: getInstruction(identifiers),
@@ -53,6 +86,8 @@ const getLeadingCoefficientQuestion = (opts) => {
53
86
  ggbOptions: getGGBOptions(identifiers),
54
87
  answerFormat: "tex",
55
88
  identifiers,
89
+ hint: getHint(identifiers),
90
+ correction: getCorrection(identifiers),
56
91
  };
57
92
  return question;
58
93
  };
@@ -96,4 +131,7 @@ export const leadingCoefficient = {
96
131
  getInstruction,
97
132
  getGGBOptions,
98
133
  options,
134
+ getHint,
135
+ getCorrection,
136
+ hasHintAndCorrection: true,
99
137
  };
@@ -1 +1 @@
1
- {"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoGF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
1
+ {"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuJF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAiBzD,CAAC"}
@@ -8,6 +8,7 @@ import { substract } from "../../../../../tree/nodes/operators/substractNode.js"
8
8
  import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
9
9
  import { probaFlip } from "../../../../../utils/alea/probaFlip.js";
10
10
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
11
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
11
12
  const getAnswerNode = (identifiers) => {
12
13
  const { a, roots } = identifiers;
13
14
  const isSingleRoot = roots.length === 1;
@@ -28,6 +29,49 @@ const getInstruction = (identifiers) => {
28
29
 
29
30
  Déterminer la forme factorisée de $f$.`;
30
31
  };
32
+ const getHint = (identifiers) => {
33
+ return `Soit $f$ un polynôme du second degré de la forme
34
+
35
+ $$
36
+ f(x)=ax^2+bx+c
37
+ $$
38
+
39
+ Si $f$ admet deux racines $x_1$ et $x_2$, alors la forme factorisée de $f$ est :
40
+
41
+ $$
42
+ f(x)=a(x-x_1)(x-x_2)
43
+ $$
44
+
45
+ Si $f$ n'admet qu'une racine $x_0$, alors sa forme factorisée est :
46
+
47
+ $$
48
+ f(x) = a(x-x_0)^2
49
+ $$
50
+
51
+ Si $f$ n'admet pas de racine, alors il n'admet pas de forme factorisée.`;
52
+ };
53
+ const getCorrection = (identifiers) => {
54
+ const { a, roots } = identifiers;
55
+ const rawForm = roots.length === 1
56
+ ? multiply(a, square(substract("x", roots[0])))
57
+ : multiply(a, multiply(substract("x", roots[0]), substract("x", roots[1])));
58
+ const simpForm = rawForm.simplify();
59
+ const hasSimplified = rawForm.toTex() !== simpForm.toTex();
60
+ return roots.length === 1
61
+ ? `Puisque $f$ n'admet qu'une racine, sa forme factorisée est :
62
+
63
+ ${alignTex([
64
+ ["f(x)", "=", rawForm.toTex()],
65
+ hasSimplified ? ["", "=", simpForm.toTex()] : [],
66
+ ])}
67
+ `
68
+ : `Puisque $f$ admet deux racines distinctes, sa forme factorisée est :
69
+
70
+ ${alignTex([
71
+ ["f(x)", "=", rawForm.toTex()],
72
+ hasSimplified ? ["", "=", simpForm.toTex()] : [],
73
+ ])}`;
74
+ };
31
75
  const getFactorizedFormFromRootsQuestion = () => {
32
76
  const a = randint(-10, 10, [0]);
33
77
  const firstRoot = randint(-10, 10);
@@ -43,6 +87,8 @@ const getFactorizedFormFromRootsQuestion = () => {
43
87
  keys: ["x"],
44
88
  answerFormat: "tex",
45
89
  identifiers,
90
+ hint: getHint(identifiers),
91
+ correction: getCorrection(identifiers),
46
92
  };
47
93
  return question;
48
94
  };
@@ -92,4 +138,7 @@ export const factorizedFormFromRoots = {
92
138
  subject: "Mathématiques",
93
139
  getInstruction,
94
140
  getAnswer,
141
+ getHint,
142
+ getCorrection,
143
+ hasHintAndCorrection: true,
95
144
  };
@@ -53,7 +53,7 @@ const getCorrection = (identifiers) => {
53
53
  L'axe de symétrie de la parabole représentant $f$ a donc pour équation :
54
54
 
55
55
  $$
56
- x=${fraction.toTex()}=${frac(x1 + x2, 2).toSimplificationString()}
56
+ x=${fraction.toTex()}=${frac(x1 + x2, 2).toSimplificationTex()}
57
57
  $$`;
58
58
  };
59
59
  const getKeys = (identifiers) => {
@@ -63,7 +63,7 @@ $$
63
63
  Or on sait que $x_1 = ${firstRoot.toTex()}$. On a donc :
64
64
 
65
65
  $$
66
- x_2 = ${frac(cOverA, firstRoot).toSimplificationString()}
66
+ x_2 = ${frac(cOverA, firstRoot).toSimplificationTex()}
67
67
  $$
68
68
  `;
69
69
  };
@@ -59,7 +59,7 @@ $$
59
59
  Ici, on a $a = ${aTex}$ et $c = ${cTex}$, donc :
60
60
 
61
61
  $$
62
- P = ${ans.toSimplificationString()}
62
+ P = ${ans.toSimplificationTex()}
63
63
  $$
64
64
  `;
65
65
  };
@@ -59,7 +59,7 @@ $$
59
59
  Ici, on a $a = ${aTex}$ et $b = ${bTex}$, donc :
60
60
 
61
61
  $$
62
- S = ${ans.toSimplificationString()}
62
+ S = ${ans.toSimplificationTex()}
63
63
  $$
64
64
  `;
65
65
  };
@@ -52,7 +52,7 @@ const getStudentGGBOptions = ({ coeff, oneUnitTex, abscissType, }) => {
52
52
  const isGGBAnswerValid = (ans, { ggbAnswer, absciss, abscissTex, abscissType, axisUnit, coeff, oneUnitTex }) => {
53
53
  const points = parseGGBPoints(ans).map((p) => ggbPointToCoords(p));
54
54
  return (points.length === 1 &&
55
- points[0].y === 0 &&
55
+ Math.abs(points[0].y) < 0.5 &&
56
56
  Math.abs(points[0].x - coeff) < 0.1);
57
57
  };
58
58
  const getPlaceAbscissOnSemiLineQuestion = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"rectanglePerimeter.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/rectanglePerimeter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAkCF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
1
+ {"version":3,"file":"rectanglePerimeter.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/rectanglePerimeter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAkCF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAWpD,CAAC"}
@@ -32,9 +32,7 @@ export const rectanglePerimeter = {
32
32
  id: "rectanglePerimeter",
33
33
  connector: "=",
34
34
  label: "Calculer le périmètre d'un rectangle",
35
- levels: ["4ème", "3ème", "2nde"],
36
35
  isSingleStep: false,
37
- sections: ["Périmètres", "Géométrie euclidienne"],
38
36
  generator: (nb) => getDistinctQuestions(getRectanglePerimeter, nb),
39
37
  qcmTimer: 60,
40
38
  freeTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"chasles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/chasles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAuDF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,WAAW,CAazC,CAAC"}
1
+ {"version":3,"file":"chasles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/chasles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAuDF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,WAAW,CAWzC,CAAC"}
@@ -49,9 +49,7 @@ export const chasles = {
49
49
  id: "chasles",
50
50
  connector: "=",
51
51
  label: "Relation de Chasles pour les vecteurs",
52
- levels: ["2nde", "1reESM", "1reSpé"],
53
52
  isSingleStep: true,
54
- sections: ["Vecteurs"],
55
53
  generator: (nb) => getDistinctQuestions(getChaslesQuestion, nb),
56
54
  qcmTimer: 60,
57
55
  freeTimer: 60,
@@ -3,6 +3,7 @@ type Identifiers = {
3
3
  AB: number;
4
4
  AC: number;
5
5
  trigoPoint: string;
6
+ letters: string[];
6
7
  };
7
8
  export declare const scalarProductViaCos: Exercise<Identifiers>;
8
9
  export {};