math-exercises 3.0.159 → 3.0.160

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 (63) hide show
  1. package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.d.ts.map +1 -1
  2. package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.js +1 -2
  3. package/lib/exercises/math/functions/trinoms/factoForm/index.d.ts +1 -0
  4. package/lib/exercises/math/functions/trinoms/factoForm/index.d.ts.map +1 -1
  5. package/lib/exercises/math/functions/trinoms/factoForm/index.js +1 -0
  6. package/lib/exercises/math/functions/trinoms/factoForm/trinomDevelopFactorizedForm.d.ts +13 -0
  7. package/lib/exercises/math/functions/trinoms/factoForm/trinomDevelopFactorizedForm.d.ts.map +1 -0
  8. package/lib/exercises/math/functions/trinoms/factoForm/trinomDevelopFactorizedForm.js +147 -0
  9. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts.map +1 -1
  10. package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.js +96 -0
  11. package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -1
  12. package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +95 -1
  13. package/lib/exercises/math/functions/trinoms/summitAndCanonical/devFormFromSummitAndPoint.d.ts +9 -0
  14. package/lib/exercises/math/functions/trinoms/summitAndCanonical/devFormFromSummitAndPoint.d.ts.map +1 -0
  15. package/lib/exercises/math/functions/trinoms/summitAndCanonical/devFormFromSummitAndPoint.js +173 -0
  16. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts +2 -0
  17. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts.map +1 -1
  18. package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.js +2 -0
  19. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.js +1 -1
  20. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromSymetricPoints.d.ts +9 -0
  21. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromSymetricPoints.d.ts.map +1 -0
  22. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromSymetricPoints.js +97 -0
  23. package/lib/exercises/math/geometry/circles/circleCanonicalEquationFromDevEquation.d.ts +10 -0
  24. package/lib/exercises/math/geometry/circles/circleCanonicalEquationFromDevEquation.d.ts.map +1 -0
  25. package/lib/exercises/math/geometry/circles/circleCanonicalEquationFromDevEquation.js +174 -0
  26. package/lib/exercises/math/geometry/circles/circleCenterAndRadiusFromEquation.d.ts +12 -0
  27. package/lib/exercises/math/geometry/circles/circleCenterAndRadiusFromEquation.d.ts.map +1 -0
  28. package/lib/exercises/math/geometry/circles/circleCenterAndRadiusFromEquation.js +161 -0
  29. package/lib/exercises/math/geometry/circles/circleEquationFromDiameter.d.ts +9 -0
  30. package/lib/exercises/math/geometry/circles/circleEquationFromDiameter.d.ts.map +1 -0
  31. package/lib/exercises/math/geometry/circles/circleEquationFromDiameter.js +145 -0
  32. package/lib/exercises/math/geometry/circles/circleEquationFromPointAndRadius.d.ts +13 -0
  33. package/lib/exercises/math/geometry/circles/circleEquationFromPointAndRadius.d.ts.map +1 -0
  34. package/lib/exercises/math/geometry/circles/circleEquationFromPointAndRadius.js +181 -0
  35. package/lib/exercises/math/geometry/circles/circleRadiusOrCenterFromDevEquation.d.ts +11 -0
  36. package/lib/exercises/math/geometry/circles/circleRadiusOrCenterFromDevEquation.d.ts.map +1 -0
  37. package/lib/exercises/math/geometry/circles/circleRadiusOrCenterFromDevEquation.js +191 -0
  38. package/lib/exercises/math/geometry/circles/index.d.ts +5 -0
  39. package/lib/exercises/math/geometry/circles/index.d.ts.map +1 -1
  40. package/lib/exercises/math/geometry/circles/index.js +5 -0
  41. package/lib/exercises/math/geometry/circles/isPointOnCircleFromCartesianEquation.js +1 -1
  42. package/lib/exercises/math/geometry/lines/cartesianEquationOfTriangleHeight.d.ts +10 -0
  43. package/lib/exercises/math/geometry/lines/cartesianEquationOfTriangleHeight.d.ts.map +1 -0
  44. package/lib/exercises/math/geometry/lines/cartesianEquationOfTriangleHeight.js +181 -0
  45. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts +4 -1
  46. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -1
  47. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +23 -3
  48. package/lib/exercises/math/geometry/lines/index.d.ts +1 -0
  49. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  50. package/lib/exercises/math/geometry/lines/index.js +1 -0
  51. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +1 -1
  52. package/lib/exercises/vea/pointVEA.d.ts +2 -0
  53. package/lib/exercises/vea/pointVEA.d.ts.map +1 -0
  54. package/lib/exercises/vea/pointVEA.js +7 -0
  55. package/lib/index.d.ts +41 -1
  56. package/lib/index.d.ts.map +1 -1
  57. package/lib/math/geometry/circle.d.ts +6 -0
  58. package/lib/math/geometry/circle.d.ts.map +1 -1
  59. package/lib/math/geometry/circle.js +16 -0
  60. package/lib/math/geometry/point.d.ts +1 -1
  61. package/lib/math/geometry/point.d.ts.map +1 -1
  62. package/lib/math/geometry/point.js +2 -2
  63. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"solveByFactorizingWithIdRmq3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AA0LF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAUF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBvE,CAAC"}
1
+ {"version":3,"file":"solveByFactorizingWithIdRmq3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAU7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AA0LF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAUF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBvE,CAAC"}
@@ -10,7 +10,6 @@ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
10
10
  import { square } from "../../../../tree/nodes/operators/powerNode.js";
11
11
  import { substract } from "../../../../tree/nodes/operators/substractNode.js";
12
12
  import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
13
- import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
14
13
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
15
14
  import { alignTex } from "../../../../utils/latex/alignTex.js";
16
15
  const getPropositions = (n, { answer }) => {
@@ -123,7 +122,7 @@ const getKeys = (_identifiers, options) => {
123
122
  const isAnswerValid = (ans, { answer, ...identifiers }, opts) => {
124
123
  try {
125
124
  if (opts?.useSetAsAnswer) {
126
- const setParsed = discreteSetParser(ans);
125
+ // const setParsed = discreteSetParser(ans);
127
126
  //!!!TODO
128
127
  return false;
129
128
  }
@@ -1,2 +1,3 @@
1
1
  export * from "./factorizedFormFromRoots.js";
2
+ export * from "./trinomDevelopFactorizedForm.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from "./factorizedFormFromRoots.js";
2
+ export * from "./trinomDevelopFactorizedForm.js";
@@ -0,0 +1,13 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ aIds: NodeIdentifiers;
5
+ x1Ids: NodeIdentifiers;
6
+ x2Ids: NodeIdentifiers;
7
+ };
8
+ type Options = {
9
+ rootsNb: string;
10
+ };
11
+ export declare const trinomDevelopFactorizedForm: Exercise<Identifiers, Options>;
12
+ export {};
13
+ //# sourceMappingURL=trinomDevelopFactorizedForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trinomDevelopFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/trinomDevelopFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAS7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAsIF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAYF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBtE,CAAC"}
@@ -0,0 +1,147 @@
1
+ import { addValidProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../../../math/utils/random/randint.js";
4
+ import { reifyAlgebraic, } from "../../../../../tree/nodes/nodeConstructor.js";
5
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
6
+ import { square } from "../../../../../tree/nodes/operators/powerNode.js";
7
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
8
+ import { polynomialParser } from "../../../../../tree/parsers/polynomialParser.js";
9
+ import { probaFlip } from "../../../../../utils/alea/probaFlip.js";
10
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
11
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
12
+ const getPropositions = (n, { answer }) => {
13
+ const propositions = [];
14
+ addValidProp(propositions, answer);
15
+ propWhile(propositions, n, () => {
16
+ const aIds = randint(-9, 10, [0]).toTree().toIdentifiers();
17
+ const x1Ids = randint(-9, 10, [0]).toTree().toIdentifiers();
18
+ const x2Ids = randint(-9, 10, [0]).toTree().toIdentifiers();
19
+ tryToAddWrongProp(propositions, getAnswer({
20
+ aIds,
21
+ x1Ids,
22
+ x2Ids,
23
+ }));
24
+ });
25
+ return shuffleProps(propositions, n);
26
+ };
27
+ const getAnswer = (identifiers) => {
28
+ return getFacto(identifiers)
29
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
30
+ .toTex();
31
+ };
32
+ const getFacto = (identifiers) => {
33
+ const { aIds, x1Ids, x2Ids } = identifiers;
34
+ const a = reifyAlgebraic(aIds);
35
+ const x1 = reifyAlgebraic(x1Ids);
36
+ const x2 = reifyAlgebraic(x2Ids);
37
+ if (x1.evaluate() === x2.evaluate()) {
38
+ return multiply(a, square(substract("x", x1).simplify()));
39
+ }
40
+ return multiply(a, multiply(substract("x", x1).simplify(), substract("x", x2).simplify()));
41
+ };
42
+ const getInstruction = (identifiers) => {
43
+ return `Soit $f$ la fonction polynôme du second degré dont la forme factorisée est :
44
+
45
+ $$
46
+ f(x) = ${getFacto(identifiers).toTex()}
47
+ $$
48
+
49
+ Donner la forme dévelopée de $f$.`;
50
+ };
51
+ const getHint = () => {
52
+ return `Il suffit de développer puis de réduire la forme factorisée de $f$.`;
53
+ };
54
+ const getCorrection = (identifiers) => {
55
+ const { aIds, x1Ids, x2Ids } = identifiers;
56
+ const a = reifyAlgebraic(aIds);
57
+ const x1 = reifyAlgebraic(x1Ids);
58
+ const x2 = reifyAlgebraic(x2Ids);
59
+ return `On développe la forme factorisée de $f$ :
60
+
61
+ ${alignTex([
62
+ ["f(x)", "=", getFacto(identifiers).toTex()],
63
+ [
64
+ "",
65
+ "=",
66
+ multiply(a, multiply(substract("x", x1), substract("x", x2)).simplify({
67
+ towardsDistribute: true,
68
+ forbidFactorize: true,
69
+ })).toTex(),
70
+ ],
71
+ ["", "=", getAnswer(identifiers)],
72
+ ])}
73
+
74
+ `;
75
+ };
76
+ const getKeys = () => {
77
+ return ["x"];
78
+ };
79
+ const isAnswerValid = (ans, { answer }) => {
80
+ try {
81
+ const parsed = polynomialParser(ans);
82
+ if (!parsed)
83
+ return false;
84
+ return (parsed
85
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
86
+ .toTex() === answer);
87
+ }
88
+ catch (err) {
89
+ return handleVEAError(err);
90
+ }
91
+ };
92
+ const getTrinomDevelopFactorizedFormQuestion = (opts) => {
93
+ const a = randint(-9, 10, [0, 1]).toTree();
94
+ const isSameRoot = opts?.rootsNb === "Une"
95
+ ? true
96
+ : opts?.rootsNb === "Deux"
97
+ ? false
98
+ : probaFlip(0.3);
99
+ const x1 = randint(-10, 10, [0]);
100
+ const x2 = isSameRoot ? x1 : randint(-10, 10, [0, x1]);
101
+ const identifiers = {
102
+ aIds: a.toIdentifiers(),
103
+ x1Ids: x1.toTree().toIdentifiers(),
104
+ x2Ids: x2.toTree().toIdentifiers(),
105
+ };
106
+ return getQuestionFromIdentifiers(identifiers);
107
+ };
108
+ const getQuestionFromIdentifiers = (identifiers) => {
109
+ return {
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
+ };
119
+ const options = [
120
+ {
121
+ id: "rootsNb",
122
+ label: "Nombre de racines",
123
+ target: GeneratorOptionTarget.generation,
124
+ type: GeneratorOptionType.select,
125
+ values: ["Une", "Deux", "Une ou deux aléatoirement"],
126
+ defaultValue: "Une ou deux aléatoirement",
127
+ },
128
+ ];
129
+ export const trinomDevelopFactorizedForm = {
130
+ id: "trinomDevelopFactorizedForm",
131
+ connector: "=",
132
+ label: "Développer une forme factorisée du type $a(x-x_1)(x-x_2)$",
133
+ isSingleStep: true,
134
+ generator: (nb, opts) => getDistinctQuestions(() => getTrinomDevelopFactorizedFormQuestion(opts), nb),
135
+ qcmTimer: 60,
136
+ freeTimer: 60,
137
+ getPropositions,
138
+ isAnswerValid,
139
+ subject: "Mathématiques",
140
+ getInstruction,
141
+ getHint,
142
+ getCorrection,
143
+ getAnswer,
144
+ getQuestionFromIdentifiers,
145
+ hasHintAndCorrection: true,
146
+ options,
147
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"niceRootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkEF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAYtD,CAAC"}
1
+ {"version":3,"file":"niceRootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA0JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
@@ -2,9 +2,17 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exer
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
4
4
  import { randint } from "../../../../../math/utils/random/randint.js";
5
+ import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
6
+ import { sqrt } from "../../../../../tree/nodes/functions/sqrtNode.js";
7
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
8
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
9
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
10
+ import { square } from "../../../../../tree/nodes/operators/powerNode.js";
11
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
5
12
  import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
6
13
  import { shuffle } from "../../../../../utils/alea/shuffle.js";
7
14
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
15
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
8
16
  const getInstruction = (identifiers) => {
9
17
  const { a, b, c } = identifiers;
10
18
  const trinom = new Trinom(a, b, c);
@@ -27,6 +35,91 @@ const getRootsFromDevFormQuestion = () => {
27
35
  const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
28
36
  return getQuestionFromIdentifiers(identifiers);
29
37
  };
38
+ const getHint = () => {
39
+ return `Calcule le déterminant $\\Delta$ de $f$ :
40
+
41
+ $$
42
+ \\Delta = b^2 -4ac
43
+ $$
44
+
45
+ Alors, l'équation $f(x) = 0$ :
46
+ - n'admet pas de solution réelle si $\\Delta<0$;
47
+ - admet une solution $x_0 = \\frac{-b}{2a}$ si $\\Delta=0$;
48
+ - admet deux solutions $x_1 = \\frac{-b-\\sqrt{\\Delta}}{2a}$ et $x_2 = \\frac{-b+\\sqrt{\\Delta}}{2a}$ si $\\Delta>0$.
49
+ `;
50
+ };
51
+ const getCorrection = (identifiers) => {
52
+ const { a, b, c } = identifiers;
53
+ const delta = substract(square(b), multiply(4, multiply(a, c))).simplify();
54
+ const deltaEv = delta.evaluate();
55
+ const hasNoSol = deltaEv < 0;
56
+ const hasOneSol = deltaEv === 0;
57
+ let corr = `On calcule le discriminant :
58
+
59
+ ${alignTex([
60
+ ["\\Delta", "=", "b^2 - 4ac"],
61
+ ["", "=", substract(square(b), multiply(4, multiply(a, c))).toTex()],
62
+ ["", "=", delta.toTex()],
63
+ ])}`;
64
+ if (hasNoSol) {
65
+ corr += `
66
+
67
+ Puisque $\\Delta<0$, l'équation $f(x) = 0$ n'admet donc pas de solution réelle.`;
68
+ }
69
+ else if (hasOneSol) {
70
+ corr += `
71
+
72
+ Puisque $\\Delta = 0$, l'équation $f(x)=0$ admet une solution $x_0$ :
73
+
74
+ ${alignTex([
75
+ ["x_0", "=", "\\frac{-b}{2a}"],
76
+ ["", "=", frac(opposite(b), multiply(2, a)).toTex()],
77
+ ["", "=", frac(opposite(b), multiply(2, a)).simplify().toTex()],
78
+ ])}
79
+
80
+ L'ensemble des solutions est donc :
81
+
82
+ $$
83
+ ${getAnswer(identifiers)}
84
+ $$`;
85
+ }
86
+ else {
87
+ corr += `
88
+
89
+ Puisque $\\Delta > 0$, l'équation $f(x)=0$ admet deux solutions :
90
+
91
+ ${alignTex([
92
+ ["x_1", "=", "\\frac{-b-\\sqrt{\\Delta}}{2a}"],
93
+ ["", "=", frac(substract(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
94
+ [
95
+ "",
96
+ "=",
97
+ frac(substract(opposite(b), sqrt(delta)), multiply(2, a))
98
+ .simplify()
99
+ .toTex(),
100
+ ],
101
+ ])}
102
+
103
+ ${alignTex([
104
+ ["x_2", "=", "\\frac{-b+\\sqrt{\\Delta}}{2a}"],
105
+ ["", "=", frac(add(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
106
+ [
107
+ "",
108
+ "=",
109
+ frac(add(opposite(b), sqrt(delta)), multiply(2, a))
110
+ .simplify()
111
+ .toTex(),
112
+ ],
113
+ ])}
114
+ L'ensemble des solutions est donc :
115
+
116
+ $$
117
+ ${getAnswer(identifiers)}
118
+ $$
119
+ `;
120
+ }
121
+ return corr;
122
+ };
30
123
  const getQuestionFromIdentifiers = (identifiers) => {
31
124
  const question = {
32
125
  answer: getAnswer(identifiers),
@@ -34,6 +127,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
34
127
  keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
35
128
  identifiers,
36
129
  answerFormat: "tex",
130
+ hint: getHint(identifiers),
131
+ correction: getCorrection(identifiers),
37
132
  };
38
133
  return question;
39
134
  };
@@ -72,4 +167,5 @@ export const niceRootsFromDevForm = {
72
167
  freeTimer: 60,
73
168
  subject: "Mathématiques",
74
169
  getQuestionFromIdentifiers,
170
+ hasHintAndCorrection: true,
75
171
  };
@@ -1 +1 @@
1
- {"version":3,"file":"rootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4GF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
1
+ {"version":3,"file":"rootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqMF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
@@ -2,15 +2,21 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exer
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
4
4
  import { randint } from "../../../../../math/utils/random/randint.js";
5
+ import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
6
+ import { sqrt } from "../../../../../tree/nodes/functions/sqrtNode.js";
7
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
8
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
5
9
  import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
10
+ import { square } from "../../../../../tree/nodes/operators/powerNode.js";
6
11
  import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
7
12
  import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
8
13
  import { shuffle } from "../../../../../utils/alea/shuffle.js";
9
14
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
15
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
10
16
  const getInstruction = (identifiers) => {
11
17
  const { a, b, c } = identifiers;
12
18
  const trinom = new Trinom(a, b, c);
13
- return `Soit $f$ la fonction définie par :
19
+ return `Soit $f$ la fonction polynôme du second degré définie par :
14
20
 
15
21
  $$
16
22
  f(x) = ${trinom.toTree().toTex()}
@@ -18,6 +24,91 @@ $$
18
24
 
19
25
  Résoudre l'équation $f(x) = 0$.`;
20
26
  };
27
+ const getHint = () => {
28
+ return `Calcule le déterminant $\\Delta$ de $f$ :
29
+
30
+ $$
31
+ \\Delta = b^2 -4ac
32
+ $$
33
+
34
+ Alors, l'équation $f(x) = 0$ :
35
+ - n'admet pas de solution réelle si $\\Delta<0$;
36
+ - admet une solution $x_0 = \\frac{-b}{2a}$ si $\\Delta=0$;
37
+ - admet deux solutions $x_1 = \\frac{-b-\\sqrt{\\Delta}}{2a}$ et $x_2 = \\frac{-b+\\sqrt{\\Delta}}{2a}$ si $\\Delta>0$.
38
+ `;
39
+ };
40
+ const getCorrection = (identifiers) => {
41
+ const { a, b, c } = identifiers;
42
+ const delta = substract(square(b), multiply(4, multiply(a, c))).simplify();
43
+ const deltaEv = delta.evaluate();
44
+ const hasNoSol = deltaEv < 0;
45
+ const hasOneSol = deltaEv === 0;
46
+ let corr = `On calcule le discriminant :
47
+
48
+ ${alignTex([
49
+ ["\\Delta", "=", "b^2 - 4ac"],
50
+ ["", "=", substract(square(b), multiply(4, multiply(a, c))).toTex()],
51
+ ["", "=", delta.toTex()],
52
+ ])}`;
53
+ if (hasNoSol) {
54
+ corr += `
55
+
56
+ Puisque $\\Delta<0$, l'équation $f(x) = 0$ n'admet donc pas de solution réelle.`;
57
+ }
58
+ else if (hasOneSol) {
59
+ corr += `
60
+
61
+ Puisque $\\Delta = 0$, l'équation $f(x)=0$ admet une solution $x_0$ :
62
+
63
+ ${alignTex([
64
+ ["x_0", "=", "\\frac{-b}{2a}"],
65
+ ["", "=", frac(opposite(b), multiply(2, a)).toTex()],
66
+ ["", "=", frac(opposite(b), multiply(2, a)).simplify().toTex()],
67
+ ])}
68
+
69
+ L'ensemble des solutions est donc :
70
+
71
+ $$
72
+ ${getAnswer(identifiers)}
73
+ $$`;
74
+ }
75
+ else {
76
+ corr += `
77
+
78
+ Puisque $\\Delta > 0$, l'équation $f(x)=0$ admet deux solutions :
79
+
80
+ ${alignTex([
81
+ ["x_1", "=", "\\frac{-b-\\sqrt{\\Delta}}{2a}"],
82
+ ["", "=", frac(substract(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
83
+ [
84
+ "",
85
+ "=",
86
+ frac(substract(opposite(b), sqrt(delta)), multiply(2, a))
87
+ .simplify()
88
+ .toTex(),
89
+ ],
90
+ ])}
91
+
92
+ ${alignTex([
93
+ ["x_2", "=", "\\frac{-b+\\sqrt{\\Delta}}{2a}"],
94
+ ["", "=", frac(add(opposite(b), sqrt(delta)), multiply(2, a)).toTex()],
95
+ [
96
+ "",
97
+ "=",
98
+ frac(add(opposite(b), sqrt(delta)), multiply(2, a))
99
+ .simplify()
100
+ .toTex(),
101
+ ],
102
+ ])}
103
+ L'ensemble des solutions est donc :
104
+
105
+ $$
106
+ ${getAnswer(identifiers)}
107
+ $$
108
+ `;
109
+ }
110
+ return corr;
111
+ };
21
112
  const getAnswer = (identifiers) => {
22
113
  const { a, b, c } = identifiers;
23
114
  const trinom = new Trinom(a, b, c);
@@ -35,6 +126,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
35
126
  keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
36
127
  answerFormat: "tex",
37
128
  identifiers,
129
+ hint: getHint(identifiers),
130
+ correction: getCorrection(identifiers),
38
131
  };
39
132
  return question;
40
133
  };
@@ -102,4 +195,5 @@ export const rootsFromDevForm = {
102
195
  subject: "Mathématiques",
103
196
  pdfOptions: { shouldSpreadPropositions: true },
104
197
  getQuestionFromIdentifiers,
198
+ hasHintAndCorrection: true,
105
199
  };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../../math/geometry/point.js";
3
+ type Identifiers = {
4
+ summitIds: PointIdentifiers;
5
+ pointIds: PointIdentifiers;
6
+ };
7
+ export declare const devFormFromSummitAndPoint: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=devFormFromSummitAndPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devFormFromSummitAndPoint.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/devFormFromSummitAndPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAWtC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAyLF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAmB3D,CAAC"}
@@ -0,0 +1,173 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Point, PointConstructor, } from "../../../../../math/geometry/point.js";
4
+ import { randint } from "../../../../../math/utils/random/randint.js";
5
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
6
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { square } from "../../../../../tree/nodes/operators/powerNode.js";
9
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
10
+ import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
11
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
12
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
13
+ const getPropositions = (n, { answer }) => {
14
+ const propositions = [];
15
+ addValidProp(propositions, answer);
16
+ propWhile(propositions, n, () => {
17
+ const summit = PointConstructor.random("S");
18
+ const a = randint(-10, 10, [0]);
19
+ const pointX = randint(-10, 10, [summit.x.evaluate()]);
20
+ const pointY = add(multiply(a, square(substract(pointX, summit.x))), summit.y).simplify();
21
+ const point = new Point("A", pointX, pointY);
22
+ const fakeIds = {
23
+ pointIds: point.toIdentifiers(),
24
+ summitIds: summit.toIdentifiers(),
25
+ };
26
+ tryToAddWrongProp(propositions, getAnswer(fakeIds));
27
+ });
28
+ return shuffleProps(propositions, n);
29
+ };
30
+ const getAnswer = (identifiers) => {
31
+ const { pointIds, summitIds } = identifiers;
32
+ const point = PointConstructor.fromIdentifiers(pointIds);
33
+ const summit = PointConstructor.fromIdentifiers(summitIds);
34
+ const a = frac(substract(point.y, summit.y), square(substract(point.x, summit.x))).simplify();
35
+ const cano = add(multiply(a, square(substract("x", summit.x))), summit.y);
36
+ return cano
37
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
38
+ .toTex();
39
+ };
40
+ const getInstruction = (identifiers) => {
41
+ const { pointIds, summitIds } = identifiers;
42
+ const point = PointConstructor.fromIdentifiers(pointIds);
43
+ const summit = PointConstructor.fromIdentifiers(summitIds);
44
+ return `On considère une fonction polynôme du second degré $f$. Sa parabole passe par le point $${point.toTexWithCoords()}$, et son sommet est $${summit.toTexWithCoords()}$.
45
+
46
+ Déterminer la forme développée de $f$.`;
47
+ };
48
+ const getHint = (identifiers) => {
49
+ return `La forme canonique d'une fonction polynôme du second degré $f$ est :
50
+
51
+ $$
52
+ f(x) = a(x-\\alpha)^2 + \\beta
53
+ $$
54
+
55
+ où $\\alpha$ est l'abscisse du sommet de la parabole, et $\\beta$ son ordonnée.
56
+
57
+ Utilise cette formule ici, puis le fait que le point $${PointConstructor.fromIdentifiers(identifiers.pointIds).toTexWithCoords()}$ est un point de la parabole pour déterminer $a$.`;
58
+ };
59
+ const getCorrection = (identifiers) => {
60
+ const { pointIds, summitIds } = identifiers;
61
+ const point = PointConstructor.fromIdentifiers(pointIds);
62
+ const summit = PointConstructor.fromIdentifiers(summitIds);
63
+ const beta = summit.y;
64
+ const alpha = summit.x;
65
+ const a = frac(substract(point.y, summit.y), square(substract(point.x, summit.x))).simplify();
66
+ return `Puisque le sommet de la parabole est $${summit.toTexWithCoords()}$, la forme canonique de $f$ est :
67
+
68
+ $$
69
+ f(x) = ${add(multiply("a", square(substract("x", alpha).simplify())), beta).toTex()}
70
+ $$
71
+
72
+ Puisque $${point.toTexWithCoords()}$ est un point de la parabole, on a :
73
+
74
+ ${alignTex([
75
+ [`f(${point.x.toTex()})`, "=", `${point.y.toTex()}`],
76
+ [
77
+ add(multiply("a", square(substract(point.x, alpha).simplify())), beta).toTex(),
78
+ "=",
79
+ `${point.y.toTex()}`,
80
+ ],
81
+ [
82
+ add(multiply("a", square(substract(point.x, alpha))), beta)
83
+ .simplify()
84
+ .toTex(),
85
+ "=",
86
+ `${point.y.toTex()}`,
87
+ ],
88
+ ["a", "=", a.simplify().toTex()],
89
+ ])}
90
+
91
+ Il ne reste plus qu'à développer la forme canonique de $f$ :
92
+
93
+ ${alignTex([
94
+ [
95
+ "f(x)",
96
+ "=",
97
+ add(multiply(a, square(substract("x", alpha))), beta)
98
+ .simplify()
99
+ .toTex(),
100
+ ],
101
+ [
102
+ "",
103
+ "=",
104
+ add(multiply(a, square(substract("x", alpha)).simplify({
105
+ towardsDistribute: true,
106
+ forbidFactorize: true,
107
+ })), beta).toTex(),
108
+ ],
109
+ [
110
+ "",
111
+ "=",
112
+ add(multiply(a, square(substract("x", alpha))), beta)
113
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
114
+ .toTex(),
115
+ ],
116
+ ])}
117
+ `;
118
+ };
119
+ const getKeys = () => {
120
+ return ["xsquare", "x"];
121
+ };
122
+ const isAnswerValid = (ans, { answer }) => {
123
+ try {
124
+ const parsed = parseAlgebraic(ans);
125
+ return (parsed
126
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
127
+ .toTex() === answer);
128
+ }
129
+ catch (err) {
130
+ return handleVEAError(err);
131
+ }
132
+ };
133
+ const getDevFormFromSummitAndPointQuestion = () => {
134
+ const summit = PointConstructor.random("S");
135
+ const a = randint(-10, 10, [0]);
136
+ const pointX = randint(-10, 10, [summit.x.evaluate()]);
137
+ const pointY = add(multiply(a, square(substract(pointX, summit.x))), summit.y).simplify();
138
+ const point = new Point("A", pointX, pointY);
139
+ const identifiers = {
140
+ pointIds: point.toIdentifiers(),
141
+ summitIds: summit.toIdentifiers(),
142
+ };
143
+ return getQuestionFromIdentifiers(identifiers);
144
+ };
145
+ const getQuestionFromIdentifiers = (identifiers) => {
146
+ return {
147
+ answer: getAnswer(identifiers),
148
+ instruction: getInstruction(identifiers),
149
+ keys: getKeys(identifiers),
150
+ answerFormat: "tex",
151
+ identifiers,
152
+ hint: getHint(identifiers),
153
+ correction: getCorrection(identifiers),
154
+ };
155
+ };
156
+ export const devFormFromSummitAndPoint = {
157
+ id: "devFormFromSummitAndPoint",
158
+ connector: "=",
159
+ label: "Déterminer la forme développée d'un trinôme en connaissant un point et le sommet de la parabole",
160
+ isSingleStep: true,
161
+ generator: (nb, opts) => getDistinctQuestions(() => getDevFormFromSummitAndPointQuestion(opts), nb),
162
+ qcmTimer: 60,
163
+ freeTimer: 60,
164
+ getPropositions,
165
+ isAnswerValid,
166
+ subject: "Mathématiques",
167
+ getInstruction,
168
+ getHint,
169
+ getCorrection,
170
+ getAnswer,
171
+ getQuestionFromIdentifiers,
172
+ hasHintAndCorrection: true,
173
+ };
@@ -6,4 +6,6 @@ export * from "./extremumTypeFromAlgebricForm.js";
6
6
  export * from "./summitAbscissFromDevForm.js";
7
7
  export * from "./summitAbscissFromRoots.js";
8
8
  export * from "./summitReading.js";
9
+ export * from "./summitAbscissFromSymetricPoints.js";
10
+ export * from "./devFormFromSummitAndPoint.js";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC"}