math-exercises 3.0.167 → 3.0.169

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 (133) hide show
  1. package/lib/exercises/math/derivation/variations/index.d.ts +1 -0
  2. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
  3. package/lib/exercises/math/derivation/variations/index.js +2 -0
  4. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts +2 -0
  5. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts.map +1 -0
  6. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.js +203 -0
  7. package/lib/exercises/math/derivation/variations/signVarTableTrinom.d.ts +9 -0
  8. package/lib/exercises/math/derivation/variations/signVarTableTrinom.d.ts.map +1 -0
  9. package/lib/exercises/math/derivation/variations/signVarTableTrinom.js +148 -0
  10. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
  11. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +1 -4
  12. package/lib/exercises/math/functions/index.d.ts +1 -0
  13. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  14. package/lib/exercises/math/functions/index.js +1 -0
  15. package/lib/exercises/math/functions/inverse/compareInverseValues.d.ts.map +1 -1
  16. package/lib/exercises/math/functions/inverse/compareInverseValues.js +1 -10
  17. package/lib/exercises/math/functions/periodicity/index.d.ts +2 -0
  18. package/lib/exercises/math/functions/periodicity/index.d.ts.map +1 -0
  19. package/lib/exercises/math/functions/periodicity/index.js +1 -0
  20. package/lib/exercises/math/functions/trinoms/equation/index.d.ts +2 -0
  21. package/lib/exercises/math/functions/trinoms/equation/index.d.ts.map +1 -1
  22. package/lib/exercises/math/functions/trinoms/equation/index.js +2 -0
  23. package/lib/exercises/math/functions/trinoms/equation/secondDegreeEquationWithRightMember.d.ts +11 -0
  24. package/lib/exercises/math/functions/trinoms/equation/secondDegreeEquationWithRightMember.d.ts.map +1 -0
  25. package/lib/exercises/math/functions/trinoms/equation/secondDegreeEquationWithRightMember.js +205 -0
  26. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -1
  27. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.js +78 -13
  28. package/lib/exercises/math/functions/trinoms/equation/solveBisquaredEquation.d.ts +9 -0
  29. package/lib/exercises/math/functions/trinoms/equation/solveBisquaredEquation.d.ts.map +1 -0
  30. package/lib/exercises/math/functions/trinoms/equation/solveBisquaredEquation.js +223 -0
  31. package/lib/exercises/math/functions/trinoms/equation/trinomSelectEquationWithoutDeltaNeeded.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/trinoms/equation/trinomSelectEquationWithoutDeltaNeeded.js +3 -1
  33. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.js +1 -0
  35. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
  36. package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +27 -1
  37. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts +4 -1
  38. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts.map +1 -1
  39. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.js +133 -11
  40. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts +4 -1
  41. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.js +135 -14
  43. package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.d.ts +9 -0
  44. package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.d.ts.map +1 -0
  45. package/lib/exercises/math/functions/trinoms/summitAndCanonical/findTrinomCanonicalFormFromGraph.js +123 -0
  46. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts +1 -0
  47. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts.map +1 -1
  48. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.js +1 -0
  49. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPerpendicularLine.js +1 -1
  50. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +2 -2
  51. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts +1 -1
  52. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  53. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +17 -11
  54. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts.map +1 -1
  55. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +25 -14
  56. package/lib/exercises/math/probaStat/randomVariable/randomVariableValues.d.ts +2 -0
  57. package/lib/exercises/math/probaStat/randomVariable/randomVariableValues.d.ts.map +1 -0
  58. package/lib/exercises/math/probaStat/randomVariable/randomVariableValues.js +83 -0
  59. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts +12 -0
  60. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -0
  61. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +30 -0
  62. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -1
  63. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +1 -1
  64. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts +4 -1
  65. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts.map +1 -1
  66. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.js +45 -20
  67. package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.d.ts +4 -1
  68. package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.d.ts.map +1 -1
  69. package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.js +43 -9
  70. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
  71. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +35 -0
  72. package/lib/exercises/math/sequences/index.d.ts +1 -0
  73. package/lib/exercises/math/sequences/index.d.ts.map +1 -1
  74. package/lib/exercises/math/sequences/index.js +2 -0
  75. package/lib/exercises/math/sequences/limits/index.d.ts +2 -0
  76. package/lib/exercises/math/sequences/limits/index.d.ts.map +1 -0
  77. package/lib/exercises/math/sequences/limits/index.js +1 -0
  78. package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts +2 -0
  79. package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts.map +1 -0
  80. package/lib/exercises/math/sequences/limits/sequenceLimitReading.js +163 -0
  81. package/lib/exercises/math/sequences/variations/expressConsecutiveTermsDifference.d.ts +11 -0
  82. package/lib/exercises/math/sequences/variations/expressConsecutiveTermsDifference.d.ts.map +1 -0
  83. package/lib/exercises/math/sequences/variations/expressConsecutiveTermsDifference.js +160 -0
  84. package/lib/exercises/math/sequences/variations/index.d.ts +2 -0
  85. package/lib/exercises/math/sequences/variations/index.d.ts.map +1 -0
  86. package/lib/exercises/math/sequences/variations/index.js +1 -0
  87. package/lib/exercises/math/trigonometry/circle/areReelsOnTheSameTrigoCirclePoint.js +2 -2
  88. package/lib/exercises/math/trigonometry/circle/findAngleFromCosAndSin.d.ts.map +1 -1
  89. package/lib/exercises/math/trigonometry/circle/findAngleFromCosAndSin.js +0 -1
  90. package/lib/exercises/math/trigonometry/circle/findAssociateAnglePointOnTrigoCircle.d.ts +8 -0
  91. package/lib/exercises/math/trigonometry/circle/findAssociateAnglePointOnTrigoCircle.d.ts.map +1 -0
  92. package/lib/exercises/math/trigonometry/circle/findAssociateAnglePointOnTrigoCircle.js +158 -0
  93. package/lib/exercises/math/trigonometry/circle/index.d.ts +2 -0
  94. package/lib/exercises/math/trigonometry/circle/index.d.ts.map +1 -1
  95. package/lib/exercises/math/trigonometry/circle/index.js +2 -0
  96. package/lib/exercises/math/trigonometry/circle/mainAngleMeasure.d.ts.map +1 -1
  97. package/lib/exercises/math/trigonometry/circle/mainAngleMeasure.js +8 -3
  98. package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.d.ts +8 -0
  99. package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.d.ts.map +1 -0
  100. package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.js +167 -0
  101. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +2 -0
  102. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
  103. package/lib/exercises/utils/geogebra/toolBarConstructor.js +4 -0
  104. package/lib/exercises/vea/numberVEA.d.ts +1 -1
  105. package/lib/exercises/vea/numberVEA.d.ts.map +1 -1
  106. package/lib/exercises/vea/numberVEA.js +7 -2
  107. package/lib/exercises/vea/signLineVEA.d.ts +8 -0
  108. package/lib/exercises/vea/signLineVEA.d.ts.map +1 -0
  109. package/lib/exercises/vea/signLineVEA.js +9 -0
  110. package/lib/exercises/vea/signTableVEA.d.ts +2 -0
  111. package/lib/exercises/vea/signTableVEA.d.ts.map +1 -0
  112. package/lib/exercises/vea/signTableVEA.js +5 -0
  113. package/lib/exercises/vea/varLineVEA.d.ts +8 -0
  114. package/lib/exercises/vea/varLineVEA.d.ts.map +1 -0
  115. package/lib/exercises/vea/varLineVEA.js +44 -0
  116. package/lib/exercises/vea/varSignTableVEA.d.ts +2 -0
  117. package/lib/exercises/vea/varSignTableVEA.d.ts.map +1 -0
  118. package/lib/exercises/vea/varSignTableVEA.js +8 -0
  119. package/lib/exercises/vea/varTableVEA.d.ts +2 -0
  120. package/lib/exercises/vea/varTableVEA.d.ts.map +1 -0
  121. package/lib/exercises/vea/varTableVEA.js +6 -0
  122. package/lib/exercises/vea/xTableLineVEA.d.ts +8 -0
  123. package/lib/exercises/vea/xTableLineVEA.d.ts.map +1 -0
  124. package/lib/exercises/vea/xTableLineVEA.js +18 -0
  125. package/lib/index.d.ts +40 -5
  126. package/lib/index.d.ts.map +1 -1
  127. package/lib/math/polynomials/polynomial.d.ts +1 -1
  128. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  129. package/lib/math/polynomials/polynomial.js +4 -2
  130. package/lib/math/polynomials/trinom.d.ts +1 -1
  131. package/lib/math/polynomials/trinom.d.ts.map +1 -1
  132. package/lib/math/polynomials/trinom.js +2 -2
  133. package/package.json +1 -1
@@ -0,0 +1,205 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { AffineConstructor } from "../../../../../math/polynomials/affine.js";
4
+ import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
5
+ import { randint } from "../../../../../math/utils/random/randint.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 { 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 { random } from "../../../../../utils/alea/random.js";
17
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
18
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
19
+ const getPropositions = (n, { answer }) => {
20
+ const propositions = [];
21
+ addValidProp(propositions, answer);
22
+ propWhile(propositions, n, () => {
23
+ const trinom = TrinomConstructor.randomNiceRoots();
24
+ const roots = trinom.getRootsNode();
25
+ tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode(roots)).toTex());
26
+ });
27
+ return shuffleProps(propositions, n);
28
+ };
29
+ const getAnswer = (identifiers) => {
30
+ const { fCoeffs, gCoeffs } = identifiers;
31
+ const trinom = new Trinom(fCoeffs[2] - (gCoeffs[2] ?? 0), fCoeffs[1] - gCoeffs[1], fCoeffs[0] - gCoeffs[0]);
32
+ const roots = trinom.getRootsNode();
33
+ const answer = new EquationSolutionNode(new DiscreteSetNode(roots)).toTex();
34
+ return answer;
35
+ };
36
+ const getInstruction = (identifiers) => {
37
+ const { fCoeffs, gCoeffs } = identifiers;
38
+ const f = TrinomConstructor.fromCoeffs(fCoeffs);
39
+ const g = gCoeffs.length === 2
40
+ ? AffineConstructor.fromCoeffs(gCoeffs)
41
+ : TrinomConstructor.fromCoeffs(gCoeffs);
42
+ return `Résoudre l'équation :
43
+
44
+ $$
45
+ ${f.toTree().toTex()} = ${g.toTree().toTex()}
46
+ $$`;
47
+ };
48
+ const getHint = () => {
49
+ return `Ramène toi à une équation du type $ax^2 + bx + c = 0$, puis résous cette équation en utilisant le discriminant.`;
50
+ };
51
+ const getCorrection = (identifiers) => {
52
+ const { fCoeffs, gCoeffs } = identifiers;
53
+ const f = TrinomConstructor.fromCoeffs(fCoeffs);
54
+ const g = gCoeffs.length === 2
55
+ ? AffineConstructor.fromCoeffs(gCoeffs)
56
+ : TrinomConstructor.fromCoeffs(gCoeffs);
57
+ const trinom = new Trinom(fCoeffs[2] - (gCoeffs[2] ?? 0), fCoeffs[1] - gCoeffs[1], fCoeffs[0] - gCoeffs[0]);
58
+ const { a, b, c } = trinom;
59
+ const delta = substract(square(b), multiply(4, multiply(a, c))).simplify();
60
+ return `On commence par passer tous les termes dans le membre de gauche :
61
+
62
+ ${alignTex([
63
+ [f.toTree().toTex(), "=", g.toTree().toTex()],
64
+ [trinom.toTree().toTex(), "=", "0"],
65
+ ])}
66
+
67
+ On résout alors cette équation. On calcule le discriminant :
68
+
69
+
70
+ ${alignTex([
71
+ ["\\Delta", "=", "b^2 - 4ac"],
72
+ ["", "=", substract(square(b), multiply(4, multiply(a, c))).toTex()],
73
+ ["", "=", delta.toTex()],
74
+ ])}
75
+
76
+ ${delta.evaluate() === 0
77
+ ? `Puisque $\\Delta = 0$, cette équation admet une solution $x_0$ :
78
+
79
+ ${alignTex([
80
+ ["x_0", "=", "\\frac{-b}{2a}"],
81
+ ["", "=", frac(opposite(b), multiply(2, a)).toTex()],
82
+ ["", "=", frac(opposite(b), multiply(2, a)).simplify().toTex()],
83
+ ])}`
84
+ : `Puisque $\\Delta > 0$, l'équation $f(x)=0$ admet deux solutions :
85
+
86
+ ${alignTex([
87
+ ["x_1", "=", "\\frac{-b-\\sqrt{\\Delta}}{2a}"],
88
+ ["", "=", frac(substract(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
89
+ [
90
+ "",
91
+ "=",
92
+ frac(substract(opposite(b), sqrt(delta)), multiply(2, a))
93
+ .simplify()
94
+ .toTex(),
95
+ ],
96
+ ])}
97
+
98
+ ${alignTex([
99
+ ["x_2", "=", "\\frac{-b+\\sqrt{\\Delta}}{2a}"],
100
+ ["", "=", frac(add(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
101
+ [
102
+ "",
103
+ "=",
104
+ frac(add(opposite(b), sqrt(delta)), multiply(2, a))
105
+ .simplify()
106
+ .toTex(),
107
+ ],
108
+ ])}`}
109
+
110
+ L'ensemble des solutions est donc :
111
+
112
+ $$
113
+ ${getAnswer(identifiers)}
114
+ $$
115
+ `;
116
+ };
117
+ const getKeys = () => {
118
+ return ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"];
119
+ };
120
+ const isAnswerValid = (ans, { answer }) => {
121
+ try {
122
+ const parsed = discreteSetParser(ans);
123
+ if (!parsed)
124
+ return false;
125
+ return ("S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer);
126
+ }
127
+ catch (err) {
128
+ return handleVEAError(err);
129
+ }
130
+ };
131
+ const getSecondDegreeEquationWithRightMemberQuestion = (opts) => {
132
+ const trinom = TrinomConstructor.randomNiceRoots(randint(1, 3));
133
+ const gType = opts?.gType === "Affine"
134
+ ? "Affine"
135
+ : opts?.gType === "Trinôme"
136
+ ? "Trinôme"
137
+ : random(["Affine", "Trinôme"]);
138
+ let fCoeffs;
139
+ let gCoeffs;
140
+ if (gType === "Affine") {
141
+ fCoeffs = [
142
+ trinom.c + randint(-9, 10, [0]),
143
+ trinom.b + randint(-9, 10, [0]),
144
+ trinom.a,
145
+ ];
146
+ gCoeffs = [fCoeffs[0] - trinom.c, fCoeffs[1] - trinom.b];
147
+ }
148
+ else {
149
+ fCoeffs = [
150
+ trinom.c + randint(-9, 10, [0]),
151
+ trinom.b + randint(-9, 10, [0]),
152
+ trinom.a + randint(-9, 10, [0, -trinom.a]),
153
+ ];
154
+ gCoeffs = [
155
+ fCoeffs[0] - trinom.c,
156
+ fCoeffs[1] - trinom.b,
157
+ fCoeffs[2] - trinom.a,
158
+ ];
159
+ }
160
+ const identifiers = {
161
+ fCoeffs,
162
+ gCoeffs,
163
+ };
164
+ return getQuestionFromIdentifiers(identifiers);
165
+ };
166
+ const getQuestionFromIdentifiers = (identifiers) => {
167
+ return {
168
+ answer: getAnswer(identifiers),
169
+ instruction: getInstruction(identifiers),
170
+ keys: getKeys(identifiers),
171
+ answerFormat: "tex",
172
+ identifiers,
173
+ hint: getHint(identifiers),
174
+ correction: getCorrection(identifiers),
175
+ };
176
+ };
177
+ const options = [
178
+ {
179
+ id: "gType",
180
+ label: "Type de la fonction $g$",
181
+ target: GeneratorOptionTarget.generation,
182
+ type: GeneratorOptionType.select,
183
+ values: ["Affine", "Trinôme", "L'un ou l'autre"],
184
+ defaultValue: "L'un ou l'autre",
185
+ },
186
+ ];
187
+ export const secondDegreeEquationWithRightMember = {
188
+ id: "secondDegreeEquationWithRightMember",
189
+ connector: "\\iff",
190
+ label: "Résoudre une équation du second degré du type $f(x)=g(x)$",
191
+ isSingleStep: true,
192
+ generator: (nb, opts) => getDistinctQuestions(() => getSecondDegreeEquationWithRightMemberQuestion(opts), nb),
193
+ qcmTimer: 60,
194
+ freeTimer: 60,
195
+ getPropositions,
196
+ isAnswerValid,
197
+ subject: "Mathématiques",
198
+ getInstruction,
199
+ getHint,
200
+ getCorrection,
201
+ getAnswer,
202
+ getQuestionFromIdentifiers,
203
+ hasHintAndCorrection: true,
204
+ options,
205
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAe9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AA4IF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
1
+ {"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAsB9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAiNF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
@@ -3,14 +3,21 @@ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinct
3
3
  import { InequationSymbol, InequationSymbolConstructor, } from "../../../../../math/inequations/inequation.js";
4
4
  import { Trinom } from "../../../../../math/polynomials/trinom.js";
5
5
  import { randint } from "../../../../../math/utils/random/randint.js";
6
+ import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
7
+ import { sqrt } from "../../../../../tree/nodes/functions/sqrtNode.js";
6
8
  import { InequationSolutionNode } from "../../../../../tree/nodes/inequations/inequationSolutionNode.js";
7
9
  import { MinusInfinityNode, PlusInfinityNode, } from "../../../../../tree/nodes/numbers/infiniteNode.js";
10
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
11
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
12
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
8
14
  import { Closure, ClosureType } from "../../../../../tree/nodes/sets/closure.js";
9
15
  import { IntervalNode } from "../../../../../tree/nodes/sets/intervalNode.js";
10
16
  import { UnionIntervalNode } from "../../../../../tree/nodes/sets/unionIntervalNode.js";
11
17
  import { unionIntervalParser } from "../../../../../tree/parsers/unionIntervalParser.js";
12
18
  import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
13
19
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
20
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
14
21
  const getInstruction = (identifiers) => {
15
22
  const { a, b, c, ineqType } = identifiers;
16
23
  const ineq = new InequationSymbol(ineqType);
@@ -27,22 +34,82 @@ const getAnswer = (identifiers) => {
27
34
  const answer = getAnswerNode(identifiers).toTex();
28
35
  return answer;
29
36
  };
37
+ const getKeys = () => {
38
+ return [
39
+ "S",
40
+ "equal",
41
+ "lbracket",
42
+ "semicolon",
43
+ "rbracket",
44
+ "cup",
45
+ "infty",
46
+ "varnothing",
47
+ ];
48
+ };
49
+ const getHint = () => {
50
+ return `Une fonction polynôme du second degré est du signe de son coefficient $a$, sauf entre ses éventuelles racines.
51
+
52
+ Commence donc par déterminer les racines de $f$.`;
53
+ };
54
+ const getCorrection = (identifiers) => {
55
+ const { a, b, c, ineqType } = identifiers;
56
+ const trinom = new Trinom(a, b, c);
57
+ const delta = trinom.getDeltaNode();
58
+ const roots = trinom.getRootsNode();
59
+ const ineq = new InequationSymbol(ineqType);
60
+ return `On commence par déterminer les racines de $f$.
61
+
62
+ On calcule le discriminant :
63
+
64
+ $$
65
+ \\Delta = b^2-4ac = ${delta.toTex()}
66
+ $$
67
+
68
+ Puisque $\\Delta>0$, $f$ admet deux racines :
69
+
70
+ ${alignTex([
71
+ ["x_1", "=", "\\frac{-b-\\sqrt{\\Delta}}{2a}"],
72
+ ["", "=", frac(substract(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
73
+ [
74
+ "",
75
+ "=",
76
+ frac(substract(opposite(b), sqrt(delta)), multiply(2, a))
77
+ .simplify()
78
+ .toTex(),
79
+ ],
80
+ ])}
81
+
82
+ ${alignTex([
83
+ ["x_2", "=", "\\frac{-b+\\sqrt{\\Delta}}{2a}"],
84
+ ["", "=", frac(add(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
85
+ [
86
+ "",
87
+ "=",
88
+ frac(add(opposite(b), sqrt(delta)), multiply(2, a))
89
+ .simplify()
90
+ .toTex(),
91
+ ],
92
+ ])}
93
+
94
+ Ensuite, on sait qu'un polynôme du second degré est du signe de son coefficient $a$, sauf entre ses racines. Ici, comme $${a
95
+ .toTree()
96
+ .toSignInequationTex()}$, $f$ est ${a > 0 ? "positive" : "négative"} sur l'intervalle $\\left]-\\infty; ${roots[0].toTex()}\\right]$ et sur l'intervalle $\\left[${roots[1].toTex()};+\\infty\\right[$, et ${a > 0 ? "négative" : "positive"} sur l'intervalle $\\left[${roots[0].toTex()},${roots[1].toTex()}\\right]$.
97
+
98
+ On en conclut que l'ensemble solution de l'inéquation $f(x) ${ineq.symbol} 0$ est :
99
+
100
+ $$
101
+ ${getAnswer(identifiers)}
102
+ $$`;
103
+ };
30
104
  const getQuestionFromIdentifiers = (identifiers) => {
31
105
  const question = {
32
106
  answer: getAnswer(identifiers),
33
107
  instruction: getInstruction(identifiers),
34
- keys: [
35
- "S",
36
- "equal",
37
- "lbracket",
38
- "semicolon",
39
- "rbracket",
40
- "cup",
41
- "infty",
42
- "varnothing",
43
- ],
108
+ keys: getKeys(identifiers),
44
109
  answerFormat: "tex",
45
110
  identifiers,
111
+ hint: getHint(identifiers),
112
+ correction: getCorrection(identifiers),
46
113
  };
47
114
  return question;
48
115
  };
@@ -131,7 +198,5 @@ export const secondDegreeInequation = {
131
198
  subject: "Mathématiques",
132
199
  pdfOptions: { shouldSpreadPropositions: true },
133
200
  getQuestionFromIdentifiers,
201
+ hasHintAndCorrection: true,
134
202
  };
135
- // export const reuseSecondDegreeInequation = {
136
- // getAnswerNode,
137
- // };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ b: number;
5
+ c: number;
6
+ };
7
+ export declare const solveBisquaredEquation: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=solveBisquaredEquation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solveBisquaredEquation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveBisquaredEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuNF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
@@ -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
+ }); //prevents x^2 + b which looks like devform
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
  };