math-exercises 2.0.40 → 2.0.42
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/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/firstIdentity.js +4 -2
- package/lib/exercises/conversion/hoursToDecimal.js +1 -1
- package/lib/exercises/functions/basics/imageFunction.js +1 -1
- package/lib/exercises/functions/parity/parityFromAlgebra.js +1 -1
- package/lib/exercises/functions/parity/parityFromGraph.js +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +7 -3
- package/lib/exercises/sequences/arithmetic/arithmeticFindReason.js +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.js +7 -3
- package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.js +7 -3
- package/lib/exercises/sequences/explicitFormulaUsage.js +3 -3
- package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.js +7 -3
- package/lib/exercises/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricReasonUsage.js +7 -3
- package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.js +7 -2
- package/lib/exercises/sequences/recurrenceFormulaUsage.js +3 -3
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +5 -2
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +7 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstIdentity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/firstIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"firstIdentity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/firstIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,WAAW,CAwBnE,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAkClE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,GAAG,CAAC,WAAW,CAKvD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,WAAW,CAYnD,CAAC"}
|
|
@@ -10,9 +10,11 @@ const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
|
|
|
10
10
|
const shuffle_1 = require("../../../utils/shuffle");
|
|
11
11
|
const getFirstIdentityQuestion = () => {
|
|
12
12
|
const affine = affine_1.AffineConstructor.random({
|
|
13
|
-
|
|
13
|
+
min: 1,
|
|
14
|
+
max: 11,
|
|
14
15
|
}, {
|
|
15
|
-
|
|
16
|
+
min: 1,
|
|
17
|
+
max: 11,
|
|
16
18
|
});
|
|
17
19
|
const statementTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
|
|
18
20
|
const answer = affine.multiply(affine).toTree().toTex();
|
|
@@ -21,7 +21,7 @@ const getHoursToDecimalQuestion = () => {
|
|
|
21
21
|
: `${hours},${(0, round_1.round)((mins / 60) * 100, 0)}\\text{h}`;
|
|
22
22
|
const question = {
|
|
23
23
|
answer,
|
|
24
|
-
instruction: `Convertir la durée suivante en ${isDecimalToHours ? "heures et minutes" : "nombre décimal"} : $${durationTex}$ (arrondir ${isDecimalToHours ? "à la minute près" : "au centième près"})`,
|
|
24
|
+
instruction: `Convertir la durée suivante en ${isDecimalToHours ? "heures et minutes" : "$\\text{h}$ (nombre décimal)"} : $${durationTex}$ (arrondir ${isDecimalToHours ? "à la minute près" : "au centième près"})`,
|
|
25
25
|
keys: ["hours", "minutes"],
|
|
26
26
|
answerFormat: "tex",
|
|
27
27
|
identifiers: { isDecimalToHours, dec: dec.value },
|
|
@@ -52,7 +52,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
52
52
|
exports.imageFunction = {
|
|
53
53
|
id: "imageFunction",
|
|
54
54
|
connector: "=",
|
|
55
|
-
label: "
|
|
55
|
+
label: "Calcul d'image par une fonction",
|
|
56
56
|
levels: ["3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
|
|
57
57
|
sections: ["Fonctions"],
|
|
58
58
|
isSingleStep: true,
|
|
@@ -105,7 +105,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
105
105
|
exports.parityFromAlgebra = {
|
|
106
106
|
id: "parityFromAlgebra",
|
|
107
107
|
label: "Déterminer algébriquement la parité d'une fonction",
|
|
108
|
-
levels: ["2nde"],
|
|
108
|
+
levels: ["2nde", "1reSpé"],
|
|
109
109
|
isSingleStep: true,
|
|
110
110
|
sections: ["Fonctions"],
|
|
111
111
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getParityFromAlgebraQuestion, nb),
|
|
@@ -115,7 +115,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
115
115
|
exports.parityFromGraph = {
|
|
116
116
|
id: "parityFromGraph",
|
|
117
117
|
label: "Reconnaître graphiquement la parité d'une fonction",
|
|
118
|
-
levels: ["2nde"],
|
|
118
|
+
levels: ["2nde", "1reSpé"],
|
|
119
119
|
isSingleStep: true,
|
|
120
120
|
sections: ["Fonctions"],
|
|
121
121
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getParityFromGraphQuestion, nb),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;
|
|
1
|
+
{"version":3,"file":"arithmeticExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAiDF,eAAO,MAAM,8BAA8B,EAAE,YAAY,CAAC,WAAW,CAapE,CAAC"}
|
|
@@ -18,7 +18,7 @@ const getArithmeticExplicitFormulaUsage = () => {
|
|
|
18
18
|
.toTex()}$. Calculer : $u_{${askedRank}}$`,
|
|
19
19
|
startStatement: `u_{${askedRank}}`,
|
|
20
20
|
answer,
|
|
21
|
-
keys: ["
|
|
21
|
+
keys: ["u", "underscore", "equal"],
|
|
22
22
|
answerFormat: "tex",
|
|
23
23
|
identifiers: { firstValue, askedRank, reason },
|
|
24
24
|
};
|
|
@@ -32,8 +32,12 @@ const getPropositions = (n, { answer, firstValue, askedRank, reason }) => {
|
|
|
32
32
|
}
|
|
33
33
|
return (0, shuffle_1.shuffle)(propositions);
|
|
34
34
|
};
|
|
35
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
36
|
-
return
|
|
35
|
+
const isAnswerValid = (ans, { answer, askedRank }) => {
|
|
36
|
+
return [
|
|
37
|
+
answer,
|
|
38
|
+
`u_${askedRank}=${answer}`,
|
|
39
|
+
`u_{${askedRank}}=${answer}`,
|
|
40
|
+
].includes(ans);
|
|
37
41
|
};
|
|
38
42
|
exports.arithmeticExplicitFormulaUsage = {
|
|
39
43
|
id: "arithmeticExplicitFormulaUsage",
|
|
@@ -16,7 +16,7 @@ const getArithmeticFindReason = () => {
|
|
|
16
16
|
instruction: `$(u_n)$ est une suite arithmétique. On sait que $u_{${rank1}} = ${value1}$ et $u_{${rank2}} = ${value2}$. Quelle est la raison de la suite $(u_n)$ ?`,
|
|
17
17
|
startStatement: "r",
|
|
18
18
|
answer,
|
|
19
|
-
keys: [
|
|
19
|
+
keys: [],
|
|
20
20
|
answerFormat: "tex",
|
|
21
21
|
identifiers: { rank1, reason, value1 },
|
|
22
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticReasonUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"arithmeticReasonUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAIlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAmCF,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAAC,WAAW,CAY3D,CAAC"}
|
|
@@ -15,7 +15,7 @@ const getArithmeticReasonUsage = () => {
|
|
|
15
15
|
instruction: `$(u_n)$ est une suite arithmétique de raison $r = ${reason}$ et on sait que $u_{${startRank}} = ${startValue}$. Calculer : $u_{${askedRank}}$`,
|
|
16
16
|
startStatement: `u_{${askedRank}}`,
|
|
17
17
|
answer,
|
|
18
|
-
keys: ["
|
|
18
|
+
keys: ["u", "underscore", "equal"],
|
|
19
19
|
answerFormat: "tex",
|
|
20
20
|
identifiers: { reason, startRank, startValue },
|
|
21
21
|
};
|
|
@@ -29,8 +29,12 @@ const getPropositions = (n, { answer }) => {
|
|
|
29
29
|
}
|
|
30
30
|
return (0, shuffle_1.shuffle)(propositions);
|
|
31
31
|
};
|
|
32
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
33
|
-
return
|
|
32
|
+
const isAnswerValid = (ans, { answer, startRank }) => {
|
|
33
|
+
return [
|
|
34
|
+
answer,
|
|
35
|
+
`u_${startRank + 1}=${answer}`,
|
|
36
|
+
`u_{${startRank + 1}}=${answer}`,
|
|
37
|
+
].includes(ans);
|
|
34
38
|
};
|
|
35
39
|
exports.arithmeticReasonUsage = {
|
|
36
40
|
id: "arithmeticReasonUsage",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;
|
|
1
|
+
{"version":3,"file":"arithmeticRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAsCF,eAAO,MAAM,gCAAgC,EAAE,YAAY,CAAC,WAAW,CAatE,CAAC"}
|
|
@@ -15,7 +15,7 @@ const getArithmeticRecurrenceFormulaUsage = () => {
|
|
|
15
15
|
instruction: `$(u_n)$ est une suite définie par $u_{n+1} = ${reason} + u_n$ et $u_{${firstRank}} = ${firstValue}$. Calculer : $u_{${askedRank}}$`,
|
|
16
16
|
startStatement: `u_{${askedRank}}`,
|
|
17
17
|
answer,
|
|
18
|
-
keys: ["
|
|
18
|
+
keys: ["u", "underscore", "equal"],
|
|
19
19
|
answerFormat: "tex",
|
|
20
20
|
identifiers: { firstRank, firstValue, reason },
|
|
21
21
|
};
|
|
@@ -29,8 +29,12 @@ const getPropositions = (n, { answer }) => {
|
|
|
29
29
|
}
|
|
30
30
|
return (0, shuffle_1.shuffle)(propositions);
|
|
31
31
|
};
|
|
32
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
33
|
-
return
|
|
32
|
+
const isAnswerValid = (ans, { answer, firstRank }) => {
|
|
33
|
+
return [
|
|
34
|
+
answer,
|
|
35
|
+
`u_${firstRank + 1}=${answer}`,
|
|
36
|
+
`u_{${firstRank + 1}}=${answer}`,
|
|
37
|
+
].includes(ans);
|
|
34
38
|
};
|
|
35
39
|
exports.arithmeticRecurrenceFormulaUsage = {
|
|
36
40
|
id: "arithmeticRecurrenceFormulaUsage",
|
|
@@ -14,7 +14,7 @@ const getExplicitFormulaUsageQuestion = () => {
|
|
|
14
14
|
instruction: `Soit $u$ la suite définie pour tout $n\\geq 0$ par $u_n = ${u
|
|
15
15
|
.toTree()
|
|
16
16
|
.toTex()}$. Calculer $u_${rank}$.`,
|
|
17
|
-
keys: [],
|
|
17
|
+
keys: ["u", "underscore", "equal"],
|
|
18
18
|
answerFormat: "tex",
|
|
19
19
|
identifiers: { rank, coeffs: u.coefficients },
|
|
20
20
|
};
|
|
@@ -32,8 +32,8 @@ const getPropositions = (n, { answer, rank, coeffs }) => {
|
|
|
32
32
|
}
|
|
33
33
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
34
34
|
};
|
|
35
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
36
|
-
return
|
|
35
|
+
const isAnswerValid = (ans, { answer, rank }) => {
|
|
36
|
+
return [answer, `u_{${rank}}=${answer}`, `u_${rank}=${answer}`].includes(ans);
|
|
37
37
|
};
|
|
38
38
|
exports.explicitFormulaUsage = {
|
|
39
39
|
id: "explicitFormulaUsage",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAgDF,eAAO,MAAM,6BAA6B,EAAE,YAAY,CAAC,WAAW,CAanE,CAAC"}
|
|
@@ -20,14 +20,18 @@ const getGeometricExplicitFormulaUsage = () => {
|
|
|
20
20
|
instruction: `$(u_n)$ est une suite géométrique définie par $u_n = ${formulaTex}$. Calculer : $u_{${askedRank}}$`,
|
|
21
21
|
startStatement: `u_{${askedRank}}`,
|
|
22
22
|
answer,
|
|
23
|
-
keys: [],
|
|
23
|
+
keys: ["u", "underscore", "equal"],
|
|
24
24
|
answerFormat: "tex",
|
|
25
25
|
identifiers: { firstValue, reason, askedRank },
|
|
26
26
|
};
|
|
27
27
|
return question;
|
|
28
28
|
};
|
|
29
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
30
|
-
return
|
|
29
|
+
const isAnswerValid = (ans, { answer, askedRank }) => {
|
|
30
|
+
return [
|
|
31
|
+
answer,
|
|
32
|
+
`u_{${askedRank}}=${answer}`,
|
|
33
|
+
`u_${askedRank}=${answer}`,
|
|
34
|
+
].includes(ans);
|
|
31
35
|
};
|
|
32
36
|
const getPropositions = (n, { answer, firstValue, reason, askedRank }) => {
|
|
33
37
|
const propositions = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA8CF,eAAO,MAAM,oBAAoB,EAAE,YAAY,CAAC,WAAW,CAY1D,CAAC"}
|
|
@@ -15,7 +15,7 @@ const getGeometricReasonUsage = () => {
|
|
|
15
15
|
instruction: `$(u_n)$ est une suite géométrique de raison $q = ${reason}$ et on sait que $u_{${startRank}} = ${startValue}$. Calculer : $u_{${askedRank}}$`,
|
|
16
16
|
startStatement: `u_{${askedRank}}`,
|
|
17
17
|
answer,
|
|
18
|
-
keys: ["
|
|
18
|
+
keys: ["u", "underscore", "equal"],
|
|
19
19
|
answerFormat: "tex",
|
|
20
20
|
identifiers: { startValue, reason, startRank },
|
|
21
21
|
};
|
|
@@ -31,8 +31,12 @@ const getPropositions = (n, { answer, startValue, reason }) => {
|
|
|
31
31
|
}
|
|
32
32
|
return (0, shuffle_1.shuffle)(propositions);
|
|
33
33
|
};
|
|
34
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
35
|
-
return
|
|
34
|
+
const isAnswerValid = (ans, { answer, startRank }) => {
|
|
35
|
+
return [
|
|
36
|
+
answer,
|
|
37
|
+
`u_{${startRank}}=${answer}`,
|
|
38
|
+
`u_${startRank}=${answer}`,
|
|
39
|
+
].includes(ans);
|
|
36
40
|
};
|
|
37
41
|
exports.geometricReasonUsage = {
|
|
38
42
|
id: "geometricReasonUsage",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAkDF,eAAO,MAAM,+BAA+B,EAAE,YAAY,CAAC,WAAW,CAarE,CAAC"}
|
|
@@ -15,7 +15,7 @@ const getGeometricRecurrenceFormulaUsage = () => {
|
|
|
15
15
|
instruction: `$(u_n)$ est une suite définie par $u_{n+1} = ${reason}\\times u_n$ et $u_{${firstRank}} = ${firstValue}$. Calculer : $u_{${askedRank}}$`,
|
|
16
16
|
startStatement: `u_{${askedRank}}`,
|
|
17
17
|
answer,
|
|
18
|
-
keys: ["
|
|
18
|
+
keys: ["u", "underscore", "equal"],
|
|
19
19
|
answerFormat: "tex",
|
|
20
20
|
identifiers: { firstValue, reason, firstRank },
|
|
21
21
|
};
|
|
@@ -31,7 +31,12 @@ const getPropositions = (n, { answer, firstValue, reason }) => {
|
|
|
31
31
|
}
|
|
32
32
|
return (0, shuffle_1.shuffle)(propositions);
|
|
33
33
|
};
|
|
34
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
34
|
+
const isAnswerValid = (ans, { answer, firstRank }) => {
|
|
35
|
+
return [
|
|
36
|
+
answer,
|
|
37
|
+
`u_{${firstRank + 1}}=${answer}`,
|
|
38
|
+
`u_${firstRank + 1}=${answer}`,
|
|
39
|
+
].includes(ans);
|
|
35
40
|
return ans === answer;
|
|
36
41
|
};
|
|
37
42
|
exports.geometricRecurrenceFormulaUsage = {
|
|
@@ -20,7 +20,7 @@ const getRecurrenceFormulaUsageQuestion = () => {
|
|
|
20
20
|
instruction: `Soit $u$ la suite définie par $u_0 = ${u0}$ et pour tout $n\\geq 1$, $u_{n+1} = ${u
|
|
21
21
|
.toTree()
|
|
22
22
|
.toTex()}$. Calculer $u_${rank}$.`,
|
|
23
|
-
keys: [],
|
|
23
|
+
keys: ["u", "underscore", "equal"],
|
|
24
24
|
answerFormat: "tex",
|
|
25
25
|
identifiers: { rank, u0, coeffs },
|
|
26
26
|
};
|
|
@@ -37,8 +37,8 @@ const getPropositions = (n, { answer, rank, u0, coeffs }) => {
|
|
|
37
37
|
}
|
|
38
38
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
39
39
|
};
|
|
40
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
41
|
-
return
|
|
40
|
+
const isAnswerValid = (ans, { answer, rank }) => {
|
|
41
|
+
return [answer, `u_{${rank}}=${answer}`, `u_${rank}=${answer}`].includes(ans);
|
|
42
42
|
};
|
|
43
43
|
exports.recurrenceFormulaUsage = {
|
|
44
44
|
id: "recurrenceFormulaUsage",
|
package/lib/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAarB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAarB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAiB3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;KACzB;CACF"}
|
package/lib/server.js
CHANGED
|
@@ -35,9 +35,10 @@ const express_1 = __importDefault(require("express"));
|
|
|
35
35
|
const body_parser_1 = __importDefault(require("body-parser"));
|
|
36
36
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
37
37
|
const cors_1 = __importDefault(require("cors"));
|
|
38
|
+
const multiplyNode_1 = require("./tree/nodes/operators/multiplyNode");
|
|
38
39
|
const numberNode_1 = require("./tree/nodes/numbers/numberNode");
|
|
39
40
|
const infiniteNode_1 = require("./tree/nodes/numbers/infiniteNode");
|
|
40
|
-
const
|
|
41
|
+
const powerNode_1 = require("./tree/nodes/operators/powerNode");
|
|
41
42
|
const jsonParser = body_parser_1.default.json();
|
|
42
43
|
const allExercises = [...exercises];
|
|
43
44
|
Number.prototype.toTree = function () {
|
|
@@ -56,7 +57,9 @@ const runServer = () => {
|
|
|
56
57
|
const app = (0, express_1.default)();
|
|
57
58
|
app.use((0, cors_1.default)());
|
|
58
59
|
console.log(exercises.length);
|
|
59
|
-
console.log((
|
|
60
|
+
console.log(new multiplyNode_1.MultiplyNode((7).toTree(), new powerNode_1.PowerNode((7).toTree(), (3).toTree()))
|
|
61
|
+
.simplify()
|
|
62
|
+
.toTex());
|
|
60
63
|
app.get("/", (req, res) => {
|
|
61
64
|
res.json(allExercises);
|
|
62
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,iBAAiB,QAAS,aAAa,EAAE,SAWrD,CAAC;AACF,qBAAa,YAAa,YAAW,uBAAuB;IAC1D,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB,OAAO,aAGL;IAEF,YAAY,IAAI,MAAM;IAItB,KAAK,IAAI,MAAM;IAkDf,SAAS;IAkDT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,YAAY,EAAE;IAwFrD,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAQ5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIrC,IAAI;IAGJ,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAgH/C,MAAM,CAAC,IAAI,EAAE,aAAa;CAU3B"}
|
|
@@ -16,6 +16,7 @@ const sqrtNode_1 = require("../functions/sqrtNode");
|
|
|
16
16
|
const oppositeNode_1 = require("../functions/oppositeNode");
|
|
17
17
|
const fractionNode_1 = require("./fractionNode");
|
|
18
18
|
const functionNode_1 = require("../functions/functionNode");
|
|
19
|
+
const addNode_1 = require("./addNode");
|
|
19
20
|
function isMultiplyNode(a) {
|
|
20
21
|
return (0, operatorNode_1.isOperatorNode)(a) && a.id === operatorNode_1.OperatorIds.multiply;
|
|
21
22
|
}
|
|
@@ -269,6 +270,12 @@ class MultiplyNode {
|
|
|
269
270
|
if ((0, sqrtNode_1.isSqrtNode)(a) && (0, sqrtNode_1.isSqrtNode)(b)) {
|
|
270
271
|
return new sqrtNode_1.SqrtNode(new MultiplyNode(a.child, b.child)).simplify(opts);
|
|
271
272
|
}
|
|
273
|
+
if ((0, numberNode_1.isNumberNode)(a) &&
|
|
274
|
+
(0, powerNode_1.isPowerNode)(b) &&
|
|
275
|
+
(0, numberNode_1.isNumberNode)(b.leftChild) &&
|
|
276
|
+
a.value === b.leftChild.value) {
|
|
277
|
+
return new powerNode_1.PowerNode(b.leftChild, new addNode_1.AddNode(b.rightChild, (1).toTree())).simplify();
|
|
278
|
+
}
|
|
272
279
|
//TODo continue
|
|
273
280
|
return null;
|
|
274
281
|
};
|