math-exercises 3.0.97 → 3.0.98

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 (81) hide show
  1. package/lib/exercises/math/calculLitteral/inequations/index.d.ts +2 -0
  2. package/lib/exercises/math/calculLitteral/inequations/index.d.ts.map +1 -1
  3. package/lib/exercises/math/calculLitteral/inequations/index.js +2 -0
  4. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts.map +1 -1
  5. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.js +83 -5
  6. package/lib/exercises/math/calculLitteral/inequations/inverseInequalityWithGraph.d.ts +10 -0
  7. package/lib/exercises/math/calculLitteral/inequations/inverseInequalityWithGraph.d.ts.map +1 -0
  8. package/lib/exercises/math/calculLitteral/inequations/inverseInequalityWithGraph.js +220 -0
  9. package/lib/exercises/math/conversion/hoursToDecimal.js +1 -1
  10. package/lib/exercises/math/functions/affines/leadingCoefficient.js +1 -1
  11. package/lib/exercises/math/functions/basics/findZeroesProductQuotient.js +1 -1
  12. package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
  13. package/lib/exercises/math/functions/basics/graphicInequation.js +37 -5
  14. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +1 -1
  15. package/lib/exercises/math/functions/basics/isPointOnFunction.d.ts.map +1 -1
  16. package/lib/exercises/math/functions/basics/isPointOnFunction.js +1 -1
  17. package/lib/exercises/math/functions/basics/twoFunctionsInequation.d.ts.map +1 -1
  18. package/lib/exercises/math/functions/basics/twoFunctionsInequation.js +34 -0
  19. package/lib/exercises/math/functions/basics/valueTableFromGraph.d.ts.map +1 -1
  20. package/lib/exercises/math/functions/basics/valueTableFromGraph.js +1 -1
  21. package/lib/exercises/math/functions/inverse/index.d.ts +1 -0
  22. package/lib/exercises/math/functions/inverse/index.d.ts.map +1 -1
  23. package/lib/exercises/math/functions/inverse/index.js +1 -0
  24. package/lib/exercises/math/functions/inverse/solveInverseEquation.d.ts +8 -0
  25. package/lib/exercises/math/functions/inverse/solveInverseEquation.d.ts.map +1 -0
  26. package/lib/exercises/math/functions/inverse/solveInverseEquation.js +147 -0
  27. package/lib/exercises/math/functions/sign/affineProductSignTable.js +1 -1
  28. package/lib/exercises/math/functions/sign/affineProductSignTableThirdLine.d.ts +9 -0
  29. package/lib/exercises/math/functions/sign/affineProductSignTableThirdLine.d.ts.map +1 -0
  30. package/lib/exercises/math/functions/sign/affineProductSignTableThirdLine.js +201 -0
  31. package/lib/exercises/math/functions/sign/affineSignTable.js +1 -1
  32. package/lib/exercises/math/functions/sign/index.d.ts +1 -0
  33. package/lib/exercises/math/functions/sign/index.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/sign/index.js +1 -0
  35. package/lib/exercises/math/functions/square/index.d.ts +2 -0
  36. package/lib/exercises/math/functions/square/index.d.ts.map +1 -1
  37. package/lib/exercises/math/functions/square/index.js +2 -1
  38. package/lib/exercises/math/functions/square/squareFunctionInequationWithGraph.d.ts +9 -0
  39. package/lib/exercises/math/functions/square/squareFunctionInequationWithGraph.d.ts.map +1 -0
  40. package/lib/exercises/math/functions/square/squareFunctionInequationWithGraph.js +151 -0
  41. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.js +19 -3
  43. package/lib/exercises/math/functions/variations/index.d.ts +4 -0
  44. package/lib/exercises/math/functions/variations/index.d.ts.map +1 -1
  45. package/lib/exercises/math/functions/variations/index.js +4 -0
  46. package/lib/exercises/math/functions/variations/readExtremaOnGraph.d.ts +14 -0
  47. package/lib/exercises/math/functions/variations/readExtremaOnGraph.d.ts.map +1 -0
  48. package/lib/exercises/math/functions/variations/readExtremaOnGraph.js +215 -0
  49. package/lib/exercises/math/functions/variations/readVarOnGraph.d.ts +9 -0
  50. package/lib/exercises/math/functions/variations/readVarOnGraph.d.ts.map +1 -0
  51. package/lib/exercises/math/functions/variations/readVarOnGraph.js +128 -0
  52. package/lib/exercises/math/functions/variations/readVarOnGraph2.d.ts +9 -0
  53. package/lib/exercises/math/functions/variations/readVarOnGraph2.d.ts.map +1 -0
  54. package/lib/exercises/math/functions/variations/readVarOnGraph2.js +172 -0
  55. package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts +4 -1
  56. package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts.map +1 -1
  57. package/lib/exercises/math/functions/variations/varTableExtremaReading.js +108 -42
  58. package/lib/exercises/math/functions/variations/varTableFromSentences.d.ts +7 -0
  59. package/lib/exercises/math/functions/variations/varTableFromSentences.d.ts.map +1 -1
  60. package/lib/exercises/math/functions/variations/varTableFromSentences.js +167 -137
  61. package/lib/exercises/math/geometry/areas/triangleArea.js +1 -1
  62. package/lib/exercises/math/probaStat/basicStats/calculateFrequency.js +1 -1
  63. package/lib/exercises/math/probaStat/binomial/binomialInequation.js +2 -2
  64. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +1 -1
  65. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +1 -1
  66. package/lib/geogebra/colors.d.ts +0 -1
  67. package/lib/geogebra/colors.d.ts.map +1 -1
  68. package/lib/geogebra/colors.js +2 -2
  69. package/lib/index.d.ts +42 -1
  70. package/lib/index.d.ts.map +1 -1
  71. package/lib/math/inequations/inequation.d.ts +1 -0
  72. package/lib/math/inequations/inequation.d.ts.map +1 -1
  73. package/lib/math/inequations/inequation.js +12 -0
  74. package/lib/tree/nodes/operators/addNode.js +0 -1
  75. package/lib/tree/nodes/sets/intervalNode.d.ts +1 -0
  76. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  77. package/lib/tree/nodes/sets/intervalNode.js +3 -0
  78. package/lib/tree/parsers/intervalParser.d.ts +2 -0
  79. package/lib/tree/parsers/intervalParser.d.ts.map +1 -1
  80. package/lib/tree/parsers/intervalParser.js +2 -1
  81. package/package.json +1 -1
@@ -0,0 +1,147 @@
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 { randint } from "../../../../math/utils/random/randint.js";
5
+ import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationSolutionNode.js";
6
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
7
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
8
+ import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
9
+ import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
10
+ import { random } from "../../../../utils/alea/random.js";
11
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
12
+ const getPropositions = (n, { answer, k }) => {
13
+ const propositions = [];
14
+ addValidProp(propositions, answer);
15
+ const kNode = reifyAlgebraic(k);
16
+ tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode([kNode])).toTex());
17
+ while (propositions.length < n) {
18
+ tryToAddWrongProp(propositions, new EquationSolutionNode(new DiscreteSetNode([randint(-10, 10, [0]).toTree()])).toTex());
19
+ }
20
+ return shuffleProps(propositions, n);
21
+ };
22
+ const getAnswer = (identifiers) => {
23
+ const kNode = reifyAlgebraic(identifiers.k);
24
+ const set = new EquationSolutionNode(new DiscreteSetNode([frac(1, kNode).simplify()]));
25
+ return set.toTex();
26
+ };
27
+ const getInstruction = (identifiers) => {
28
+ return `Résoudre, pour $x\\neq 0$, l'équation suivante :
29
+
30
+ $$
31
+ \\frac{1}{x} = ${reifyAlgebraic(identifiers.k).toTex()}
32
+ $$`;
33
+ };
34
+ const getHint = (identifiers) => {
35
+ return `La solution de l'équation $\\frac{1}{x} = k$ est :
36
+
37
+ $$
38
+ S=\\left\\lbrace \\frac{1}{k} \\right\\rbrace
39
+ $$`;
40
+ };
41
+ const getCorrection = (identifiers) => {
42
+ const kNode = reifyAlgebraic(identifiers.k);
43
+ const isSimp = frac(1, kNode).simplify().toTex() === frac(1, kNode).toTex();
44
+ return `La solution de l'équation $\\frac{1}{x} = k$ est :
45
+
46
+ $$
47
+ S=\\left\\lbrace \\frac{1}{k} \\right\\rbrace
48
+ $$
49
+
50
+ Ici, on a $k = ${kNode.toTex()}$, ${!isSimp
51
+ ? `et :
52
+
53
+ $$
54
+ \\frac{1}{${kNode.toTex()}}=${frac(1, kNode).simplify().toTex()}
55
+ $$
56
+
57
+ On a donc :
58
+
59
+ $$
60
+ ${getAnswer(identifiers)}
61
+ $$`
62
+ : `donc :
63
+
64
+ $$
65
+ ${getAnswer(identifiers)}
66
+ $$`}`;
67
+ };
68
+ const getKeys = (identifiers) => {
69
+ return ["S", "equal", "lbrace", "semicolon", "rbrace"];
70
+ };
71
+ const isAnswerValid = (ans, { answer }) => {
72
+ try {
73
+ const parsed = discreteSetParser(ans);
74
+ if (!parsed)
75
+ return false;
76
+ return ("S=" +
77
+ parsed
78
+ .simplify({
79
+ decimalToFractions: true,
80
+ })
81
+ .toTex() ===
82
+ answer);
83
+ }
84
+ catch (err) {
85
+ return handleVEAError(err);
86
+ }
87
+ };
88
+ const getSolveInverseEquationQuestion = (ops) => {
89
+ const type = randint(0, 4);
90
+ let k;
91
+ switch (type) {
92
+ case 0:
93
+ k = (random([-1, 1]) * 2 ** randint(0, 3) * 5 ** randint(0, 3)).toTree();
94
+ break;
95
+ case 1:
96
+ let a;
97
+ do {
98
+ a = randint(-19, 20, [0]);
99
+ } while ((1 / a).toString().length > 5);
100
+ k = a.toTree();
101
+ break;
102
+ case 2:
103
+ const b = randint(-10, 10, [0, 1, -1]);
104
+ k = frac(1, b);
105
+ break;
106
+ case 3:
107
+ default:
108
+ let ratio;
109
+ do {
110
+ ratio = RationalConstructor.randomIrreductible();
111
+ } while (ratio.num === 1);
112
+ k = ratio.toTree();
113
+ break;
114
+ }
115
+ const identifiers = {
116
+ k: k.toIdentifiers(),
117
+ };
118
+ return getQuestionFromIdentifiers(identifiers);
119
+ };
120
+ const getQuestionFromIdentifiers = (identifiers) => {
121
+ return {
122
+ answer: getAnswer(identifiers),
123
+ instruction: getInstruction(identifiers),
124
+ keys: getKeys(identifiers),
125
+ answerFormat: "tex",
126
+ identifiers,
127
+ hint: getHint(identifiers),
128
+ correction: getCorrection(identifiers),
129
+ };
130
+ };
131
+ export const solveInverseEquation = {
132
+ id: "solveInverseEquation",
133
+ label: "Résoudre une équation du type $\\frac{1}{x}=k$",
134
+ isSingleStep: true,
135
+ generator: (nb, opts) => getDistinctQuestions(() => getSolveInverseEquationQuestion(opts), nb),
136
+ qcmTimer: 60,
137
+ freeTimer: 60,
138
+ getPropositions,
139
+ isAnswerValid,
140
+ subject: "Mathématiques",
141
+ getInstruction,
142
+ getHint,
143
+ getCorrection,
144
+ getAnswer,
145
+ getQuestionFromIdentifiers,
146
+ hasHintAndCorrection: true,
147
+ };
@@ -65,7 +65,7 @@ $$`;
65
65
  const getHint = (identifiers) => {
66
66
  const affine1 = AffineConstructor.fromCoeffs(identifiers.affine1Coeffs);
67
67
  const affine2 = AffineConstructor.fromCoeffs(identifiers.affine2Coeffs);
68
- return `Résout les inéquations $${affine1.toTree().toTex()}>0$ et $${affine2
68
+ return `Résous les inéquations $${affine1.toTree().toTex()}>0$ et $${affine2
69
69
  .toTree()
70
70
  .toTex()}>0$.
71
71
 
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ affine1Coeffs: number[];
4
+ affine2Coeffs: number[];
5
+ initTable: string[][];
6
+ };
7
+ export declare const affineProductSignTableThirdLine: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=affineProductSignTableThirdLine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affineProductSignTableThirdLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSignTableThirdLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;CACvB,CAAC;AA8MF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAkBjE,CAAC"}
@@ -0,0 +1,201 @@
1
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
2
+ import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.js";
3
+ import { randint } from "../../../../math/utils/random/randint.js";
4
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
5
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
+ const getAnswerTable = (identifiers) => {
7
+ const affine1 = AffineConstructor.fromCoeffs(identifiers.affine1Coeffs);
8
+ const affine2 = AffineConstructor.fromCoeffs(identifiers.affine2Coeffs);
9
+ let root1 = affine1.getRoot().toTree();
10
+ let root2 = affine2.getRoot().toTree();
11
+ const isRoot1OfAffine1 = root1.evaluate() < root2.evaluate();
12
+ if (!isRoot1OfAffine1) {
13
+ [root1, root2] = [root2, root1];
14
+ }
15
+ const signs1 = affine1.a > 0 ? ["-", "+"] : ["+", "-"];
16
+ const signs2 = affine2.a > 0 ? ["-", "+"] : ["+", "-"];
17
+ const signs3 = affine1.a * affine2.a > 0 ? ["+", "-", "+"] : ["-", "+", "-"];
18
+ return [
19
+ [
20
+ "$x$",
21
+ "-\\infty",
22
+ "\\ ",
23
+ root1.toTex(),
24
+ "\\ ",
25
+ root2.toTex(),
26
+ "\\ ",
27
+ "+\\infty",
28
+ ],
29
+ [
30
+ `$${affine1.toTree().toTex()}$`,
31
+ "\\ ",
32
+ signs1[0],
33
+ isRoot1OfAffine1 ? "0" : signs1[0],
34
+ isRoot1OfAffine1 ? signs1[1] : signs1[0],
35
+ isRoot1OfAffine1 ? signs1[1] : "0",
36
+ signs1[1],
37
+ "\\ ",
38
+ ],
39
+ [
40
+ `$${affine2.toTree().toTex()}$`,
41
+ "\\ ",
42
+ signs2[0],
43
+ !isRoot1OfAffine1 ? "0" : signs2[0],
44
+ !isRoot1OfAffine1 ? signs2[1] : signs2[0],
45
+ !isRoot1OfAffine1 ? signs2[1] : "0",
46
+ signs2[1],
47
+ "\\ ",
48
+ ],
49
+ [`$f(x)$`, "\\ ", signs3[0], "0", signs3[1], "0", signs3[2], "\\ "],
50
+ ];
51
+ };
52
+ const getInstruction = (identifiers) => {
53
+ const affine1 = AffineConstructor.fromCoeffs(identifiers.affine1Coeffs);
54
+ const affine2 = AffineConstructor.fromCoeffs(identifiers.affine2Coeffs);
55
+ const product = multiply(affine1.toTree(), affine2.toTree());
56
+ return `Compléter le tableau de signes suivant afin de déterminer le signe de la fonction $f$ définie par :
57
+
58
+ $$
59
+ f(x) = ${product.toTex()}
60
+ $$`;
61
+ };
62
+ const getHint = (identifiers) => {
63
+ const affine1 = AffineConstructor.fromCoeffs(identifiers.affine1Coeffs);
64
+ const affine2 = AffineConstructor.fromCoeffs(identifiers.affine2Coeffs);
65
+ return `Utilise la règle des signes pour déterminer le signe de $f(x)$.`;
66
+ };
67
+ const getCorrection = (identifiers) => {
68
+ const affine1 = AffineConstructor.fromCoeffs(identifiers.affine1Coeffs);
69
+ const affine2 = AffineConstructor.fromCoeffs(identifiers.affine2Coeffs);
70
+ let root1 = affine1.getRoot().toTree();
71
+ let root2 = affine2.getRoot().toTree();
72
+ const isRoot1OfAffine1 = root1.evaluate() < root2.evaluate();
73
+ if (!isRoot1OfAffine1) {
74
+ [root1, root2] = [root2, root1];
75
+ }
76
+ const signs3 = affine1.a * affine2.a > 0
77
+ ? ["positif", "négatif", "positif"]
78
+ : ["négatif", "positif", "négatif"];
79
+ return `En utilisant la règle des signes, on conclut que $f$ est ${signs3[0]} sur $]\\infty; ${root1.toTex()}]$, puis ${signs3[1]} sur $[${root1.toTex()}; ${root2.toTex()}[$, puis ${signs3[2]} sur $[${root2.toTex()}; +\\infty[$.
80
+ `;
81
+ };
82
+ const getKeys = (identifiers) => {
83
+ return ["infty"];
84
+ };
85
+ const isAnswerTableValid = (ans, { answerTable, affine1Coeffs, affine2Coeffs }) => {
86
+ try {
87
+ const lastRowVEA = ans[3].every((cell, j) => cell === answerTable[3][j]);
88
+ if (!lastRowVEA)
89
+ return false;
90
+ return true;
91
+ return true;
92
+ }
93
+ catch (err) {
94
+ return handleVEAError(err);
95
+ }
96
+ };
97
+ const rowTableVEA = (row, answerRow, affineCoeffs) => {
98
+ const signs = affineCoeffs[1] > 0 ? ["-", "+"] : ["+", "-"];
99
+ const zero = row.indexOf("0");
100
+ if (!zero || answerRow[zero] !== "0")
101
+ return false;
102
+ const left = row.slice(1, zero);
103
+ const right = row.slice(zero + 1);
104
+ const leftGood = left.some((e) => e === signs[0]) &&
105
+ left.every((e) => e === signs[0] || e == "\\ " || e === "");
106
+ const rightGood = right.some((e) => e === signs[1]) &&
107
+ right.every((e) => e === signs[1] || e == "\\ " || e === "");
108
+ if (!leftGood || !rightGood)
109
+ return false;
110
+ return true;
111
+ };
112
+ const getTestSignTableQuestion = (ops) => {
113
+ let a = 0;
114
+ let b = 0;
115
+ let c = 0;
116
+ let d = 0;
117
+ do {
118
+ a = randint(-10, 10, [0]);
119
+ b = randint(-10, 10);
120
+ c = randint(-10, 10, [0]);
121
+ d = randint(-10, 10);
122
+ } while (c * b === a * d);
123
+ const affine1 = new Affine(a, b);
124
+ const affine2 = new Affine(c, d);
125
+ let root1 = affine1.getRoot().toTree();
126
+ let root2 = affine2.getRoot().toTree();
127
+ const isRoot1OfAffine1 = root1.evaluate() < root2.evaluate();
128
+ if (!isRoot1OfAffine1) {
129
+ [root1, root2] = [root2, root1];
130
+ }
131
+ const signs1 = affine1.a > 0 ? ["-", "+"] : ["+", "-"];
132
+ const signs2 = affine2.a > 0 ? ["-", "+"] : ["+", "-"];
133
+ const initTable = [
134
+ [
135
+ "$x$",
136
+ "-\\infty",
137
+ "\\ ",
138
+ root1.toTex(),
139
+ "\\ ",
140
+ root2.toTex(),
141
+ "\\ ",
142
+ "+\\infty",
143
+ ],
144
+ [
145
+ `$${affine1.toTree().toTex()}$`,
146
+ "\\ ",
147
+ signs1[0],
148
+ isRoot1OfAffine1 ? "0" : signs1[0],
149
+ isRoot1OfAffine1 ? signs1[1] : signs1[0],
150
+ isRoot1OfAffine1 ? signs1[1] : "0",
151
+ signs1[1],
152
+ "\\ ",
153
+ ],
154
+ [
155
+ `$${affine2.toTree().toTex()}$`,
156
+ "\\ ",
157
+ signs2[0],
158
+ !isRoot1OfAffine1 ? "0" : signs2[0],
159
+ !isRoot1OfAffine1 ? signs2[1] : signs2[0],
160
+ !isRoot1OfAffine1 ? signs2[1] : "0",
161
+ signs2[1],
162
+ "\\ ",
163
+ ],
164
+ [`$f(x)$`, "\\ ", "", "", "", "", "", "\\ "],
165
+ ];
166
+ const identifiers = {
167
+ affine1Coeffs: [b, a],
168
+ affine2Coeffs: [d, c],
169
+ initTable,
170
+ };
171
+ return getQuestionFromIdentifiers(identifiers);
172
+ };
173
+ const getQuestionFromIdentifiers = (identifiers) => {
174
+ return {
175
+ answerTable: getAnswerTable(identifiers),
176
+ instruction: getInstruction(identifiers),
177
+ keys: getKeys(identifiers),
178
+ answerFormat: "tex",
179
+ identifiers,
180
+ hint: getHint(identifiers),
181
+ correction: getCorrection(identifiers),
182
+ initTable: identifiers.initTable,
183
+ };
184
+ };
185
+ export const affineProductSignTableThirdLine = {
186
+ id: "affineProductSignTableThirdLine",
187
+ label: "Compléter la troisième ligne du tableau de signes d'un produit de fonctions affines",
188
+ isSingleStep: true,
189
+ generator: (nb, opts) => getDistinctQuestions(() => getTestSignTableQuestion(opts), nb),
190
+ qcmTimer: 60,
191
+ freeTimer: 60,
192
+ isAnswerTableValid,
193
+ subject: "Mathématiques",
194
+ getInstruction,
195
+ getHint,
196
+ getCorrection,
197
+ getAnswerTable,
198
+ getQuestionFromIdentifiers,
199
+ hasHintAndCorrection: true,
200
+ answerType: "signTable",
201
+ };
@@ -31,7 +31,7 @@ f(x) = ${affine.toTree().toTex()}
31
31
  $$`;
32
32
  };
33
33
  const getHint = (identifiers) => {
34
- return `Résout l'inéquation $f(x)>0$.`;
34
+ return `Résous l'inéquation $f(x)>0$.`;
35
35
  };
36
36
  const getCorrection = (identifiers) => {
37
37
  const { affineCoeffs, initTable } = identifiers;
@@ -5,4 +5,5 @@ export * from "./readSignTable.js";
5
5
  export * from "./signTableFromGraph.js";
6
6
  export * from "./equationFromSignTable.js";
7
7
  export * from "./partialSignTableFromGraph.js";
8
+ export * from "./affineProductSignTableThirdLine.js";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC"}
@@ -5,3 +5,4 @@ export * from "./readSignTable.js";
5
5
  export * from "./signTableFromGraph.js";
6
6
  export * from "./equationFromSignTable.js";
7
7
  export * from "./partialSignTableFromGraph.js";
8
+ export * from "./affineProductSignTableThirdLine.js";
@@ -1,4 +1,6 @@
1
1
  export * from "./squareImageInterval.js";
2
2
  export * from "./imageOfSquareFunction.js";
3
3
  export * from "./compareSquaredValues.js";
4
+ export * from "./squareImageIntervalWithGraph.js";
5
+ export * from "./squareFunctionInequationWithGraph.js";
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wCAAwC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from "./squareImageInterval.js";
2
2
  export * from "./imageOfSquareFunction.js";
3
3
  export * from "./compareSquaredValues.js";
4
- // export * from "./sqaureImageIntervalWithGraph.js";
4
+ export * from "./squareImageIntervalWithGraph.js";
5
+ export * from "./squareFunctionInequationWithGraph.js";
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { InegalitySymbols } from "../../../../math/inequations/inequation.js";
3
+ type Identifiers = {
4
+ k: number;
5
+ inequationSymbol: InegalitySymbols;
6
+ };
7
+ export declare const squareFunctionInequationWithGraph: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=squareFunctionInequationWithGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"squareFunctionInequationWithGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/squareFunctionInequationWithGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAa9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAoKF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAenE,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randomColor } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { InequationSymbol, InequationSymbolConstructor, } from "../../../../math/inequations/inequation.js";
6
+ import { randint } from "../../../../math/utils/random/randint.js";
7
+ import { OppositeNode } from "../../../../tree/nodes/functions/oppositeNode.js";
8
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
9
+ import { InequationSolutionNode } from "../../../../tree/nodes/inequations/inequationSolutionNode.js";
10
+ import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
11
+ import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
12
+ import { unionIntervalParser } from "../../../../tree/parsers/unionIntervalParser.js";
13
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
14
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
15
+ const getAnswer = (identifiers) => {
16
+ const { k, inequationSymbol } = identifiers;
17
+ const sqrtTree = sqrt(k).simplify();
18
+ const symbol = new InequationSymbol(inequationSymbol);
19
+ const isStrict = symbol.isStrict;
20
+ const insideInterval = new IntervalNode(new OppositeNode(sqrtTree), sqrtTree, isStrict ? ClosureType.OO : ClosureType.FF);
21
+ const set = symbol.isSup
22
+ ? insideInterval.toReversedClosure().toComplement()
23
+ : insideInterval;
24
+ const solution = new InequationSolutionNode(set);
25
+ return solution.toTex();
26
+ };
27
+ const getInstruction = (identifiers) => {
28
+ const { k, inequationSymbol } = identifiers;
29
+ return `On rappelle ci-dessous la courbe représentative de la fonction carré $f(x) = x^2$.
30
+
31
+ À l'aide de la courbe, résoudre l'inéquation suivante :
32
+
33
+ $$
34
+ x^2 ${inequationSymbol} ${k}
35
+ $$
36
+
37
+ *On pourra zoomer et déplacer la courbe si besoin.*`;
38
+ };
39
+ const getHint = (identifiers) => {
40
+ const { k, inequationSymbol } = identifiers;
41
+ const word = inequationSymbol === "<"
42
+ ? "strictement inférieure"
43
+ : inequationSymbol === ">"
44
+ ? "strictement supérieure"
45
+ : inequationSymbol === "\\le"
46
+ ? "inférieure"
47
+ : "supérieure";
48
+ return `Lit graphiquement tous les points de la courbe dont l'ordonnée est ${word} à $${k.frenchify()}$. La solution de l'inéquation est alors l'ensemble des abscisses de ces points.`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ const { k, inequationSymbol } = identifiers;
52
+ const word = inequationSymbol === "<"
53
+ ? "strictement en-dessous"
54
+ : inequationSymbol === ">"
55
+ ? "strictement au-dessus"
56
+ : inequationSymbol === "\\ge"
57
+ ? "au-dessus"
58
+ : "en-dessous";
59
+ const sqrtIsSimp = sqrt(k).toTex() === sqrt(k).simplify().toTex();
60
+ return `On trace la droite d'équation $y = ${k.frenchify()}$, et on repère les points de la courbe qui sont ${word} de cette droite.
61
+
62
+ On repère deux points d'intersection de la droite et de la courbe : les points $\\left(-${sqrt(k).toTex()};${k.frenchify()}\\right)$ et $\\left(${sqrt(k).toTex()};${k.frenchify()}\\right)$.
63
+
64
+ ${sqrtIsSimp
65
+ ? `La solution de l'inéquation est donc :
66
+
67
+ $$
68
+ ${getAnswer(identifiers)}
69
+ $$`
70
+ : `Puisque $${sqrt(k).toTex()} = ${sqrt(k)
71
+ .simplify()
72
+ .toTex()}$, on a donc :
73
+
74
+ $$
75
+ ${getAnswer(identifiers)}
76
+ $$`}`;
77
+ };
78
+ const getSquareFunctionInequationQuestion = () => {
79
+ const k = coinFlip() ? randint(1, 11) ** 2 : randint(1, 100);
80
+ const inequationSymbol = InequationSymbolConstructor.random();
81
+ const identifiers = { k, inequationSymbol: inequationSymbol.symbol };
82
+ return getQuestionFromIdentifiers(identifiers);
83
+ };
84
+ const getGGBOptions = (identifiers) => {
85
+ const ggb = new GeogebraConstructor({
86
+ commands: ["f(x) = x^2", `SetColor(f, "${randomColor()}")`],
87
+ lockedAxesRatio: false,
88
+ });
89
+ // const { a, b } = identifiers;
90
+ return ggb.getOptions({
91
+ // coords: [
92
+ // Math.min(a - 1, -1),
93
+ // Math.max(b + 1, 1),
94
+ // -1,
95
+ // Math.max(a ** 2, b ** 2) + 1,
96
+ // ],
97
+ coords: [-11, 11, -5, 110],
98
+ });
99
+ };
100
+ const getQuestionFromIdentifiers = (identifiers) => {
101
+ const question = {
102
+ answer: getAnswer(identifiers),
103
+ instruction: getInstruction(identifiers),
104
+ keys: ["S", "equal", "lbracket", "rbracket", "semicolon", "infty", "cup"],
105
+ answerFormat: "tex",
106
+ identifiers,
107
+ hint: getHint(identifiers),
108
+ correction: getCorrection(identifiers),
109
+ ggbOptions: getGGBOptions(identifiers),
110
+ };
111
+ return question;
112
+ };
113
+ const getPropositions = (n, { answer, k, inequationSymbol }) => {
114
+ const propositions = [];
115
+ addValidProp(propositions, answer);
116
+ tryToAddWrongProp(propositions, getAnswer({ k: k ** 2, inequationSymbol }));
117
+ tryToAddWrongProp(propositions, getAnswer({
118
+ k,
119
+ inequationSymbol: new InequationSymbol(inequationSymbol).reversed(),
120
+ }));
121
+ while (propositions.length < n) {
122
+ tryToAddWrongProp(propositions, getAnswer({ k: randint(1, 100), inequationSymbol }));
123
+ }
124
+ return shuffleProps(propositions, n);
125
+ };
126
+ const isAnswerValid = (ans, { answer, k, inequationSymbol }) => {
127
+ try {
128
+ const parsed = unionIntervalParser(ans.replaceAll("S", "").replaceAll("=", ""));
129
+ if (!parsed)
130
+ return false;
131
+ return "S=\\ " + parsed.simplify().toTex() === answer;
132
+ }
133
+ catch (err) {
134
+ return handleVEAError(err);
135
+ }
136
+ };
137
+ export const squareFunctionInequationWithGraph = {
138
+ id: "squareFunctionInequationWithGraph",
139
+ label: "Résoudre une inéquation du type $x^2 < k$ (avec graphique)",
140
+ isSingleStep: true,
141
+ generator: (nb) => getDistinctQuestions(getSquareFunctionInequationQuestion, nb),
142
+ qcmTimer: 60,
143
+ freeTimer: 60,
144
+ getPropositions,
145
+ isAnswerValid,
146
+ subject: "Mathématiques",
147
+ pdfOptions: { shouldSpreadPropositions: true },
148
+ getQuestionFromIdentifiers,
149
+ hasGeogebra: true,
150
+ hasHintAndCorrection: true,
151
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"squareImageIntervalWithGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/squareImageIntervalWithGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAW,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAMxE,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA8LF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAc9D,CAAC"}
1
+ {"version":3,"file":"squareImageIntervalWithGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/squareImageIntervalWithGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAW,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAMxE,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAoNF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAc9D,CAAC"}
@@ -67,7 +67,9 @@ $$
67
67
 
68
68
  On rappelle ci-dessous la courbe représentative de la fonction carré $f(x) = x^2$.
69
69
 
70
- À l'aide de la courbe, déterminer à quel intervalle appartient $x^2$.`;
70
+ À l'aide de la courbe, déterminer à quel intervalle appartient $x^2$.
71
+
72
+ *On pourra zoomer et déplacer la courbe si besoin.*`;
71
73
  };
72
74
  const getSquareImageIntervalQuestion = () => {
73
75
  let a;
@@ -97,12 +99,26 @@ const getSquareImageIntervalQuestion = () => {
97
99
  return getQuestionFromIdentifiers(identifiers);
98
100
  };
99
101
  const getHint = (identifiers) => {
100
- return ``;
102
+ const { a, b, closure, type } = identifiers;
103
+ const interval = new IntervalNode(a.toTree(), b.toTree(), closure);
104
+ return `Repère sur la courbe les points dont l'abscisse est ${interval.toText(false, true)}.
105
+
106
+ Lit alors la valeur minimale et la valeur maximale des ordonnées de ces points : cela te donnera l'intervalle auquel appartient $x^2$.`;
101
107
  };
102
108
  const getCorrection = (identifiers) => {
103
109
  const { a, b, closure, type } = identifiers;
104
110
  const interval = new IntervalNode(a.toTree(), b.toTree(), closure);
105
- return ``;
111
+ const min = a * b < 0 ? 0 : Math.min(Math.abs(a), Math.abs(b)) ** 2;
112
+ const max = Math.max(Math.abs(a), Math.abs(b)) ** 2;
113
+ return `On lit sur la courbe l'ordonnée des points dont l'abscisse $x$ est ${interval.toText(false, true)}.
114
+
115
+ Au minimum, l'ordonnée peut valoir $${min}$, et au maximum, elle peut valoir $${max}$.
116
+
117
+ On en conclut que $x^2$ est compris dans l'intervalle :
118
+
119
+ $$
120
+ ${getAnswer(identifiers)}
121
+ $$`;
106
122
  };
107
123
  const getGGBOptions = (identifiers) => {
108
124
  const ggb = new GeogebraConstructor({
@@ -2,4 +2,8 @@ export * from "./varTableExtremaReading.js";
2
2
  export * from "./varTableFromGraph.js";
3
3
  export * from "./compareImagesInVarTable.js";
4
4
  export * from "./partialVarTableFromGraph.js";
5
+ export * from "./varTableFromSentences.js";
6
+ export * from "./readVarOnGraph.js";
7
+ export * from "./readVarOnGraph2.js";
8
+ export * from "./readExtremaOnGraph.js";
5
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/variations/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/variations/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
@@ -2,3 +2,7 @@ export * from "./varTableExtremaReading.js";
2
2
  export * from "./varTableFromGraph.js";
3
3
  export * from "./compareImagesInVarTable.js";
4
4
  export * from "./partialVarTableFromGraph.js";
5
+ export * from "./varTableFromSentences.js";
6
+ export * from "./readVarOnGraph.js";
7
+ export * from "./readVarOnGraph2.js";
8
+ export * from "./readExtremaOnGraph.js";