math-exercises 3.0.6 → 3.0.7
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/ordering/decimalOrdering.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/decimalOrdering.js +3 -1
- package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.js +3 -1
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +2 -3
- package/lib/exercises/math/dataRepresentations/barChartReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/barChartReading.js +56 -50
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +1 -1
- package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.js +2 -1
- package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +1 -1
- package/lib/exercises/math/percent/globalPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/globalPercent.js +50 -32
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +6 -0
- package/lib/pc/constants/molecularChemistry/molecule.js +0 -1
- package/lib/pc/constants/molecularChemistry/reaction.d.ts.map +1 -1
- package/lib/pc/constants/molecularChemistry/reaction.js +0 -3
- package/lib/pc/measure/measure.d.ts.map +1 -1
- package/lib/pc/measure/measure.js +0 -2
- package/lib/tests/pdfExo.test.js +2 -2
- package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -1
- package/lib/tests/pdfs/buildPDFForExercise.js +7 -3
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +2 -2
- package/lib/tests/singleExo.test.js +2 -2
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +2 -2
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimalOrdering.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/decimalOrdering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"decimalOrdering.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/decimalOrdering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAgE1D,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC"}
|
|
@@ -39,7 +39,9 @@ const getDecimalOrderingQuestion = () => {
|
|
|
39
39
|
answer,
|
|
40
40
|
instruction: `Compléter par le bon symbole :
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
$$
|
|
43
|
+
${a.frenchify()}\\ ...... \\ ${b.frenchify()}
|
|
44
|
+
$$`,
|
|
43
45
|
keys: [],
|
|
44
46
|
answerFormat: "tex",
|
|
45
47
|
identifiers: { type, a, b },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimalOrderingNoRelatives.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/decimalOrderingNoRelatives.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"decimalOrderingNoRelatives.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/decimalOrderingNoRelatives.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAkE1D,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAe5D,CAAC"}
|
|
@@ -39,7 +39,9 @@ const getDecimalOrderingNoRelativesQuestion = () => {
|
|
|
39
39
|
answer,
|
|
40
40
|
instruction: `Compléter par le bon symbole :
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
$$
|
|
43
|
+
${a.frenchify()}\\ ...... \\ ${b.frenchify()}
|
|
44
|
+
$$`,
|
|
43
45
|
keys: [],
|
|
44
46
|
answerFormat: "tex",
|
|
45
47
|
identifiers: { type, a, b },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAcrC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAcrC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAoBvD,CAAC"}
|
|
@@ -36,7 +36,7 @@ const getCorrection = (identifiers) => {
|
|
|
36
36
|
const tree = new EqualNode(affine, new NumberNode(b));
|
|
37
37
|
const statementTree = tree.toTex();
|
|
38
38
|
const answer = getAnswer(identifiers);
|
|
39
|
-
return `Pour isoler $x$ à gauche, on effectue l'opération $${a > 0 ?
|
|
39
|
+
return `Pour isoler $x$ à gauche, on effectue l'opération $${a > 0 ? `-${a}` : `+${Math.abs(a)}`}$ des deux côtés de l'équation :
|
|
40
40
|
|
|
41
41
|
${alignTex([
|
|
42
42
|
[
|
|
@@ -45,8 +45,7 @@ ${alignTex([
|
|
|
45
45
|
new EqualNode(new AddNode(affine, new NumberNode(-a)), new AddNode(b.toTree(), new NumberNode(-a))).toTex(),
|
|
46
46
|
],
|
|
47
47
|
["", "\\iff", answer],
|
|
48
|
-
])}
|
|
49
|
-
`;
|
|
48
|
+
])}`;
|
|
50
49
|
};
|
|
51
50
|
const getStartStatement = (identifiers) => {
|
|
52
51
|
const { a, b } = identifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"barChartReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"barChartReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC"}
|
|
@@ -3,7 +3,6 @@ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuesti
|
|
|
3
3
|
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
4
4
|
//@ts-ignore
|
|
5
5
|
import { D3Node } from "d3-node";
|
|
6
|
-
import katex from "katex";
|
|
7
6
|
const getPropositions = (n, { answer }) => {
|
|
8
7
|
const propositions = [];
|
|
9
8
|
addValidProp(propositions, answer);
|
|
@@ -16,57 +15,64 @@ const getAnswer = (identifiers) => {
|
|
|
16
15
|
return "";
|
|
17
16
|
};
|
|
18
17
|
const getInstruction = (identifiers) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
18
|
+
const newspapers = [
|
|
19
|
+
{ name: "Le Figaro", sales: 320000 },
|
|
20
|
+
{ name: "Les Échos", sales: 130000 },
|
|
21
|
+
{ name: "La Croix", sales: 90000 },
|
|
22
|
+
{ name: "L'Équipe", sales: 210000 },
|
|
23
|
+
{ name: "Le Monde", sales: 330000 },
|
|
24
|
+
{ name: "Le Parisien", sales: 270000 },
|
|
25
|
+
{ name: "Libération", sales: 70000 },
|
|
26
|
+
{ name: "L'Humanité", sales: 30000 },
|
|
27
|
+
];
|
|
28
|
+
const width = 600, height = 400, margin = { top: 20, right: 30, bottom: 100, left: 60 };
|
|
29
|
+
const d3n = new D3Node();
|
|
21
30
|
const d3 = d3n.d3;
|
|
22
|
-
const width = 600;
|
|
23
|
-
const height = 250;
|
|
24
31
|
const svg = d3n.createSVG(width, height);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
secondRow.forEach((text, i) => addLatexText(startX + i * cellWidth + cellWidth / 2, startY + 2 * cellHeight + 25, text));
|
|
32
|
+
const xScale = d3
|
|
33
|
+
.scaleBand()
|
|
34
|
+
.domain(newspapers.map((d) => d.name))
|
|
35
|
+
.range([margin.left, width - margin.right])
|
|
36
|
+
.padding(0.1);
|
|
37
|
+
const yScale = d3
|
|
38
|
+
.scaleLinear()
|
|
39
|
+
.domain([0, d3.max(newspapers, (d) => d.sales)])
|
|
40
|
+
.nice()
|
|
41
|
+
.range([height - margin.bottom, margin.top]);
|
|
42
|
+
svg
|
|
43
|
+
.append("g")
|
|
44
|
+
.attr("transform", `translate(0,${height - margin.bottom})`)
|
|
45
|
+
.call(d3.axisBottom(xScale).tickSize(0))
|
|
46
|
+
.selectAll("text")
|
|
47
|
+
.style("text-anchor", "end")
|
|
48
|
+
.attr("transform", "rotate(-30)");
|
|
49
|
+
svg
|
|
50
|
+
.append("g")
|
|
51
|
+
.attr("transform", `translate(${margin.left},0)`)
|
|
52
|
+
.call(d3
|
|
53
|
+
.axisLeft(yScale)
|
|
54
|
+
.ticks(5)
|
|
55
|
+
.tickFormat((d) => d.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ")));
|
|
56
|
+
svg
|
|
57
|
+
.append("text")
|
|
58
|
+
.attr("x", margin.left)
|
|
59
|
+
.attr("y", margin.top)
|
|
60
|
+
.attr("text-anchor", "start")
|
|
61
|
+
.style("font-size", "14px")
|
|
62
|
+
.style("font-weight", "bold")
|
|
63
|
+
.text("Nombre d’exemplaires vendus");
|
|
64
|
+
svg
|
|
65
|
+
.selectAll(".bar")
|
|
66
|
+
.data(newspapers)
|
|
67
|
+
.enter()
|
|
68
|
+
.append("rect")
|
|
69
|
+
.attr("class", "bar")
|
|
70
|
+
.attr("x", (d) => xScale(d.name))
|
|
71
|
+
.attr("y", (d) => yScale(d.sales))
|
|
72
|
+
.attr("width", xScale.bandwidth())
|
|
73
|
+
.attr("height", (d) => height - margin.bottom - yScale(d.sales))
|
|
74
|
+
.attr("fill", "steelblue");
|
|
75
|
+
console.log(d3n.svgString());
|
|
70
76
|
const svgString = d3n.svgString();
|
|
71
77
|
return `BBteeeezfst :
|
|
72
78
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractPointFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/extractPointFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"extractPointFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/extractPointFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAyHF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAkBhE,CAAC"}
|
|
@@ -44,7 +44,8 @@ const getCorrection = (identifiers) => {
|
|
|
44
44
|
const point = line.getPointCoords(new NumberNode(0));
|
|
45
45
|
return `Pour obtenir les coordonnées d'un point appartenant à la droite, il suffit de remplacer $t$ par n'importe quelle valeur dans les trois équations. Par simplicité, prenons $t = 0$. On obtient alors :
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
$$
|
|
48
|
+
\\left\\{\\begin{matrix}
|
|
48
49
|
x=${detailedEquations[0].toTex()} \\\\
|
|
49
50
|
y=${detailedEquations[1].toTex()} \\\\
|
|
50
51
|
z=${detailedEquations[2].toTex()}
|
|
@@ -13,7 +13,7 @@ const getAnswer = (identifiers) => {
|
|
|
13
13
|
return correctAnswer.simplify().toTex();
|
|
14
14
|
};
|
|
15
15
|
const getHint = (identifiers) => {
|
|
16
|
-
return `La norme d'un vecteur est la racine carrée de la somme des carrés de ses coordonnées. En d'autres termes, la norme du vecteur
|
|
16
|
+
return `La norme d'un vecteur est la racine carrée de la somme des carrés de ses coordonnées. En d'autres termes, la norme du vecteur $\\overrightarrow{u}\\begin{pmatrix}x \\\\ y \\end{pmatrix}$ est :
|
|
17
17
|
|
|
18
18
|
$$
|
|
19
19
|
\\lVert \\overrightarrow u \\rVert = \\sqrt{x^2+y^2}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/globalPercent.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"globalPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/globalPercent.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAYT,MAAM,mBAAmB,CAAC;AAO3B,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAuGF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAe/C,CAAC"}
|
|
@@ -4,49 +4,67 @@ import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
|
4
4
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
5
5
|
import { round } from "../../../math/utils/round.js";
|
|
6
6
|
import { percentParser } from "../../../tree/parsers/percentParser.js";
|
|
7
|
-
const
|
|
8
|
-
const tab = ["hausse", "baisse"];
|
|
9
|
-
let ans = 1;
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
10
8
|
let instruction = "Le prix d'un article subit une ";
|
|
9
|
+
identifiers.evolutions.forEach((evolution, i) => {
|
|
10
|
+
const type = evolution[0] === "-" ? "baisse" : "hausse";
|
|
11
|
+
if (i === 0)
|
|
12
|
+
instruction += `${type} de $${evolution.substring(1)}\\%$`;
|
|
13
|
+
else
|
|
14
|
+
instruction += `, puis une ${type} de $${evolution.substring(1)}\\%$`;
|
|
15
|
+
});
|
|
16
|
+
instruction += `.
|
|
17
|
+
|
|
18
|
+
Déterminer le taux d'évolution global du prix de cet article (arrondir au centième de pourcentage).`;
|
|
19
|
+
return instruction;
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { evolutions } = identifiers;
|
|
23
|
+
const cms = evolutions.map((e) => 1 + Number(e) / 100);
|
|
24
|
+
const prod = cms.reduce((acc, curr) => acc * curr, 1);
|
|
25
|
+
const answer = round((prod - 1) * 100, 2).frenchify() + "\\%";
|
|
26
|
+
return answer;
|
|
27
|
+
};
|
|
28
|
+
const getHint = (identifiers) => {
|
|
29
|
+
return "Transforme chaque taux d'évolution en coefficient multiplicateur, puis multiplie ces coefficients multiplicateurs entre eux pour obtenir le coefficient multiplicateur global. Transforme alors ce CM global en taux d'évolution.";
|
|
30
|
+
};
|
|
31
|
+
const getCorrection = (identifiers) => {
|
|
32
|
+
const { evolutions } = identifiers;
|
|
33
|
+
const answer = getAnswer(identifiers);
|
|
34
|
+
return `On transforme les taux d'évolution en coefficients multiplicateurs puis on les multiplie entre eux :
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
${evolutions
|
|
38
|
+
.map((e) => round(1 + Number(e) / 100, 2).frenchify())
|
|
39
|
+
.join(" \\times ")} = ${round(evolutions.reduce((acc, curr) => acc * round(1 + Number(curr) / 100, 2), 1), 4).frenchify()}
|
|
40
|
+
$$
|
|
41
|
+
|
|
42
|
+
Enfin, on transforme ce CM global en taux d'évolution :
|
|
43
|
+
|
|
44
|
+
$$
|
|
45
|
+
(${round(evolutions.reduce((acc, curr) => acc * round(1 + Number(curr) / 100, 2), 1), 4).frenchify()} - 1)\\times 100 = ${answer.replace("\\%", "")}
|
|
46
|
+
$$
|
|
47
|
+
|
|
48
|
+
Le taux d'évolution global est donc de $${answer}$.
|
|
49
|
+
`;
|
|
50
|
+
};
|
|
51
|
+
const getGlobalPercentQuestion = () => {
|
|
11
52
|
const indice = randint(2, 4);
|
|
12
53
|
const evolutions = [];
|
|
13
54
|
for (let i = 0; i < indice; i++) {
|
|
14
55
|
const randPercent = randint(1, 50);
|
|
15
56
|
let a = randint(0, 2);
|
|
16
|
-
instruction += `${tab[a]} de $${randPercent}\\%$`;
|
|
17
57
|
evolutions.push((a === 0 ? "+" : "-") + randPercent);
|
|
18
|
-
if (i + 1 < indice)
|
|
19
|
-
instruction += ", puis une ";
|
|
20
|
-
if (a == 0)
|
|
21
|
-
ans *= 1 + randPercent / 100;
|
|
22
|
-
else
|
|
23
|
-
ans *= 1 - randPercent / 100;
|
|
24
58
|
}
|
|
25
|
-
|
|
26
|
-
instruction +=
|
|
27
|
-
". \nDéterminer le taux d'évolution global du prix de cet article (arrondir au centième de pourcentage).";
|
|
28
|
-
const answer = `${(ans + "").replace(".", ",")}\\%`;
|
|
59
|
+
const identifiers = { evolutions };
|
|
29
60
|
const question = {
|
|
30
|
-
instruction,
|
|
31
|
-
answer,
|
|
61
|
+
instruction: getInstruction(identifiers),
|
|
62
|
+
answer: getAnswer(identifiers),
|
|
32
63
|
keys: ["percent"],
|
|
33
64
|
answerFormat: "tex",
|
|
34
|
-
identifiers
|
|
35
|
-
hint:
|
|
36
|
-
correction:
|
|
37
|
-
|
|
38
|
-
$$${evolutions
|
|
39
|
-
.map((e) => round(1 + Number(e) / 100, 2).frenchify())
|
|
40
|
-
.join(" \\times ")} = ${round(evolutions.reduce((acc, curr) => acc * round(1 + Number(curr) / 100, 2), 1), 4).frenchify()}
|
|
41
|
-
$$
|
|
42
|
-
|
|
43
|
-
Enfin, on transforme ce CM global en taux d'évolution :
|
|
44
|
-
|
|
45
|
-
$$(${round(evolutions.reduce((acc, curr) => acc * round(1 + Number(curr) / 100, 2), 1), 4).frenchify()} - 1)\\times 100 = ${answer.replace("\\%", "")}
|
|
46
|
-
$$
|
|
47
|
-
|
|
48
|
-
Le taux d'évolution global est donc de $${answer}$.
|
|
49
|
-
`,
|
|
65
|
+
identifiers,
|
|
66
|
+
hint: getHint(identifiers),
|
|
67
|
+
correction: getCorrection(identifiers),
|
|
50
68
|
};
|
|
51
69
|
return question;
|
|
52
70
|
};
|
package/lib/latexTester.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latexTester.d.ts","sourceRoot":"","sources":["../src/latexTester.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"latexTester.d.ts","sourceRoot":"","sources":["../src/latexTester.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UAAW,MAAM,2CAkJxC,CAAC"}
|
package/lib/latexTester.js
CHANGED
|
@@ -9,6 +9,7 @@ export const latexTester = (latex, isDefaultInMathMode = false) => {
|
|
|
9
9
|
const prevChar = latex[i - 1];
|
|
10
10
|
const char = latex[i];
|
|
11
11
|
const nextChar = latex[i + 1];
|
|
12
|
+
const nextNextChar = latex[i + 2];
|
|
12
13
|
if (char === "$") {
|
|
13
14
|
if (isDefaultInMathMode)
|
|
14
15
|
throw new Error("Dollar in default math mode");
|
|
@@ -18,6 +19,11 @@ export const latexTester = (latex, isDefaultInMathMode = false) => {
|
|
|
18
19
|
if (inDollarMode)
|
|
19
20
|
throw new Error("Double dollar instead of single");
|
|
20
21
|
inDoubleDollarMode = !inDoubleDollarMode;
|
|
22
|
+
if (inDoubleDollarMode &&
|
|
23
|
+
nextNextChar !== undefined &&
|
|
24
|
+
nextNextChar !== "\n") {
|
|
25
|
+
throw new Error(`Whitespace missing after double dollar, got char ${nextNextChar}`);
|
|
26
|
+
}
|
|
21
27
|
i++;
|
|
22
28
|
}
|
|
23
29
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../../src/pc/constants/molecularChemistry/reaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,8BAAsB,mBAAmB;IACvC,MAAM,CAAC,cAAc,IAAI,QAAQ;
|
|
1
|
+
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../../src/pc/constants/molecularChemistry/reaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,8BAAsB,mBAAmB;IACvC,MAAM,CAAC,cAAc,IAAI,QAAQ;CAkVlC;AAED,qBAAa,QAAQ;IACnB,aAAa,EAAE,eAAe,EAAE,CAAC;gBAErB,aAAa,EAAE,eAAe,EAAE;IAI5C,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,kBAAkB;IAU1B,iBAAiB,IAAI,MAAM;IAU3B,sBAAsB,IAAI,MAAM;IAchC,wBAAwB,IAAI,MAAM;IAsBlC,OAAO,CAAC,oBAAoB;IAwB5B,2BAA2B,CAAC,2BAA2B,EAAE,MAAM,GAAG,MAAM;IAgCxE,kBAAkB,IAAI,KAAK,EAAE;IAc7B,iBAAiB,IAAI,MAAM,EAAE;IAW7B,cAAc,IAAI,MAAM,EAAE;IAW1B,SAAS,IAAI,KAAK,EAAE;CAWrB;AACD,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -320,9 +320,6 @@ export class ReactionConstructor {
|
|
|
320
320
|
for (const reactionSpecies of reaction) {
|
|
321
321
|
const foundMolecule = molecules.find((molecule) => molecule.formula === reactionSpecies.species);
|
|
322
322
|
if (!foundMolecule) {
|
|
323
|
-
// console.log(
|
|
324
|
-
// `La species '${reactionSpecies.species}' n'a pas été trouvée dans molecules.`,
|
|
325
|
-
// );
|
|
326
323
|
}
|
|
327
324
|
}
|
|
328
325
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/pc/measure/measure.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKxD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;CACd;AACD,qBAAa,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEH,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/pc/measure/measure.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKxD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;CACd;AACD,qBAAa,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEH,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAkD/D,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAkB9B,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAgB/B,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAuB1B,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAuB/B,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY;IA4BzB,OAAO,CAAC,kBAAkB;IAqB1B;;OAEG;IACH,aAAa,CAAC,CAAC,EAAE,MAAM;IAMvB,QAAQ;IAIR,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAMpB,aAAa;;;;IAOb,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC;IAOlB,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAW5B,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;IAIvB,gBAAgB,IAAI,MAAM;CAO3B"}
|
|
@@ -13,7 +13,6 @@ export class Measure {
|
|
|
13
13
|
significantPart;
|
|
14
14
|
unit;
|
|
15
15
|
constructor(value, exponent = 0, unit) {
|
|
16
|
-
// console.log("bf", value, exponent);
|
|
17
16
|
if (unit)
|
|
18
17
|
this.unit = unit;
|
|
19
18
|
if (value === 0) {
|
|
@@ -59,7 +58,6 @@ export class Measure {
|
|
|
59
58
|
this.significantPart = value;
|
|
60
59
|
this.exponent = exponent;
|
|
61
60
|
}
|
|
62
|
-
// console.log("after", this.significantPart, this.exponent);
|
|
63
61
|
}
|
|
64
62
|
times(n) {
|
|
65
63
|
if (typeof n === "number")
|
package/lib/tests/pdfExo.test.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extractPointFromParametricLine, } from "../exercises/math/index.js";
|
|
2
2
|
import { buildPdfForExercise } from "./pdfs/buildPDFForExercise.js";
|
|
3
3
|
import "../prototypesEnhancement.js";
|
|
4
4
|
try {
|
|
5
|
-
buildPdfForExercise(
|
|
5
|
+
buildPdfForExercise(extractPointFromParametricLine);
|
|
6
6
|
}
|
|
7
7
|
catch (err) {
|
|
8
8
|
console.log(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPDFForExercise.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/buildPDFForExercise.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAyB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"buildPDFForExercise.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/buildPDFForExercise.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAyB,MAAM,6BAA6B,CAAC;AAI9E,eAAO,MAAM,mBAAmB,QAAS,QAAQ,SAkHhD,CAAC"}
|
|
@@ -5,7 +5,11 @@ import { formatMarkdownToLatex } from "./formatMdToLatex.js";
|
|
|
5
5
|
// import { activities } from "@root/resolvers/activity/query/activities";
|
|
6
6
|
import fs from "fs";
|
|
7
7
|
import latex from "node-latex";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
import path from "path";
|
|
8
10
|
export const buildPdfForExercise = (exo) => {
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
9
13
|
const exoShortName = exo.id;
|
|
10
14
|
const preambule = quizPdfPreambule();
|
|
11
15
|
const questions = exo.generator(10);
|
|
@@ -86,9 +90,9 @@ export const buildPdfForExercise = (exo) => {
|
|
|
86
90
|
${header}
|
|
87
91
|
${content}
|
|
88
92
|
${endDocument}`;
|
|
89
|
-
fs.appendFileSync(__dirname + `/dump/${exoShortName}.tex
|
|
90
|
-
const input = fs.createReadStream(__dirname + `/dump/${exoShortName}.tex`);
|
|
91
|
-
const output = fs.createWriteStream(__dirname + `/dump/${exoShortName}.pdf`);
|
|
93
|
+
fs.appendFileSync((__dirname + `/dump/${exoShortName}.tex`).replace("lib\\", "src\\"), `${file}`);
|
|
94
|
+
const input = fs.createReadStream((__dirname + `/dump/${exoShortName}.tex`).replaceAll("lib\\", "src\\"));
|
|
95
|
+
const output = fs.createWriteStream((__dirname + `/dump/${exoShortName}.pdf`).replaceAll("lib\\", "src\\"));
|
|
92
96
|
//@ts-ignore
|
|
93
97
|
const pdf = latex(input, { args: ["-shell-escape"] });
|
|
94
98
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIjE,eAAO,MAAM,YAAY,QAAS,QAAQ,YAAY,QAAQ;;;
|
|
1
|
+
{"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIjE,eAAO,MAAM,YAAY,QAAS,QAAQ,YAAY,QAAQ;;;CAyK7D,CAAC"}
|
|
@@ -105,14 +105,14 @@ export const questionTest = (exo, question) => {
|
|
|
105
105
|
let before = Date.now();
|
|
106
106
|
console.log("will test vea : ", exo.id);
|
|
107
107
|
if (!exo.isAnswerValid(answer, { answer, ...question.identifiers })) {
|
|
108
|
-
throw new Error(`exo ${exo.id} has invalid VEA`);
|
|
108
|
+
throw new Error(`exo ${exo.id} has invalid VEA, ids ${question.identifiers}, answer ${question.answer}`);
|
|
109
109
|
}
|
|
110
110
|
let after = Date.now();
|
|
111
111
|
veaTime = after - before;
|
|
112
112
|
}
|
|
113
113
|
if (exo.answerType !== "free" && exo.answerType !== "GGB") {
|
|
114
114
|
let before = Date.now();
|
|
115
|
-
console.log("will generate props : ", exo.id);
|
|
115
|
+
console.log("will generate props : ", exo.id, "ids :", question.identifiers);
|
|
116
116
|
const props = exo.getPropositions(4, {
|
|
117
117
|
answer: question.answer,
|
|
118
118
|
...question.identifiers,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { factoType1Exercise, } from "../exercises/math/index.js";
|
|
2
2
|
import "../prototypesEnhancement.js";
|
|
3
3
|
import { exoTest } from "./exoTest.js";
|
|
4
4
|
try {
|
|
5
|
-
exoTest(
|
|
5
|
+
exoTest(factoType1Exercise);
|
|
6
6
|
}
|
|
7
7
|
catch (err) {
|
|
8
8
|
throw err;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unionIntervalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/unionIntervalNode.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"unionIntervalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/unionIntervalNode.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOlE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAa,MAAM,cAAc,CAAC;AAE1D,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,iBAAiB,CAEnE;AACD,8BAAsB,wBAAwB;IAC5C,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,aAAa;CAMlC;AACD,qBAAa,iBAAkB,YAAW,IAAI;IAC5C,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,IAAI,EAAE,OAAO,EAAE,CAAC;gBACJ,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,EAAE,WAAW;IAO/C,cAAc;IAId,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAcpC,YAAY;IAIZ,QAAQ;IAIR,KAAK;IAGL,aAAa;;;;;;IAMb,QAAQ;IAMR,YAAY;CAMb"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCartesiansProducts } from "../../../utils/arrays/cartesianProducts.js";
|
|
2
2
|
import { permute } from "../../../utils/arrays/permutations.js";
|
|
3
3
|
import { NodeIds, NodeType } from "../node.js";
|
|
4
|
-
import { MinusInfinityNode } from "../numbers/infiniteNode.js";
|
|
4
|
+
import { MinusInfinityNode, PlusInfinityNode, } from "../numbers/infiniteNode.js";
|
|
5
5
|
import { ClosureType } from "./closure.js";
|
|
6
6
|
import { IntervalNode } from "./intervalNode.js";
|
|
7
7
|
import { SetIds, isSetNode } from "./setNode.js";
|
|
@@ -12,7 +12,7 @@ export class UnionIntervalNodeBuilder {
|
|
|
12
12
|
static realMinus(a) {
|
|
13
13
|
return new UnionIntervalNode([
|
|
14
14
|
new IntervalNode(MinusInfinityNode, a, ClosureType.OO),
|
|
15
|
-
new IntervalNode(a,
|
|
15
|
+
new IntervalNode(a, PlusInfinityNode, ClosureType.OO),
|
|
16
16
|
]);
|
|
17
17
|
}
|
|
18
18
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "math-exercises",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.7",
|
|
5
5
|
"description": "Math exercises generator for middle school and high school",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"files": [
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"testml": "npm run build && node lib/tests/ml.test.js",
|
|
16
16
|
"testxl": "npm run build && node lib/tests/xl.test.js",
|
|
17
17
|
"testlatex": "npm run build && node lib/tests/latexParser.test.js",
|
|
18
|
+
"testpdf": "npm run build && node lib/tests/pdfExo.test.js",
|
|
18
19
|
"testsimplify": "npx jest simplify.test.js",
|
|
19
20
|
"prepublishOnly": "npm run build",
|
|
20
21
|
"build": "tsc && tsc-alias"
|