math-exercises 3.0.158 → 3.0.159

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 (218) hide show
  1. package/lib/exercises/math/calculLitteral/equation/exp/expOfFEqualsExpOfGEquation.js +7 -6
  2. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.d.ts.map +1 -1
  3. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.js +88 -9
  4. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -1
  5. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +8 -2
  6. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
  7. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  8. package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
  9. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +27 -2
  11. package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.d.ts.map +1 -1
  12. package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.js +0 -1
  13. package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts.map +1 -1
  14. package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.js +0 -1
  15. package/lib/exercises/math/calculLitteral/inequations/exp/expOfFEqualsExpOfGInequation.d.ts.map +1 -1
  16. package/lib/exercises/math/calculLitteral/inequations/exp/expOfFEqualsExpOfGInequation.js +11 -4
  17. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  18. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +11 -5
  19. package/lib/exercises/math/calculLitteral/inequations/index.d.ts +1 -0
  20. package/lib/exercises/math/calculLitteral/inequations/index.d.ts.map +1 -1
  21. package/lib/exercises/math/calculLitteral/inequations/index.js +1 -0
  22. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
  23. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +91 -21
  24. package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.d.ts.map +1 -1
  25. package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.js +63 -43
  26. package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.d.ts.map +1 -1
  27. package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.js +72 -49
  28. package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.d.ts.map +1 -1
  29. package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.js +19 -19
  30. package/lib/exercises/math/derivation/derivative/exp/expOverExpDerivative.d.ts.map +1 -1
  31. package/lib/exercises/math/derivation/derivative/exp/expOverExpDerivative.js +26 -14
  32. package/lib/exercises/math/derivation/derivative/exp/index.d.ts +1 -0
  33. package/lib/exercises/math/derivation/derivative/exp/index.d.ts.map +1 -1
  34. package/lib/exercises/math/derivation/derivative/exp/index.js +1 -0
  35. package/lib/exercises/math/derivation/variations/index.d.ts +1 -0
  36. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
  37. package/lib/exercises/math/derivation/variations/index.js +1 -0
  38. package/lib/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.d.ts +7 -0
  39. package/lib/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.d.ts.map +1 -0
  40. package/lib/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.js +174 -0
  41. package/lib/exercises/math/functions/exponential/algebraic/approxExpAPlusB.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/exponential/algebraic/approxExpAPlusB.js +30 -3
  43. package/lib/exercises/math/functions/exponential/algebraic/approxExpKa.d.ts.map +1 -1
  44. package/lib/exercises/math/functions/exponential/algebraic/approxExpKa.js +12 -7
  45. package/lib/exercises/math/functions/exponential/algebraic/approxExpN.js +1 -1
  46. package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.js +2 -2
  47. package/lib/exercises/math/functions/exponential/definition/approxExpAPlusH.d.ts.map +1 -1
  48. package/lib/exercises/math/functions/exponential/definition/approxExpAPlusH.js +33 -44
  49. package/lib/exercises/math/functions/exponential/definition/expAntecedentFromGraph.d.ts.map +1 -1
  50. package/lib/exercises/math/functions/exponential/definition/expAntecedentFromGraph.js +80 -8
  51. package/lib/exercises/math/functions/exponential/definition/expImageFromGraph.d.ts.map +1 -1
  52. package/lib/exercises/math/functions/exponential/definition/expImageFromGraph.js +80 -25
  53. package/lib/exercises/math/functions/exponential/definition/isPlausibleExpFromGraph.d.ts.map +1 -1
  54. package/lib/exercises/math/functions/exponential/definition/isPlausibleExpFromGraph.js +6 -15
  55. package/lib/exercises/math/functions/exponential/expFactorization.d.ts.map +1 -1
  56. package/lib/exercises/math/functions/exponential/expFactorization.js +54 -42
  57. package/lib/exercises/math/functions/exponential/index.d.ts +2 -0
  58. package/lib/exercises/math/functions/exponential/index.d.ts.map +1 -1
  59. package/lib/exercises/math/functions/exponential/index.js +2 -0
  60. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.js +3 -0
  61. package/lib/exercises/math/functions/variations/exp/varOfAEXPlusB.d.ts.map +1 -1
  62. package/lib/exercises/math/functions/variations/exp/varOfAEXPlusB.js +18 -23
  63. package/lib/exercises/math/functions/variations/exp/varOfAEXPlusBOverCEXPlusD.d.ts.map +1 -1
  64. package/lib/exercises/math/functions/variations/exp/varOfAEXPlusBOverCEXPlusD.js +24 -26
  65. package/lib/exercises/math/functions/variations/index.d.ts +1 -0
  66. package/lib/exercises/math/functions/variations/index.d.ts.map +1 -1
  67. package/lib/exercises/math/functions/variations/index.js +1 -0
  68. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPerpendicularLine.d.ts +12 -0
  69. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPerpendicularLine.d.ts.map +1 -0
  70. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPerpendicularLine.js +230 -0
  71. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPointAndNormalVector.d.ts +10 -0
  72. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPointAndNormalVector.d.ts.map +1 -0
  73. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLineFromPointAndNormalVector.js +167 -0
  74. package/lib/exercises/math/geometry/cartesian/index.d.ts +3 -0
  75. package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
  76. package/lib/exercises/math/geometry/cartesian/index.js +3 -0
  77. package/lib/exercises/math/geometry/cartesian/normalVectorFromCartesianLineEquation.d.ts +10 -0
  78. package/lib/exercises/math/geometry/cartesian/normalVectorFromCartesianLineEquation.d.ts.map +1 -0
  79. package/lib/exercises/math/geometry/cartesian/normalVectorFromCartesianLineEquation.js +131 -0
  80. package/lib/exercises/math/geometry/circles/index.d.ts +2 -0
  81. package/lib/exercises/math/geometry/circles/index.d.ts.map +1 -0
  82. package/lib/exercises/math/geometry/circles/index.js +1 -0
  83. package/lib/exercises/math/geometry/circles/isPointOnCircleFromCartesianEquation.d.ts +11 -0
  84. package/lib/exercises/math/geometry/circles/isPointOnCircleFromCartesianEquation.d.ts.map +1 -0
  85. package/lib/exercises/math/geometry/circles/isPointOnCircleFromCartesianEquation.js +131 -0
  86. package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts.map +1 -1
  87. package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.js +0 -2
  88. package/lib/exercises/math/geometry/index.d.ts +1 -0
  89. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  90. package/lib/exercises/math/geometry/index.js +1 -0
  91. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/index.d.ts +4 -0
  92. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/index.d.ts.map +1 -0
  93. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/index.js +3 -0
  94. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.d.ts +9 -0
  95. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.d.ts.map +1 -0
  96. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.js +247 -0
  97. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts +13 -0
  98. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts.map +1 -0
  99. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.js +452 -0
  100. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.d.ts +9 -0
  101. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.d.ts.map +1 -0
  102. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js +253 -0
  103. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/index.d.ts +4 -0
  104. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/index.d.ts.map +1 -0
  105. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/index.js +3 -0
  106. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductIdentities.d.ts +10 -0
  107. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductIdentities.d.ts.map +1 -0
  108. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductIdentities.js +174 -0
  109. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.d.ts +9 -0
  110. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.d.ts.map +1 -0
  111. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.js +231 -0
  112. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.d.ts +14 -0
  113. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.d.ts.map +1 -0
  114. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.js +292 -0
  115. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/index.d.ts +6 -0
  116. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/index.d.ts.map +1 -0
  117. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/index.js +5 -0
  118. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.d.ts +9 -0
  119. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.d.ts.map +1 -0
  120. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.js +202 -0
  121. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsUsingCoords.d.ts +9 -0
  122. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsUsingCoords.d.ts.map +1 -0
  123. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsUsingCoords.js +127 -0
  124. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.d.ts +12 -0
  125. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.d.ts.map +1 -0
  126. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.js +167 -0
  127. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.d.ts +12 -0
  128. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.d.ts.map +1 -0
  129. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.js +180 -0
  130. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.d.ts +12 -0
  131. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.d.ts.map +1 -0
  132. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.js +235 -0
  133. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts +12 -0
  134. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts.map +1 -0
  135. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.js +423 -0
  136. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.d.ts +17 -0
  137. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.d.ts.map +1 -0
  138. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.js +347 -0
  139. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.d.ts +8 -0
  140. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.d.ts.map +1 -0
  141. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.js +301 -0
  142. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts +9 -0
  143. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts.map +1 -0
  144. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +141 -0
  145. package/lib/exercises/math/probaStat/randomVariable/findValueToMatchRandomVariableAverage.d.ts +10 -0
  146. package/lib/exercises/math/probaStat/randomVariable/findValueToMatchRandomVariableAverage.d.ts.map +1 -0
  147. package/lib/exercises/math/probaStat/randomVariable/findValueToMatchRandomVariableAverage.js +174 -0
  148. package/lib/exercises/math/probaStat/randomVariable/index.d.ts +1 -0
  149. package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
  150. package/lib/exercises/math/probaStat/randomVariable/index.js +2 -0
  151. package/lib/exercises/math/sequences/generation/index.d.ts +2 -0
  152. package/lib/exercises/math/sequences/generation/index.d.ts.map +1 -0
  153. package/lib/exercises/math/sequences/generation/index.js +1 -0
  154. package/lib/exercises/math/sequences/generation/recognizeRecurrenceOrExplicit.d.ts +8 -0
  155. package/lib/exercises/math/sequences/generation/recognizeRecurrenceOrExplicit.d.ts.map +1 -0
  156. package/lib/exercises/math/sequences/generation/recognizeRecurrenceOrExplicit.js +63 -0
  157. package/lib/exercises/math/sequences/graph/index.d.ts +2 -0
  158. package/lib/exercises/math/sequences/graph/index.d.ts.map +1 -0
  159. package/lib/exercises/math/sequences/graph/index.js +1 -0
  160. package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.d.ts +11 -0
  161. package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.d.ts.map +1 -0
  162. package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.js +113 -0
  163. package/lib/exercises/math/sequences/index.d.ts +2 -0
  164. package/lib/exercises/math/sequences/index.d.ts.map +1 -1
  165. package/lib/exercises/math/sequences/index.js +2 -0
  166. package/lib/exercises/math/sequences/notation/identifyRankInSequenceTermsList.d.ts +12 -0
  167. package/lib/exercises/math/sequences/notation/identifyRankInSequenceTermsList.d.ts.map +1 -0
  168. package/lib/exercises/math/sequences/notation/identifyRankInSequenceTermsList.js +114 -0
  169. package/lib/exercises/math/sequences/notation/identifySequenceTermInList.d.ts +12 -0
  170. package/lib/exercises/math/sequences/notation/identifySequenceTermInList.d.ts.map +1 -0
  171. package/lib/exercises/math/sequences/notation/identifySequenceTermInList.js +111 -0
  172. package/lib/exercises/math/sequences/notation/index.d.ts +3 -0
  173. package/lib/exercises/math/sequences/notation/index.d.ts.map +1 -0
  174. package/lib/exercises/math/sequences/notation/index.js +2 -0
  175. package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts.map +1 -1
  176. package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.js +0 -1
  177. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.d.ts.map +1 -1
  178. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.js +0 -2
  179. package/lib/exercises/vea/cartesianLineVEA.d.ts +2 -0
  180. package/lib/exercises/vea/cartesianLineVEA.d.ts.map +1 -0
  181. package/lib/exercises/vea/cartesianLineVEA.js +1 -0
  182. package/lib/index.d.ts +123 -0
  183. package/lib/index.d.ts.map +1 -1
  184. package/lib/math/geometry/line.d.ts +2 -0
  185. package/lib/math/geometry/line.d.ts.map +1 -1
  186. package/lib/math/geometry/line.js +7 -0
  187. package/lib/math/geometry/point.d.ts +1 -0
  188. package/lib/math/geometry/point.d.ts.map +1 -1
  189. package/lib/math/geometry/point.js +5 -0
  190. package/lib/math/geometry/polygons/relationPP.d.ts +8 -0
  191. package/lib/math/geometry/polygons/relationPP.d.ts.map +1 -0
  192. package/lib/math/geometry/polygons/relationPP.js +41 -0
  193. package/lib/math/polynomials/trinom.d.ts +1 -1
  194. package/lib/math/polynomials/trinom.d.ts.map +1 -1
  195. package/lib/math/polynomials/trinom.js +15 -6
  196. package/lib/math/utils/arithmetic/primeFactors.js +1 -1
  197. package/lib/math/utils/geometry/randomVecs2.d.ts +6 -0
  198. package/lib/math/utils/geometry/randomVecs2.d.ts.map +1 -0
  199. package/lib/math/utils/geometry/randomVecs2.js +34 -0
  200. package/lib/tests/questionTest.d.ts.map +1 -1
  201. package/lib/tests/questionTest.js +2 -2
  202. package/lib/tree/nodes/equations/equationSolutionNode.d.ts +1 -0
  203. package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
  204. package/lib/tree/nodes/equations/equationSolutionNode.js +3 -0
  205. package/lib/tree/nodes/functions/expNode.d.ts +1 -1
  206. package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
  207. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +1 -0
  208. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
  209. package/lib/tree/nodes/inequations/inequationSolutionNode.js +3 -0
  210. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
  211. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  212. package/lib/tree/nodes/operators/fractionNode.js +6 -4
  213. package/lib/tree/nodes/sets/intervalNode.d.ts +6 -0
  214. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  215. package/lib/tree/nodes/sets/namedIntervalNode.d.ts +31 -0
  216. package/lib/tree/nodes/sets/namedIntervalNode.d.ts.map +1 -0
  217. package/lib/tree/nodes/sets/namedIntervalNode.js +77 -0
  218. package/package.json +1 -1
@@ -8,32 +8,6 @@ import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
8
8
  import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
9
9
  import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
10
10
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
11
- const getHint = () => {
12
- return `Utilise la formule de dérivation suivante :
13
-
14
- $$
15
- \\left(e^{u}\\right)' = u' \\times e^{u}
16
- $$`;
17
- };
18
- const getCorrection = (identifiers) => {
19
- const { a, b } = identifiers;
20
- const affine = new Polynomial([b, a]);
21
- return `On utilise la formule de dérivation suivante :
22
-
23
- $$
24
- \\left(e^{u}\\right)' = u' \\times e^{u}
25
- $$
26
-
27
- Ici, $u(x) = ${affine.toTree().toTex()}$.
28
-
29
- Donc $u'(x) = ${a}$.
30
-
31
- Ainsi,
32
-
33
- $$
34
- f'(x) = ${getAnswer(identifiers)}
35
- $$`;
36
- };
37
11
  const getInstruction = (identifiers) => {
38
12
  const { a, b } = identifiers;
39
13
  const affine = new Polynomial([b, a]);
@@ -52,24 +26,51 @@ const getAnswer = (identifiers) => {
52
26
  const answer = derivative.toTex();
53
27
  return answer;
54
28
  };
55
- const getExpDerivative = () => {
56
- const a = randint(-9, 10, [0]);
57
- const b = randint(-9, 10);
58
- const identifiers = { a, b };
59
- return getQuestionFromIdentifiers(identifiers);
29
+ const getHint = (identifiers) => {
30
+ const { a, b } = identifiers;
31
+ const affine = new Polynomial([b, a]);
32
+ return `Si $v$ est une fonction dérivable alors :
33
+
34
+ $$
35
+ (e^{v(x)})'(x) = v'(x) \\times e^{v(x)}
36
+ $$
37
+
38
+ Ici, on a :
39
+
40
+ $$
41
+ v(x) = ${affine.toTex()}
42
+ $$
43
+
44
+ `;
60
45
  };
61
- const getQuestionFromIdentifiers = (identifiers) => {
62
- const question = {
63
- instruction: getInstruction(identifiers),
64
- startStatement: "f'(x)",
65
- answer: getAnswer(identifiers),
66
- keys: ["x", "epower", "exp"],
67
- answerFormat: "tex",
68
- identifiers,
69
- hint: getHint(identifiers),
70
- correction: getCorrection(identifiers),
71
- };
72
- return question;
46
+ const getCorrection = (identifiers) => {
47
+ const { a, b } = identifiers;
48
+ const affine = new Polynomial([b, a]);
49
+ const texAffine = affine.toTex();
50
+ const texDeriv = affine.toTree().derivative().simplify().toTex();
51
+ return `Si $v$ est une fonction dérivable alors :
52
+
53
+ $$
54
+ (e^{(v(x)})'(x) = v'(x) \\times e^{v(x)}
55
+ $$
56
+
57
+ Ici, on a :
58
+
59
+ $$
60
+ v(x) = ${texAffine}
61
+ $$
62
+
63
+ $$
64
+ v'(x) = ${texDeriv}
65
+ $$
66
+
67
+ Donc :
68
+
69
+ $$
70
+ (e^{${texAffine}})'(x) = ${texDeriv} e^{${texAffine}}
71
+ $$
72
+
73
+ `;
73
74
  };
74
75
  const getPropositions = (n, { answer, a, b }) => {
75
76
  const propositions = [];
@@ -101,6 +102,25 @@ const isAnswerValid = (ans, { answer }) => {
101
102
  return handleVEAError(err);
102
103
  }
103
104
  };
105
+ const getExpDerivative = () => {
106
+ const a = randint(-9, 10, [0]);
107
+ const b = randint(-9, 10);
108
+ const identifiers = { a, b };
109
+ return getQuestionFromIdentifiers(identifiers);
110
+ };
111
+ const getQuestionFromIdentifiers = (identifiers) => {
112
+ const question = {
113
+ instruction: getInstruction(identifiers),
114
+ startStatement: "f'(x)",
115
+ answer: getAnswer(identifiers),
116
+ keys: ["x", "epower", "exp"],
117
+ answerFormat: "tex",
118
+ identifiers,
119
+ hint: getHint(identifiers),
120
+ correction: getCorrection(identifiers),
121
+ };
122
+ return question;
123
+ };
104
124
  export const expDerivativeOne = {
105
125
  id: "expDerivativeOne",
106
126
  connector: "=",
@@ -1 +1 @@
1
- {"version":3,"file":"expDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoIF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
1
+ {"version":3,"file":"expDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgKF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
@@ -2,42 +2,12 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../e
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Polynomial } from "../../../../../math/polynomials/polynomial.js";
4
4
  import { randint } from "../../../../../math/utils/random/randint.js";
5
- import { exp, ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
5
+ import { ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
6
6
  import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
7
- import { add } from "../../../../../tree/nodes/operators/addNode.js";
8
- import { multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
9
8
  import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
10
9
  import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
11
10
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
12
- import { alignTex } from "../../../../../utils/latex/alignTex.js";
13
- const getHint = () => {
14
- return `La fonction proposée est un produit. On peut donc utiliser la formule de dérivation :
15
-
16
- $$
17
- (uv)' = u'v+uv'
18
- $$`;
19
- };
20
- const getCorrection = (identifiers) => {
21
- const { a, b } = identifiers;
22
- const affine = new Polynomial([b, a]).toTree();
23
- const expo = exp("x");
24
- return `$f(x)$ est de la forme $u(x)\\times v(x)$, avec $u(x) = ${affine.toTex()}$, et $v(x) = ${expo.toTex()}$.
25
-
26
- On a donc $u'(x) = ${a}$, et $v'(x) = ${expo.toTex()}$.
27
-
28
- On utilise alors la formule de dérivation d'un produit :
29
-
30
- $$
31
- (uv)' = u'v+uv'
32
- $$
33
-
34
- Cela donne :
35
-
36
- ${alignTex([
37
- ["f'(x)", "=", add(multiply(a, expo), multiply(affine, expo)).toTex()],
38
- ["", "=", getAnswer(identifiers)],
39
- ])}`;
40
- };
41
11
  const getInstruction = (identifiers) => {
42
12
  const { a, b } = identifiers;
43
13
  const myfunction = new MultiplyNode(new Polynomial([b, a]).toTree(), new ExpNode(new VariableNode("x")));
@@ -55,24 +25,58 @@ const getAnswerNode = (identifiers) => {
55
25
  const getAnswer = (identifiers) => {
56
26
  return getAnswerNode(identifiers).simplify().toTex();
57
27
  };
58
- const getQuestionFromIdentifiers = (identifiers) => {
59
- const question = {
60
- instruction: getInstruction(identifiers),
61
- startStatement: "f'(x)",
62
- answer: getAnswer(identifiers),
63
- keys: ["x", "epower", "exp"],
64
- answerFormat: "tex",
65
- identifiers,
66
- hint: getHint(identifiers),
67
- correction: getCorrection(identifiers),
68
- };
69
- return question;
28
+ const getHint = () => {
29
+ return `Si $u$ et $v$ sont deux fonctions dérivables, alors :
30
+
31
+ $$
32
+ (uv)'(x) = u'(x)v(x) + u(x)v'(x)
33
+ $$
34
+
35
+ `;
70
36
  };
71
- const getExpDerivativeThree = () => {
72
- const a = randint(-9, 10, [0]);
73
- const b = randint(-9, 10);
74
- const identifiers = { a, b };
75
- return getQuestionFromIdentifiers(identifiers);
37
+ const getCorrection = (identifiers) => {
38
+ const { a, b } = identifiers;
39
+ const nodeU = new Polynomial([b, a]).toTree();
40
+ return `Si $u$ et $v$ sont deux fonctions dérivables, alors :
41
+
42
+ $$
43
+ (uv)'(x) = u'(x)v(x) + u(x)v'(x)
44
+ $$
45
+
46
+ Ici :
47
+
48
+ $$
49
+ u(x) = ${nodeU.toTex()}
50
+ $$
51
+
52
+ $$
53
+ v(x) = e^x
54
+ $$
55
+
56
+ $$
57
+ u'(x) = ${nodeU.derivative().simplify().toTex()}
58
+ $$
59
+
60
+ $$
61
+ v'(x) = e^x
62
+ $$
63
+
64
+ On a donc :
65
+
66
+ $$
67
+ f'(x) = ${nodeU
68
+ .derivative()
69
+ .simplify()
70
+ .toTex()} \\times e^x + (${nodeU.toTex()}) \\times e^x
71
+ $$
72
+
73
+ Donc :
74
+
75
+ $$
76
+ f'(x) = ${getAnswer(identifiers)}
77
+ $$
78
+
79
+ `;
76
80
  };
77
81
  const getPropositions = (n, { answer, a, b }) => {
78
82
  const propositions = [];
@@ -101,6 +105,25 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
101
105
  return handleVEAError(err);
102
106
  }
103
107
  };
108
+ const getExpDerivativeThree = () => {
109
+ const a = randint(-9, 10, [0]);
110
+ const b = randint(-9, 10);
111
+ const identifiers = { a, b };
112
+ return getQuestionFromIdentifiers(identifiers);
113
+ };
114
+ const getQuestionFromIdentifiers = (identifiers) => {
115
+ const question = {
116
+ instruction: getInstruction(identifiers),
117
+ startStatement: "f'(x)",
118
+ answer: getAnswer(identifiers),
119
+ keys: ["x", "epower", "exp"],
120
+ answerFormat: "tex",
121
+ identifiers,
122
+ hint: getHint(identifiers),
123
+ correction: getCorrection(identifiers),
124
+ };
125
+ return question;
126
+ };
104
127
  export const expDerivativeThree = {
105
128
  id: "expDerivativeThree",
106
129
  connector: "=",
@@ -1 +1 @@
1
- {"version":3,"file":"expDerivativeTwo.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeTwo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAelD,CAAC"}
1
+ {"version":3,"file":"expDerivativeTwo.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeTwo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAsGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAelD,CAAC"}
@@ -39,25 +39,6 @@ const getAnswer = (identifiers) => {
39
39
  const answer = derivative.toTex();
40
40
  return answer;
41
41
  };
42
- const getExpDerivative = () => {
43
- const a = randint(-9, 10, [0]);
44
- const b = randint(-9, 10);
45
- const identifiers = { a, b };
46
- return getQuestionFromIdentifiers(identifiers);
47
- };
48
- const getQuestionFromIdentifiers = (identifiers) => {
49
- const question = {
50
- instruction: getInstruction(identifiers),
51
- startStatement: "f'(x)",
52
- answer: getAnswer(identifiers),
53
- keys: ["x", "epower", "exp"],
54
- answerFormat: "tex",
55
- identifiers,
56
- hint: getHint(identifiers),
57
- correction: getCorrection(identifiers),
58
- };
59
- return question;
60
- };
61
42
  const getPropositions = (n, { answer, a, b }) => {
62
43
  const propositions = [];
63
44
  addValidProp(propositions, answer);
@@ -81,6 +62,25 @@ const isAnswerValid = (ans, { answer }) => {
81
62
  return handleVEAError(err);
82
63
  }
83
64
  };
65
+ const getExpDerivative = () => {
66
+ const a = randint(-9, 10, [0]);
67
+ const b = randint(-9, 10);
68
+ const identifiers = { a, b };
69
+ return getQuestionFromIdentifiers(identifiers);
70
+ };
71
+ const getQuestionFromIdentifiers = (identifiers) => {
72
+ const question = {
73
+ instruction: getInstruction(identifiers),
74
+ startStatement: "f'(x)",
75
+ answer: getAnswer(identifiers),
76
+ keys: ["x", "epower", "exp"],
77
+ answerFormat: "tex",
78
+ identifiers,
79
+ hint: getHint(identifiers),
80
+ correction: getCorrection(identifiers),
81
+ };
82
+ return question;
83
+ };
84
84
  export const expDerivativeTwo = {
85
85
  id: "expDerivativeTwo",
86
86
  connector: "=",
@@ -1 +1 @@
1
- {"version":3,"file":"expOverExpDerivative.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expOverExpDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAqCrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmUF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
1
+ {"version":3,"file":"expOverExpDerivative.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expOverExpDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAqCrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmVF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
@@ -214,30 +214,42 @@ const getExpOverExpDerivativeQuestion = () => {
214
214
  function createRandomIdentifiers() {
215
215
  const a = randint(-9, 10, [0]);
216
216
  const b = randint(-9, 10, [0]);
217
- const c = randint(9, 10, [0]);
217
+ const c = randint(-9, 10, [0]);
218
218
  const d = randint(-9, 10, [c, -c, 0]);
219
219
  const identifiers = { a, b, c, d };
220
220
  return identifiers;
221
221
  }
222
+ function isValidIdentifiers(identifiersCandidate) {
223
+ const { a, b, c, d } = identifiersCandidate;
224
+ const isInstructionNodeNotReductible = () => {
225
+ return a * d - b * c !== 0;
226
+ };
227
+ const isAnswerNodeNonZeroFraction = () => {
228
+ let isValid = false;
229
+ try {
230
+ const nodeAnswer = getAnswerNode(identifiersCandidate);
231
+ if (nodeAnswer && isFractionNode(nodeAnswer)) {
232
+ const nodeFraction = nodeAnswer;
233
+ const isZero = nodeFraction.leftChild.evaluate() === 0;
234
+ isValid = !isZero;
235
+ }
236
+ }
237
+ catch (_) {
238
+ (() => { })();
239
+ }
240
+ return isValid;
241
+ };
242
+ return isInstructionNodeNotReductible() && isAnswerNodeNonZeroFraction();
243
+ }
222
244
  let identifiers;
223
245
  let counter = -1;
224
246
  let isValid = false;
225
247
  while (!isValid && counter < 100) {
226
248
  counter++;
227
249
  const identifiersCandidate = createRandomIdentifiers();
228
- try {
229
- const nodeAnswer = getAnswerNode(identifiersCandidate);
230
- if (nodeAnswer && isFractionNode(nodeAnswer)) {
231
- const nodeFraction = nodeAnswer;
232
- const isZero = nodeFraction.leftChild.evaluate() === 0;
233
- isValid = !isZero;
234
- if (isValid) {
235
- identifiers = identifiersCandidate;
236
- }
237
- }
238
- }
239
- catch (_) {
240
- (() => { })();
250
+ isValid = isValidIdentifiers(identifiersCandidate);
251
+ if (isValid) {
252
+ identifiers = identifiersCandidate;
241
253
  }
242
254
  }
243
255
  if (!isValid) {
@@ -3,4 +3,5 @@ export * from "./expDerivativeThree.js";
3
3
  export * from "./expDerivativeTwo.js";
4
4
  export * from "./expDerivativeFour.js";
5
5
  export * from "./secondDerivativeOfExpoFunction.js";
6
+ export * from "./expOverExpDerivative.js";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC"}
@@ -3,3 +3,4 @@ export * from "./expDerivativeThree.js";
3
3
  export * from "./expDerivativeTwo.js";
4
4
  export * from "./expDerivativeFour.js";
5
5
  export * from "./secondDerivativeOfExpoFunction.js";
6
+ export * from "./expOverExpDerivative.js";
@@ -1,4 +1,5 @@
1
1
  export * from "./thirdDegreeFunctionVariation.js";
2
2
  export * from "./thirdDegreeDerivativeVariation.js";
3
3
  export * from "./variationArrowAmount.js";
4
+ export * from "./readExtremaAbscissFromDerivativeCurve.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4CAA4C,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./thirdDegreeFunctionVariation.js";
2
2
  export * from "./thirdDegreeDerivativeVariation.js";
3
3
  export * from "./variationArrowAmount.js";
4
+ export * from "./readExtremaAbscissFromDerivativeCurve.js";
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ splinePoints: number[][];
4
+ };
5
+ export declare const readExtremaAbscissFromDerivativeCurve: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=readExtremaAbscissFromDerivativeCurve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readExtremaAbscissFromDerivativeCurve.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;CAC1B,CAAC;AAuKF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAAC,WAAW,CAwBvE,CAAC"}
@@ -0,0 +1,174 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randomColor } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { randTupleInt } from "../../../../math/utils/random/randTupleInt.js";
7
+ import { valueParser } from "../../../../tree/parsers/valueParser.js";
8
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
9
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
10
+ import { dollarize } from "../../../../utils/latex/dollarize.js";
11
+ const getPropositions = (n, { answer }) => {
12
+ const propositions = [];
13
+ addValidProp(propositions, answer);
14
+ propWhile(propositions, n, () => {
15
+ const nbs = randTupleInt(randint(1, 4), {
16
+ allDifferent: true,
17
+ from: -10,
18
+ to: 10,
19
+ });
20
+ nbs.sort((a, b) => a - b);
21
+ tryToAddWrongProp(propositions, nbs.map((e) => e.frenchify()).join("\\text{ et }"));
22
+ });
23
+ return shuffleProps(propositions, n);
24
+ };
25
+ const getAnswer = (identifiers) => {
26
+ const { splinePoints } = identifiers;
27
+ const valids = splinePoints.filter((e) => e[1] === 0).map((e) => e[0]);
28
+ return valids.map((e) => e.frenchify()).join("\\text{ et }");
29
+ };
30
+ const getInstruction = () => {
31
+ return `Ci-dessous est donnée la courbe représentative de la fonction dérivée $f'$ d'une fonction $f$.
32
+
33
+ Quelles sont les abscisses des extremum locaux de $f$ ?`;
34
+ };
35
+ const getHint = () => {
36
+ return `$x$ est un extremum local d'une fonction dérivable $f$ si et seulement si la fonction dérivée s'annule et change de signe en $x$.`;
37
+ };
38
+ const getCorrection = (identifiers) => {
39
+ const { splinePoints } = identifiers;
40
+ const valids = splinePoints.filter((e) => e[1] === 0).map((e) => e[0]);
41
+ return `On lit graphiquement que la fonction $f'$ s'annule en changeant de signe pour $x$ valant ${valids
42
+ .map((e) => dollarize(e.frenchify()))
43
+ .join(", ou ")}.
44
+
45
+ Ce sont donc les abscisses des extremum locaux de $f$.`;
46
+ };
47
+ const getGGBOptions = (identifiers) => {
48
+ const { splinePoints } = identifiers;
49
+ const xMin = Math.min(...splinePoints.map((point) => point[0]));
50
+ const yMin = Math.min(...splinePoints.map((point) => point[1]));
51
+ const xMax = Math.max(...splinePoints.map((point) => point[0]));
52
+ const yMax = Math.max(...splinePoints.map((point) => point[1]));
53
+ const commands = [
54
+ `S = Spline(${splinePoints
55
+ .map((point) => `(${point[0]},${point[1]})`)
56
+ .join(",")})`,
57
+ "SetFixed(S, true, false)",
58
+ `SetColor(S, "${randomColor()}")`,
59
+ ];
60
+ const ggb = new GeogebraConstructor({
61
+ commands,
62
+ });
63
+ return ggb.getOptions({
64
+ coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
65
+ });
66
+ };
67
+ const getKeys = () => {
68
+ return ["et"];
69
+ };
70
+ const isAnswerValid = (ans, { answer: _answer, splinePoints }) => {
71
+ try {
72
+ const validPoints = splinePoints.filter((p) => p[1] === 0);
73
+ const ansElements = ans.split("\\text{ et }");
74
+ if (validPoints.length !== ansElements.length)
75
+ return false;
76
+ const sorted = [];
77
+ for (const el of ansElements) {
78
+ const parsed = valueParser(el);
79
+ if (parsed === false)
80
+ return false;
81
+ sorted.push(parsed);
82
+ }
83
+ sorted.sort((a, b) => a - b);
84
+ for (let i = 0; i < sorted.length; i++) {
85
+ const validPointX = validPoints[i][0];
86
+ if (Math.abs(sorted[i] - validPointX) > 0.4)
87
+ return false;
88
+ }
89
+ return true;
90
+ }
91
+ catch (err) {
92
+ return handleVEAError(err);
93
+ }
94
+ };
95
+ const getReadExtremaAbscissFromDerivativeCurveQuestion = (opts) => {
96
+ const xSolutions = [];
97
+ const nb = randint(2, 4);
98
+ // const nb = 2;
99
+ for (let i = 0; i < nb; i++) {
100
+ xSolutions.push(randint(-9, 10, xSolutions));
101
+ }
102
+ xSolutions.sort((a, b) => a - b);
103
+ const yValue = 0;
104
+ const splinePoints = [];
105
+ let prevYWasAbove = coinFlip();
106
+ const y = prevYWasAbove ? randint(-2, 0) : randint(1, 3);
107
+ prevYWasAbove = y > 0;
108
+ splinePoints.push([xSolutions[0] - (1 + Math.random() * 3), yValue + y]);
109
+ for (let i = 0; i < xSolutions.length; i++) {
110
+ splinePoints.push([xSolutions[i], yValue]);
111
+ if (i < xSolutions.length - 1) {
112
+ const mid = (xSolutions[i] + xSolutions[i + 1]) / 2;
113
+ const distance = xSolutions[i + 1] - xSolutions[i];
114
+ const x = mid + ((Math.random() * 2) / 5) * (distance / 2);
115
+ const y = prevYWasAbove ? randint(-2, 0) : randint(1, 3);
116
+ prevYWasAbove = y > 0;
117
+ splinePoints.push([x, yValue + y]);
118
+ }
119
+ }
120
+ const y2 = prevYWasAbove ? randint(-2, 0) : randint(1, 3);
121
+ prevYWasAbove = y2 > 0;
122
+ splinePoints.push([
123
+ xSolutions[xSolutions.length - 1] + (1 + Math.random() * 3),
124
+ yValue + y2,
125
+ ]);
126
+ const identifiers = { splinePoints };
127
+ return getQuestionFromIdentifiers(identifiers, opts);
128
+ };
129
+ const getQuestionFromIdentifiers = (identifiers) => {
130
+ return {
131
+ answer: getAnswer(identifiers),
132
+ instruction: getInstruction(identifiers),
133
+ keys: getKeys(identifiers),
134
+ answerFormat: "tex",
135
+ identifiers,
136
+ hint: getHint(identifiers),
137
+ correction: getCorrection(identifiers),
138
+ ggbOptions: getGGBOptions(identifiers),
139
+ };
140
+ };
141
+ // const options: GeneratorOption[] = [
142
+ // {
143
+ // id: "curveTypes",
144
+ // label: "Types de courbes",
145
+ // target: GeneratorOptionTarget.generation,
146
+ // type: GeneratorOptionType.multiselect,
147
+ // defaultValue: ["Tracés"],
148
+ // values: [
149
+ // "Tracés",
150
+ // "Droites",
151
+ // "Paraboles",
152
+ // ],
153
+ // },
154
+ // ];
155
+ export const readExtremaAbscissFromDerivativeCurve = {
156
+ id: "readExtremaAbscissFromDerivativeCurve",
157
+ connector: "=",
158
+ label: "Lire les abscisses des extremums locaux d'une fonction sur la courbe de sa dérivée",
159
+ isSingleStep: true,
160
+ generator: (nb, opts) => getDistinctQuestions(() => getReadExtremaAbscissFromDerivativeCurveQuestion(opts), nb),
161
+ qcmTimer: 60,
162
+ freeTimer: 60,
163
+ getPropositions,
164
+ isAnswerValid,
165
+ subject: "Mathématiques",
166
+ getHint,
167
+ getCorrection,
168
+ getInstruction,
169
+ getAnswer,
170
+ getGGBOptions,
171
+ hasGeogebra: true,
172
+ getQuestionFromIdentifiers,
173
+ hasHintAndCorrection: true,
174
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"approxExpAPlusB.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/algebraic/approxExpAPlusB.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,eAAe,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA4UF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAkBjD,CAAC"}
1
+ {"version":3,"file":"approxExpAPlusB.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/algebraic/approxExpAPlusB.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,eAAe,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAmXF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAmBjD,CAAC"}