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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
@@ -81,21 +81,43 @@ const getCorrection = (identifiers) => {
|
|
|
81
81
|
|
|
82
82
|
D'après le tableau de signes, $f(${xNode.toTex()})$ est donc ${ans}.`;
|
|
83
83
|
};
|
|
84
|
-
const getReadSignTableQuestion = () => {
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
84
|
+
const getReadSignTableQuestion = (opts) => {
|
|
85
|
+
const x1 = randint(-9, 10);
|
|
86
|
+
const x2 = randint(-9, 10, [x1]);
|
|
87
|
+
const x3 = randint(-9, 10, [x1, x2]);
|
|
88
|
+
const sorted = [x1, x2, x3].sort((a, b) => a - b);
|
|
89
|
+
const type = opts?.functionType === "Affine"
|
|
90
|
+
? 0
|
|
91
|
+
: opts?.functionType === "Degré $3$"
|
|
92
|
+
? 2
|
|
93
|
+
: 1;
|
|
94
|
+
const roots = type === 0 ? [x1] : type === 1 ? [sorted[0], sorted[1]] : sorted;
|
|
95
|
+
const xs = [
|
|
96
|
+
MinusInfinityNode,
|
|
97
|
+
...roots.map((e) => e.toTree()),
|
|
98
|
+
PlusInfinityNode,
|
|
99
|
+
];
|
|
88
100
|
const signs = coinFlip()
|
|
89
|
-
? ["+", "0", "-", "0", "+"]
|
|
90
|
-
: ["-", "0", "+", "0", "-"];
|
|
91
|
-
const x = randint(-20, 20,
|
|
101
|
+
? ["+", "0", "-", "0", "+", "0", "-"]
|
|
102
|
+
: ["-", "0", "+", "0", "-", "0", "+"];
|
|
103
|
+
const x = randint(-20, 20, roots).toTree();
|
|
92
104
|
const identifiers = {
|
|
93
105
|
x: x.toIdentifiers(),
|
|
94
106
|
xs: xs.map((e) => e.toIdentifiers()),
|
|
95
|
-
signs,
|
|
107
|
+
signs: type === 0 ? signs.slice(0, 3) : type === 1 ? signs.slice(0, 5) : signs,
|
|
96
108
|
};
|
|
97
109
|
return getQuestionFromIdentifiers(identifiers);
|
|
98
110
|
};
|
|
111
|
+
const options = [
|
|
112
|
+
{
|
|
113
|
+
id: "functionType",
|
|
114
|
+
label: "Type de fonction",
|
|
115
|
+
target: GeneratorOptionTarget.generation,
|
|
116
|
+
type: GeneratorOptionType.select,
|
|
117
|
+
values: ["Affine", "Degré $2$", "Degré $3$"],
|
|
118
|
+
defaultValue: "Degré $2$",
|
|
119
|
+
},
|
|
120
|
+
];
|
|
99
121
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
100
122
|
return {
|
|
101
123
|
answer: getAnswer(identifiers),
|
|
@@ -122,4 +144,5 @@ export const readSignTable = {
|
|
|
122
144
|
getQuestionFromIdentifiers,
|
|
123
145
|
answerType: "QCU",
|
|
124
146
|
hasHintAndCorrection: true,
|
|
147
|
+
options,
|
|
125
148
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
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
|
};
|
|
9
|
-
|
|
8
|
+
type Options = {
|
|
9
|
+
functionType: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const signTableFromGraph: Exercise<Identifiers, Options>;
|
|
10
12
|
export {};
|
|
11
13
|
//# sourceMappingURL=signTableFromGraph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signTableFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/signTableFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"signTableFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/signTableFromGraph.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;CACb,CAAC;AA+OF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAWF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB7D,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";
|
|
@@ -6,7 +8,7 @@ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
|
6
8
|
const getInstruction = () => {
|
|
7
9
|
return `On donne la représentation graphique d'une fonction $f$ définie sur $\\mathbb{R}$.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
Compléter le tableau de signes de $f$.`;
|
|
10
12
|
};
|
|
11
13
|
const getHint = () => {
|
|
12
14
|
return `La fonction est définie sur $\\mathbb{R}$, donc les valeurs de $x$ vont de $-\\infty$ à $+\\infty$.
|
|
@@ -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,61 +91,113 @@ const getGGBOptions = (identifiers) => {
|
|
|
51
91
|
const getKeys = () => {
|
|
52
92
|
return ["infty"];
|
|
53
93
|
};
|
|
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;
|
|
122
|
+
};
|
|
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
|
+
];
|
|
156
|
+
};
|
|
54
157
|
const getAnswerTable = (identifiers) => {
|
|
55
|
-
|
|
56
|
-
const signs = a > 0 ? ["-", "+", "-", "+"] : ["+", "-", "+", "-"];
|
|
57
|
-
return [
|
|
58
|
-
[
|
|
59
|
-
"$x$",
|
|
60
|
-
"-\\infty",
|
|
61
|
-
"\\ ",
|
|
62
|
-
x1.frenchify(),
|
|
63
|
-
"\\ ",
|
|
64
|
-
x2.frenchify(),
|
|
65
|
-
"\\ ",
|
|
66
|
-
x3.frenchify(),
|
|
67
|
-
"\\ ",
|
|
68
|
-
"+\\infty",
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
"$f(x)$",
|
|
72
|
-
"\\ ",
|
|
73
|
-
signs[0],
|
|
74
|
-
"0",
|
|
75
|
-
signs[1],
|
|
76
|
-
"0",
|
|
77
|
-
signs[2],
|
|
78
|
-
"0",
|
|
79
|
-
signs[3],
|
|
80
|
-
"\\ ",
|
|
81
|
-
],
|
|
82
|
-
];
|
|
158
|
+
return [getFirstLine(identifiers), getSecondLine(identifiers)];
|
|
83
159
|
};
|
|
84
160
|
const isAnswerTableValid = (ans, { answerTable }) => {
|
|
85
161
|
try {
|
|
86
|
-
return ans
|
|
162
|
+
return signTableVEA(ans, answerTable);
|
|
87
163
|
}
|
|
88
164
|
catch (err) {
|
|
89
165
|
return handleVEAError(err);
|
|
90
166
|
}
|
|
91
167
|
};
|
|
92
|
-
const getSignTableFromGraphQuestion = () => {
|
|
168
|
+
const getSignTableFromGraphQuestion = (opts) => {
|
|
93
169
|
const x1 = randint(-9, 10);
|
|
170
|
+
const type = opts?.functionType === "Affine"
|
|
171
|
+
? 0
|
|
172
|
+
: opts?.functionType === "Degré $2$"
|
|
173
|
+
? 1
|
|
174
|
+
: 2;
|
|
94
175
|
const x2 = randint(-9, 10, [x1]);
|
|
95
176
|
const x3 = randint(-9, 10, [x1, x2]);
|
|
96
177
|
const sorted = [x1, x2, x3].sort((a, b) => a - b);
|
|
97
|
-
const a = randfloat(-1, 1, 4, [0]);
|
|
178
|
+
const a = type === 0 ? randint(-5, 5, [0]) : randfloat(-1, 1, 4, [0]);
|
|
98
179
|
const identifiers = {
|
|
99
180
|
a,
|
|
100
181
|
x1: sorted[0],
|
|
101
|
-
x2: sorted[1],
|
|
102
|
-
x3: sorted[2],
|
|
103
|
-
initTable: [
|
|
104
|
-
["$x$", "", "\\ ", "", "\\ ", "", "\\ ", "", "\\ ", ""],
|
|
105
|
-
["$f(x)$", "\\ ", "", "", "", "", "", "", "", "\\ "],
|
|
106
|
-
],
|
|
182
|
+
x2: type < 1 ? undefined : sorted[1],
|
|
183
|
+
x3: type < 2 ? undefined : sorted[2],
|
|
107
184
|
};
|
|
108
|
-
return getQuestionFromIdentifiers(identifiers);
|
|
185
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
186
|
+
};
|
|
187
|
+
const getInitTable = (identifiers) => {
|
|
188
|
+
const { x2, x3 } = identifiers;
|
|
189
|
+
const rootsNb = x2 === undefined ? 1 : x3 === undefined ? 2 : 3;
|
|
190
|
+
const firstLine = rootsNb === 1
|
|
191
|
+
? ["$x$", "", "\\ ", "", "\\ ", ""]
|
|
192
|
+
: rootsNb === 2
|
|
193
|
+
? ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", ""]
|
|
194
|
+
: ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", "", "\\ ", ""];
|
|
195
|
+
const secondLine = rootsNb === 1
|
|
196
|
+
? ["$f(x)$", "\\ ", "", "", "", "\\ "]
|
|
197
|
+
: rootsNb === 2
|
|
198
|
+
? ["$f(x)$", "\\ ", "", "", "", "", "", "\\ "]
|
|
199
|
+
: ["$f(x)$", "\\ ", "", "", "", "", "", "", "", "\\ "];
|
|
200
|
+
return [firstLine, secondLine];
|
|
109
201
|
};
|
|
110
202
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
111
203
|
return {
|
|
@@ -117,9 +209,19 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
117
209
|
hint: getHint(identifiers),
|
|
118
210
|
correction: getCorrection(identifiers),
|
|
119
211
|
ggbOptions: getGGBOptions(identifiers),
|
|
120
|
-
initTable: identifiers
|
|
212
|
+
initTable: getInitTable(identifiers),
|
|
121
213
|
};
|
|
122
214
|
};
|
|
215
|
+
const options = [
|
|
216
|
+
{
|
|
217
|
+
id: "functionType",
|
|
218
|
+
label: "Type de fonction",
|
|
219
|
+
target: GeneratorOptionTarget.generation,
|
|
220
|
+
type: GeneratorOptionType.select,
|
|
221
|
+
values: ["Affine", "Degré $2$", "Degré $3$"],
|
|
222
|
+
defaultValue: "Degré $3$",
|
|
223
|
+
},
|
|
224
|
+
];
|
|
123
225
|
export const signTableFromGraph = {
|
|
124
226
|
id: "signTableFromGraph",
|
|
125
227
|
label: "Dresser le tableau de signes d'une fonction à partir de sa représentation graphique",
|
|
@@ -138,4 +240,5 @@ export const signTableFromGraph = {
|
|
|
138
240
|
getQuestionFromIdentifiers,
|
|
139
241
|
answerType: "signTable",
|
|
140
242
|
hasHintAndCorrection: true,
|
|
243
|
+
options,
|
|
141
244
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
vi: number;
|
|
4
|
+
vf: number;
|
|
5
|
+
nbEvolutions: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const averageEvolutionRateFromStartAndEndValue: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=averageEvolutionRateFromStartAndEndValue.d.ts.map
|
package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"averageEvolutionRateFromStartAndEndValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAwHF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAsB1E,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { percentVEA } from "../../../../exercises/vea/percentVEA.js";
|
|
4
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../../math/utils/round.js";
|
|
7
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
11
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
12
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
13
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
14
|
+
const getPropositions = (n, { answer }) => {
|
|
15
|
+
const propositions = [];
|
|
16
|
+
addValidProp(propositions, answer);
|
|
17
|
+
propWhile(propositions, n, () => {
|
|
18
|
+
tryToAddWrongProp(propositions, randfloat(-20, 20, 2).frenchify() + "\\%");
|
|
19
|
+
});
|
|
20
|
+
return shuffleProps(propositions, n);
|
|
21
|
+
};
|
|
22
|
+
const getAnswer = (identifiers) => {
|
|
23
|
+
const { nbEvolutions, vf, vi } = identifiers;
|
|
24
|
+
const cm = vf / vi;
|
|
25
|
+
const cmMoy = Math.pow(cm, 1 / nbEvolutions);
|
|
26
|
+
const answer = round((cmMoy - 1) * 100, 2).frenchify();
|
|
27
|
+
return answer + "\\%";
|
|
28
|
+
};
|
|
29
|
+
const getInstruction = (identifiers) => {
|
|
30
|
+
const { nbEvolutions, vf, vi } = identifiers;
|
|
31
|
+
return `Le prix d'un article est passé de $${vi}\\ €$ à $${vf}\\ €$ sur une durée de $${nbEvolutions}$ mois.
|
|
32
|
+
|
|
33
|
+
Quel est le taux d'évolution moyen par mois du prix de cet article ? Arrondir au centième de pourcentage.`;
|
|
34
|
+
};
|
|
35
|
+
const getHint = () => {
|
|
36
|
+
// const { nbEvolutions, vf, vi } = identifiers;
|
|
37
|
+
return `Si une quantité passe d'une valeur initiale $V_i$ à une valeur finale $V_f$ après $n$ évolutions, alors on a :
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
V_i \\times (1+t)^n = V_f
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
où $t$ est le taux d'évolution moyen.
|
|
45
|
+
|
|
46
|
+
Il suffit donc de résoudre cette équation d'inconnue $t$.`;
|
|
47
|
+
};
|
|
48
|
+
const getCorrection = (identifiers) => {
|
|
49
|
+
const { nbEvolutions, vf, vi } = identifiers;
|
|
50
|
+
return `Si une quantité passe d'une valeur initiale $V_i$ à une valeur finale $V_f$ après $n$ évolutions, alors on a :
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
$$
|
|
54
|
+
V_i \\times (1+t)^n = V_f
|
|
55
|
+
$$
|
|
56
|
+
|
|
57
|
+
où $t$ est le taux d'évolution moyen.
|
|
58
|
+
|
|
59
|
+
Il suffit donc de résoudre cette équation d'inconnue $t$.
|
|
60
|
+
|
|
61
|
+
Ici, on a donc :
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
${multiply(vi, power(add(1, "t"), nbEvolutions)).toTex()} = ${vf.frenchify()}
|
|
65
|
+
$$
|
|
66
|
+
|
|
67
|
+
d'où :
|
|
68
|
+
|
|
69
|
+
$$
|
|
70
|
+
(1+t)^{${nbEvolutions.frenchify()}} = ${frac(vf, vi).toTex()}
|
|
71
|
+
$$
|
|
72
|
+
|
|
73
|
+
donc
|
|
74
|
+
|
|
75
|
+
${alignTex([
|
|
76
|
+
["t", "=", power(frac(vf, vi).toTex(), frac(1, nbEvolutions)).toTex() + "-1"],
|
|
77
|
+
[
|
|
78
|
+
"",
|
|
79
|
+
"\\approx",
|
|
80
|
+
round(substract(power(frac(vf, vi), frac(1, nbEvolutions)), 1).evaluate(), 4).frenchify(),
|
|
81
|
+
],
|
|
82
|
+
["", "\\approx", getAnswer(identifiers)],
|
|
83
|
+
])}`;
|
|
84
|
+
};
|
|
85
|
+
const getKeys = () => {
|
|
86
|
+
return ["percent"];
|
|
87
|
+
};
|
|
88
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
89
|
+
try {
|
|
90
|
+
return percentVEA(ans, answer);
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
return handleVEAError(err);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const getAverageEvolutionRateFromStartAndEndValueQuestion = () => {
|
|
97
|
+
const vi = randint(10, 100);
|
|
98
|
+
const vf = randint(10, 100, [vi]);
|
|
99
|
+
const nbEvolutions = randint(4, 10);
|
|
100
|
+
const identifiers = {
|
|
101
|
+
nbEvolutions,
|
|
102
|
+
vi,
|
|
103
|
+
vf,
|
|
104
|
+
};
|
|
105
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
106
|
+
};
|
|
107
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
108
|
+
return {
|
|
109
|
+
answer: getAnswer(identifiers),
|
|
110
|
+
instruction: getInstruction(identifiers),
|
|
111
|
+
keys: getKeys(identifiers),
|
|
112
|
+
answerFormat: "tex",
|
|
113
|
+
identifiers,
|
|
114
|
+
hint: getHint(identifiers),
|
|
115
|
+
correction: getCorrection(identifiers),
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export const averageEvolutionRateFromStartAndEndValue = {
|
|
119
|
+
id: "averageEvolutionRateFromStartAndEndValue",
|
|
120
|
+
connector: "=",
|
|
121
|
+
label: "Déterminer le taux d'évolution moyen en connaissant la valeur initiale, la valeur finale et le nombre d'évolutions",
|
|
122
|
+
isSingleStep: true,
|
|
123
|
+
generator: (nb, opts) => getDistinctQuestions(() => getAverageEvolutionRateFromStartAndEndValueQuestion(opts), nb),
|
|
124
|
+
qcmTimer: 60,
|
|
125
|
+
freeTimer: 60,
|
|
126
|
+
getPropositions,
|
|
127
|
+
isAnswerValid,
|
|
128
|
+
subject: "Mathématiques",
|
|
129
|
+
getInstruction,
|
|
130
|
+
getHint,
|
|
131
|
+
getCorrection,
|
|
132
|
+
getAnswer,
|
|
133
|
+
getQuestionFromIdentifiers,
|
|
134
|
+
hasHintAndCorrection: true,
|
|
135
|
+
};
|
|
@@ -9,4 +9,5 @@ export * from "./findStartValueAfterEvolution.js";
|
|
|
9
9
|
export * from "./findEndValueAfterEvolution.js";
|
|
10
10
|
export * from "./findRightCalculForPriceEvolution.js";
|
|
11
11
|
export * from "./globalCM.js";
|
|
12
|
+
export * from "./averageEvolutionRateFromStartAndEndValue.js";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/evolutions/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/evolutions/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,eAAe,CAAC;AAC9B,cAAc,+CAA+C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
nIds: NodeIdentifiers;
|
|
5
|
+
kIds: NodeIdentifiers;
|
|
6
|
+
};
|
|
7
|
+
export declare const equationOnePlusTPowerN: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=equationOnePlusTPowerN.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equationOnePlusTPowerN.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/equationOnePlusTPowerN.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IAEjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAmGF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
|