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
@@ -0,0 +1,102 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { InequationSymbol, InequationSymbolConstructor, } from "../../../../../math/inequations/inequation.js";
4
+ import { Trinom } from "../../../../../math/polynomials/trinom.js";
5
+ import { randint } from "../../../../../math/utils/random/randint.js";
6
+ import { InequationSolutionNode } from "../../../../../tree/nodes/inequations/inequationSolutionNode.js";
7
+ import { MinusInfinityNode, PlusInfinityNode, } from "../../../../../tree/nodes/numbers/infiniteNode.js";
8
+ import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
9
+ import { ClosureType } from "../../../../../tree/nodes/sets/closure.js";
10
+ import { IntervalNode } from "../../../../../tree/nodes/sets/intervalNode.js";
11
+ import { UnionIntervalNode } from "../../../../../tree/nodes/sets/unionIntervalNode.js";
12
+ import { unionIntervalParser } from "../../../../../tree/parsers/unionIntervalParser.js";
13
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
14
+ const getAnswer = ({ a, roots, ineqType }) => {
15
+ const aPositive = a > 0;
16
+ const insideInterval = new IntervalNode(roots[0], roots[1], ineqType.isStrict ? ClosureType.OO : ClosureType.FF);
17
+ const outsideUnion = new UnionIntervalNode([
18
+ new IntervalNode(MinusInfinityNode, roots[0], ineqType.isStrict ? ClosureType.OO : ClosureType.OF),
19
+ new IntervalNode(roots[1], PlusInfinityNode, ineqType.isStrict ? ClosureType.OO : ClosureType.FO),
20
+ ]);
21
+ const tree = ineqType.isSup
22
+ ? aPositive
23
+ ? outsideUnion
24
+ : insideInterval
25
+ : aPositive
26
+ ? insideInterval
27
+ : outsideUnion;
28
+ return new InequationSolutionNode(tree);
29
+ };
30
+ const getSecondDegreeInequationQuestion = () => {
31
+ const a = randint(-5, 6, [0]);
32
+ const x1 = randint(-5, 6);
33
+ const x2 = randint(-5, 6, [x1]);
34
+ const roots = x1 < x2
35
+ ? [new NumberNode(x1), new NumberNode(x2)]
36
+ : [new NumberNode(x2), new NumberNode(x1)];
37
+ const c = a * x1 * x2;
38
+ const b = -a * x2 - a * x1;
39
+ const trinom = new Trinom(a, b, c);
40
+ const ineqType = InequationSymbolConstructor.random();
41
+ const answer = getAnswer({ a: trinom.a, roots, ineqType }).toTex();
42
+ const question = {
43
+ answer,
44
+ instruction: `Soit $f(x) = ${trinom
45
+ .toTree()
46
+ .toTex()}$. Résoudre l'inéquation $f(x) ${ineqType.symbol} 0$.`,
47
+ keys: [
48
+ "S",
49
+ "equal",
50
+ "lbracket",
51
+ "semicolon",
52
+ "rbracket",
53
+ "cup",
54
+ "infty",
55
+ "varnothing",
56
+ ],
57
+ answerFormat: "tex",
58
+ identifiers: {
59
+ a: trinom.a,
60
+ b: trinom.b,
61
+ c: trinom.c,
62
+ ineqType: ineqType.symbol,
63
+ },
64
+ };
65
+ return question;
66
+ };
67
+ const getPropositions = (n, { answer, a, b, c, ineqType }) => {
68
+ const propositions = [];
69
+ addValidProp(propositions, answer);
70
+ const roots = new Trinom(a, b, c).getRootsNode();
71
+ const ineq = new InequationSymbol(ineqType);
72
+ tryToAddWrongProp(propositions, getAnswer({ a: -a, ineqType: ineq, roots }).toTex());
73
+ tryToAddWrongProp(propositions, getAnswer({ a, ineqType: ineq.toStrictnessToggled(), roots }).toTex());
74
+ tryToAddWrongProp(propositions, getAnswer({ a: -a, ineqType: ineq.toStrictnessToggled(), roots }).toTex());
75
+ return shuffleProps(propositions, n);
76
+ };
77
+ const isAnswerValid = (ans, { answer, a, b, c, ineqType }) => {
78
+ try {
79
+ const parsed = unionIntervalParser(ans.replaceAll("S", "").replaceAll("=", ""));
80
+ if (!parsed)
81
+ return false;
82
+ return "S=\\ " + parsed.simplify().toTex() === answer;
83
+ }
84
+ catch (err) {
85
+ return handleVEAError(err);
86
+ }
87
+ };
88
+ export const secondDegreeInequation = {
89
+ id: "secondDegreeInequation",
90
+ connector: "\\iff",
91
+ label: "Résoudre une inéquation du second degré",
92
+ levels: ["1reSpé"],
93
+ isSingleStep: true,
94
+ sections: ["Inéquations", "Second degré"],
95
+ generator: (nb) => getDistinctQuestions(getSecondDegreeInequationQuestion, nb),
96
+ qcmTimer: 60,
97
+ freeTimer: 60,
98
+ getPropositions,
99
+ isAnswerValid,
100
+ subject: "Mathématiques",
101
+ pdfOptions: { shouldSpreadPropositions: true },
102
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ b: number;
5
+ type: number;
6
+ };
7
+ export declare const solveSecondDegreeEquationByFactorisation: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=solveSecondDegreeEquationByFactorisation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solveSecondDegreeEquationByFactorisation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAgIF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAiB1E,CAAC"}
@@ -0,0 +1,131 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { equationKeys } from "../../../../../exercises/utils/keys/equationKeys.js";
4
+ import { Rational } from "../../../../../math/numbers/rationals/rational.js";
5
+ import { Trinom } from "../../../../../math/polynomials/trinom.js";
6
+ import { randint } from "../../../../../math/utils/random/randint.js";
7
+ import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
8
+ import { DiscreteSetNode } from "../../../../../tree/nodes/sets/discreteSetNode.js";
9
+ import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
10
+ /**
11
+ * Equation donnée sous forme ax^2 + bx ou bien forme développée d'une identité remarquable
12
+ * type 1 ax^2 + bx
13
+ * type 2 (ax+b)^2
14
+ * type 3 (ax-b)^2
15
+ * type 4 (ax+b)(ax-b)
16
+ */
17
+ const getSolveSecondDegreeEquationByFactorisationQuestion = () => {
18
+ const type = randint(1, 4);
19
+ let statement = "";
20
+ let roots = [];
21
+ let answer = "";
22
+ let a;
23
+ let b;
24
+ switch (type) {
25
+ case 1:
26
+ {
27
+ //ax^2 + bx
28
+ const trinom = new Trinom(randint(-9, 10, [0]), randint(-9, 10), 0);
29
+ a = trinom.a;
30
+ b = trinom.b;
31
+ statement = trinom.toTex();
32
+ roots = trinom.getRootsNode();
33
+ }
34
+ break;
35
+ case 2:
36
+ {
37
+ //(ax+b)^2
38
+ a = randint(-9, 10, [0]);
39
+ b = randint(1, 10);
40
+ statement = new Trinom(a ** 2, 2 * a * b, b ** 2).toTex();
41
+ roots = [new Rational(-b, a).simplify().toTree()];
42
+ }
43
+ break;
44
+ case 3:
45
+ {
46
+ //(ax-b)^2
47
+ a = randint(-9, 10, [0]);
48
+ b = randint(-9, 0, [0]);
49
+ statement = new Trinom(a ** 2, -2 * a * b, b ** 2).toTex();
50
+ roots = [new Rational(b, a).simplify().toTree()];
51
+ }
52
+ break;
53
+ case 4:
54
+ default:
55
+ {
56
+ //(ax+b)(ax-b)
57
+ a = randint(-9, 10, [0]);
58
+ b = randint(1, 10);
59
+ statement = new Trinom(a ** 2, 0, -(b ** 2)).toTex();
60
+ roots = [b, -b].sort((a, b) => a - b).map((x) => x.toTree());
61
+ }
62
+ break;
63
+ }
64
+ const instruction = `Soit $f(x) = ${statement}$. Factoriser $f(x)$, puis résoudre l'équation $f(x) = 0$.`;
65
+ answer = new EquationSolutionNode(new DiscreteSetNode(roots)).toTex();
66
+ const question = {
67
+ answer,
68
+ instruction,
69
+ keys: [...equationKeys],
70
+ answerFormat: "tex",
71
+ identifiers: { a, b, type },
72
+ };
73
+ return question;
74
+ };
75
+ const getPropositions = (n, { answer }) => {
76
+ const propositions = [];
77
+ addValidProp(propositions, answer);
78
+ while (propositions.length < n) {
79
+ const firstRoot = randint(-10, 10);
80
+ tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode(coinFlip()
81
+ ? [firstRoot.toTree()]
82
+ : [firstRoot, randint(-10, 10, [firstRoot])]
83
+ .sort((a, b) => a - b)
84
+ .map((x) => x.toTree()))).toTex());
85
+ }
86
+ return shuffleProps(propositions, n);
87
+ };
88
+ const isAnswerValid = (ans, { answer, type, a, b }) => {
89
+ let roots = [];
90
+ switch (type) {
91
+ case 1:
92
+ {
93
+ const trinom = new Trinom(a, b, 0);
94
+ roots = trinom.getRootsNode();
95
+ }
96
+ break;
97
+ case 2:
98
+ {
99
+ roots = [new Rational(-b, a).simplify().toTree()];
100
+ }
101
+ break;
102
+ case 3:
103
+ {
104
+ roots = [new Rational(b, a).simplify().toTree()];
105
+ }
106
+ break;
107
+ case 4:
108
+ {
109
+ roots = [b, -b].sort((a, b) => a - b).map((x) => x.toTree());
110
+ }
111
+ break;
112
+ }
113
+ const answerTree = new EquationSolutionNode(new DiscreteSetNode(roots), {
114
+ opts: { allowFractionToDecimal: true, allowRawRightChildAsSolution: true },
115
+ });
116
+ return answerTree.toAllValidTexs().includes(ans);
117
+ };
118
+ export const solveSecondDegreeEquationByFactorisation = {
119
+ id: "solveSecondDegreeEquationByFactorisation",
120
+ connector: "\\iff",
121
+ label: "Résoudre une équation du second degré par factorisation",
122
+ levels: [],
123
+ isSingleStep: true,
124
+ sections: [],
125
+ generator: (nb) => getDistinctQuestions(getSolveSecondDegreeEquationByFactorisationQuestion, nb),
126
+ qcmTimer: 60,
127
+ freeTimer: 60,
128
+ getPropositions,
129
+ isAnswerValid,
130
+ subject: "Mathématiques",
131
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ coeffs: number[];
4
+ };
5
+ export declare const solveSecondDegreeEquationFromCano: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=solveSecondDegreeEquationFromCano.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solveSecondDegreeEquationFromCano.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAkEF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAcnE,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { equationKeys } from "../../../../../exercises/utils/keys/equationKeys.js";
4
+ import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
5
+ import { randint } from "../../../../../math/utils/random/randint.js";
6
+ import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
7
+ import { DiscreteSetNode } from "../../../../../tree/nodes/sets/discreteSetNode.js";
8
+ const getInstruction = (identifiers) => {
9
+ const { coeffs } = identifiers;
10
+ const trinom = TrinomConstructor.fromCoeffs(coeffs);
11
+ const statement = trinom.getCanonicalForm().toTex();
12
+ return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
13
+
14
+ $$
15
+ f(x) = ${statement}
16
+ $$
17
+
18
+ Résoudre l'équation $f(x) = 0$.`;
19
+ };
20
+ const getAnswer = (identifiers) => {
21
+ const { coeffs } = identifiers;
22
+ const trinom = TrinomConstructor.fromCoeffs(coeffs);
23
+ const roots = trinom.getRootsNode();
24
+ const answer = new EquationSolutionNode(new DiscreteSetNode(roots)).toTex();
25
+ return answer;
26
+ };
27
+ const getSolveSecondDegreeEquationFromCanoQuestion = () => {
28
+ const trinom = TrinomConstructor.randomNiceRootsAndSummit();
29
+ const identifiers = { coeffs: trinom.coefficients };
30
+ const question = {
31
+ answer: getAnswer(identifiers),
32
+ instruction: getInstruction(identifiers),
33
+ keys: [...equationKeys],
34
+ answerFormat: "tex",
35
+ identifiers,
36
+ };
37
+ return question;
38
+ };
39
+ const getPropositions = (n, { answer }) => {
40
+ const propositions = [];
41
+ addValidProp(propositions, answer);
42
+ while (propositions.length < n) {
43
+ tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode([randint(-9, 0), randint(1, 10)].map((e) => e.toTree()))).toTex());
44
+ }
45
+ return shuffleProps(propositions, n);
46
+ };
47
+ const isAnswerValid = (ans, { answer, coeffs }) => {
48
+ const trinom = TrinomConstructor.fromCoeffs(coeffs);
49
+ const roots = trinom.getRootsNode();
50
+ const answerTree = new EquationSolutionNode(new DiscreteSetNode(roots), {
51
+ opts: { allowFractionToDecimal: true, allowRawRightChildAsSolution: true },
52
+ });
53
+ const texs = answerTree.toAllValidTexs();
54
+ return texs.includes(ans);
55
+ };
56
+ export const solveSecondDegreeEquationFromCano = {
57
+ id: "solveSecondDegreeEquationFromCano",
58
+ connector: "\\iff",
59
+ label: "Résoudre une équation du type $a(x-b)^2 + c = 0$",
60
+ levels: [],
61
+ isSingleStep: true,
62
+ sections: [],
63
+ generator: (nb) => getDistinctQuestions(getSolveSecondDegreeEquationFromCanoQuestion, nb),
64
+ qcmTimer: 60,
65
+ freeTimer: 60,
66
+ getPropositions,
67
+ isAnswerValid,
68
+ subject: "Mathématiques",
69
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ roots: number[];
4
+ a: number;
5
+ };
6
+ export declare const factorizedFormFromRoots: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=factorizedFormFromRoots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+EF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../../../math/utils/random/randint.js";
4
+ import { multiply, } from "../../../../../tree/nodes/operators/multiplyNode.js";
5
+ import { square } from "../../../../../tree/nodes/operators/powerNode.js";
6
+ import { substract, } from "../../../../../tree/nodes/operators/substractNode.js";
7
+ import { probaFlip } from "../../../../../utils/alea/probaFlip.js";
8
+ const getAnswerNode = (roots, a) => {
9
+ const isSingleRoot = roots.length === 1;
10
+ return isSingleRoot
11
+ ? multiply(a, square(substract("x", roots[0]))).simplify({
12
+ keepPowers: true,
13
+ })
14
+ : multiply(multiply(a, substract("x", roots[0])), substract("x", roots[1])).simplify();
15
+ };
16
+ const getInstruction = (identifiers) => {
17
+ const { a, roots } = identifiers;
18
+ return `Soit $f(x) = ax^2 + bx + c$ un polynôme du second degré avec $a = ${a}$ et qui a ${roots.length === 1
19
+ ? `pour seule racine : $${roots[0]}$`
20
+ : `deux racines : $${roots[0]}$ et $${roots[1]}$`}. Déterminer la forme factorisée de $f$.`;
21
+ };
22
+ const getFactorizedFormFromRootsQuestion = () => {
23
+ const a = randint(-10, 10, [0]);
24
+ const firstRoot = randint(-10, 10);
25
+ const secondRoot = randint(-10, 10, [firstRoot]);
26
+ const isSingleRoot = probaFlip(0.3);
27
+ const roots = isSingleRoot
28
+ ? [firstRoot]
29
+ : [firstRoot, secondRoot].sort((a, b) => a - b);
30
+ const answer = getAnswerNode(roots, a);
31
+ const answerTex = answer.toTex();
32
+ const identifiers = { a, roots };
33
+ const question = {
34
+ answer: answerTex,
35
+ instruction: getInstruction(identifiers),
36
+ keys: ["x"],
37
+ answerFormat: "tex",
38
+ identifiers,
39
+ };
40
+ return question;
41
+ };
42
+ const getPropositions = (n, { answer, a, roots }) => {
43
+ const propositions = [];
44
+ addValidProp(propositions, answer);
45
+ tryToAddWrongProp(propositions, getAnswerNode(roots.map((r) => -r), a).toTex());
46
+ while (propositions.length < n) {
47
+ const x1 = randint(-10, 10);
48
+ const x2 = randint(-10, 10, [x1]);
49
+ tryToAddWrongProp(propositions, getAnswerNode([x1, x2].sort((a, b) => a - b), randint(-10, 10, [0])).toTex());
50
+ }
51
+ return shuffleProps(propositions, n);
52
+ };
53
+ const isAnswerValid = (ans, { answer, a, roots }) => {
54
+ const answerNode = getAnswerNode(roots, a);
55
+ const texs = answerNode.toAllValidTexs();
56
+ return texs.includes(ans);
57
+ };
58
+ export const factorizedFormFromRoots = {
59
+ id: "factorizedFormFromRoots",
60
+ connector: "=",
61
+ label: "Déterminer la forme factorisée en connaissant les racines",
62
+ levels: ["1rePro", "1reSpé"],
63
+ isSingleStep: true,
64
+ sections: ["Second degré"],
65
+ generator: (nb) => getDistinctQuestions(getFactorizedFormFromRootsQuestion, nb),
66
+ qcmTimer: 60,
67
+ freeTimer: 60,
68
+ getPropositions,
69
+ isAnswerValid,
70
+ subject: "Mathématiques",
71
+ getInstruction,
72
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./factorizedFormFromRoots.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./factorizedFormFromRoots.js";
@@ -1,25 +1,9 @@
1
- export * from "./alphaBetaFromDevForm.js";
2
- export * from "./alphaBetaInCanonicalForm.js";
3
- export * from "./canonicalFromDevForm.js";
4
- export * from "./deltaTrinom.js";
5
- export * from "./extremumFromCanonicalForm.js";
6
- export * from "./extremumTypeFromAlgebricForm.js";
7
- export * from "./niceRootsFromDevForm.js";
8
- export * from "./rootsFromDevForm.js";
9
- export * from "./rootsFromFactorizedForm.js";
10
- export * from "./variationsFromAlgebricForm.js";
11
- export * from "./secondDegreeInequation.js";
12
- export * from "./rootsReading.js";
13
- export * from "./factorizedFormFromRoots.js";
14
- export * from "./summitReading.js";
15
- export * from "./summitAbscissFromRoots.js";
16
- export * from "./summitAbscissFromDevForm.js";
17
1
  export * from "./trinomialMeanValue.js";
18
- export * from "./solveSecondDegreeEquationByFactorisation.js";
19
- export * from "./solveSecondDegreeEquationFromCano.js";
20
- export * from "./trinomSignFromRoots.js";
21
- export * from "./coefficientsIdentification.js";
22
- export * from "./rootsSum.js";
23
- export * from "./rootsProduct.js";
24
- export * from "./findSecondRoot.js";
2
+ export * from "./devForm/index.js";
3
+ export * from "./equation/index.js";
4
+ export * from "./factoForm/index.js";
5
+ export * from "./roots/index.js";
6
+ export * from "./sign/index.js";
7
+ export * from "./summitAndCanonical/index.js";
8
+ export * from "./parabole/index.js";
25
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wCAAwC,CAAC;AACvD,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC"}
@@ -1,24 +1,8 @@
1
- export * from "./alphaBetaFromDevForm.js";
2
- export * from "./alphaBetaInCanonicalForm.js";
3
- export * from "./canonicalFromDevForm.js";
4
- export * from "./deltaTrinom.js";
5
- export * from "./extremumFromCanonicalForm.js";
6
- export * from "./extremumTypeFromAlgebricForm.js";
7
- export * from "./niceRootsFromDevForm.js";
8
- export * from "./rootsFromDevForm.js";
9
- export * from "./rootsFromFactorizedForm.js";
10
- export * from "./variationsFromAlgebricForm.js";
11
- export * from "./secondDegreeInequation.js";
12
- export * from "./rootsReading.js";
13
- export * from "./factorizedFormFromRoots.js";
14
- export * from "./summitReading.js";
15
- export * from "./summitAbscissFromRoots.js";
16
- export * from "./summitAbscissFromDevForm.js";
17
1
  export * from "./trinomialMeanValue.js";
18
- export * from "./solveSecondDegreeEquationByFactorisation.js";
19
- export * from "./solveSecondDegreeEquationFromCano.js";
20
- export * from "./trinomSignFromRoots.js";
21
- export * from "./coefficientsIdentification.js";
22
- export * from "./rootsSum.js";
23
- export * from "./rootsProduct.js";
24
- export * from "./findSecondRoot.js";
2
+ export * from "./devForm/index.js";
3
+ export * from "./equation/index.js";
4
+ export * from "./factoForm/index.js";
5
+ export * from "./roots/index.js";
6
+ export * from "./sign/index.js";
7
+ export * from "./summitAndCanonical/index.js";
8
+ export * from "./parabole/index.js";
@@ -0,0 +1,3 @@
1
+ export * from "./paraboleExpressionReading.js";
2
+ export * from "./trinomSymetryAxisFromFacto.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/parabole/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./paraboleExpressionReading.js";
2
+ export * from "./trinomSymetryAxisFromFacto.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ type: number;
4
+ points: number[][];
5
+ };
6
+ export declare const paraboleExpressionReading: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=paraboleExpressionReading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paraboleExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CAIpB,CAAC;AAoSF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAmB3D,CAAC"}