math-exercises 3.0.93 → 3.0.95
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.
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +0 -9
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +0 -9
- package/lib/exercises/math/calcul/decimals/decimalBoundingOnLine.d.ts +9 -0
- package/lib/exercises/math/calcul/decimals/decimalBoundingOnLine.d.ts.map +1 -0
- package/lib/exercises/math/calcul/decimals/decimalBoundingOnLine.js +171 -0
- package/lib/exercises/math/calcul/decimals/index.d.ts +1 -0
- package/lib/exercises/math/calcul/decimals/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/decimals/index.js +1 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts +0 -1
- package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/index.js +0 -1
- package/lib/exercises/math/functions/basics/countFunctionZeroes.d.ts +11 -0
- package/lib/exercises/math/functions/basics/countFunctionZeroes.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/countFunctionZeroes.js +197 -0
- package/lib/exercises/math/functions/basics/findZeroesProductQuotient.d.ts +11 -0
- package/lib/exercises/math/functions/basics/findZeroesProductQuotient.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/findZeroesProductQuotient.js +213 -0
- package/lib/exercises/math/functions/basics/index.d.ts +3 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +3 -1
- package/lib/exercises/math/functions/basics/isPointOnFunction.d.ts +10 -0
- package/lib/exercises/math/functions/basics/isPointOnFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/isPointOnFunction.js +133 -0
- package/lib/exercises/math/functions/cube/index.d.ts +1 -0
- package/lib/exercises/math/functions/cube/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/cube/index.js +1 -0
- package/lib/exercises/math/functions/cube/isPointOnCubicFunction.d.ts +9 -0
- package/lib/exercises/math/functions/cube/isPointOnCubicFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/cube/isPointOnCubicFunction.js +111 -0
- package/lib/exercises/math/functions/inverse/compareInverseValues.d.ts +10 -0
- package/lib/exercises/math/functions/inverse/compareInverseValues.d.ts.map +1 -0
- package/lib/exercises/math/functions/inverse/compareInverseValues.js +136 -0
- package/lib/exercises/math/functions/inverse/index.d.ts +3 -0
- package/lib/exercises/math/functions/inverse/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/inverse/index.js +2 -0
- package/lib/exercises/math/functions/inverse/isPointOnReciprocalFunction.d.ts +9 -0
- package/lib/exercises/math/functions/inverse/isPointOnReciprocalFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/inverse/isPointOnReciprocalFunction.js +117 -0
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts +4 -1
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/equationFromSignTable.js +25 -10
- package/lib/exercises/math/functions/sqrt/getImageOfSquareRootFunction.d.ts +8 -0
- package/lib/exercises/math/functions/sqrt/getImageOfSquareRootFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/sqrt/getImageOfSquareRootFunction.js +128 -0
- package/lib/exercises/math/functions/sqrt/index.d.ts +1 -0
- package/lib/exercises/math/functions/sqrt/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/sqrt/index.js +1 -0
- package/lib/exercises/math/functions/square/compareSquaredValues.d.ts +9 -0
- package/lib/exercises/math/functions/square/compareSquaredValues.d.ts.map +1 -0
- package/lib/exercises/math/functions/square/compareSquaredValues.js +143 -0
- package/lib/exercises/math/functions/square/imageOfSquareFunction.d.ts +8 -0
- package/lib/exercises/math/functions/square/imageOfSquareFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/square/imageOfSquareFunction.js +152 -0
- package/lib/exercises/math/functions/square/index.d.ts +2 -1
- package/lib/exercises/math/functions/square/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/index.js +3 -1
- package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.d.ts +11 -0
- package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.js +174 -0
- package/lib/exercises/math/functions/variations/index.d.ts +1 -0
- package/lib/exercises/math/functions/variations/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/index.js +1 -0
- package/lib/exercises/math/functions/variations/partialVarTableFromGraph.d.ts +10 -0
- package/lib/exercises/math/functions/variations/partialVarTableFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/variations/partialVarTableFromGraph.js +198 -0
- package/lib/exercises/math/functions/variations/varTableFromSentences.d.ts +2 -0
- package/lib/exercises/math/functions/variations/varTableFromSentences.d.ts.map +1 -0
- package/lib/exercises/math/functions/variations/varTableFromSentences.js +137 -0
- package/lib/exercises/math/powers/index.d.ts +1 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +1 -0
- package/lib/exercises/math/powers/powerNotation.d.ts +9 -0
- package/lib/exercises/math/powers/powerNotation.d.ts.map +1 -0
- package/lib/exercises/math/powers/powerNotation.js +126 -0
- package/lib/exercises/math/sets/index.d.ts +1 -0
- package/lib/exercises/math/sets/index.d.ts.map +1 -1
- package/lib/exercises/math/sets/index.js +1 -0
- package/lib/exercises/math/sets/isNumberDecimal.d.ts +11 -0
- package/lib/exercises/math/sets/isNumberDecimal.d.ts.map +1 -0
- package/lib/exercises/math/sets/isNumberDecimal.js +144 -0
- package/lib/index.d.ts +48 -42
- package/lib/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
2
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
3
|
+
import { Polynomial } from "../../../../math/polynomials/polynomial.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
6
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
|
+
const getFunc = (identifiers) => {
|
|
8
|
+
const { coeffs } = identifiers;
|
|
9
|
+
const poly = new Polynomial(coeffs);
|
|
10
|
+
return (x) => coeffs;
|
|
11
|
+
};
|
|
12
|
+
const getRoots = (coeffs) => {
|
|
13
|
+
const [d, c, b, a] = coeffs;
|
|
14
|
+
const sqrtDelta = 2 * Math.sqrt(b ** 2 - 3 * a * c);
|
|
15
|
+
const x1 = (-2 * b - sqrtDelta) / (6 * a);
|
|
16
|
+
const x2 = (-2 * b + sqrtDelta) / (6 * a);
|
|
17
|
+
return [x1, x2].sort((a, b) => a - b);
|
|
18
|
+
};
|
|
19
|
+
const getGGBOptions = (identifiers) => {
|
|
20
|
+
const { coeffs } = identifiers;
|
|
21
|
+
const poly = new Polynomial(coeffs);
|
|
22
|
+
const commands = [`f(x) =${poly.toMathString()}`];
|
|
23
|
+
const ggb = new GeogebraConstructor({
|
|
24
|
+
commands,
|
|
25
|
+
lockedAxesRatio: false,
|
|
26
|
+
});
|
|
27
|
+
const [x1, x2] = getRoots(coeffs);
|
|
28
|
+
const fx1 = poly.calculate(x1);
|
|
29
|
+
const fx2 = poly.calculate(x2);
|
|
30
|
+
return ggb.getOptions({
|
|
31
|
+
coords: ggb.getAdaptedCoords({
|
|
32
|
+
xMin: x1 - 2,
|
|
33
|
+
xMax: x2 + 2,
|
|
34
|
+
yMin: Math.min(fx1, fx2) - 2,
|
|
35
|
+
yMax: Math.max(fx1, fx2) + 2,
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const getFirstLine = (x1, x2) => {
|
|
40
|
+
return [
|
|
41
|
+
"$x$",
|
|
42
|
+
"-\\infty",
|
|
43
|
+
"\\ ",
|
|
44
|
+
x1.toTree().toTex(),
|
|
45
|
+
"\\ ",
|
|
46
|
+
x2.toTree().toTex(),
|
|
47
|
+
"\\ ",
|
|
48
|
+
"+\\infty",
|
|
49
|
+
];
|
|
50
|
+
};
|
|
51
|
+
const getSecondsLines = (coeffs) => {
|
|
52
|
+
const [d, c, b, a] = coeffs;
|
|
53
|
+
const poly = new Polynomial(coeffs);
|
|
54
|
+
const [x1, x2] = getRoots(coeffs);
|
|
55
|
+
const fx1 = poly.calculate(x1);
|
|
56
|
+
const fx2 = poly.calculate(x2);
|
|
57
|
+
const vars = coeffs[3] > 0
|
|
58
|
+
? ["\\nearrow", "\\searrow", "\\nearrow"]
|
|
59
|
+
: ["\\searrow", "\\nearrow", "\\searrow"];
|
|
60
|
+
return [
|
|
61
|
+
[
|
|
62
|
+
"$\\ $",
|
|
63
|
+
"\\ ",
|
|
64
|
+
"\\ ",
|
|
65
|
+
a > 0 ? fx1.toTree().toTex() : "\\ ",
|
|
66
|
+
"\\ ",
|
|
67
|
+
a > 0 ? "\\ " : fx1.toTree().toTex(),
|
|
68
|
+
"\\ ",
|
|
69
|
+
"\\ ",
|
|
70
|
+
],
|
|
71
|
+
["$f(x)$", "\\ ", vars[0], "\\ ", vars[1], "\\ ", vars[2], "\\ "],
|
|
72
|
+
[
|
|
73
|
+
"$\\ $",
|
|
74
|
+
"\\ ",
|
|
75
|
+
"\\ ",
|
|
76
|
+
a > 0 ? "\\ " : fx2.toTree().toTex(),
|
|
77
|
+
"\\ ",
|
|
78
|
+
a > 0 ? fx2.toTree().toTex() : "\\ ",
|
|
79
|
+
"\\ ",
|
|
80
|
+
"\\ ",
|
|
81
|
+
],
|
|
82
|
+
];
|
|
83
|
+
};
|
|
84
|
+
const getAnswerTable = (identifiers) => {
|
|
85
|
+
const { coeffs } = identifiers;
|
|
86
|
+
const [x1, x2] = getRoots(coeffs);
|
|
87
|
+
return [getFirstLine(x1, x2), ...getSecondsLines(coeffs)];
|
|
88
|
+
};
|
|
89
|
+
const getInstruction = (identifiers) => {
|
|
90
|
+
return `Dresser le tableau de variations de la fonction $f$ définie sur $\\mathbb{R}$ dont la courbe représentative est donnée ci-dessous :`;
|
|
91
|
+
};
|
|
92
|
+
const getHint = (identifiers) => {
|
|
93
|
+
return `La fonction est définie sur $\\mathbb{R}$, donc les valeurs de $x$ vont de $-\\infty$ à $+\\infty$.
|
|
94
|
+
|
|
95
|
+
Repère ensuite les points de la courbe auxquels le sens de variation change. Dans la première ligne du tableau, il faut mettre les abscisses de ces points, et dans la deuxième ligne, les ordonnées.`;
|
|
96
|
+
};
|
|
97
|
+
const getCorrection = (identifiers) => {
|
|
98
|
+
const { coeffs } = identifiers;
|
|
99
|
+
const [d, c, b, a] = coeffs;
|
|
100
|
+
const poly = new Polynomial(coeffs);
|
|
101
|
+
const [x1, x2] = getRoots(coeffs);
|
|
102
|
+
const fx1 = poly.calculate(x1);
|
|
103
|
+
const fx2 = poly.calculate(x2);
|
|
104
|
+
const words = a > 0
|
|
105
|
+
? ["croissante", "décroissante", "croissante"]
|
|
106
|
+
: ["décroissante", "croissante", "décroissante"];
|
|
107
|
+
return `D'après le graphique, la fonction $f$ est ${words[0]} sur $]-\\infty; ${x1}]$, puis ${words[1]} sur $[${x1}; ${x2}]$, puis ${words[2]} sur $[${x2}; +\\infty[$.
|
|
108
|
+
|
|
109
|
+
De plus, on lit graphiquement que l'image de $${x1}$ est $${fx1}$, et celle de $${x2}$ est $${fx2}$.
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
`;
|
|
113
|
+
};
|
|
114
|
+
const getKeys = (identifiers) => {
|
|
115
|
+
return ["infty"];
|
|
116
|
+
};
|
|
117
|
+
const isAnswerTableValid = (ans, { answerTable }) => {
|
|
118
|
+
try {
|
|
119
|
+
return ans.every((row, i) => row.every((cell, j) => cell === answerTable[i][j]));
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
return handleVEAError(err);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
// const lists = [
|
|
126
|
+
// "x^3 - 3x",
|
|
127
|
+
// "x^3 -6x^2 + 9x",
|
|
128
|
+
// "-x^3 + 3x^2 + 9x",
|
|
129
|
+
// "2x^3 - 9x^2 + 12x",
|
|
130
|
+
// "-x^3+6x^2-9x",
|
|
131
|
+
// "4x^3 -24x^2 + 36x",
|
|
132
|
+
// ];
|
|
133
|
+
const poly3Coeffs = [
|
|
134
|
+
[0, -3, 0, 1],
|
|
135
|
+
[0, 9, -6, 1],
|
|
136
|
+
// [0, 9, 3, -1],
|
|
137
|
+
[0, 12, -9, 2],
|
|
138
|
+
[0, -9, 6, -1],
|
|
139
|
+
// [0, 36, -24, 4],
|
|
140
|
+
];
|
|
141
|
+
const getTestSignTableQuestion = (ops) => {
|
|
142
|
+
const index = randint(0, 4);
|
|
143
|
+
const lineAsked = randint(0, 2);
|
|
144
|
+
const coeffs = coinFlip()
|
|
145
|
+
? poly3Coeffs[index]
|
|
146
|
+
: poly3Coeffs[index].map((x) => -x);
|
|
147
|
+
const finalCoeffs = [coeffs[0] + randint(-10, 10), ...coeffs.slice(1)];
|
|
148
|
+
const [x1, x2] = getRoots(finalCoeffs);
|
|
149
|
+
const initTable = [
|
|
150
|
+
lineAsked === 0
|
|
151
|
+
? ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", ""]
|
|
152
|
+
: getFirstLine(x1, x2),
|
|
153
|
+
];
|
|
154
|
+
if (lineAsked === 1) {
|
|
155
|
+
initTable.push(["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "], ["$f(x)$", "\\ ", "", "", "", "", "", "\\ "], ["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "]);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
initTable.push(...getSecondsLines(finalCoeffs));
|
|
159
|
+
}
|
|
160
|
+
const identifiers = {
|
|
161
|
+
type: 0,
|
|
162
|
+
coeffs: finalCoeffs,
|
|
163
|
+
initTable,
|
|
164
|
+
lineAsked,
|
|
165
|
+
};
|
|
166
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
167
|
+
};
|
|
168
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
169
|
+
return {
|
|
170
|
+
answerTable: getAnswerTable(identifiers),
|
|
171
|
+
instruction: getInstruction(identifiers),
|
|
172
|
+
keys: getKeys(identifiers),
|
|
173
|
+
answerFormat: "tex",
|
|
174
|
+
identifiers,
|
|
175
|
+
hint: getHint(identifiers),
|
|
176
|
+
correction: getCorrection(identifiers),
|
|
177
|
+
initTable: identifiers.initTable,
|
|
178
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
export const partialVarTableFromGraph = {
|
|
182
|
+
id: "partialVarTableFromGraph",
|
|
183
|
+
label: "Compléter le tableau de variations d'une fonction à partir de sa représentation graphique",
|
|
184
|
+
isSingleStep: true,
|
|
185
|
+
generator: (nb, opts) => getDistinctQuestions(() => getTestSignTableQuestion(opts), nb),
|
|
186
|
+
qcmTimer: 60,
|
|
187
|
+
freeTimer: 60,
|
|
188
|
+
isAnswerTableValid,
|
|
189
|
+
subject: "Mathématiques",
|
|
190
|
+
getInstruction,
|
|
191
|
+
getHint,
|
|
192
|
+
getCorrection,
|
|
193
|
+
getAnswerTable,
|
|
194
|
+
getQuestionFromIdentifiers,
|
|
195
|
+
hasHintAndCorrection: true,
|
|
196
|
+
answerType: "varTable",
|
|
197
|
+
hasGeogebra: true,
|
|
198
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"varTableFromSentences.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/variations/varTableFromSentences.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// import {
|
|
2
|
+
// Exercise,
|
|
3
|
+
// Proposition,
|
|
4
|
+
// QCMGenerator,
|
|
5
|
+
// Question,
|
|
6
|
+
// QuestionGenerator,
|
|
7
|
+
// VEA,
|
|
8
|
+
// addValidProp,
|
|
9
|
+
// shuffleProps,
|
|
10
|
+
// GetAnswer,
|
|
11
|
+
// GetHint,
|
|
12
|
+
// GetCorrection,
|
|
13
|
+
// GetInstruction,
|
|
14
|
+
// GetKeys,
|
|
15
|
+
// GetQuestionFromIdentifiers,
|
|
16
|
+
// GetAnswerTable,
|
|
17
|
+
// TableVEA,
|
|
18
|
+
// } from "../../../../exercises/exercise.js";
|
|
19
|
+
// import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
20
|
+
// import { randTupleInt } from "../../../../math/utils/random/randTupleInt.js";
|
|
21
|
+
// import {
|
|
22
|
+
// NodeIdentifiers,
|
|
23
|
+
// reifyAlgebraic,
|
|
24
|
+
// } from "../../../../tree/nodes/nodeConstructor.js";
|
|
25
|
+
// import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
26
|
+
// import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
27
|
+
// import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
28
|
+
export {};
|
|
29
|
+
// type Identifiers = {
|
|
30
|
+
// vars: string[];
|
|
31
|
+
// xs: NodeIdentifiers[];
|
|
32
|
+
// };
|
|
33
|
+
// /**
|
|
34
|
+
// *
|
|
35
|
+
// * xs
|
|
36
|
+
// * [-10, -4, 3, 10]
|
|
37
|
+
// * [f(-10), "\\nearrow", f(-4), "\\searrow", "f(3)", "\\nearrow", f(10)]
|
|
38
|
+
// */
|
|
39
|
+
// const getAnswerTable: GetAnswerTable<Identifiers> = (identifiers) => {
|
|
40
|
+
// const { vars, xs } = identifiers;
|
|
41
|
+
// const xsNodes = xs.map((x) => reifyAlgebraic(x));
|
|
42
|
+
// const secondLine: string[][] = [[], [], []];
|
|
43
|
+
// for (let i = 0; i < vars.length; i++) {
|
|
44
|
+
// if (i % 2 === 0) {
|
|
45
|
+
// let row = 0;
|
|
46
|
+
// if (i === 0) {
|
|
47
|
+
// row = vars[1] === "\\nearrow" ? 2 : 0;
|
|
48
|
+
// } else {
|
|
49
|
+
// row = vars[i - 1] === "\\nearrow" ? 0 : 2;
|
|
50
|
+
// }
|
|
51
|
+
// secondLine[row].push(vars[i]);
|
|
52
|
+
// secondLine[2 - row].push("\\ ");
|
|
53
|
+
// secondLine[1].push("\\ ");
|
|
54
|
+
// } else {
|
|
55
|
+
// secondLine[1].push(vars[i]);
|
|
56
|
+
// secondLine[0].push("\\ ");
|
|
57
|
+
// secondLine[2].push("\\ ");
|
|
58
|
+
// }
|
|
59
|
+
// }
|
|
60
|
+
// return [
|
|
61
|
+
// ["$x$", ...xsNodes.join("\\ ")],
|
|
62
|
+
// ["$\\ $", ...secondLine[0]],
|
|
63
|
+
// ["$f(x)$", ...secondLine[1]],
|
|
64
|
+
// ["$\\ $", ...secondLine[2]],
|
|
65
|
+
// ];
|
|
66
|
+
// };
|
|
67
|
+
// const getInstruction: GetInstruction<Identifiers> = (identifiers) => {
|
|
68
|
+
// const { vars, xs } = identifiers;
|
|
69
|
+
// const xsNodes = xs.map((x) => reifyAlgebraic(x));
|
|
70
|
+
// return `La fonction $f$ est définie sur ...
|
|
71
|
+
// Elle est croissante sur ...
|
|
72
|
+
// Elle est décroissante sur ...
|
|
73
|
+
// De plus, on a $f()=...$`;
|
|
74
|
+
// };
|
|
75
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {
|
|
76
|
+
// return `La première ligne d'un tableau de variations contient les valeurs de $x$. La deuxième ligne donne les variations de la fonction en fonction des valeurs de $x$ de la premiere ligne.`;
|
|
77
|
+
// };
|
|
78
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
|
|
79
|
+
// return ``;
|
|
80
|
+
// };
|
|
81
|
+
// const getKeys: GetKeys<Identifiers> = (identifiers) => {
|
|
82
|
+
// return [];
|
|
83
|
+
// };
|
|
84
|
+
// const isAnswerTableValid: TableVEA<Identifiers> = (ans, { answerTable }) => {
|
|
85
|
+
// try {
|
|
86
|
+
// return ans.every((row, i) =>
|
|
87
|
+
// row.every((cell, j) => cell === answerTable[i][j]),
|
|
88
|
+
// );
|
|
89
|
+
// } catch (err) {
|
|
90
|
+
// return handleVEAError(err);
|
|
91
|
+
// }
|
|
92
|
+
// };
|
|
93
|
+
// const getVarTableFromSentencesQuestion: QuestionGenerator<Identifiers> = (
|
|
94
|
+
// ops,
|
|
95
|
+
// ) => {
|
|
96
|
+
// const x = randTupleInt(4, {allDifferent: true, from: -10, to: 11})
|
|
97
|
+
// const xs = x.sort((a,b)=>a-b);
|
|
98
|
+
// const sens = coinFlip()
|
|
99
|
+
// const vars = [];
|
|
100
|
+
// const identifiers: Identifiers = {
|
|
101
|
+
// xs: xs.map((e)=>e.toTree().toIdentifiers()),
|
|
102
|
+
// vars,
|
|
103
|
+
// };
|
|
104
|
+
// return getQuestionFromIdentifiers(identifiers);
|
|
105
|
+
// };
|
|
106
|
+
// const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (
|
|
107
|
+
// identifiers,
|
|
108
|
+
// ) => {
|
|
109
|
+
// return {
|
|
110
|
+
// answerTable: getAnswerTable(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
|
+
// export const varTableFromSentences: Exercise<Identifiers> = {
|
|
120
|
+
// id: "varTableFromSentences",
|
|
121
|
+
// label:
|
|
122
|
+
// "Dresser le tableau de variations d'une fonction à partir de phrases descriptives",
|
|
123
|
+
// isSingleStep: true,
|
|
124
|
+
// generator: (nb, opts) =>
|
|
125
|
+
// getDistinctQuestions(() => getVarTableFromSentencesQuestion(opts), nb),
|
|
126
|
+
// qcmTimer: 60,
|
|
127
|
+
// freeTimer: 60,
|
|
128
|
+
// isAnswerTableValid,
|
|
129
|
+
// subject: "Mathématiques",
|
|
130
|
+
// getInstruction,
|
|
131
|
+
// getHint,
|
|
132
|
+
// getCorrection,
|
|
133
|
+
// getAnswerTable,
|
|
134
|
+
// getQuestionFromIdentifiers,
|
|
135
|
+
// hasHintAndCorrection: true,
|
|
136
|
+
// answerType: "varTable",
|
|
137
|
+
// };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"powerNotation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powerNotation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAmIF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAkB/C,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
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 { add } from "../../../tree/nodes/operators/addNode.js";
|
|
5
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
6
|
+
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
7
|
+
import { isPowerNode, power } from "../../../tree/nodes/operators/powerNode.js";
|
|
8
|
+
import { substract } from "../../../tree/nodes/operators/substractNode.js";
|
|
9
|
+
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
10
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
12
|
+
const getPropositions = (nn, { answer, ...identifiers }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
addValidProp(propositions, answer);
|
|
15
|
+
const { a, n } = identifiers;
|
|
16
|
+
// Soit 1/a^n
|
|
17
|
+
// (a+1)^n
|
|
18
|
+
tryToAddWrongProp(propositions, power(add(a, 1).simplify(), n).toTex());
|
|
19
|
+
// (a-1)^n
|
|
20
|
+
tryToAddWrongProp(propositions, power(substract(a, 1).simplify(), n).toTex());
|
|
21
|
+
// -a^n
|
|
22
|
+
tryToAddWrongProp(propositions, power(multiply(-1, a), n).toTex());
|
|
23
|
+
// -a^(-n)
|
|
24
|
+
tryToAddWrongProp(propositions, power(multiply(-1, a), multiply(-1, n)).toTex());
|
|
25
|
+
// a*-1^(-n)
|
|
26
|
+
tryToAddWrongProp(propositions, multiply(a, power(-1, multiply(-1, n))).toTex());
|
|
27
|
+
// n^a
|
|
28
|
+
tryToAddWrongProp(propositions, power(n, a).toTex());
|
|
29
|
+
// -n^a
|
|
30
|
+
tryToAddWrongProp(propositions, power(multiply(-1, n), a).toTex());
|
|
31
|
+
// n^(-a)
|
|
32
|
+
tryToAddWrongProp(propositions, power(n, multiply(-1, a)).toTex());
|
|
33
|
+
return shuffleProps(propositions, nn);
|
|
34
|
+
};
|
|
35
|
+
const getAnswer = (identifiers) => {
|
|
36
|
+
// (1/a^n) <=> a^(-n)
|
|
37
|
+
const { a, n } = identifiers;
|
|
38
|
+
return `${power(a, multiply(-1, n)).toTex()}`;
|
|
39
|
+
};
|
|
40
|
+
const getInstruction = (identifiers) => {
|
|
41
|
+
const { a, n, isSimplified } = identifiers;
|
|
42
|
+
const an = power(a, n);
|
|
43
|
+
const fraction = frac(1, isSimplified ? an.evaluate() : an);
|
|
44
|
+
return `Écrire $${fraction.toTex()}$ sous la forme $a^n$, avec $n \\in \\mathbb{Z}.$`;
|
|
45
|
+
};
|
|
46
|
+
const getHint = (identifiers) => {
|
|
47
|
+
const fracForm = frac(1, power("a", "n")).toTex();
|
|
48
|
+
return `On a :
|
|
49
|
+
|
|
50
|
+
$$
|
|
51
|
+
${fracForm} = ${power("a", multiply(-1, "n")).toTex()}
|
|
52
|
+
$$`;
|
|
53
|
+
};
|
|
54
|
+
const getCorrection = (identifiers) => {
|
|
55
|
+
const { a, n, isSimplified } = identifiers;
|
|
56
|
+
const fraction = frac(1, power(a, n));
|
|
57
|
+
const fracForm = frac(1, power("a", "n")).toTex();
|
|
58
|
+
return `On sait que :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
${fracForm} = ${power("a", multiply(-1, "n")).toTex()}
|
|
62
|
+
$$
|
|
63
|
+
|
|
64
|
+
Ici on a donc :
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
${fraction.toTex()} = ${power(a, multiply(-1, n)).toTex()}
|
|
68
|
+
$$
|
|
69
|
+
|
|
70
|
+
avec $a = ${a}$ et $n = ${n}$${isSimplified
|
|
71
|
+
? `, sachant que $${power(a, n).evaluate()} = ${power(a, n).toTex()}$`
|
|
72
|
+
: ""}.`;
|
|
73
|
+
};
|
|
74
|
+
const getKeys = (identifiers) => {
|
|
75
|
+
return [];
|
|
76
|
+
};
|
|
77
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
78
|
+
const { a, n } = identifiers;
|
|
79
|
+
const node = parseAlgebraic(ans);
|
|
80
|
+
try {
|
|
81
|
+
return (isPowerNode(node) &&
|
|
82
|
+
node.simplify().equals(power(a, multiply(-1, n)).simplify()));
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
return handleVEAError(err);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const getPowerNotationQuestion = (ops) => {
|
|
89
|
+
const isSimplePower = (a, n) => {
|
|
90
|
+
return (n === 2 && a <= 11) || (n === 3 && a <= 3);
|
|
91
|
+
};
|
|
92
|
+
const a = randint(2, 12);
|
|
93
|
+
const n = randint(2, 5);
|
|
94
|
+
const isSimplified = isSimplePower(a, n) ? coinFlip() : false;
|
|
95
|
+
const identifiers = { a, n, isSimplified };
|
|
96
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
97
|
+
};
|
|
98
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
99
|
+
return {
|
|
100
|
+
answer: getAnswer(identifiers),
|
|
101
|
+
instruction: getInstruction(identifiers),
|
|
102
|
+
keys: getKeys(identifiers),
|
|
103
|
+
answerFormat: "tex",
|
|
104
|
+
identifiers,
|
|
105
|
+
hint: getHint(identifiers),
|
|
106
|
+
correction: getCorrection(identifiers),
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export const powerNotation = {
|
|
110
|
+
id: "powerNotation",
|
|
111
|
+
label: "Écrire une fraction sous la forme $a^n$",
|
|
112
|
+
isSingleStep: true,
|
|
113
|
+
generator: (nb, opts) => getDistinctQuestions(() => getPowerNotationQuestion(opts), nb),
|
|
114
|
+
qcmTimer: 60,
|
|
115
|
+
freeTimer: 60,
|
|
116
|
+
getPropositions,
|
|
117
|
+
isAnswerValid,
|
|
118
|
+
subject: "Mathématiques",
|
|
119
|
+
getInstruction,
|
|
120
|
+
getHint,
|
|
121
|
+
getCorrection,
|
|
122
|
+
getAnswer,
|
|
123
|
+
getQuestionFromIdentifiers,
|
|
124
|
+
hasHintAndCorrection: true,
|
|
125
|
+
shouldHaveCalculator: false,
|
|
126
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
options: {
|
|
5
|
+
a: NodeIdentifiers;
|
|
6
|
+
isDecimal: boolean;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
export declare const isNumberdecimal: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=isNumberDecimal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isNumberDecimal.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/isNumberDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAa7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE;QACP,CAAC,EAAE,eAAe,CAAC;QACnB,SAAS,EAAE,OAAO,CAAC;KACpB,EAAE,CAAC;CACL,CAAC;AAqIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAmBjD,CAAC"}
|