math-exercises 3.0.57 → 3.0.58

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 (196) hide show
  1. package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts +2 -0
  2. package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/operations/operationsPriorities.js +46 -36
  4. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  5. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +1 -4
  6. package/lib/exercises/math/calculLitteral/factorisation/facto1.d.ts +16 -0
  7. package/lib/exercises/math/calculLitteral/factorisation/facto1.d.ts.map +1 -0
  8. package/lib/exercises/math/calculLitteral/factorisation/facto1.js +184 -0
  9. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -1
  10. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  11. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -1
  12. package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.d.ts +8 -0
  13. package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.d.ts.map +1 -0
  14. package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.js +102 -0
  15. package/lib/exercises/math/derivation/convexity/convexityTrinomials.d.ts +7 -0
  16. package/lib/exercises/math/derivation/convexity/convexityTrinomials.d.ts.map +1 -0
  17. package/lib/exercises/math/derivation/convexity/convexityTrinomials.js +52 -0
  18. package/lib/exercises/math/derivation/convexity/index.d.ts +4 -0
  19. package/lib/exercises/math/derivation/convexity/index.d.ts.map +1 -0
  20. package/lib/exercises/math/derivation/convexity/index.js +3 -0
  21. package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.d.ts +7 -0
  22. package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.d.ts.map +1 -0
  23. package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.js +134 -0
  24. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts +8 -0
  25. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -0
  26. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +79 -0
  27. package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.d.ts +8 -0
  28. package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.d.ts.map +1 -0
  29. package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.js +85 -0
  30. package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.d.ts +8 -0
  31. package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.d.ts.map +1 -0
  32. package/lib/exercises/math/derivation/derivative/exp/expDerivativeThree.js +86 -0
  33. package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.d.ts +8 -0
  34. package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.d.ts.map +1 -0
  35. package/lib/exercises/math/derivation/derivative/exp/expDerivativeTwo.js +76 -0
  36. package/lib/exercises/math/derivation/derivative/exp/index.d.ts +6 -0
  37. package/lib/exercises/math/derivation/derivative/exp/index.d.ts.map +1 -0
  38. package/lib/exercises/math/derivation/derivative/exp/index.js +5 -0
  39. package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.d.ts +7 -0
  40. package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.d.ts.map +1 -0
  41. package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.js +84 -0
  42. package/lib/exercises/math/derivation/derivative/index.d.ts +6 -27
  43. package/lib/exercises/math/derivation/derivative/index.d.ts.map +1 -1
  44. package/lib/exercises/math/derivation/derivative/index.js +6 -27
  45. package/lib/exercises/math/derivation/derivative/ln/index.d.ts +4 -0
  46. package/lib/exercises/math/derivation/derivative/ln/index.d.ts.map +1 -0
  47. package/lib/exercises/math/derivation/derivative/ln/index.js +3 -0
  48. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.d.ts +8 -0
  49. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.d.ts.map +1 -0
  50. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.js +81 -0
  51. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.d.ts +8 -0
  52. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.d.ts.map +1 -0
  53. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.js +103 -0
  54. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.d.ts +8 -0
  55. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.d.ts.map +1 -0
  56. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.js +77 -0
  57. package/lib/exercises/math/derivation/derivative/polynomial/constanteDerivative.d.ts +10 -0
  58. package/lib/exercises/math/derivation/derivative/polynomial/constanteDerivative.d.ts.map +1 -0
  59. package/lib/exercises/math/derivation/derivative/polynomial/constanteDerivative.js +71 -0
  60. package/lib/exercises/math/derivation/derivative/polynomial/firstDegreeDerivative.d.ts +11 -0
  61. package/lib/exercises/math/derivation/derivative/polynomial/firstDegreeDerivative.d.ts.map +1 -0
  62. package/lib/exercises/math/derivation/derivative/polynomial/firstDegreeDerivative.js +88 -0
  63. package/lib/exercises/math/derivation/derivative/polynomial/index.d.ts +8 -0
  64. package/lib/exercises/math/derivation/derivative/polynomial/index.d.ts.map +1 -0
  65. package/lib/exercises/math/derivation/derivative/polynomial/index.js +7 -0
  66. package/lib/exercises/math/derivation/derivative/polynomial/secondDegreeDerivative.d.ts +10 -0
  67. package/lib/exercises/math/derivation/derivative/polynomial/secondDegreeDerivative.d.ts.map +1 -0
  68. package/lib/exercises/math/derivation/derivative/polynomial/secondDegreeDerivative.js +115 -0
  69. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.d.ts +10 -0
  70. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.d.ts.map +1 -0
  71. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.js +80 -0
  72. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.d.ts +9 -0
  73. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.d.ts.map +1 -0
  74. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.js +67 -0
  75. package/lib/exercises/math/derivation/derivative/polynomial/thirdDegreeDerivative.d.ts +10 -0
  76. package/lib/exercises/math/derivation/derivative/polynomial/thirdDegreeDerivative.d.ts.map +1 -0
  77. package/lib/exercises/math/derivation/derivative/polynomial/thirdDegreeDerivative.js +134 -0
  78. package/lib/exercises/math/derivation/derivative/polynomial/usualderivative.d.ts +11 -0
  79. package/lib/exercises/math/derivation/derivative/polynomial/usualderivative.d.ts.map +1 -0
  80. package/lib/exercises/math/derivation/derivative/polynomial/usualderivative.js +97 -0
  81. package/lib/exercises/math/derivation/derivative/power/index.d.ts +3 -0
  82. package/lib/exercises/math/derivation/derivative/power/index.d.ts.map +1 -0
  83. package/lib/exercises/math/derivation/derivative/power/index.js +2 -0
  84. package/lib/exercises/math/derivation/derivative/power/powerCompositionDerivation.d.ts +9 -0
  85. package/lib/exercises/math/derivation/derivative/power/powerCompositionDerivation.d.ts.map +1 -0
  86. package/lib/exercises/math/derivation/derivative/power/powerCompositionDerivation.js +122 -0
  87. package/lib/exercises/math/derivation/derivative/power/powerFunctionDerivative.d.ts +8 -0
  88. package/lib/exercises/math/derivation/derivative/power/powerFunctionDerivative.d.ts.map +1 -0
  89. package/lib/exercises/math/derivation/derivative/power/powerFunctionDerivative.js +118 -0
  90. package/lib/exercises/math/derivation/derivative/sqrt/index.d.ts +3 -0
  91. package/lib/exercises/math/derivation/derivative/sqrt/index.d.ts.map +1 -0
  92. package/lib/exercises/math/derivation/derivative/sqrt/index.js +3 -0
  93. package/lib/exercises/math/derivation/derivative/sqrt/rootFunctionDerivative.d.ts +7 -0
  94. package/lib/exercises/math/derivation/derivative/sqrt/rootFunctionDerivative.d.ts.map +1 -0
  95. package/lib/exercises/math/derivation/derivative/sqrt/rootFunctionDerivative.js +115 -0
  96. package/lib/exercises/math/derivation/derivative/sqrt/sqrtCompositionDerivation.d.ts +8 -0
  97. package/lib/exercises/math/derivation/derivative/sqrt/sqrtCompositionDerivation.d.ts.map +1 -0
  98. package/lib/exercises/math/derivation/derivative/sqrt/sqrtCompositionDerivation.js +77 -0
  99. package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.d.ts +8 -0
  100. package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.d.ts.map +1 -0
  101. package/lib/exercises/math/derivation/derivative/sqrt/sqrtProductDerivative.js +85 -0
  102. package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.d.ts +8 -0
  103. package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.d.ts.map +1 -0
  104. package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.js +81 -0
  105. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.d.ts +7 -0
  106. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.d.ts.map +1 -0
  107. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.js +103 -0
  108. package/lib/exercises/math/derivation/derivative/trigo/index.d.ts +5 -0
  109. package/lib/exercises/math/derivation/derivative/trigo/index.d.ts.map +1 -0
  110. package/lib/exercises/math/derivation/derivative/trigo/index.js +4 -0
  111. package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.d.ts +8 -0
  112. package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.d.ts.map +1 -0
  113. package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.js +70 -0
  114. package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.d.ts +7 -0
  115. package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.d.ts.map +1 -0
  116. package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.js +91 -0
  117. package/lib/exercises/math/derivation/derivativeNumberCalcul.d.ts.map +1 -1
  118. package/lib/exercises/math/derivation/derivativeNumberCalcul.js +4 -2
  119. package/lib/exercises/math/derivation/index.d.ts +2 -0
  120. package/lib/exercises/math/derivation/index.d.ts.map +1 -1
  121. package/lib/exercises/math/derivation/index.js +2 -0
  122. package/lib/exercises/math/derivation/variations/index.d.ts +2 -0
  123. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -0
  124. package/lib/exercises/math/derivation/variations/index.js +1 -0
  125. package/lib/exercises/math/derivation/variations/thirdDegreeFunctionVariation.d.ts +11 -0
  126. package/lib/exercises/math/derivation/variations/thirdDegreeFunctionVariation.d.ts.map +1 -0
  127. package/lib/exercises/math/derivation/variations/thirdDegreeFunctionVariation.js +168 -0
  128. package/lib/exercises/math/equaDiff/equaDiffAyPlusB.d.ts.map +1 -1
  129. package/lib/exercises/math/equaDiff/equaDiffAyPlusB.js +39 -22
  130. package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -1
  131. package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.js +7 -1
  132. package/lib/exercises/math/equaDiff/equaDiffGeneralForme.d.ts.map +1 -1
  133. package/lib/exercises/math/equaDiff/equaDiffGeneralForme.js +38 -15
  134. package/lib/exercises/math/equaDiff/equaDiffGeneralFormeWithIC.d.ts.map +1 -1
  135. package/lib/exercises/math/equaDiff/equaDiffGeneralFormeWithIC.js +29 -8
  136. package/lib/exercises/math/equaDiff/exponentialDifferentialEquationWithIC.d.ts +8 -0
  137. package/lib/exercises/math/equaDiff/exponentialDifferentialEquationWithIC.d.ts.map +1 -0
  138. package/lib/exercises/math/equaDiff/exponentialDifferentialEquationWithIC.js +86 -0
  139. package/lib/exercises/math/equaDiff/index.d.ts +1 -1
  140. package/lib/exercises/math/equaDiff/index.d.ts.map +1 -1
  141. package/lib/exercises/math/equaDiff/index.js +1 -1
  142. package/lib/exercises/math/functions/exponential/expEquation.d.ts.map +1 -1
  143. package/lib/exercises/math/functions/exponential/expEquation.js +3 -0
  144. package/lib/exercises/math/functions/exponential/expFactorization.d.ts.map +1 -1
  145. package/lib/exercises/math/functions/exponential/expFactorization.js +3 -0
  146. package/lib/exercises/math/functions/exponential/expSimplifiying.d.ts.map +1 -1
  147. package/lib/exercises/math/functions/exponential/expSimplifiying.js +83 -45
  148. package/lib/exercises/math/geometry/euclidianConstructions/buildRhombus.d.ts +2 -0
  149. package/lib/exercises/math/geometry/euclidianConstructions/buildRhombus.d.ts.map +1 -0
  150. package/lib/exercises/math/geometry/euclidianConstructions/buildRhombus.js +63 -0
  151. package/lib/exercises/math/primitive/klogUPrimitive.js +1 -1
  152. package/lib/exercises/math/primitive/logarithmePrimitive.js +1 -1
  153. package/lib/exercises/math/probaStat/stats1var/averageList.d.ts.map +1 -1
  154. package/lib/exercises/math/probaStat/stats1var/averageList.js +4 -4
  155. package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
  156. package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +42 -11
  157. package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.d.ts.map +1 -1
  158. package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.js +8 -20
  159. package/lib/exercises/math/probaStat/stats1var/etendueList.d.ts.map +1 -1
  160. package/lib/exercises/math/probaStat/stats1var/etendueList.js +4 -6
  161. package/lib/exercises/math/probaStat/stats1var/interquartilesList.d.ts.map +1 -1
  162. package/lib/exercises/math/probaStat/stats1var/interquartilesList.js +4 -4
  163. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
  164. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +4 -4
  165. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  166. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +13 -9
  167. package/lib/exercises/math/probaStat/stats1var/median.d.ts.map +1 -1
  168. package/lib/exercises/math/probaStat/stats1var/median.js +19 -14
  169. package/lib/exercises/math/probaStat/stats1var/medianList.d.ts.map +1 -1
  170. package/lib/exercises/math/probaStat/stats1var/medianList.js +3 -0
  171. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  172. package/lib/exercises/math/probaStat/stats1var/quartiles.js +16 -11
  173. package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
  174. package/lib/exercises/math/probaStat/stats1var/quartilesList.js +18 -14
  175. package/lib/exercises/math/probaStat/stats1var/standardDeviationList.d.ts.map +1 -1
  176. package/lib/exercises/math/probaStat/stats1var/standardDeviationList.js +4 -4
  177. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -1
  178. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +4 -4
  179. package/lib/exercises/math/probaStat/stats1var/varianceList.d.ts.map +1 -1
  180. package/lib/exercises/math/probaStat/stats1var/varianceList.js +4 -4
  181. package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -1
  182. package/lib/exercises/math/probaStat/stats1var/varianceTable.js +4 -4
  183. package/lib/exercises/pc/index.d.ts +5 -5
  184. package/lib/exercises/pc/index.d.ts.map +1 -1
  185. package/lib/exercises/pc/index.js +5 -5
  186. package/lib/index.d.ts +42 -41
  187. package/lib/index.d.ts.map +1 -1
  188. package/lib/playground.d.ts.map +1 -1
  189. package/lib/playground.js +6 -1
  190. package/lib/tree/nodes/functions/logNode.js +2 -4
  191. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  192. package/lib/tree/nodes/operators/fractionNode.js +4 -0
  193. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  194. package/lib/tree/nodes/operators/multiplyNode.js +4 -3
  195. package/lib/tree/parsers/latexParser.js +6 -2
  196. package/package.json +1 -1
@@ -6,12 +6,14 @@
6
6
  * a/b ± c*d
7
7
  */
8
8
  import { Exercise } from "../../../../exercises/exercise.js";
9
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
9
10
  type Identifiers = {
10
11
  type: number;
11
12
  a: number;
12
13
  b: number;
13
14
  c: number;
14
15
  d: number | undefined;
16
+ statementIds: NodeIdentifiers;
15
17
  };
16
18
  export declare const operationsPriorities: Exercise<Identifiers>;
17
19
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"operationsPriorities.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPriorities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAkJF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
1
+ {"version":3,"file":"operationsPriorities.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPriorities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAS7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEtB,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AA6JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAYtD,CAAC"}
@@ -7,17 +7,49 @@
7
7
  */
8
8
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
9
9
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
10
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
10
11
  import { randint } from "../../../../math/utils/random/randint.js";
12
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
11
13
  import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
12
14
  import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
13
15
  import { DivideNode } from "../../../../tree/nodes/operators/divideNode.js";
14
16
  import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
15
17
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
16
18
  import { shuffle } from "../../../../utils/alea/shuffle.js";
19
+ const getStartStatement = (identifiers) => {
20
+ const { statementIds } = identifiers;
21
+ return reifyAlgebraic(statementIds).toTex();
22
+ };
23
+ const getInstruction = (identifiers) => {
24
+ return `Calculer :
25
+
26
+ $$
27
+ ${getStartStatement(identifiers)}
28
+ $$`;
29
+ };
30
+ const getAnswer = (identifiers) => {
31
+ const { statementIds } = identifiers;
32
+ return reifyAlgebraic(statementIds).simplify().toTex();
33
+ };
34
+ const getHint = (identifiers) => {
35
+ return ``;
36
+ };
37
+ const getCorrection = (identifiers) => {
38
+ return ``;
39
+ };
40
+ const getQuestionFromIdentifiers = (identifiers) => {
41
+ const question = {
42
+ instruction: getInstruction(identifiers),
43
+ startStatement: getStartStatement(identifiers),
44
+ answer: getAnswer(identifiers),
45
+ keys: [],
46
+ answerFormat: "tex",
47
+ identifiers,
48
+ };
49
+ return question;
50
+ };
17
51
  const getPriorityQuestions = () => {
18
52
  const type = randint(1, 9);
19
- let startStatement = "";
20
- let answer = "";
21
53
  let a, b, c, d;
22
54
  let statement;
23
55
  switch (type) {
@@ -30,8 +62,6 @@ const getPriorityQuestions = () => {
30
62
  : //a*b middle
31
63
  new AddNode(new AddNode(new NumberNode(c), new MultiplyNode(new NumberNode(a), new NumberNode(b))), new NumberNode(d));
32
64
  statement = statement.shuffle();
33
- startStatement = statement.toTex();
34
- answer = (a * b + c + d).toString();
35
65
  break;
36
66
  case 2: // a/b ±c±d
37
67
  [b, c, d] = [1, 2, 3].map((el) => randint(-10, 11, [0]));
@@ -42,67 +72,50 @@ const getPriorityQuestions = () => {
42
72
  : //a/b middle
43
73
  new AddNode(new AddNode(new NumberNode(c), new DivideNode(new NumberNode(a), new NumberNode(b))), new NumberNode(d));
44
74
  statement = statement.shuffle();
45
- startStatement = statement.toTex();
46
- answer = (a / b + c + d).toString();
47
75
  break;
48
76
  case 3: // a*b ± c*d
49
77
  [a, b, c, d] = [1, 2, 3, 4].map((el) => randint(-10, 11));
50
78
  statement = new AddNode(new MultiplyNode(new NumberNode(a), new NumberNode(b)), new MultiplyNode(new NumberNode(c), new NumberNode(d)));
51
- startStatement = statement.toTex();
52
- answer = (a * b + c * d).toString();
53
79
  break;
54
80
  case 4: // a*b ± c/d
55
81
  [a, b] = [1, 2].map((el) => randint(-10, 11));
56
82
  d = randint(-10, 11, [0]);
57
83
  c = d * randint(0, 11);
58
84
  statement = new AddNode(new MultiplyNode(new NumberNode(a), new NumberNode(b)), new DivideNode(new NumberNode(c), new NumberNode(d)));
59
- statement = statement.shuffle();
60
- startStatement = statement.toTex();
61
- answer = (a * b + c / d).toString();
62
85
  break;
63
86
  case 5: // a/b ± c/d
64
87
  [b, d] = [1, 2].map((el) => randint(-10, 11, [0]));
65
88
  a = b * randint(0, 11);
66
89
  c = d * randint(0, 11);
67
90
  statement = new AddNode(new DivideNode(new NumberNode(a), new NumberNode(b)), new DivideNode(new NumberNode(c), new NumberNode(d)));
68
- startStatement = statement.toTex();
69
- answer = (a / b + c / d).toString();
70
91
  break;
71
92
  case 6: // a*b*c ± d
72
93
  [a, b, c, d] = [1, 2, 3, 4].map((el) => randint(-10, 11, [0]));
73
94
  statement = new AddNode(new MultiplyNode(new MultiplyNode(new NumberNode(a), new NumberNode(b)), new NumberNode(c)), new NumberNode(d));
74
- statement = statement.shuffle();
75
- startStatement = statement.toTex();
76
- answer = (a * b * c + d).toString();
77
95
  break;
78
96
  case 7: //a/b*c et c*a/b
79
97
  b = randint(2, 10);
80
98
  a = b * randint(2, 10);
81
99
  c = randint(2, 10);
82
100
  statement = new MultiplyNode(new DivideNode(a.toTree(), b.toTree()), c.toTree()).shuffle();
83
- answer = ((a / b) * c).frenchify();
84
- startStatement = statement.toTex();
85
101
  break;
86
102
  case 8: //a+-b+-c
103
+ default:
87
104
  a = randint(-15, 15);
88
105
  b = randint(-10, 10);
89
106
  c = b > 0 ? randint(-10, 0) : randint(-10, 10);
90
107
  statement = new AddNode(new AddNode(a.toTree(), b.toTree()), c.toTree());
91
- answer = (a + b + c).frenchify();
92
- startStatement = statement.toTex();
93
108
  break;
94
- default:
95
- throw Error("impossible");
96
109
  }
97
- const question = {
98
- instruction: `Calculer : $${startStatement}$`,
99
- startStatement,
100
- answer,
101
- keys: [],
102
- answerFormat: "tex",
103
- identifiers: { type, a, b, c, d },
110
+ const identifiers = {
111
+ type,
112
+ a,
113
+ b,
114
+ c,
115
+ d,
116
+ statementIds: statement.toIdentifiers(),
104
117
  };
105
- return question;
118
+ return getQuestionFromIdentifiers(identifiers);
106
119
  };
107
120
  const getPropositions = (n, { answer }) => {
108
121
  const propositions = [];
@@ -112,17 +125,13 @@ const getPropositions = (n, { answer }) => {
112
125
  }
113
126
  return shuffle(propositions);
114
127
  };
115
- const isAnswerValid = (studentAns, { answer }) => {
116
- const answerTree = new NumberNode(Number(answer));
117
- const texs = answerTree.toAllValidTexs();
118
- return texs.includes(studentAns);
128
+ const isAnswerValid = (ans, { answer }) => {
129
+ return numberVEA(ans, answer);
119
130
  };
120
131
  export const operationsPriorities = {
121
132
  id: "operationsPriorities",
122
133
  connector: "=",
123
134
  label: "Priorités opératoires",
124
- levels: ["5ème", "4ème"],
125
- sections: ["Calculs"],
126
135
  isSingleStep: true,
127
136
  generator: (nb) => getDistinctQuestions(getPriorityQuestions, nb),
128
137
  qcmTimer: 60,
@@ -130,4 +139,5 @@ export const operationsPriorities = {
130
139
  getPropositions,
131
140
  isAnswerValid,
132
141
  subject: "Mathématiques",
142
+ getQuestionFromIdentifiers,
133
143
  };
@@ -1 +1 @@
1
- {"version":3,"file":"multiplicationEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/multiplicationEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAarC,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;AA8HF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
1
+ {"version":3,"file":"multiplicationEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/multiplicationEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAarC,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;AA8HF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
@@ -123,8 +123,5 @@ export const multiplicationEquation = {
123
123
  isAnswerValid,
124
124
  subject: "Mathématiques",
125
125
  hasHintAndCorrection: true,
126
- getInstruction,
127
- getAnswer,
128
- getCorrection,
129
- getHint,
126
+ getQuestionFromIdentifiers,
130
127
  };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * type (ax+b)(cx+d) ± (ax+b)(ex+f)
3
+ */
4
+ import { Exercise } from "../../../../exercises/exercise.js";
5
+ /**
6
+ * facto du type (ax+b)(cx+d) ± (ax+b)(ex+f)
7
+ * b, d, f non nuls
8
+ */
9
+ type Identifiers = {
10
+ affinesCoeffs: number[][];
11
+ operation: string;
12
+ affinesOrder: number[];
13
+ };
14
+ export declare const factoType1Exercise: Exercise<Identifiers>;
15
+ export {};
16
+ //# sourceMappingURL=facto1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"facto1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/facto1.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAwBrC;;;GAGG;AACH,KAAK,WAAW,GAAG;IAEjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA4NF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * type (ax+b)(cx+d) ± (ax+b)(ex+f)
3
+ */
4
+ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
5
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
6
+ import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.js";
7
+ import { randint } from "../../../../math/utils/random/randint.js";
8
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
9
+ import { MultiplyNode, isMultiplyNode, multiply, } from "../../../../tree/nodes/operators/multiplyNode.js";
10
+ import { isPowerNode, isSquareNode, } from "../../../../tree/nodes/operators/powerNode.js";
11
+ import { substract, } from "../../../../tree/nodes/operators/substractNode.js";
12
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
13
+ import { random } from "../../../../utils/alea/random.js";
14
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
15
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
16
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
17
+ const getStatementNode = (identifiers) => {
18
+ const { affinesCoeffs, operation, affinesOrder } = identifiers;
19
+ const affines = affinesCoeffs.map((coeffs) => new Affine(coeffs[1], coeffs[0]));
20
+ const order = [[], []];
21
+ order[0][affinesOrder[0]] = affines[1];
22
+ order[1][affinesOrder[1]] = affines[2];
23
+ order[0][1 - affinesOrder[0]] = affines[0];
24
+ order[1][1 - affinesOrder[1]] = affines[0];
25
+ const statementTree = (operation === "add" ? add : substract)(new MultiplyNode(order[0][0].toTree(), order[0][1].toTree()), new MultiplyNode(order[1][0].toTree(), order[1][1].toTree()));
26
+ return statementTree;
27
+ };
28
+ const getInstruction = (identifiers) => {
29
+ const { affinesCoeffs, operation } = identifiers;
30
+ return `Factoriser et réduire :
31
+
32
+ $$
33
+ ${getStatementNode(identifiers).toTex()}
34
+ $$`;
35
+ };
36
+ const getAnswerNode = (identifiers) => {
37
+ const { affinesCoeffs, operation } = identifiers;
38
+ const factor = new Affine(affinesCoeffs[0][1], affinesCoeffs[0][0]);
39
+ const affine2 = new Affine(affinesCoeffs[2][1], affinesCoeffs[2][0]);
40
+ const affine1 = new Affine(affinesCoeffs[1][1], affinesCoeffs[1][0]);
41
+ const secondTerm = (operation === "add"
42
+ ? add(affine1.toTree(), affine2.toTree())
43
+ : substract(affine1.toTree(), affine2.toTree())).simplify({ forbidFactorize: true, towardsDistribute: true });
44
+ const sol = multiply(factor.toTree(), secondTerm).simplify({});
45
+ return sol;
46
+ };
47
+ const getAnswer = (identifiers) => {
48
+ return getAnswerNode(identifiers).toTex();
49
+ };
50
+ const getFactoType1Question = () => {
51
+ const a = randint(-9, 10, [0]);
52
+ const b = randint(-9, 10, [0]);
53
+ let operation = random(["add", "substract"]);
54
+ let c, d;
55
+ let e, f;
56
+ do {
57
+ c = randint(-9, 10, [0]);
58
+ d = randint(-9, 10, [0]);
59
+ e = randint(-9, 10, [0]);
60
+ f = randint(-9, 10, [0]);
61
+ } while (c / a === d / b ||
62
+ e / a === f / b ||
63
+ //éviter un multiple +-1
64
+ (operation === "add" && f === -d && Math.abs(e + c) === 1) ||
65
+ (operation === "substract" && f === d && Math.abs(e - c) === 1));
66
+ const identifiers = {
67
+ affinesCoeffs: [
68
+ [a, b],
69
+ [c, d],
70
+ [e, f],
71
+ ],
72
+ operation,
73
+ affinesOrder: [random([0, 1]), random([0, 1])],
74
+ };
75
+ return getQuestionFromIdentifiers(identifiers);
76
+ };
77
+ const getQuestionFromIdentifiers = (identifiers) => {
78
+ const question = {
79
+ instruction: getInstruction(identifiers),
80
+ startStatement: getStatementNode(identifiers).toTex(),
81
+ answer: getAnswer(identifiers),
82
+ keys: ["x"],
83
+ answerFormat: "tex",
84
+ identifiers,
85
+ hint: getHint(identifiers),
86
+ correction: getCorrection(identifiers),
87
+ };
88
+ return question;
89
+ };
90
+ const getHint = (identifiers) => {
91
+ return `On repère le facteur commun dans les deux termes de l'expression.
92
+
93
+ On utilise ensuite la propriété :
94
+
95
+ $$
96
+ k\\times a + k \\times b = k\\times (a+b)
97
+ $$`;
98
+ };
99
+ const getCorrection = (identifiers) => {
100
+ const { affinesCoeffs, operation, affinesOrder } = identifiers;
101
+ const affines = affinesCoeffs.map((coeffs) => new Affine(coeffs[1], coeffs[0]));
102
+ const order = [[], []];
103
+ order[0][affinesOrder[0]] = affines[1];
104
+ order[1][affinesOrder[1]] = affines[2];
105
+ order[0][1 - affinesOrder[0]] = affines[0];
106
+ order[1][1 - affinesOrder[1]] = affines[0];
107
+ const statementTree = (operation === "add" ? add : substract)(new MultiplyNode(order[0][0].toTree(), order[0][1].toTree()), new MultiplyNode(order[1][0].toTree(), order[1][1].toTree()));
108
+ return `On repère que le facteur commun dans les deux termes est :
109
+
110
+ $$
111
+ ${affines[0].toTree().toTex()}
112
+ $$
113
+
114
+ On a donc :
115
+
116
+ ${alignTex([
117
+ ["", statementTree.toTex()],
118
+ [
119
+ "=",
120
+ multiply(affines[0].toTree(), (operation === "add" ? add : substract)(affines[1].toTree(), affines[2].toTree())).toTex(),
121
+ ],
122
+ ["=", getAnswer(identifiers)],
123
+ ])}`;
124
+ };
125
+ const getPropositions = (n, { answer, affinesCoeffs, operation }) => {
126
+ const propositions = [];
127
+ addValidProp(propositions, answer);
128
+ const affines = affinesCoeffs.map((coeffs) => new Affine(coeffs[1], coeffs[0]));
129
+ tryToAddWrongProp(propositions, new MultiplyNode(affines[0].toTree(), affines[1]
130
+ .add(operation !== "add" ? affines[2] : affines[2].opposite())
131
+ .toTree()).toTex());
132
+ tryToAddWrongProp(propositions, new MultiplyNode(affines[1].toTree(), affines[0]
133
+ .add(operation === "add" ? affines[2] : affines[2].opposite())
134
+ .toTree()).toTex());
135
+ tryToAddWrongProp(propositions, new MultiplyNode(affines[2].toTree(), affines[0]
136
+ .add(operation === "add" ? affines[2] : affines[2].opposite())
137
+ .toTree()).toTex());
138
+ while (propositions.length < n) {
139
+ const wrongAnswer = new MultiplyNode(affines[0].toTree(), affines[1].add(AffineConstructor.differentRandoms(1)[0]).toTree());
140
+ tryToAddWrongProp(propositions, wrongAnswer.toTex());
141
+ }
142
+ return shuffle(propositions);
143
+ };
144
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
145
+ try {
146
+ const parsed = parseAlgebraic(ans);
147
+ if (!parsed)
148
+ return false;
149
+ if (answer !== "0" &&
150
+ !isMultiplyNode(parsed) &&
151
+ !isSquareNode(parsed) &&
152
+ !isPowerNode(parsed))
153
+ return false;
154
+ const simp = parsed.simplify({
155
+ forbidFactorize: true,
156
+ towardsDistribute: true,
157
+ });
158
+ const answerSimp = getAnswerNode(identifiers).simplify({
159
+ towardsDistribute: true,
160
+ forbidFactorize: true,
161
+ });
162
+ // const simp = parsed.simplify({});
163
+ return simp.toTex() === answerSimp.toTex();
164
+ }
165
+ catch (err) {
166
+ return handleVEAError(err);
167
+ }
168
+ };
169
+ export const factoType1Exercise = {
170
+ id: "facto1",
171
+ connector: "=",
172
+ isSingleStep: false,
173
+ label: "Factorisation du type $(ax+b)(cx+d) \\pm (ax+b)(ex+f)$",
174
+ generator: (nb) => getDistinctQuestions(getFactoType1Question, nb),
175
+ qcmTimer: 60,
176
+ freeTimer: 60,
177
+ getPropositions,
178
+ isAnswerValid,
179
+ subject: "Mathématiques",
180
+ getInstruction,
181
+ getAnswer,
182
+ getQuestionFromIdentifiers,
183
+ hasHintAndCorrection: true,
184
+ };
@@ -1,7 +1,7 @@
1
1
  export * from "./factoIdRmq1.js";
2
2
  export * from "./factoIdRmq2.js";
3
3
  export * from "./factoIdRmq3.js";
4
- export * from "./factoType1Exercise.js";
4
+ export * from "./facto1.js";
5
5
  export * from "./factorizeCanonicalForm.js";
6
6
  export * from "./factorizeCanonicalFormWithSqrt.js";
7
7
  export * from "./factoType2.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export * from "./factoIdRmq1.js";
2
2
  export * from "./factoIdRmq2.js";
3
3
  export * from "./factoIdRmq3.js";
4
- export * from "./factoType1Exercise.js";
4
+ export * from "./facto1.js";
5
5
  export * from "./factorizeCanonicalForm.js";
6
6
  export * from "./factorizeCanonicalFormWithSqrt.js";
7
7
  export * from "./factoType2.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ askConvex: boolean;
4
+ quadcoeffs: number[];
5
+ };
6
+ export declare const convexityQuadrinomials: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=convexityQuadrinomials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convexityQuadrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/convexityQuadrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAqIF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { MinusInfinityNode, PlusInfinityNode, } from "../../../../tree/nodes/numbers/infiniteNode.js";
6
+ import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
7
+ import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
8
+ import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
10
+ import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
11
+ import { intervalParser } from "../../../../tree/parsers/intervalParser.js";
12
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
13
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
14
+ const getInstruction = (identifiers) => {
15
+ const { askConvex, quadcoeffs } = identifiers;
16
+ const quadrinomial = new Polynomial(quadcoeffs);
17
+ const questionType = askConvex ? "convexe" : "concave";
18
+ return `Soit la fonction $f$ définie par :
19
+
20
+ $$
21
+ f(x) = ${quadrinomial.toTex()}
22
+ $$
23
+
24
+ Sur quelle intervalle $f$ est-elle ${questionType} ?`;
25
+ };
26
+ const getAnswer = (identifiers) => {
27
+ const { askConvex, quadcoeffs } = identifiers;
28
+ const quadrinomial = new Polynomial(quadcoeffs);
29
+ const secondderivative = quadrinomial.derivate().derivate();
30
+ const seconddcoeffs = secondderivative.coefficients;
31
+ const inflexionPoint = new FractionNode(new MultiplyNode(seconddcoeffs[0].toTree(), new NumberNode(-1)), seconddcoeffs[1].toTree()).simplify();
32
+ let interval;
33
+ if (askConvex) {
34
+ interval =
35
+ quadcoeffs[3] > 0
36
+ ? new IntervalNode(inflexionPoint, PlusInfinityNode, ClosureType.OO).toTex()
37
+ : new IntervalNode(MinusInfinityNode, inflexionPoint, ClosureType.OO).toTex();
38
+ }
39
+ else {
40
+ interval =
41
+ quadcoeffs[3] <= 0
42
+ ? new IntervalNode(inflexionPoint, PlusInfinityNode, ClosureType.OO).toTex()
43
+ : new IntervalNode(MinusInfinityNode, inflexionPoint, ClosureType.OO).toTex();
44
+ }
45
+ return interval;
46
+ };
47
+ const getConvexityQuadrinomialsQuestion = () => {
48
+ const quadrinomial = PolynomialConstructor.randomWithOrder(3);
49
+ const quadcoeffs = quadrinomial.coefficients;
50
+ const askConvex = coinFlip();
51
+ const identifiers = { askConvex, quadcoeffs };
52
+ const question = {
53
+ answer: getAnswer(identifiers),
54
+ instruction: getInstruction(identifiers),
55
+ keys: ["rbracket", "lbracket", "semicolon", "infty", "reals"],
56
+ answerFormat: "tex",
57
+ identifiers,
58
+ };
59
+ return question;
60
+ };
61
+ const getPropositions = (n, { answer, quadcoeffs }) => {
62
+ const propositions = [];
63
+ addValidProp(propositions, answer, "tex");
64
+ const quadrinomial = new Polynomial(quadcoeffs);
65
+ const secondderivative = quadrinomial.derivate().derivate();
66
+ const seconddcoeffs = secondderivative.coefficients;
67
+ const inflexionPoint = new FractionNode(new MultiplyNode(seconddcoeffs[0].toTree(), new NumberNode(-1)), seconddcoeffs[1].toTree()).simplify();
68
+ const wrongInterval1 = new IntervalNode(inflexionPoint, PlusInfinityNode, ClosureType.OO).toTex();
69
+ const wrongInterval2 = new IntervalNode(MinusInfinityNode, inflexionPoint, ClosureType.OO).toTex();
70
+ const wrongInterval3 = new IntervalNode(MinusInfinityNode, PlusInfinityNode, ClosureType.OO).toTex();
71
+ const wrongInterval4 = new IntervalNode(new NumberNode(randint(-1, 2)), PlusInfinityNode, ClosureType.FO).toTex();
72
+ tryToAddWrongProp(propositions, wrongInterval1);
73
+ tryToAddWrongProp(propositions, wrongInterval2);
74
+ tryToAddWrongProp(propositions, wrongInterval3);
75
+ tryToAddWrongProp(propositions, wrongInterval4);
76
+ return shuffleProps(propositions, n);
77
+ };
78
+ const isAnswerValid = (ans, { answer, askConvex, quadcoeffs }) => {
79
+ try {
80
+ const parsed = intervalParser(ans);
81
+ if (!parsed)
82
+ return false;
83
+ return parsed.simplify().toTex() === answer;
84
+ }
85
+ catch (err) {
86
+ return handleVEAError(err);
87
+ }
88
+ };
89
+ export const convexityQuadrinomials = {
90
+ id: "convexityQuadrinomials",
91
+ label: "Convexité des fonctions polynomiales de degré $3$",
92
+ isSingleStep: true,
93
+ generator: (nb) => getDistinctQuestions(getConvexityQuadrinomialsQuestion, nb),
94
+ qcmTimer: 60,
95
+ freeTimer: 60,
96
+ answerType: "QCU",
97
+ getPropositions,
98
+ isAnswerValid,
99
+ subject: "Mathématiques",
100
+ getAnswer,
101
+ getInstruction,
102
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ coeffs: number[];
4
+ };
5
+ export declare const convexityTrinomials: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=convexityTrinomials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convexityTrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/convexityTrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA0CF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAarD,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
4
+ const getInstruction = (identifiers) => {
5
+ const trinom = TrinomConstructor.fromCoeffs(identifiers.coeffs);
6
+ return `Soit la fonction $f$ définie par :
7
+
8
+ $$
9
+ f(x) = ${trinom.toTex()}
10
+ $$
11
+
12
+ Sur $\\mathbb{R}$, $f$ est :`;
13
+ };
14
+ const getAnswer = (identifiers) => {
15
+ const trinom = TrinomConstructor.fromCoeffs(identifiers.coeffs);
16
+ const isConvex = trinom.a > 0 ? "Convexe" : "Concave";
17
+ return isConvex;
18
+ };
19
+ const getConvexityTrinomialsQuestion = () => {
20
+ const trinom = TrinomConstructor.random();
21
+ const identifiers = { coeffs: trinom.coefficients };
22
+ const question = {
23
+ answer: getAnswer(identifiers),
24
+ instruction: getInstruction(identifiers),
25
+ keys: [],
26
+ answerFormat: "raw",
27
+ identifiers,
28
+ };
29
+ return question;
30
+ };
31
+ const getPropositions = (n, { answer }) => {
32
+ const propositions = [];
33
+ addValidProp(propositions, answer, "raw");
34
+ tryToAddWrongProp(propositions, "Concave", "raw");
35
+ tryToAddWrongProp(propositions, "Convexe", "raw");
36
+ tryToAddWrongProp(propositions, "Ni concave, ni convexe", "raw");
37
+ tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
38
+ return shuffleProps(propositions, n);
39
+ };
40
+ export const convexityTrinomials = {
41
+ id: "convexityTrinomials",
42
+ label: "Déterminer la convexité d'un trinôme",
43
+ isSingleStep: true,
44
+ generator: (nb) => getDistinctQuestions(getConvexityTrinomialsQuestion, nb),
45
+ qcmTimer: 60,
46
+ freeTimer: 60,
47
+ answerType: "QCU",
48
+ getPropositions,
49
+ subject: "Mathématiques",
50
+ getAnswer,
51
+ getInstruction,
52
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./convexityTrinomials.js";
2
+ export * from "./convexityQuadrinomials.js";
3
+ export * from "./inflexionPointQuadrinomials.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./convexityTrinomials.js";
2
+ export * from "./convexityQuadrinomials.js";
3
+ export * from "./inflexionPointQuadrinomials.js";
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ quadcoeffs: number[];
4
+ };
5
+ export declare const inflexionPointQuadrinomials: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=inflexionPointQuadrinomials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inflexionPointQuadrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/inflexionPointQuadrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAsJF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAkB7D,CAAC"}