math-exercises 3.0.187 → 3.0.188
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/derivation/derivative/exp/expDerivativeProductFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +22 -6
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +16 -8
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts +9 -0
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.js +155 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivativeNumber/index.js +1 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +80 -29
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +30 -2
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +59 -16
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +23 -9
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +2 -7
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +2 -7
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts +1 -0
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/equationFromSignTable.js +60 -33
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts +6 -4
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.js +160 -63
- package/lib/exercises/math/functions/sign/readSignTable.d.ts +4 -1
- package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/readSignTable.js +32 -9
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +6 -4
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/signTableFromGraph.js +160 -57
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts +9 -0
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts.map +1 -0
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.js +135 -0
- package/lib/exercises/math/percent/evolutions/index.d.ts +1 -0
- package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/index.js +1 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts +9 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts.map +1 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.js +118 -0
- package/lib/exercises/math/powers/estimateNthRoot.d.ts +13 -0
- package/lib/exercises/math/powers/estimateNthRoot.d.ts.map +1 -0
- package/lib/exercises/math/powers/estimateNthRoot.js +126 -0
- package/lib/exercises/math/powers/index.d.ts +3 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +3 -0
- package/lib/exercises/math/powers/solveNthRootEquation.d.ts +9 -0
- package/lib/exercises/math/powers/solveNthRootEquation.d.ts.map +1 -0
- package/lib/exercises/math/powers/solveNthRootEquation.js +111 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +2 -2
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +1 -1
- package/lib/exercises/vea/percentVEA.d.ts +6 -1
- package/lib/exercises/vea/percentVEA.d.ts.map +1 -1
- package/lib/exercises/vea/percentVEA.js +15 -1
- package/lib/index.d.ts +34 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +5 -8
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +1 -3
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqGeometricSituations.js +8 -10
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +8 -0
- package/lib/tree/nodes/sets/closure.d.ts +1 -0
- package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
- package/lib/tree/nodes/sets/closure.js +12 -0
- package/package.json +1 -1
|
@@ -200,10 +200,15 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
200
200
|
{
|
|
201
201
|
const nodeX = "x".toTree();
|
|
202
202
|
const nodeTWrong = add(multiply(nodeValueDerivative, nodeX), nodeValueImage);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
try {
|
|
204
|
+
const texWrong = `y = ${nodeTWrong
|
|
205
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
206
|
+
.toTex()}`;
|
|
207
|
+
tryToAddWrongProp(propositionsMandatory, texWrong);
|
|
208
|
+
}
|
|
209
|
+
catch (_) {
|
|
210
|
+
(() => { })();
|
|
211
|
+
}
|
|
207
212
|
}
|
|
208
213
|
//filler
|
|
209
214
|
const propositionsFiller = [];
|
|
@@ -222,10 +227,15 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
222
227
|
].forEach(([nodeXAskedWrong, nodeValueImageWrong, nodeValueDerivativeWrong]) => {
|
|
223
228
|
const nodeX = "x".toTree();
|
|
224
229
|
const nodeTWrong = add(multiply(nodeValueDerivativeWrong, substract(nodeX, nodeXAskedWrong)), nodeValueImageWrong);
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
230
|
+
try {
|
|
231
|
+
const texWrong = `y = ${nodeTWrong
|
|
232
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
233
|
+
.toTex()}`;
|
|
234
|
+
tryToAddWrongProp(propositionsFiller, texWrong);
|
|
235
|
+
}
|
|
236
|
+
catch (_) {
|
|
237
|
+
(() => { })();
|
|
238
|
+
}
|
|
229
239
|
});
|
|
230
240
|
}
|
|
231
241
|
propWhile(propositionsFiller, n, () => {
|
|
@@ -288,7 +298,11 @@ const isIdentifiersQCPassed = (identifiers) => {
|
|
|
288
298
|
}
|
|
289
299
|
return isExploding;
|
|
290
300
|
};
|
|
291
|
-
|
|
301
|
+
const isVEAOk = (identifiers) => {
|
|
302
|
+
const answer = getAnswer(identifiers);
|
|
303
|
+
return isAnswerValid(answer, { answer, ...identifiers });
|
|
304
|
+
};
|
|
305
|
+
return !isExploding(identifiers) && isVEAOk(identifiers);
|
|
292
306
|
};
|
|
293
307
|
const getTangentEquationFromFunctionExpressionQuestion = (optsIn) => {
|
|
294
308
|
const arrayedOptions = optsIn ?? arrayedOptsDefault;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findAbscissaOfExtremaFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA4R7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA2LF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"findAbscissaOfExtremaFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA4R7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA2LF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoCF,eAAO,MAAM,2CAA2C,EAAE,QAAQ,CAChE,WAAW,EACX,OAAO,CAqBR,CAAC"}
|
package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js
CHANGED
|
@@ -371,13 +371,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
371
371
|
};
|
|
372
372
|
};
|
|
373
373
|
const arrayedOptsDefault = {
|
|
374
|
-
typeF: [
|
|
375
|
-
|
|
376
|
-
"polynôme (degré $3$)",
|
|
377
|
-
"$\\frac{ax^2+bx+c}{dx+m}$",
|
|
378
|
-
"$\\frac{dx+m}{ax^2+bx+c}$",
|
|
379
|
-
],
|
|
380
|
-
typeRoots: ["entières", "rationnelles"],
|
|
374
|
+
typeF: ["polynôme (degré $2$)", "polynôme (degré $3$)"],
|
|
375
|
+
typeRoots: ["entières"],
|
|
381
376
|
};
|
|
382
377
|
const options = [
|
|
383
378
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findExtremaFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/findExtremaFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA+R7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAwUF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"findExtremaFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/findExtremaFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA+R7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAwUF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoCF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB1E,CAAC"}
|
|
@@ -498,13 +498,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
498
498
|
};
|
|
499
499
|
};
|
|
500
500
|
const arrayedOptsDefault = {
|
|
501
|
-
typeF: [
|
|
502
|
-
|
|
503
|
-
"polynôme (degré $3$)",
|
|
504
|
-
"$\\frac{ax^2+bx+c}{dx+m}$",
|
|
505
|
-
"$\\frac{dx+m}{ax^2+bx+c}$",
|
|
506
|
-
],
|
|
507
|
-
typeRoots: ["entières", "rationnelles"],
|
|
501
|
+
typeF: ["polynôme (degré $2$)", "polynôme (degré $3$)"],
|
|
502
|
+
typeRoots: ["entières"],
|
|
508
503
|
};
|
|
509
504
|
const options = [
|
|
510
505
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationFromSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/equationFromSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAc7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,eAAe,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;
|
|
1
|
+
{"version":3,"file":"equationFromSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/equationFromSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAc7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,eAAe,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAwRF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBhE,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationS
|
|
|
6
6
|
import { InequationSolutionNode } from "../../../../tree/nodes/inequations/inequationSolutionNode.js";
|
|
7
7
|
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
8
8
|
import { MinusInfinityNode, PlusInfinityNode, } from "../../../../tree/nodes/numbers/infiniteNode.js";
|
|
9
|
-
import {
|
|
9
|
+
import { Closure } from "../../../../tree/nodes/sets/closure.js";
|
|
10
10
|
import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
|
|
11
11
|
import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
|
|
12
12
|
import { UnionIntervalNode } from "../../../../tree/nodes/sets/unionIntervalNode.js";
|
|
@@ -38,38 +38,32 @@ const getIntervalsSolution = (identifiers) => {
|
|
|
38
38
|
const xNodes = xs.map((e) => reifyAlgebraic(e));
|
|
39
39
|
const isSup = inequation.isSup;
|
|
40
40
|
const isStrict = inequation.isStrict;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
];
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
return [
|
|
50
|
-
new IntervalNode(xNodes[1], xNodes[2], isStrict ? ClosureType.OO : ClosureType.FF),
|
|
51
|
-
];
|
|
52
|
-
}
|
|
41
|
+
const rawSigns = signs.filter((s) => s !== "0");
|
|
42
|
+
const rightSignIndexes = [];
|
|
43
|
+
for (let i = 0; i < rawSigns.length; i++) {
|
|
44
|
+
if (isSup === (rawSigns[i] === "+"))
|
|
45
|
+
rightSignIndexes.push(i);
|
|
53
46
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return [
|
|
63
|
-
new IntervalNode(xNodes[1], xNodes[2], isStrict ? ClosureType.OO : ClosureType.FF),
|
|
64
|
-
];
|
|
65
|
-
}
|
|
47
|
+
const intervals = [];
|
|
48
|
+
for (let i = 0; i < rightSignIndexes.length; i++) {
|
|
49
|
+
const index = rightSignIndexes[i];
|
|
50
|
+
const start = xNodes[index];
|
|
51
|
+
const end = xNodes[index + 1];
|
|
52
|
+
const leftOpen = index === 0 || isStrict;
|
|
53
|
+
const rightOpen = index === rawSigns.length - 1 || isStrict;
|
|
54
|
+
intervals.push(new IntervalNode(start, end, Closure.fromBooleans(!leftOpen, !rightOpen)));
|
|
66
55
|
}
|
|
56
|
+
return intervals;
|
|
67
57
|
};
|
|
68
58
|
const getAnswerNode = (identifiers) => {
|
|
69
59
|
const { xs, type } = identifiers;
|
|
70
60
|
const xNodes = xs.map((e) => reifyAlgebraic(e));
|
|
71
61
|
if (type === 0) {
|
|
72
|
-
|
|
62
|
+
if (xs.length === 3)
|
|
63
|
+
return new EquationSolutionNode(new DiscreteSetNode([xNodes[1]]));
|
|
64
|
+
if (xs.length === 4)
|
|
65
|
+
return new EquationSolutionNode(new DiscreteSetNode([xNodes[1], xNodes[2]]));
|
|
66
|
+
return new EquationSolutionNode(new DiscreteSetNode([xNodes[1], xNodes[2], xNodes[3]]));
|
|
73
67
|
}
|
|
74
68
|
else {
|
|
75
69
|
const intervals = getIntervalsSolution(identifiers);
|
|
@@ -126,7 +120,12 @@ const getCorrection = (identifiers) => {
|
|
|
126
120
|
const { xs, type, ineqSymbol } = identifiers;
|
|
127
121
|
const xNodes = xs.map((e) => reifyAlgebraic(e));
|
|
128
122
|
if (type === 0) {
|
|
129
|
-
|
|
123
|
+
const corr = xNodes.length === 5
|
|
124
|
+
? `D'après le tableau de signes de $f$, les antécédents de $0$ par $f$ sont $${xNodes[1].toTex()}$, $${xNodes[2].toTex()}$ et $${xNodes[3].toTex()}$.`
|
|
125
|
+
: xNodes.length === 4
|
|
126
|
+
? `D'après le tableau de signes de $f$, les antécédents de $0$ par $f$ sont $${xNodes[1].toTex()}$ et $${xNodes[2].toTex()}$.`
|
|
127
|
+
: `D'après le tableau de signes de $f$, l'antécédent de $0$ par $f$ est $${xNodes[1].toTex()}$.`;
|
|
128
|
+
return `${corr}
|
|
130
129
|
|
|
131
130
|
L'ensemble des solutions de $f(x)=0$ est donc :
|
|
132
131
|
|
|
@@ -152,12 +151,28 @@ ${getAnswer(identifiers)}
|
|
|
152
151
|
$$`;
|
|
153
152
|
};
|
|
154
153
|
const getReadSignTableQuestion = (opts) => {
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
const
|
|
154
|
+
const x1 = randint(-9, 10);
|
|
155
|
+
const x2 = randint(-9, 10, [x1]);
|
|
156
|
+
const x3 = randint(-9, 10, [x1, x2]);
|
|
157
|
+
const sorted = [x1, x2, x3].sort((a, b) => a - b);
|
|
158
|
+
const functionType = opts?.functionType === "Affine"
|
|
159
|
+
? 0
|
|
160
|
+
: opts?.functionType === "Degré $3$"
|
|
161
|
+
? 2
|
|
162
|
+
: 1;
|
|
163
|
+
const roots = functionType === 0
|
|
164
|
+
? [x1]
|
|
165
|
+
: functionType === 1
|
|
166
|
+
? [sorted[0], sorted[1]]
|
|
167
|
+
: sorted;
|
|
168
|
+
const xs = [
|
|
169
|
+
MinusInfinityNode,
|
|
170
|
+
...roots.map((e) => e.toTree()),
|
|
171
|
+
PlusInfinityNode,
|
|
172
|
+
];
|
|
158
173
|
const signs = coinFlip()
|
|
159
|
-
? ["+", "0", "-", "0", "+"]
|
|
160
|
-
: ["-", "0", "+", "0", "-"];
|
|
174
|
+
? ["+", "0", "-", "0", "+", "0", "-"]
|
|
175
|
+
: ["-", "0", "+", "0", "-", "0", "+"];
|
|
161
176
|
const type = !opts?.questionType || opts.questionType === "Les deux"
|
|
162
177
|
? randint(0, 2)
|
|
163
178
|
: opts.questionType === "Inéquations"
|
|
@@ -168,7 +183,11 @@ const getReadSignTableQuestion = (opts) => {
|
|
|
168
183
|
type,
|
|
169
184
|
ineqSymbol,
|
|
170
185
|
xs: xs.map((e) => e.toIdentifiers()),
|
|
171
|
-
signs
|
|
186
|
+
signs: functionType === 0
|
|
187
|
+
? signs.slice(0, 3)
|
|
188
|
+
: functionType === 1
|
|
189
|
+
? signs.slice(0, 5)
|
|
190
|
+
: signs,
|
|
172
191
|
};
|
|
173
192
|
return getQuestionFromIdentifiers(identifiers, opts);
|
|
174
193
|
};
|
|
@@ -206,6 +225,14 @@ const options = [
|
|
|
206
225
|
defaultValue: "Les deux",
|
|
207
226
|
values: ["Équation $f(x) = 0$", "Inéquations", "Les deux"],
|
|
208
227
|
},
|
|
228
|
+
{
|
|
229
|
+
id: "functionType",
|
|
230
|
+
label: "Type de fonction",
|
|
231
|
+
target: GeneratorOptionTarget.generation,
|
|
232
|
+
type: GeneratorOptionType.select,
|
|
233
|
+
values: ["Affine", "Degré $2$", "Degré $3$"],
|
|
234
|
+
defaultValue: "Degré $2$",
|
|
235
|
+
},
|
|
209
236
|
];
|
|
210
237
|
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
211
238
|
return {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
2
|
type Identifiers = {
|
|
3
|
-
initTable: string[][];
|
|
4
3
|
a: number;
|
|
5
4
|
x1: number;
|
|
6
|
-
x2
|
|
7
|
-
x3
|
|
5
|
+
x2?: number;
|
|
6
|
+
x3?: number;
|
|
8
7
|
lineAsked: number;
|
|
9
8
|
};
|
|
10
|
-
|
|
9
|
+
type Options = {
|
|
10
|
+
functionType: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const partialSignTableFromGraph: Exercise<Identifiers, Options>;
|
|
11
13
|
export {};
|
|
12
14
|
//# sourceMappingURL=partialSignTableFromGraph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partialSignTableFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/partialSignTableFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"partialSignTableFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/partialSignTableFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoPF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAWF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBpE,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
1
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { signTableVEA } from "../../../../exercises/vea/signTableVEA.js";
|
|
2
4
|
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
3
5
|
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
4
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
@@ -15,35 +17,73 @@ Repère ensuite les points de la courbe à l'intersection de l'axe des abscisses
|
|
|
15
17
|
};
|
|
16
18
|
const getCorrection = (identifiers) => {
|
|
17
19
|
const { a, x1, x2, x3 } = identifiers;
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const rootsNb = x2 === undefined ? 1 : x3 === undefined ? 2 : 3;
|
|
21
|
+
const signs = rootsNb === 1
|
|
22
|
+
? a > 0
|
|
23
|
+
? ["-", "+"]
|
|
24
|
+
: ["+", "-"]
|
|
25
|
+
: rootsNb === 2
|
|
26
|
+
? a > 0
|
|
27
|
+
? ["+", "-", "+"]
|
|
28
|
+
: ["-", "+", "-"]
|
|
29
|
+
: a > 0
|
|
30
|
+
? ["-", "+", "-", "+"]
|
|
31
|
+
: ["+", "-", "+", "-"];
|
|
32
|
+
const signWords = signs.map((e) => (e === "-" ? "négatif" : "positif"));
|
|
33
|
+
return rootsNb === 1
|
|
34
|
+
? `On lit graphiquement que $f(x)$ s'annule pour $x$ valant $${x1}$.
|
|
22
35
|
|
|
23
|
-
De plus, $f(x)$ est ${
|
|
36
|
+
De plus, $f(x)$ est ${signWords[0]} pour $x \\in ]-\\infty;${x1}]$, puis ${signWords[1]} pour $x \\in [${x1}, +\\infty[$.`
|
|
37
|
+
: rootsNb === 2
|
|
38
|
+
? `On lit graphiquement que $f(x)$ s'annule pour $x$ valant $${x1}$ et $${x2}$.
|
|
39
|
+
|
|
40
|
+
De plus, $f(x)$ est ${signWords[0]} pour $x \\in ]-\\infty;${x1}]$, puis ${signWords[1]} pour $x \\in [${x1}, ${x2}]$, puis ${signWords[2]} pour $x \\in [${x2}, +\\infty[$.`
|
|
41
|
+
: `On lit graphiquement que $f(x)$ s'annule pour les valeurs de $x$ suivantes : $${x1}$, $${x2}$ et $${x3}$.
|
|
42
|
+
|
|
43
|
+
De plus, $f(x)$ est ${signWords[0]} pour $x \\in ]-\\infty;${x1}]$, puis ${signWords[1]} pour $x \\in [${x1}, ${x2}]$, puis ${signWords[2]} pour $x \\in [${x2}, ${x3}]$, et enfin ${signWords[3]} pour $x \\in [${x3}, +\\infty[$.`;
|
|
24
44
|
};
|
|
25
45
|
const getGGBOptions = (identifiers) => {
|
|
26
46
|
const { a, x1, x2, x3 } = identifiers;
|
|
27
47
|
const ggb = new GeogebraConstructor({
|
|
28
|
-
commands: [
|
|
48
|
+
commands: [
|
|
49
|
+
x2 === undefined
|
|
50
|
+
? `f(x) = ${a}*(x-${x1})`
|
|
51
|
+
: x3 === undefined
|
|
52
|
+
? `f(x) = ${a}*(x-${x1})*(x-${x2})`
|
|
53
|
+
: `f(x) = ${a}*(x-${x1})*(x-${x2})*(x-${x3})`,
|
|
54
|
+
],
|
|
29
55
|
lockedAxesRatio: false,
|
|
30
56
|
gridDistance: false,
|
|
31
57
|
xAxis: {
|
|
32
58
|
steps: 1,
|
|
33
59
|
},
|
|
34
60
|
});
|
|
35
|
-
const func = (x) =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
61
|
+
const func = (x) => {
|
|
62
|
+
if (x2 === undefined)
|
|
63
|
+
return a * (x - x1);
|
|
64
|
+
if (x3 === undefined)
|
|
65
|
+
return a * (x - x1) * (x - x2);
|
|
66
|
+
return a * (x - x1) * (x - x2) * (x - x3);
|
|
67
|
+
};
|
|
68
|
+
const xMin = Math.min(-2, Math.min(x1, x2 ?? x1, x3 ?? x2 ?? x1));
|
|
69
|
+
const xMax = Math.max(2, Math.max(x1, x2 ?? x1, x3 ?? x2 ?? x1));
|
|
70
|
+
const root1 = x2 === undefined
|
|
71
|
+
? 0
|
|
72
|
+
: x3 === undefined
|
|
73
|
+
? (x1 + x2) / 2
|
|
74
|
+
: (2 * (x1 + x2 + x3) -
|
|
75
|
+
Math.sqrt(4 * (x1 + x2 + x3) ** 2 - 12 * (x1 * x2 + x1 * x3 + x2 * x3))) /
|
|
76
|
+
6;
|
|
77
|
+
const root2 = x2 === undefined
|
|
78
|
+
? 0
|
|
79
|
+
: x3 === undefined
|
|
80
|
+
? (x1 + x2) / 2
|
|
81
|
+
: (2 * (x1 + x2 + x3) +
|
|
82
|
+
Math.sqrt(4 * (x1 + x2 + x3) ** 2 - 12 * (x1 * x2 + x1 * x3 + x2 * x3))) /
|
|
83
|
+
6;
|
|
44
84
|
const [fx1, fx2] = [func(root1), func(root2)];
|
|
45
|
-
const yMin = Math.min(fx1, fx2);
|
|
46
|
-
const yMax = Math.max(fx1, fx2);
|
|
85
|
+
const yMin = Math.min(-2, Math.min(fx1, fx2));
|
|
86
|
+
const yMax = Math.max(2, Math.max(fx1, fx2));
|
|
47
87
|
return ggb.getOptions({
|
|
48
88
|
coords: [xMin - 2, xMax + 2, yMin - 2, yMax + 2],
|
|
49
89
|
});
|
|
@@ -51,72 +91,118 @@ const getGGBOptions = (identifiers) => {
|
|
|
51
91
|
const getKeys = () => {
|
|
52
92
|
return ["infty"];
|
|
53
93
|
};
|
|
54
|
-
const getFirstLine = (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"-\\infty",
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
94
|
+
const getFirstLine = (identifiers) => {
|
|
95
|
+
const { x1, x2, x3 } = identifiers;
|
|
96
|
+
const firstLine = x2 === undefined
|
|
97
|
+
? ["$x$", "-\\infty", "\\ ", x1.frenchify(), "\\ ", "+\\infty"]
|
|
98
|
+
: x3 === undefined
|
|
99
|
+
? [
|
|
100
|
+
"$x$",
|
|
101
|
+
"-\\infty",
|
|
102
|
+
"\\ ",
|
|
103
|
+
x1.frenchify(),
|
|
104
|
+
"\\ ",
|
|
105
|
+
x2.frenchify(),
|
|
106
|
+
"\\ ",
|
|
107
|
+
"+\\infty",
|
|
108
|
+
]
|
|
109
|
+
: [
|
|
110
|
+
"$x$",
|
|
111
|
+
"-\\infty",
|
|
112
|
+
"\\ ",
|
|
113
|
+
x1.frenchify(),
|
|
114
|
+
"\\ ",
|
|
115
|
+
x2.frenchify(),
|
|
116
|
+
"\\ ",
|
|
117
|
+
x3.frenchify(),
|
|
118
|
+
"\\ ",
|
|
119
|
+
"+\\infty",
|
|
120
|
+
];
|
|
121
|
+
return firstLine;
|
|
67
122
|
};
|
|
68
|
-
const getSecondLine = (
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
123
|
+
const getSecondLine = (identifiers) => {
|
|
124
|
+
const { a, x2, x3 } = identifiers;
|
|
125
|
+
//affine a>0 ? ["-", "+"] : ["+","-"]
|
|
126
|
+
//degré 2 a>0 ? ["+", "-", "+"] : ["-", "+", "-"]
|
|
127
|
+
//degré 3 a > 0 ? ["-", "+", "-", "+"] : ["+", "-", "+", "-"];
|
|
128
|
+
const rootsNb = x2 === undefined ? 1 : x3 === undefined ? 2 : 3;
|
|
129
|
+
const signs = rootsNb === 1
|
|
130
|
+
? a > 0
|
|
131
|
+
? ["-", "+"]
|
|
132
|
+
: ["+", "-"]
|
|
133
|
+
: rootsNb === 2
|
|
134
|
+
? a > 0
|
|
135
|
+
? ["+", "-", "+"]
|
|
136
|
+
: ["-", "+", "-"]
|
|
137
|
+
: a > 0
|
|
138
|
+
? ["-", "+", "-", "+"]
|
|
139
|
+
: ["+", "-", "+", "-"];
|
|
140
|
+
return rootsNb === 1
|
|
141
|
+
? ["$f(x)$", "\\ ", signs[0], "0", signs[1], "\\ "]
|
|
142
|
+
: rootsNb === 2
|
|
143
|
+
? ["$f(x)$", "\\ ", signs[0], "0", signs[1], "0", signs[2], "\\ "]
|
|
144
|
+
: [
|
|
145
|
+
"$f(x)$",
|
|
146
|
+
"\\ ",
|
|
147
|
+
signs[0],
|
|
148
|
+
"0",
|
|
149
|
+
signs[1],
|
|
150
|
+
"0",
|
|
151
|
+
signs[2],
|
|
152
|
+
"0",
|
|
153
|
+
signs[3],
|
|
154
|
+
"\\ ",
|
|
155
|
+
];
|
|
82
156
|
};
|
|
83
157
|
const getAnswerTable = (identifiers) => {
|
|
84
|
-
return [
|
|
85
|
-
getFirstLine(identifiers.x1, identifiers.x2, identifiers.x3),
|
|
86
|
-
getSecondLine(identifiers.a),
|
|
87
|
-
];
|
|
158
|
+
return [getFirstLine(identifiers), getSecondLine(identifiers)];
|
|
88
159
|
};
|
|
89
160
|
const isAnswerTableValid = (ans, { answerTable }) => {
|
|
90
161
|
try {
|
|
91
|
-
return ans
|
|
162
|
+
return signTableVEA(ans, answerTable);
|
|
92
163
|
}
|
|
93
164
|
catch (err) {
|
|
94
165
|
return handleVEAError(err);
|
|
95
166
|
}
|
|
96
167
|
};
|
|
97
|
-
const getSignTableFromGraphQuestion = () => {
|
|
168
|
+
const getSignTableFromGraphQuestion = (opts) => {
|
|
98
169
|
const x1 = randint(-9, 10);
|
|
170
|
+
const type = opts?.functionType === "Affine"
|
|
171
|
+
? 0
|
|
172
|
+
: opts?.functionType === "Degré $2$"
|
|
173
|
+
? 1
|
|
174
|
+
: 2;
|
|
99
175
|
const x2 = randint(-9, 10, [x1]);
|
|
100
176
|
const x3 = randint(-9, 10, [x1, x2]);
|
|
101
177
|
const sorted = [x1, x2, x3].sort((a, b) => a - b);
|
|
102
|
-
const a = randfloat(-1, 1, 4, [0]);
|
|
178
|
+
const a = type === 0 ? randint(-5, 5, [0]) : randfloat(-1, 1, 4, [0]);
|
|
103
179
|
const lineAsked = randint(0, 2);
|
|
104
180
|
const identifiers = {
|
|
105
181
|
a,
|
|
106
182
|
lineAsked,
|
|
107
183
|
x1: sorted[0],
|
|
108
|
-
x2: sorted[1],
|
|
109
|
-
x3: sorted[2],
|
|
110
|
-
initTable: [
|
|
111
|
-
lineAsked === 0
|
|
112
|
-
? ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", "", "\\ ", ""]
|
|
113
|
-
: getFirstLine(sorted[0], sorted[1], sorted[2]),
|
|
114
|
-
lineAsked === 1
|
|
115
|
-
? ["$f(x)$", "\\ ", "", "", "", "", "", "", "", "\\ "]
|
|
116
|
-
: getSecondLine(a),
|
|
117
|
-
],
|
|
184
|
+
x2: type < 1 ? undefined : sorted[1],
|
|
185
|
+
x3: type < 2 ? undefined : sorted[2],
|
|
118
186
|
};
|
|
119
|
-
return getQuestionFromIdentifiers(identifiers);
|
|
187
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
188
|
+
};
|
|
189
|
+
const getInitTable = (identifiers) => {
|
|
190
|
+
const { x2, x3, lineAsked } = identifiers;
|
|
191
|
+
const rootsNb = x2 === undefined ? 1 : x3 === undefined ? 2 : 3;
|
|
192
|
+
const firstLine = rootsNb === 1
|
|
193
|
+
? ["$x$", "", "\\ ", "", "\\ ", ""]
|
|
194
|
+
: rootsNb === 2
|
|
195
|
+
? ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", ""]
|
|
196
|
+
: ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", "", "\\ ", ""];
|
|
197
|
+
const secondLine = rootsNb === 1
|
|
198
|
+
? ["$f(x)$", "\\ ", "", "", "", "\\ "]
|
|
199
|
+
: rootsNb === 2
|
|
200
|
+
? ["$f(x)$", "\\ ", "", "", "", "", "", "\\ "]
|
|
201
|
+
: ["$f(x)$", "\\ ", "", "", "", "", "", "", "", "\\ "];
|
|
202
|
+
return [
|
|
203
|
+
lineAsked === 0 ? firstLine : getFirstLine(identifiers),
|
|
204
|
+
lineAsked === 1 ? secondLine : getSecondLine(identifiers),
|
|
205
|
+
];
|
|
120
206
|
};
|
|
121
207
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
122
208
|
return {
|
|
@@ -128,9 +214,19 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
128
214
|
hint: getHint(identifiers),
|
|
129
215
|
correction: getCorrection(identifiers),
|
|
130
216
|
ggbOptions: getGGBOptions(identifiers),
|
|
131
|
-
initTable: identifiers
|
|
217
|
+
initTable: getInitTable(identifiers),
|
|
132
218
|
};
|
|
133
219
|
};
|
|
220
|
+
const options = [
|
|
221
|
+
{
|
|
222
|
+
id: "functionType",
|
|
223
|
+
label: "Type de fonction",
|
|
224
|
+
target: GeneratorOptionTarget.generation,
|
|
225
|
+
type: GeneratorOptionType.select,
|
|
226
|
+
values: ["Affine", "Degré $2$", "Degré $3$"],
|
|
227
|
+
defaultValue: "Degré $3$",
|
|
228
|
+
},
|
|
229
|
+
];
|
|
134
230
|
export const partialSignTableFromGraph = {
|
|
135
231
|
id: "partialSignTableFromGraph",
|
|
136
232
|
label: "Compléter le tableau de signes d'une fonction à partir de sa représentation graphique",
|
|
@@ -149,4 +245,5 @@ export const partialSignTableFromGraph = {
|
|
|
149
245
|
getQuestionFromIdentifiers,
|
|
150
246
|
answerType: "signTable",
|
|
151
247
|
hasHintAndCorrection: true,
|
|
248
|
+
options,
|
|
152
249
|
};
|
|
@@ -5,6 +5,9 @@ type Identifiers = {
|
|
|
5
5
|
xs: NodeIdentifiers[];
|
|
6
6
|
x: NodeIdentifiers;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type Options = {
|
|
9
|
+
functionType: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const readSignTable: Exercise<Identifiers, Options>;
|
|
9
12
|
export {};
|
|
10
13
|
//# sourceMappingURL=readSignTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/readSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"readSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/readSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,eAAe,EAAE,CAAC;IACtB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AAmHF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAyBF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBxD,CAAC"}
|