math-exercises 3.0.9 → 3.0.11

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 (139) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/fractions/fractionsOperations.js +0 -1
  3. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.js +1 -1
  4. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  5. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +6 -2
  6. package/lib/exercises/math/functions/basics/imageFunctionGeogebra.d.ts +1 -1
  7. package/lib/exercises/math/functions/basics/imageFunctionGeogebra.d.ts.map +1 -1
  8. package/lib/exercises/math/functions/basics/imageFunctionGeogebra.js +54 -17
  9. package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.d.ts +11 -0
  10. package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.d.ts.map +1 -0
  11. package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.js +134 -0
  12. package/lib/exercises/math/functions/trinoms/devForm/index.d.ts +3 -0
  13. package/lib/exercises/math/functions/trinoms/devForm/index.d.ts.map +1 -0
  14. package/lib/exercises/math/functions/trinoms/devForm/index.js +2 -0
  15. package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts +9 -0
  16. package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts.map +1 -0
  17. package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.js +42 -0
  18. package/lib/exercises/math/functions/trinoms/equation/deltaTrinom.d.ts +9 -0
  19. package/lib/exercises/math/functions/trinoms/equation/deltaTrinom.d.ts.map +1 -0
  20. package/lib/exercises/math/functions/trinoms/equation/deltaTrinom.js +50 -0
  21. package/lib/exercises/math/functions/trinoms/equation/index.d.ts +5 -0
  22. package/lib/exercises/math/functions/trinoms/equation/index.d.ts.map +1 -0
  23. package/lib/exercises/math/functions/trinoms/equation/index.js +4 -0
  24. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts +11 -0
  25. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -0
  26. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.js +102 -0
  27. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts +9 -0
  28. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -0
  29. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.js +131 -0
  30. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts +7 -0
  31. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -0
  32. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.js +69 -0
  33. package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts +8 -0
  34. package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts.map +1 -0
  35. package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.js +72 -0
  36. package/lib/exercises/math/functions/trinoms/factoForm/index.d.ts +2 -0
  37. package/lib/exercises/math/functions/trinoms/factoForm/index.d.ts.map +1 -0
  38. package/lib/exercises/math/functions/trinoms/factoForm/index.js +1 -0
  39. package/lib/exercises/math/functions/trinoms/index.d.ts +7 -23
  40. package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
  41. package/lib/exercises/math/functions/trinoms/index.js +7 -23
  42. package/lib/exercises/math/functions/trinoms/parabole/index.d.ts +3 -0
  43. package/lib/exercises/math/functions/trinoms/parabole/index.d.ts.map +1 -0
  44. package/lib/exercises/math/functions/trinoms/parabole/index.js +2 -0
  45. package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts +8 -0
  46. package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts.map +1 -0
  47. package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.js +285 -0
  48. package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.d.ts +9 -0
  49. package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.d.ts.map +1 -0
  50. package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.js +112 -0
  51. package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.d.ts +10 -0
  52. package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.d.ts.map +1 -0
  53. package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.js +124 -0
  54. package/lib/exercises/math/functions/trinoms/roots/index.d.ts +8 -0
  55. package/lib/exercises/math/functions/trinoms/roots/index.d.ts.map +1 -0
  56. package/lib/exercises/math/functions/trinoms/roots/index.js +7 -0
  57. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts +9 -0
  58. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts.map +1 -0
  59. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.js +54 -0
  60. package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts +9 -0
  61. package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -0
  62. package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +55 -0
  63. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts +9 -0
  64. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -0
  65. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +67 -0
  66. package/lib/exercises/math/functions/trinoms/roots/rootsProduct.d.ts +8 -0
  67. package/lib/exercises/math/functions/trinoms/roots/rootsProduct.d.ts.map +1 -0
  68. package/lib/exercises/math/functions/trinoms/roots/rootsProduct.js +109 -0
  69. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts +9 -0
  70. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -0
  71. package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +63 -0
  72. package/lib/exercises/math/functions/trinoms/roots/rootsSum.d.ts +8 -0
  73. package/lib/exercises/math/functions/trinoms/roots/rootsSum.d.ts.map +1 -0
  74. package/lib/exercises/math/functions/trinoms/roots/rootsSum.js +109 -0
  75. package/lib/exercises/math/functions/trinoms/sign/index.d.ts +3 -0
  76. package/lib/exercises/math/functions/trinoms/sign/index.d.ts.map +1 -0
  77. package/lib/exercises/math/functions/trinoms/sign/index.js +2 -0
  78. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts +8 -0
  79. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts.map +1 -0
  80. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.js +120 -0
  81. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.d.ts +8 -0
  82. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.d.ts.map +1 -0
  83. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.js +119 -0
  84. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts +8 -0
  85. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts.map +1 -0
  86. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.js +49 -0
  87. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaInCanonicalForm.d.ts +10 -0
  88. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaInCanonicalForm.d.ts.map +1 -0
  89. package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaInCanonicalForm.js +64 -0
  90. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts +9 -0
  91. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map +1 -0
  92. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.js +48 -0
  93. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.d.ts +9 -0
  94. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.d.ts.map +1 -0
  95. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.js +55 -0
  96. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts +9 -0
  97. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts.map +1 -0
  98. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.js +42 -0
  99. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts +9 -0
  100. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts.map +1 -0
  101. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.js +8 -0
  102. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts +9 -0
  103. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts.map +1 -0
  104. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.js +90 -0
  105. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts +9 -0
  106. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts.map +1 -0
  107. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.js +55 -0
  108. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts +9 -0
  109. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts.map +1 -0
  110. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.js +59 -0
  111. package/lib/exercises/math/geometry/areas/triangleArea.d.ts +2 -0
  112. package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
  113. package/lib/exercises/math/geometry/areas/triangleArea.js +56 -31
  114. package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.d.ts.map +1 -1
  115. package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.js +34 -14
  116. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
  117. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
  118. package/lib/index.d.ts +43 -32
  119. package/lib/index.d.ts.map +1 -1
  120. package/lib/math/geometry/line.d.ts +1 -1
  121. package/lib/math/geometry/line.d.ts.map +1 -1
  122. package/lib/math/geometry/line.js +11 -1
  123. package/lib/math/geometry/parabola.d.ts +1 -1
  124. package/lib/math/geometry/parabola.d.ts.map +1 -1
  125. package/lib/math/geometry/parabola.js +4 -1
  126. package/lib/math/geometry/triangle.d.ts +1 -0
  127. package/lib/math/geometry/triangle.d.ts.map +1 -1
  128. package/lib/math/geometry/triangle.js +10 -2
  129. package/lib/math/systems/generalSystem.d.ts.map +1 -1
  130. package/lib/tests/questionTest.d.ts.map +1 -1
  131. package/lib/tests/questionTest.js +1 -1
  132. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  133. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  134. package/lib/tree/nodes/polynomials/trinomNode.d.ts +1 -0
  135. package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -1
  136. package/lib/tree/nodes/polynomials/trinomNode.js +9 -0
  137. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  138. package/lib/tree/nodes/variables/variableNode.js +1 -3
  139. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"fractionsOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,eAAe,CAAC;CACvC,CAAC;AA4FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
1
+ {"version":3,"file":"fractionsOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,eAAe,CAAC;CACvC,CAAC;AA2FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
@@ -17,7 +17,6 @@ const getPropositions = (n, { answer }) => {
17
17
  return shuffleProps(propositions, n);
18
18
  };
19
19
  const getAnswer = (identifiers) => {
20
- console.log("ans", identifiers);
21
20
  const statement = NodeConstructor.fromIdentifiers(identifiers.statementIdentifiers, true);
22
21
  return statement.simplify().toTex();
23
22
  };
@@ -45,7 +45,7 @@ const getHint = (identifiers) => {
45
45
  return `Il faut isoler $x$ à gauche. Pour cela, effectue l'opération des deux côtés de l'équation qui permet de supprimer la multiplication par $${a}$.`;
46
46
  };
47
47
  const getFirstDegreeEquationIntQuestion = () => {
48
- const a = randint(-15, 15, [0]);
48
+ const a = randint(-15, 15, [0, 1]);
49
49
  const x = randint(-15, 15, [0]);
50
50
  const b = a * x;
51
51
  const identifiers = { a: a, x: x, b: b };
@@ -1 +1 @@
1
- {"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAmBrC;;;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;AA8JF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
1
+ {"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAuBrC;;;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;AAoKF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
@@ -7,6 +7,7 @@ import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.j
7
7
  import { randint } from "../../../../math/utils/random/randint.js";
8
8
  import { add } from "../../../../tree/nodes/operators/addNode.js";
9
9
  import { MultiplyNode, isMultiplyNode, multiply, } from "../../../../tree/nodes/operators/multiplyNode.js";
10
+ import { isPowerNode, isSquareNode, } from "../../../../tree/nodes/operators/powerNode.js";
10
11
  import { substract, } from "../../../../tree/nodes/operators/substractNode.js";
11
12
  import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
12
13
  import { random } from "../../../../utils/alea/random.js";
@@ -48,7 +49,7 @@ const getAnswer = (identifiers) => {
48
49
  const getFactoType1Question = () => {
49
50
  const a = randint(-9, 10, [0]);
50
51
  const b = randint(-9, 10, [0]);
51
- const operation = random(["add", "substract"]);
52
+ let operation = random(["add", "substract"]);
52
53
  let c, d;
53
54
  let e, f;
54
55
  do {
@@ -104,7 +105,10 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
104
105
  const parsed = parseAlgebraic(ans);
105
106
  if (!parsed)
106
107
  return false;
107
- if (answer !== "0" && !isMultiplyNode(parsed))
108
+ if (answer !== "0" &&
109
+ !isMultiplyNode(parsed) &&
110
+ !isSquareNode(parsed) &&
111
+ !isPowerNode(parsed))
108
112
  return false;
109
113
  const simp = parsed.simplify({
110
114
  forbidFactorize: true,
@@ -6,7 +6,7 @@ type Identifiers = {
6
6
  functionType: string;
7
7
  x: number;
8
8
  y?: number;
9
- wrongY: number;
9
+ wrongY?: number;
10
10
  otherPoints: number[][];
11
11
  functionCommand?: string;
12
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAsBrC,KAAK,WAAW,GAAG;IACjB,cAAc;IAMd,UAAU;IAMV,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAgRF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBhE,CAAC"}
1
+ {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAyBrC,KAAK,WAAW,GAAG;IACjB,cAAc;IAMd,UAAU;IAMV,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AA0SF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBhE,CAAC"}
@@ -13,8 +13,11 @@ import { randfloat } from "../../../../math/utils/random/randfloat.js";
13
13
  import { randint } from "../../../../math/utils/random/randint.js";
14
14
  import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
15
15
  import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
16
+ import { valueParser } from "../../../../tree/parsers/valueParser.js";
17
+ import { probaFlip } from "../../../../utils/alea/probaFlip.js";
16
18
  import { random } from "../../../../utils/alea/random.js";
17
19
  import { shuffle } from "../../../../utils/alea/shuffle.js";
20
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
18
21
  const rebuildIdentifiers = (oldIds) => {
19
22
  if (oldIds.splinePoints?.length) {
20
23
  const x = oldIds.x;
@@ -51,12 +54,13 @@ const rebuildIdentifiers = (oldIds) => {
51
54
  };
52
55
  const getInstruction = (identifiers, opts) => {
53
56
  const { x } = identifiers;
54
- let instruction = `Quelle est l'image de $${x}$ par la fonction $f$ représentée ci dessous ?`;
55
- if (opts?.curveTypes?.includes("Avec valeur interdite (pas d'image)")) {
56
- instruction += `
57
-
57
+ let instruction = `Quelle est l'image de $${x}$ par la fonction $f$ représentée ci dessous ?
58
+
58
59
  On écrira "aucun" si l'image n'existe pas.`;
59
- }
60
+ // if (opts?.curveTypes?.includes("Avec valeur interdite (pas d'image)")) {
61
+ // instruction += `
62
+ // On écrira "aucun" si l'image n'existe pas.`;
63
+ // }
60
64
  return instruction;
61
65
  };
62
66
  const getAnswer = (identifiers) => {
@@ -67,18 +71,25 @@ const getAnswer = (identifiers) => {
67
71
  };
68
72
  const getGGBOptions = (identifiers) => {
69
73
  const { functionType, otherPoints, wrongY, x, y, functionCommand } = identifiers;
70
- const allPoints = [...otherPoints, [x, y], [wrongY, x]].sort((a, b) => a[0] - b[0]);
74
+ const allPoints = [...otherPoints];
75
+ if (y !== undefined)
76
+ allPoints.push([x, y]);
77
+ if (wrongY !== undefined)
78
+ allPoints.push([wrongY, x]);
79
+ allPoints.sort((a, b) => a[0] - b[0]);
71
80
  let commands = [];
72
81
  switch (functionType) {
73
82
  case "Avec valeur interdite (pas d'image)":
74
83
  commands = [
75
84
  `f(x) = ${functionCommand}`,
76
85
  `SetColor(f, "${randomColor()}")`,
86
+ `SetCaption(f, "$f$")`,
87
+ `ShowLabel(f, true)`,
77
88
  ];
78
89
  break;
79
90
  case "Droites":
80
91
  const line = new Line(new Point("A", allPoints[0][0], allPoints[0][1]), new Point("B", allPoints[1][0], allPoints[1][1]));
81
- commands = line.toGGBCommands(false);
92
+ commands = line.toGGBCommands(false, { showLabel: true, label: "$f$" });
82
93
  break;
83
94
  case "Tracés":
84
95
  //! on devrait plutôt build a spline et renvoyer toGgbCommand
@@ -88,6 +99,8 @@ const getGGBOptions = (identifiers) => {
88
99
  .join(",")})`,
89
100
  "SetFixed(S, true)",
90
101
  `SetColor(S, "${randomColor()}")`,
102
+ `SetCaption(S, "$f$")`,
103
+ `ShowLabel(S, true)`,
91
104
  ];
92
105
  break;
93
106
  case "Paraboles":
@@ -96,7 +109,10 @@ const getGGBOptions = (identifiers) => {
96
109
  new Point("B", allPoints[1][0], allPoints[1][1]),
97
110
  new Point("C", allPoints[2][0], allPoints[2][1]),
98
111
  ]);
99
- commands = parabola.toGGBCommands(false);
112
+ commands = parabola.toGGBCommands(false, {
113
+ showLabel: true,
114
+ label: "$f$",
115
+ });
100
116
  break;
101
117
  case "Polynômes":
102
118
  default:
@@ -107,6 +123,8 @@ const getGGBOptions = (identifiers) => {
107
123
  .join(",")})`,
108
124
  "SetFixed(P, true)",
109
125
  `SetColor(P, "${randomColor()}")`,
126
+ `SetCaption(P, "$f$")`,
127
+ `ShowLabel(P, true)`,
110
128
  ];
111
129
  break;
112
130
  }
@@ -146,12 +164,12 @@ const getStartStatement = (identifiers) => {
146
164
  return `f(${x})`;
147
165
  };
148
166
  const getKeys = (identifiers, options) => {
149
- if (options?.curveTypes?.includes("Avec valeur interdite (pas d'image)")) {
150
- return ["aucun"];
151
- }
152
- else {
153
- return [];
154
- }
167
+ // if (options?.curveTypes?.includes("Avec valeur interdite (pas d'image)")) {
168
+ // return ["aucun"];
169
+ // } else {
170
+ // return [];
171
+ // }
172
+ return ["aucun"];
155
173
  };
156
174
  const getQuestionFromIdentifiers = (identifiers, opts) => {
157
175
  const question = {
@@ -179,6 +197,11 @@ const getImageFunctionGeogebra = (opts) => {
179
197
  functionCommand = `${k}/(x-${x}) -x`;
180
198
  break;
181
199
  case "Droites":
200
+ const isConstante = probaFlip(0.2);
201
+ if (isConstante) {
202
+ wrongY = undefined;
203
+ otherPoints.push([x + 1, y]);
204
+ }
182
205
  //nothing to add
183
206
  break;
184
207
  case "Tracés":
@@ -216,15 +239,27 @@ const getImageFunctionGeogebra = (opts) => {
216
239
  const getPropositions = (n, { answer, wrongY }, opts) => {
217
240
  const propositions = [];
218
241
  addValidProp(propositions, answer);
219
- //old questions have spline POint undefined
220
- tryToAddWrongProp(propositions, wrongY + "");
242
+ if (wrongY !== undefined)
243
+ tryToAddWrongProp(propositions, wrongY + "");
244
+ tryToAddWrongProp(propositions, "\\text{Aucun}");
221
245
  while (propositions.length < n) {
222
- const wrongAnswer = Number(answer) + randint(-10, 11, [0]);
246
+ const wrongAnswer = randint(-10, 11, [0]);
223
247
  tryToAddWrongProp(propositions, wrongAnswer + "");
224
248
  }
225
249
  return shuffle(propositions);
226
250
  };
227
251
  const isAnswerValid = (ans, { answer }, opts) => {
252
+ if (answer === "\\text{Aucun}")
253
+ return ans === answer;
254
+ try {
255
+ const parsed = valueParser(ans);
256
+ if (parsed === false)
257
+ return false;
258
+ return Math.abs(parsed - answer.unfrenchify()) < 0.3;
259
+ }
260
+ catch (err) {
261
+ return handleVEAError(err);
262
+ }
228
263
  return numberVEA(ans, answer);
229
264
  };
230
265
  const options = [
@@ -261,4 +296,6 @@ export const imageFunctionGeogebra = {
261
296
  getGGBOptions,
262
297
  rebuildIdentifiers,
263
298
  getQuestionFromIdentifiers,
299
+ getKeys,
300
+ getStartStatement,
264
301
  };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ aIdentifiers: NodeIdentifiers;
5
+ bIdentifiers: NodeIdentifiers;
6
+ cIdentifiers: NodeIdentifiers;
7
+ isAsking: string;
8
+ };
9
+ export declare const coefficientsIdentification: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=coefficientsIdentification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coefficientsIdentification.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/devForm/coefficientsIdentification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,YAAY,EAAE,eAAe,CAAC;IAC9B,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAuIF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAgB5D,CAAC"}
@@ -0,0 +1,134 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { RationalConstructor } from "../../../../../math/numbers/rationals/rational.js";
4
+ import { TrinomNode } from "../../../../../tree/nodes/polynomials/trinomNode.js";
5
+ import { randint } from "../../../../../math/utils/random/randint.js";
6
+ import { NodeConstructor, } from "../../../../../tree/nodes/nodeConstructor.js";
7
+ import { isFractionNode } from "../../../../../tree/nodes/operators/fractionNode.js";
8
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { square } from "../../../../../tree/nodes/operators/powerNode.js";
10
+ import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
11
+ import { random } from "../../../../../utils/alea/random.js";
12
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
13
+ const getPropositions = (n, { answer, aIdentifiers, bIdentifiers, cIdentifiers, isAsking }) => {
14
+ const propositions = [];
15
+ addValidProp(propositions, answer);
16
+ const trinom = new TrinomNode(NodeConstructor.fromIdentifiers(aIdentifiers), NodeConstructor.fromIdentifiers(bIdentifiers), NodeConstructor.fromIdentifiers(cIdentifiers));
17
+ if (answer === "1") {
18
+ tryToAddWrongProp(propositions, "0");
19
+ }
20
+ if (answer === "0") {
21
+ tryToAddWrongProp(propositions, "1");
22
+ }
23
+ if (answer === "-1") {
24
+ tryToAddWrongProp(propositions, "-");
25
+ }
26
+ const askedNode = isAsking === "a" ? trinom.a : isAsking === "b" ? trinom.b : trinom.c;
27
+ if (isFractionNode(askedNode)) {
28
+ tryToAddWrongProp(propositions, askedNode.leftChild.toTex());
29
+ }
30
+ // si frac ajouter que le num
31
+ const monom = isAsking === "a"
32
+ ? multiply(trinom.a, square("x")).simplify()
33
+ : isAsking === "b"
34
+ ? multiply(trinom.b, "x").simplify()
35
+ : trinom.c;
36
+ tryToAddWrongProp(propositions, monom.toTex());
37
+ while (propositions.length < n) {
38
+ tryToAddWrongProp(propositions, randint(-10, 10) + "");
39
+ }
40
+ return shuffleProps(propositions, n);
41
+ };
42
+ const getAnswer = (identifiers) => {
43
+ const { aIdentifiers, bIdentifiers, cIdentifiers, isAsking } = identifiers;
44
+ return isAsking === "a"
45
+ ? NodeConstructor.fromIdentifiers(aIdentifiers).toTex()
46
+ : isAsking === "b"
47
+ ? NodeConstructor.fromIdentifiers(bIdentifiers).toTex()
48
+ : NodeConstructor.fromIdentifiers(cIdentifiers).toTex();
49
+ };
50
+ const getInstruction = (identifiers) => {
51
+ const trinom = new TrinomNode(NodeConstructor.fromIdentifiers(identifiers.aIdentifiers), NodeConstructor.fromIdentifiers(identifiers.bIdentifiers), NodeConstructor.fromIdentifiers(identifiers.cIdentifiers));
52
+ return `Soit $f$ la fonction polynôme de degré $2$ définie sur $\\mathbb{R}$ par :
53
+
54
+ $$
55
+ f(x)=${trinom
56
+ .toTree()
57
+ .simplify({
58
+ // forceDistributeFractions: true,
59
+ forbidFactorize: true,
60
+ towardsDistribute: true,
61
+ })
62
+ .toTex()}
63
+ $$
64
+
65
+ Quelle est la valeur du coefficient $${identifiers.isAsking}$ de $f$ ?`;
66
+ };
67
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
68
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
69
+ const getKeys = (identifiers) => {
70
+ return [];
71
+ };
72
+ const isAnswerValid = (ans, { answer }) => {
73
+ try {
74
+ const parsed = parseAlgebraic(ans);
75
+ if (!parsed)
76
+ return false;
77
+ return parsed.simplify().toTex() === answer;
78
+ }
79
+ catch (err) {
80
+ return handleVEAError(err);
81
+ }
82
+ };
83
+ const getCoefficientsIdentificationQuestion = () => {
84
+ const a = random([
85
+ (-1).toTree(),
86
+ (1).toTree(),
87
+ randint(-10, 11, [-1, 0, 1]).toTree(),
88
+ RationalConstructor.randomIrreductible().toTree(),
89
+ ]);
90
+ const b = random([
91
+ (-1).toTree(),
92
+ (1).toTree(),
93
+ (0).toTree(),
94
+ randint(-10, 10, [-1, 1, 0]).toTree(),
95
+ RationalConstructor.randomIrreductible().toTree(),
96
+ ]);
97
+ const c = random([
98
+ (0).toTree(),
99
+ randint(-10, 11, [0]).toTree(),
100
+ RationalConstructor.randomIrreductible().toTree(),
101
+ ]);
102
+ const isAsking = random(["a", "b", "c"]);
103
+ const identifiers = {
104
+ aIdentifiers: a.toIdentifiers(),
105
+ bIdentifiers: b.toIdentifiers(),
106
+ cIdentifiers: c.toIdentifiers(),
107
+ isAsking,
108
+ };
109
+ const question = {
110
+ answer: getAnswer(identifiers),
111
+ instruction: getInstruction(identifiers),
112
+ keys: getKeys(identifiers),
113
+ answerFormat: "tex",
114
+ identifiers,
115
+ // hint: getHint(identifiers),
116
+ // correction: getCorrection(identifiers),
117
+ };
118
+ return question;
119
+ };
120
+ export const coefficientsIdentification = {
121
+ id: "coefficientsIdentification",
122
+ connector: "=",
123
+ label: "Reconnaître les coefficients $a$, $b$ et $c$ d'un trinôme exprimé sous forme développée",
124
+ isSingleStep: true,
125
+ generator: (nb) => getDistinctQuestions(getCoefficientsIdentificationQuestion, nb),
126
+ qcmTimer: 60,
127
+ freeTimer: 60,
128
+ getPropositions,
129
+ isAnswerValid,
130
+ subject: "Mathématiques",
131
+ // getHint,
132
+ // getCorrection,
133
+ getAnswer,
134
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./coefficientsIdentification.js";
2
+ export * from "./variationsFromAlgebricForm.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/devForm/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./coefficientsIdentification.js";
2
+ export * from "./variationsFromAlgebricForm.js";
@@ -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 variationsFromAlgebricForm: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=variationsFromAlgebricForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variationsFromAlgebricForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwCF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAc5D,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { addValidProp, addWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
4
+ import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
5
+ import { shuffle } from "../../../../../utils/alea/shuffle.js";
6
+ const getVariationsFromAlgebricFormQuestion = () => {
7
+ const isDevForm = coinFlip();
8
+ const trinom = isDevForm
9
+ ? TrinomConstructor.random()
10
+ : TrinomConstructor.randomCanonical();
11
+ const answer = trinom.a > 0
12
+ ? "Décroissante puis croissante"
13
+ : "Croissante puis décroissante";
14
+ const question = {
15
+ answer: answer,
16
+ instruction: `Quelles sont les variations de la fonction $f$ définie par $f(x) = ${isDevForm ? trinom.toTree().toTex() : trinom.getCanonicalForm().toTex()}$ ?`,
17
+ answerFormat: "raw",
18
+ identifiers: { a: trinom.a, b: trinom.b, c: trinom.c },
19
+ };
20
+ return question;
21
+ };
22
+ const getPropositions = (n, { answer, a }) => {
23
+ const propositions = [];
24
+ addValidProp(propositions, answer, "raw");
25
+ addWrongProp(propositions, a < 0 ? "Décroissante puis croissante" : "Croissante puis décroissante", "raw");
26
+ addWrongProp(propositions, "Constante", "raw");
27
+ addWrongProp(propositions, "On ne peut pas savoir", "raw");
28
+ return shuffle(propositions);
29
+ };
30
+ export const variationsFromAlgebricForm = {
31
+ id: "variationsFromAlgebricForm",
32
+ label: "Déterminer les variations d'une fonction du second degré via sa forme algébrique",
33
+ levels: ["1reSpé"],
34
+ isSingleStep: true,
35
+ sections: ["Second degré"],
36
+ generator: (nb) => getDistinctQuestions(getVariationsFromAlgebricFormQuestion, nb),
37
+ answerType: "QCU",
38
+ qcmTimer: 60,
39
+ freeTimer: 60,
40
+ getPropositions,
41
+ subject: "Mathématiques",
42
+ };
@@ -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 deltaTrinom: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=deltaTrinom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deltaTrinom.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/deltaTrinom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwCF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAc7C,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { addValidProp, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
4
+ import { randint } from "../../../../../math/utils/random/randint.js";
5
+ import { shuffle } from "../../../../../utils/alea/shuffle.js";
6
+ const getDeltaTrinomQuestion = () => {
7
+ const trinom = TrinomConstructor.random();
8
+ const answer = trinom.getDelta() + "";
9
+ const question = {
10
+ answer: answer,
11
+ instruction: `Soit $f(x) = ${trinom
12
+ .toTree()
13
+ .toTex()}$. Calculer le discriminant $\\Delta$.`,
14
+ keys: [],
15
+ answerFormat: "tex",
16
+ identifiers: { a: trinom.a, b: trinom.b, c: trinom.c },
17
+ };
18
+ return question;
19
+ };
20
+ const getPropositions = (n, { answer, a, b, c }) => {
21
+ const propositions = [];
22
+ addValidProp(propositions, answer);
23
+ const bMinus4ac = b - 4 * a * c;
24
+ tryToAddWrongProp(propositions, bMinus4ac + "");
25
+ const bSquarePlus4ac = b ** 2 + a * c;
26
+ tryToAddWrongProp(propositions, bSquarePlus4ac + "");
27
+ while (propositions.length < n) {
28
+ const wrongAnswer = randint(-100, 100) + "";
29
+ tryToAddWrongProp(propositions, wrongAnswer);
30
+ }
31
+ return shuffle(propositions);
32
+ };
33
+ const isAnswerValid = (ans, { a, b, c }) => {
34
+ const delta = b ** 2 - 4 * a * c;
35
+ return ans === delta.toString();
36
+ };
37
+ export const deltaTrinom = {
38
+ id: "deltaTrinom",
39
+ connector: "=",
40
+ getPropositions,
41
+ label: "Calculer le discriminant d'un trinôme",
42
+ levels: ["1reSpé", "TermSpé", "MathComp"],
43
+ isSingleStep: true,
44
+ sections: ["Second degré"],
45
+ generator: (nb) => getDistinctQuestions(getDeltaTrinomQuestion, nb),
46
+ qcmTimer: 60,
47
+ freeTimer: 60,
48
+ isAnswerValid,
49
+ subject: "Mathématiques",
50
+ };
@@ -0,0 +1,5 @@
1
+ export * from "./deltaTrinom.js";
2
+ export * from "./secondDegreeInequation.js";
3
+ export * from "./solveSecondDegreeEquationByFactorisation.js";
4
+ export * from "./solveSecondDegreeEquationFromCano.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wCAAwC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./deltaTrinom.js";
2
+ export * from "./secondDegreeInequation.js";
3
+ export * from "./solveSecondDegreeEquationByFactorisation.js";
4
+ export * from "./solveSecondDegreeEquationFromCano.js";
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { InegalitySymbols } from "../../../../../math/inequations/inequation.js";
3
+ type Identifiers = {
4
+ a: number;
5
+ b: number;
6
+ c: number;
7
+ ineqType: InegalitySymbols;
8
+ };
9
+ export declare const secondDegreeInequation: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=secondDegreeInequation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAiB9C,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;AAwHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}