math-exercises 3.0.166 → 3.0.168

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 (132) hide show
  1. package/lib/exercises/math/_debug/debugVarSignTableReading.d.ts.map +1 -1
  2. package/lib/exercises/math/_debug/debugVarSignTableReading.js +1 -10
  3. package/lib/exercises/math/_debug/index.d.ts +1 -2
  4. package/lib/exercises/math/_debug/index.d.ts.map +1 -1
  5. package/lib/exercises/math/_debug/index.js +1 -2
  6. package/lib/exercises/math/derivation/variations/index.d.ts +3 -0
  7. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
  8. package/lib/exercises/math/derivation/variations/index.js +4 -0
  9. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts +2 -0
  10. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts.map +1 -0
  11. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.js +203 -0
  12. package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.d.ts +9 -0
  13. package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.d.ts.map +1 -0
  14. package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.js +163 -0
  15. package/lib/exercises/math/derivation/variations/signVarTableFromGraph.d.ts +9 -0
  16. package/lib/exercises/math/derivation/variations/signVarTableFromGraph.d.ts.map +1 -0
  17. package/lib/exercises/math/derivation/variations/signVarTableFromGraph.js +189 -0
  18. package/lib/exercises/math/derivation/variations/signVarTableTrinom.d.ts +9 -0
  19. package/lib/exercises/math/derivation/variations/signVarTableTrinom.d.ts.map +1 -0
  20. package/lib/exercises/math/derivation/variations/signVarTableTrinom.js +148 -0
  21. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
  22. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +1 -4
  23. package/lib/exercises/math/functions/index.d.ts +1 -0
  24. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  25. package/lib/exercises/math/functions/index.js +1 -0
  26. package/lib/exercises/math/functions/inverse/compareInverseValues.d.ts.map +1 -1
  27. package/lib/exercises/math/functions/inverse/compareInverseValues.js +1 -10
  28. package/lib/exercises/math/functions/periodicity/index.d.ts +2 -0
  29. package/lib/exercises/math/functions/periodicity/index.d.ts.map +1 -0
  30. package/lib/exercises/math/functions/periodicity/index.js +1 -0
  31. package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/sign/equationFromSignTable.js +3 -0
  33. package/lib/exercises/math/functions/trinoms/equation/index.d.ts +2 -0
  34. package/lib/exercises/math/functions/trinoms/equation/index.d.ts.map +1 -1
  35. package/lib/exercises/math/functions/trinoms/equation/index.js +2 -0
  36. package/lib/exercises/math/functions/trinoms/equation/secondDegreeEquationWithRightMember.d.ts +11 -0
  37. package/lib/exercises/math/functions/trinoms/equation/secondDegreeEquationWithRightMember.d.ts.map +1 -0
  38. package/lib/exercises/math/functions/trinoms/equation/secondDegreeEquationWithRightMember.js +205 -0
  39. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -1
  40. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.js +78 -13
  41. package/lib/exercises/math/functions/trinoms/equation/solveBisquaredEquation.d.ts +9 -0
  42. package/lib/exercises/math/functions/trinoms/equation/solveBisquaredEquation.d.ts.map +1 -0
  43. package/lib/exercises/math/functions/trinoms/equation/solveBisquaredEquation.js +223 -0
  44. package/lib/exercises/math/functions/trinoms/equation/trinomSelectEquationWithoutDeltaNeeded.d.ts.map +1 -1
  45. package/lib/exercises/math/functions/trinoms/equation/trinomSelectEquationWithoutDeltaNeeded.js +3 -1
  46. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts.map +1 -1
  47. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.js +1 -0
  48. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
  49. package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +27 -1
  50. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts +4 -1
  51. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts.map +1 -1
  52. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.js +133 -11
  53. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts +4 -1
  54. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map +1 -1
  55. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.js +135 -14
  56. package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.d.ts +9 -0
  57. package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.d.ts.map +1 -0
  58. package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.js +123 -0
  59. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts +1 -0
  60. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts.map +1 -1
  61. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.js +1 -0
  62. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPerpendicularLine.js +1 -1
  63. package/lib/exercises/math/index.d.ts +0 -1
  64. package/lib/exercises/math/index.d.ts.map +1 -1
  65. package/lib/exercises/math/index.js +1 -1
  66. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +2 -2
  67. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts +1 -1
  68. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  69. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +17 -11
  70. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts.map +1 -1
  71. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +25 -14
  72. package/lib/exercises/math/probaStat/randomVariable/randomVariableValues.d.ts +2 -0
  73. package/lib/exercises/math/probaStat/randomVariable/randomVariableValues.d.ts.map +1 -0
  74. package/lib/exercises/math/probaStat/randomVariable/randomVariableValues.js +83 -0
  75. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts +12 -0
  76. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -0
  77. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +30 -0
  78. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -1
  79. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +1 -1
  80. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
  81. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +35 -0
  82. package/lib/exercises/math/sequences/index.js +1 -0
  83. package/lib/exercises/math/sequences/limits/index.d.ts +2 -0
  84. package/lib/exercises/math/sequences/limits/index.d.ts.map +1 -0
  85. package/lib/exercises/math/sequences/limits/index.js +1 -0
  86. package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts +2 -0
  87. package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts.map +1 -0
  88. package/lib/exercises/math/sequences/limits/sequenceLimitReading.js +163 -0
  89. package/lib/exercises/math/trigonometry/circle/areReelsOnTheSameTrigoCirclePoint.js +2 -2
  90. package/lib/exercises/vea/numberVEA.d.ts +1 -1
  91. package/lib/exercises/vea/numberVEA.d.ts.map +1 -1
  92. package/lib/exercises/vea/numberVEA.js +7 -2
  93. package/lib/exercises/vea/signLineVEA.d.ts +8 -0
  94. package/lib/exercises/vea/signLineVEA.d.ts.map +1 -0
  95. package/lib/exercises/vea/signLineVEA.js +9 -0
  96. package/lib/exercises/vea/signTableVEA.d.ts +2 -0
  97. package/lib/exercises/vea/signTableVEA.d.ts.map +1 -0
  98. package/lib/exercises/vea/signTableVEA.js +5 -0
  99. package/lib/exercises/vea/varLineVEA.d.ts +8 -0
  100. package/lib/exercises/vea/varLineVEA.d.ts.map +1 -0
  101. package/lib/exercises/vea/varLineVEA.js +44 -0
  102. package/lib/exercises/vea/varSignTableVEA.d.ts +2 -0
  103. package/lib/exercises/vea/varSignTableVEA.d.ts.map +1 -0
  104. package/lib/exercises/vea/varSignTableVEA.js +8 -0
  105. package/lib/exercises/vea/varTableVEA.d.ts +2 -0
  106. package/lib/exercises/vea/varTableVEA.d.ts.map +1 -0
  107. package/lib/exercises/vea/varTableVEA.js +6 -0
  108. package/lib/exercises/vea/xTableLineVEA.d.ts +8 -0
  109. package/lib/exercises/vea/xTableLineVEA.d.ts.map +1 -0
  110. package/lib/exercises/vea/xTableLineVEA.js +18 -0
  111. package/lib/index.d.ts +32 -15
  112. package/lib/index.d.ts.map +1 -1
  113. package/lib/math/polynomials/polynomial.d.ts +1 -1
  114. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  115. package/lib/math/polynomials/polynomial.js +4 -2
  116. package/lib/tests/exoTest.d.ts.map +1 -1
  117. package/lib/tests/exoTest.js +6 -3
  118. package/lib/tests/pdfExo.test.js +2 -2
  119. package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -1
  120. package/lib/tests/pdfs/buildPDFForExercise.js +17 -1
  121. package/lib/tests/pdfs/dollarizeString.d.ts +2 -0
  122. package/lib/tests/pdfs/dollarizeString.d.ts.map +1 -0
  123. package/lib/tests/pdfs/dollarizeString.js +7 -0
  124. package/lib/tests/pdfs/signTableToLatex.js +1 -1
  125. package/lib/tests/pdfs/signVarTableToLatex.d.ts +2 -0
  126. package/lib/tests/pdfs/signVarTableToLatex.d.ts.map +1 -0
  127. package/lib/tests/pdfs/signVarTableToLatex.js +58 -0
  128. package/lib/tests/pdfs/varTableToLatex.d.ts.map +1 -1
  129. package/lib/tests/pdfs/varTableToLatex.js +2 -2
  130. package/lib/tests/questionTest.d.ts.map +1 -1
  131. package/lib/tests/questionTest.js +8 -4
  132. package/package.json +1 -1
@@ -0,0 +1,223 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
4
+ import { randint } from "../../../../../math/utils/random/randint.js";
5
+ import { round } from "../../../../../math/utils/round.js";
6
+ import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
7
+ import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
8
+ import { sqrt } from "../../../../../tree/nodes/functions/sqrtNode.js";
9
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
10
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
11
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
12
+ import { power, square } from "../../../../../tree/nodes/operators/powerNode.js";
13
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
14
+ import { DiscreteSetNode } from "../../../../../tree/nodes/sets/discreteSetNode.js";
15
+ import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
16
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
17
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
18
+ const getPropositions = (n, { answer }) => {
19
+ const propositions = [];
20
+ addValidProp(propositions, answer);
21
+ propWhile(propositions, n, () => {
22
+ const trinom = TrinomConstructor.randomNiceRoots(randint(1, 3));
23
+ tryToAddWrongProp(propositions, getAnswer({ a: trinom.a, b: trinom.b, c: trinom.c }));
24
+ });
25
+ return shuffleProps(propositions, n);
26
+ };
27
+ const getAnswer = (identifiers) => {
28
+ const { a, b, c } = identifiers;
29
+ const trinom = new Trinom(a, b, c);
30
+ const roots = trinom.getRootsNode();
31
+ const pos = roots.filter((r) => r.evaluate() >= 0);
32
+ const sqrtRoots = pos
33
+ .map((root) => root.evaluate() === 0
34
+ ? [(0).toTree()]
35
+ : [opposite(sqrt(root)).simplify(), sqrt(root).simplify()])
36
+ .flat();
37
+ if (!sqrtRoots.length)
38
+ return "S=\\varnothing";
39
+ return new EquationSolutionNode(new DiscreteSetNode(sqrtRoots))
40
+ .simplify()
41
+ .toTex();
42
+ };
43
+ const getEquation = (identifiers, withX = false) => {
44
+ const { a, b, c } = identifiers;
45
+ if (withX) {
46
+ return add(add(multiply(a, square("X")), multiply(b, "X")), c);
47
+ }
48
+ return add(add(multiply(a, power("x", 4)), multiply(b, square("x"))), c);
49
+ };
50
+ const getInstruction = (identifiers) => {
51
+ return `En posant $X = x^2$, résoudre :
52
+
53
+ $$
54
+ ${getEquation(identifiers).toTex()}=0
55
+ $$`;
56
+ };
57
+ const getHint = () => {
58
+ return `Réécris l'équation en posant $X = x^2$.
59
+
60
+ Cela te donnera une équation du second degré d'inconnue $X$.
61
+
62
+ Résous cette nouvelle équation, puis retrouve $x$ en résolvant l'équation $x^2 = X$.`;
63
+ };
64
+ const getCorrection = (identifiers) => {
65
+ const { a, b, c } = identifiers;
66
+ const delta = round(b ** 2 - 4 * a * c, 5);
67
+ const roots = new Trinom(a, b, c).getRootsNode();
68
+ const XOrdered = a < 0 ? [roots[1], roots[0]] : roots;
69
+ return `On réécris l'équation en posant $X = x^2$ :
70
+
71
+ ${alignTex([
72
+ ["", getEquation(identifiers).toTex() + "=0"],
73
+ ["\\iff", getEquation(identifiers, true).toTex() + "=0"],
74
+ ])}
75
+
76
+ On obtient alors une équation du second degré, qu'on résout avec le discriminant :
77
+
78
+ $$
79
+ \\Delta = b^2-4ac = ${delta.frenchify()}
80
+ $$
81
+
82
+ ${delta === 0
83
+ ? `Puisque $\\Delta = 0$, cette équation admet une solution $X_0$ :
84
+
85
+ ${alignTex([
86
+ ["X_0", "=", "\\frac{-b}{2a}"],
87
+ ["", "=", frac(opposite(b), multiply(2, a)).toTex()],
88
+ ["", "=", frac(opposite(b), multiply(2, a)).simplify().toTex()],
89
+ ])}`
90
+ : `Puisque $\\Delta > 0$, cette équation admet deux solutions :
91
+
92
+ ${alignTex([
93
+ ["X_1", "=", "\\frac{-b-\\sqrt{\\Delta}}{2a}"],
94
+ ["", "=", frac(substract(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
95
+ [
96
+ "",
97
+ "=",
98
+ frac(substract(opposite(b), sqrt(delta)), multiply(2, a))
99
+ .simplify()
100
+ .toTex(),
101
+ ],
102
+ ])}
103
+
104
+ ${alignTex([
105
+ ["X_2", "=", "\\frac{-b+\\sqrt{\\Delta}}{2a}"],
106
+ ["", "=", frac(add(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
107
+ [
108
+ "",
109
+ "=",
110
+ frac(add(opposite(b), sqrt(delta)), multiply(2, a))
111
+ .simplify()
112
+ .toTex(),
113
+ ],
114
+ ])}`}
115
+
116
+ Pour retrouver les solutions de l'équation initiale, on utilise le fait que $X = x^2$, donc $x = \\sqrt{X}$ ou $x = -\\sqrt{X}$ si $X$ est positif, et il n'y a pas de solution si $X$ est négatif.
117
+
118
+ ${delta === 0
119
+ ? roots[0].evaluate() < 0
120
+ ? `Or, puisque $X_0<0$, il n'y a pas de solution.`
121
+ : roots[0].evaluate() === 0
122
+ ? `Ici, puisque $X_0=0$, il n'y a qu'une solution : $x = 0$.`
123
+ : `Cela donne donc deux solutions :
124
+
125
+ $$
126
+ x_0 = \\sqrt{X_0} = ${sqrt(roots[0]).simplify().toTex()}
127
+ $$
128
+
129
+ $$
130
+ x_1 = -\\sqrt{X_0} = ${opposite(sqrt(roots[0])).simplify().toTex()}
131
+ $$`
132
+ : ""}
133
+
134
+ ${delta > 0
135
+ ? XOrdered[0].evaluate() < 0
136
+ ? `Puisque $X_1<0$, l'équation $x^2 = X_1$ n'a pas de solution.`
137
+ : XOrdered[0].evaluate() === 0
138
+ ? `Puisque $X_1 = 0$, l'équation $x^2 = X_1$ admet une solution : $x_1 = 0$.`
139
+ : `Puisque $X_1>0$, cela donne deux solutions :
140
+
141
+ $$
142
+ x_1 = \\sqrt{X_1} = ${sqrt(XOrdered[0]).simplify().toTex()}
143
+ $$
144
+
145
+ $$
146
+ x_1' = -\\sqrt{X_1} = ${opposite(sqrt(XOrdered[0])).simplify().toTex()}
147
+ $$
148
+ `
149
+ : ""}
150
+
151
+
152
+ ${delta > 0
153
+ ? XOrdered[1].evaluate() < 0
154
+ ? `Puisque $X_2<0$, l'équation $x^2 = X_2$ n'a pas de solution.`
155
+ : XOrdered[1].evaluate() === 0
156
+ ? `Puisque $X_2 = 0$, l'équation $x^2 = X_2$ admet une solution : $x_2 = 0$.`
157
+ : `Puisque $X_2>0$, cela donne deux solutions :
158
+
159
+ $$
160
+ x_2 = \\sqrt{X_2} = ${sqrt(XOrdered[1]).simplify().toTex()}
161
+ $$
162
+
163
+ $$
164
+ x_2' = -\\sqrt{X_2} = ${opposite(sqrt(XOrdered[1])).simplify().toTex()}
165
+ $$
166
+ `
167
+ : ""}
168
+
169
+ L'ensemble des solutions est donc :
170
+
171
+ $$
172
+ ${getAnswer(identifiers)}
173
+ $$
174
+ `;
175
+ };
176
+ const getKeys = () => {
177
+ return ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"];
178
+ };
179
+ const isAnswerValid = (ans, { answer }) => {
180
+ try {
181
+ const parsed = discreteSetParser(ans);
182
+ if (!parsed)
183
+ return false;
184
+ return ("S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer);
185
+ }
186
+ catch (err) {
187
+ return handleVEAError(err);
188
+ }
189
+ };
190
+ const getSolveBisquaredEquationQuestion = () => {
191
+ const trinom = TrinomConstructor.randomNiceRoots(randint(1, 3));
192
+ const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
193
+ return getQuestionFromIdentifiers(identifiers);
194
+ };
195
+ const getQuestionFromIdentifiers = (identifiers) => {
196
+ return {
197
+ answer: getAnswer(identifiers),
198
+ instruction: getInstruction(identifiers),
199
+ keys: getKeys(identifiers),
200
+ answerFormat: "tex",
201
+ identifiers,
202
+ hint: getHint(identifiers),
203
+ correction: getCorrection(identifiers),
204
+ };
205
+ };
206
+ export const solveBisquaredEquation = {
207
+ id: "solveBisquaredEquation",
208
+ connector: "\\iff",
209
+ label: "Résoudre une équation bicarrée du type $ax^4+bx^2+c = 0$",
210
+ isSingleStep: true,
211
+ generator: (nb, opts) => getDistinctQuestions(() => getSolveBisquaredEquationQuestion(opts), nb),
212
+ qcmTimer: 60,
213
+ freeTimer: 60,
214
+ getPropositions,
215
+ isAnswerValid,
216
+ subject: "Mathématiques",
217
+ getInstruction,
218
+ getHint,
219
+ getCorrection,
220
+ getAnswer,
221
+ getQuestionFromIdentifiers,
222
+ hasHintAndCorrection: true,
223
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"trinomSelectEquationWithoutDeltaNeeded.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/trinomSelectEquationWithoutDeltaNeeded.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;CAChC,CAAC;AACF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AA6MF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,WAAW,CAqBxE,CAAC"}
1
+ {"version":3,"file":"trinomSelectEquationWithoutDeltaNeeded.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/trinomSelectEquationWithoutDeltaNeeded.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;CAChC,CAAC;AACF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AA+MF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,WAAW,CAqBxE,CAAC"}
@@ -139,7 +139,9 @@ const getTrinomSelectEquationWithoutDeltaNeededQuestion = () => {
139
139
  };
140
140
  }
141
141
  else {
142
- const trinom = TrinomConstructor.randomCanonical();
142
+ const trinom = TrinomConstructor.randomCanonical(undefined, {
143
+ excludes: [0],
144
+ });
143
145
  return {
144
146
  a: trinom.a,
145
147
  b: trinom.b,
@@ -1 +1 @@
1
- {"version":3,"file":"niceRootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA0JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
1
+ {"version":3,"file":"niceRootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
@@ -111,6 +111,7 @@ ${alignTex([
111
111
  .toTex(),
112
112
  ],
113
113
  ])}
114
+
114
115
  L'ensemble des solutions est donc :
115
116
 
116
117
  $$
@@ -1 +1 @@
1
- {"version":3,"file":"rootsReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgHF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAUF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAcvD,CAAC"}
1
+ {"version":3,"file":"rootsReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkJF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAUF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAevD,CAAC"}
@@ -9,7 +9,7 @@ import { divide } from "../../../../../tree/nodes/operators/divideNode.js";
9
9
  import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
10
10
  import { probaLawFlip } from "../../../../../utils/alea/probaLawFlip.js";
11
11
  const getInstruction = () => {
12
- return `Déterminer graphiquement le ou les racine(s) du polynôme du second degré représenté ci-dessous.
12
+ return `Déterminer graphiquement la ou les racine(s) du polynôme du second degré représenté ci-dessous.
13
13
 
14
14
  S'il n'y en a pas, on écrira "Aucun".`;
15
15
  };
@@ -59,6 +59,29 @@ const getRootsReadingQuestion = (opts) => {
59
59
  const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
60
60
  return getQuestionFromIdentifiers(identifiers);
61
61
  };
62
+ const getHint = () => {
63
+ return `Les racines d'un polynôme du second degré $f$ sont les valeurs de $x$ telles que $f(x) = 0$.
64
+
65
+ Graphiquement, ce sont donc les abscisse à l'intersection de la parabole et de l'axe des abscisses.`;
66
+ };
67
+ const getCorrection = (identifiers) => {
68
+ const answer = getAnswer(identifiers);
69
+ const nbRoots = answer === "\\text{Aucun}" ? 0 : answer.includes("et") ? 2 : 1;
70
+ const roots = getAnswer(identifiers).split("\\text{ et }");
71
+ return `Les racines d'un polynôme du second degré $f$ sont les valeurs de $x$ telles que $f(x) = 0$.
72
+
73
+ Graphiquement, ce sont donc les abscisse à l'intersection de la parabole et de l'axe des abscisses.
74
+
75
+ ${nbRoots === 0
76
+ ? `Ici, la parabole ne coupe pas l'axe des abscisses. Ce polynôme n'a donc pas de racine.`
77
+ : ""}
78
+ ${answer.includes("et")
79
+ ? `Ici, la parabole coupe l'axe des abscisses deux fois : aux abscisses $${roots[0]}$ et $${roots[1]}$. Ce sont donc les deux racines du polynôme.`
80
+ : ""}
81
+ ${nbRoots === 1
82
+ ? `Ici, la parabole coupe l'axe des abscisses une seule fois, en son sommet : c'est à l'abscisse $${getAnswer(identifiers)}$. C'est donc la seule racine du polynôme.`
83
+ : ""}`;
84
+ };
62
85
  const getQuestionFromIdentifiers = (identifiers) => {
63
86
  const question = {
64
87
  answer: getAnswer(identifiers),
@@ -67,6 +90,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
67
90
  answerFormat: "tex",
68
91
  ggbOptions: getGGBOptions(identifiers),
69
92
  identifiers,
93
+ hint: getHint(identifiers),
94
+ correction: getCorrection(identifiers),
70
95
  };
71
96
  return question;
72
97
  };
@@ -121,4 +146,5 @@ export const rootsReading = {
121
146
  subject: "Mathématiques",
122
147
  getQuestionFromIdentifiers,
123
148
  options,
149
+ hasHintAndCorrection: true,
124
150
  };
@@ -3,6 +3,9 @@ type Identifiers = {
3
3
  param: string;
4
4
  coeffs: number[];
5
5
  };
6
- export declare const alphaBetaFromDevForm: Exercise<Identifiers>;
6
+ type Options = {
7
+ correctionType: "Mise sous forme canonique" | "Formule $\\alpha=\\frac{-b}{2a}$";
8
+ };
9
+ export declare const alphaBetaFromDevForm: Exercise<Identifiers, Options>;
7
10
  export {};
8
11
  //# sourceMappingURL=alphaBetaFromDevForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"alphaBetaFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA8DF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
1
+ {"version":3,"file":"alphaBetaFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAuNF,KAAK,OAAO,GAAG;IACb,cAAc,EACV,2BAA2B,GAC3B,kCAAkC,CAAC;CACxC,CAAC;AAYF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB/D,CAAC"}
@@ -1,13 +1,20 @@
1
- import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
- import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
3
+ import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
4
4
  import { randint } from "../../../../../math/utils/random/randint.js";
5
+ import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
6
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
7
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
8
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { square } from "../../../../../tree/nodes/operators/powerNode.js";
10
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
5
11
  import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
6
12
  import { shuffle } from "../../../../../utils/alea/shuffle.js";
13
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
7
14
  const getInstruction = (identifiers) => {
8
15
  const { param, coeffs } = identifiers;
9
16
  const trinom = TrinomConstructor.fromCoeffs(coeffs);
10
- return `Soit $f$ la fonction polynôme du second degré définie par
17
+ return `Soit $f$ la fonction polynôme du second degré définie par :
11
18
 
12
19
  $$
13
20
  f(x) = ${trinom.toTree().toTex()}
@@ -27,22 +34,125 @@ const getStartStatement = (identifiers) => {
27
34
  const { param } = identifiers;
28
35
  return param;
29
36
  };
30
- const getQuestionFromIdentifiers = (identifiers) => {
31
- const question = {
37
+ const getHint = (identifiers, opts) => {
38
+ const { coeffs, param } = identifiers;
39
+ const [c, b, a] = coeffs;
40
+ const trinom = new Trinom(a, b, c);
41
+ let hint = `La forme canonique d'un polynôme du second degré $f$ est la forme :
42
+
43
+ $$
44
+ f(x) = a(x-\\alpha)^2 + \\beta
45
+ $$
46
+
47
+ où $\\alpha$ est l'abscisse du sommet de la parabole, et $\\beta$ son ordonnée.
48
+
49
+ `;
50
+ if (opts?.correctionType === "Mise sous forme canonique") {
51
+ hint += `Pour obtenir cette forme afin de déterminer $${param}$, il faut compléter l'égalité suivante :
52
+
53
+ $$
54
+ ${trinom.toTree().toTex()} = ${add(multiply(a, square(substract("x", "\\ldots"))), "\\ldots").toTex()}
55
+ $$`;
56
+ }
57
+ else {
58
+ hint += `On sait d'après le cours que $\\alpha$ se calcule par la formule :
59
+
60
+ $$
61
+ \\alpha = \\frac{-b}{2a}
62
+ $$
63
+
64
+ On peut ensuite calculer $\\beta = f(\\alpha)$.`;
65
+ }
66
+ return hint;
67
+ };
68
+ const getCorrection = (identifiers, opts) => {
69
+ const { coeffs, param } = identifiers;
70
+ const [c, b, a] = coeffs;
71
+ const trinom = new Trinom(a, b, c);
72
+ const alpha = trinom.getAlphaNode();
73
+ const beta = trinom.getBetaNode();
74
+ let corr = `La forme canonique d'un polynôme du second degré $f$ est la forme :
75
+
76
+ $$
77
+ f(x) = a(x-\\alpha)^2 + \\beta
78
+ $$
79
+
80
+ où $\\alpha$ est l'abscisse du sommet de la parabole, et $\\beta$ son ordonnée.
81
+
82
+ `;
83
+ if (opts?.correctionType === "Mise sous forme canonique") {
84
+ const isAdd = frac(b, a).evaluate() > 0;
85
+ corr += `Pour l'obtenir, on fait apparaître une identité remarquable :
86
+
87
+ ${alignTex([
88
+ ["", trinom.toTree().toTex()],
89
+ // a(x^2 + b/ax)+c
90
+ [
91
+ "=",
92
+ add(multiply(a, add(square("x"), multiply(frac(b, a).simplify(), "x"))), c).toTex(),
93
+ ],
94
+ // a(x^2 + 2*b/2a*x)+c
95
+ [
96
+ "=",
97
+ add(multiply(a, (isAdd ? add : substract)(square("x"), multiply(multiply(2, frac(b, multiply(isAdd ? 2 : -2, a)).simplify()), "x"))), c).toTex(),
98
+ ],
99
+ // a(x^2 + 2*b/2a*x + (b/2a)^2)+c - a*(b/2a)^2
100
+ [
101
+ "=",
102
+ add(multiply(a, add((isAdd ? add : substract)(square("x"), multiply(multiply(2, frac(b, multiply(isAdd ? 2 : -2, a)).simplify()), "x")), square(frac(b, multiply(isAdd ? 2 : -2, a)).simplify()))), substract(c, multiply(a, square(frac(b, multiply(isAdd ? 2 : -2, a)).simplify())))).toTex(),
103
+ ],
104
+ // a(x-(b/2a))^2 + c - a*(b/2a)^2
105
+ [
106
+ "=",
107
+ add(multiply(a, square(add("x", frac(b, multiply(2, a))).simplify())), substract(c, multiply(a, square(frac(b, multiply(2, a))))).simplify()).toTex(),
108
+ ],
109
+ ])}
110
+
111
+ On a donc $${param}=${getAnswer(identifiers)}$.`;
112
+ }
113
+ else {
114
+ corr += `On sait que :
115
+
116
+ $$
117
+ \\alpha = \\frac{-b}{2a}
118
+ $$
119
+
120
+ donc
121
+
122
+ $$
123
+ \\alpha = ${frac(opposite(b), multiply(2, a)).toSimplificationTex()}
124
+ $$
125
+
126
+ ${param === "\\beta"
127
+ ? `
128
+ On retrouve alors $\\beta = f(\\alpha)$ :
129
+
130
+ ${alignTex([
131
+ ["\\beta", "=", `f(${alpha.toTex()})`],
132
+ ["", "=", trinom.toTree().toDetailedEvaluation({ x: alpha }).toTex()],
133
+ ["", "=", beta.toTex()],
134
+ ])}`
135
+ : ""}`;
136
+ }
137
+ return corr;
138
+ };
139
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
140
+ return {
32
141
  answer: getAnswer(identifiers),
33
- keys: ["x", "alpha", "beta"],
142
+ keys: [],
34
143
  instruction: getInstruction(identifiers),
35
144
  answerFormat: "tex",
36
145
  startStatement: getStartStatement(identifiers),
37
146
  identifiers,
147
+ hint: getHint(identifiers, opts),
148
+ correction: getCorrection(identifiers, opts),
38
149
  };
39
- return question;
40
150
  };
41
- const getAlphaBetaFromDevFormQuestion = () => {
151
+ const getAlphaBetaFromDevFormQuestion = (opts) => {
42
152
  const trinom = TrinomConstructor.randomCanonical();
43
153
  const param = coinFlip() ? "\\alpha" : "\\beta";
44
154
  const identifiers = { coeffs: trinom.coefficients, param };
45
- return getQuestionFromIdentifiers(identifiers);
155
+ return getQuestionFromIdentifiers(identifiers, opts);
46
156
  };
47
157
  const getPropositions = (n, { answer }) => {
48
158
  const propositions = [];
@@ -55,16 +165,28 @@ const getPropositions = (n, { answer }) => {
55
165
  const isAnswerValid = (ans, { answer }) => {
56
166
  return ans === answer;
57
167
  };
168
+ const options = [
169
+ {
170
+ id: "correctionType",
171
+ label: "Méthode pour la correction",
172
+ target: GeneratorOptionTarget.correction,
173
+ type: GeneratorOptionType.select,
174
+ values: ["Mise sous forme canonique", "Formule $\\alpha=\\frac{-b}{2a}$"],
175
+ defaultValue: "Formule $\\alpha=\\frac{-b}{2a}$",
176
+ },
177
+ ];
58
178
  export const alphaBetaFromDevForm = {
59
179
  id: "alphaBetaFromDevForm",
60
180
  connector: "=",
61
- label: "Déterminer $\\alpha$ ou $\\beta$ à partir de la forme développée",
181
+ label: "Déterminer $\\alpha$ ou $\\beta$ à partir de la forme développée d'un polynôme du second degré",
62
182
  isSingleStep: false,
63
- generator: (nb) => getDistinctQuestions(getAlphaBetaFromDevFormQuestion, nb),
183
+ generator: (nb, opts) => getDistinctQuestions(() => getAlphaBetaFromDevFormQuestion(opts), nb),
64
184
  qcmTimer: 60,
65
185
  freeTimer: 60,
66
186
  getPropositions,
67
187
  isAnswerValid,
68
188
  subject: "Mathématiques",
69
189
  getQuestionFromIdentifiers,
190
+ hasHintAndCorrection: true,
191
+ options,
70
192
  };
@@ -4,6 +4,9 @@ type Identifiers = {
4
4
  b: number;
5
5
  c: number;
6
6
  };
7
- export declare const canonicalFromDevForm: Exercise<Identifiers>;
7
+ type Options = {
8
+ correctionType: "Mise sous forme canonique" | "Formule $\\alpha=\\frac{-b}{2a}$";
9
+ };
10
+ export declare const canonicalFromDevForm: Exercise<Identifiers, Options>;
8
11
  export {};
9
12
  //# sourceMappingURL=canonicalFromDevForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"canonicalFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8DF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
1
+ {"version":3,"file":"canonicalFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqNF,KAAK,OAAO,GAAG;IACb,cAAc,EACV,2BAA2B,GAC3B,kCAAkC,CAAC;CACxC,CAAC;AAWF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB/D,CAAC"}