math-exercises 3.0.6 → 3.0.8

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.
Files changed (51) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/fractions/fractionsOperations.js +6 -1
  3. package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/ordering/decimalOrdering.js +3 -1
  5. package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.js +3 -1
  7. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts.map +1 -1
  8. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.js +4 -4
  9. package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +6 -3
  11. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
  12. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +9 -5
  13. package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
  14. package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.js +4 -0
  15. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
  16. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +18 -14
  17. package/lib/exercises/math/dataRepresentations/barChartReading.d.ts.map +1 -1
  18. package/lib/exercises/math/dataRepresentations/barChartReading.js +123 -50
  19. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
  20. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +4 -1
  21. package/lib/exercises/math/functions/basics/imageFunctionGeogebra.d.ts.map +1 -1
  22. package/lib/exercises/math/functions/basics/imageFunctionGeogebra.js +14 -20
  23. package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.d.ts.map +1 -1
  24. package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.js +2 -1
  25. package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +1 -1
  26. package/lib/exercises/math/percent/globalPercent.d.ts.map +1 -1
  27. package/lib/exercises/math/percent/globalPercent.js +54 -32
  28. package/lib/latexTester.d.ts.map +1 -1
  29. package/lib/latexTester.js +6 -0
  30. package/lib/pc/constants/molecularChemistry/molecule.js +0 -1
  31. package/lib/pc/constants/molecularChemistry/reaction.d.ts.map +1 -1
  32. package/lib/pc/constants/molecularChemistry/reaction.js +0 -3
  33. package/lib/pc/measure/measure.d.ts.map +1 -1
  34. package/lib/pc/measure/measure.js +0 -2
  35. package/lib/playground.d.ts.map +1 -1
  36. package/lib/playground.js +2 -7
  37. package/lib/server.d.ts +1 -0
  38. package/lib/server.d.ts.map +1 -1
  39. package/lib/server.js +16 -0
  40. package/lib/tests/pdfExo.test.js +2 -2
  41. package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -1
  42. package/lib/tests/pdfs/buildPDFForExercise.js +7 -3
  43. package/lib/tests/questionTest.d.ts.map +1 -1
  44. package/lib/tests/questionTest.js +2 -2
  45. package/lib/tests/singleExo.test.js +2 -2
  46. package/lib/tree/nodes/nodeConstructor.d.ts +2 -2
  47. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  48. package/lib/tree/nodes/nodeConstructor.js +3 -2
  49. package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
  50. package/lib/tree/nodes/sets/unionIntervalNode.js +2 -2
  51. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"fractionsOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,eAAe,CAAC;CACvC,CAAC;AAqFF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAgBrD,CAAC"}
1
+ {"version":3,"file":"fractionsOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,eAAe,CAAC;CACvC,CAAC;AA4FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
@@ -17,7 +17,8 @@ const getPropositions = (n, { answer }) => {
17
17
  return shuffleProps(propositions, n);
18
18
  };
19
19
  const getAnswer = (identifiers) => {
20
- const statement = NodeConstructor.fromIdentifiers(identifiers.statementIdentifiers);
20
+ console.log("ans", identifiers);
21
+ const statement = NodeConstructor.fromIdentifiers(identifiers.statementIdentifiers, true);
21
22
  return statement.simplify().toTex();
22
23
  };
23
24
  const getInstruction = (identifiers) => {
@@ -58,6 +59,9 @@ const getFractionsOperationsQuestion = (ops) => {
58
59
  const identifiers = {
59
60
  statementIdentifiers: ids,
60
61
  };
62
+ return getQuestionFromIdentifiers(identifiers);
63
+ };
64
+ const getQuestionFromIdentifiers = (identifiers) => {
61
65
  const question = {
62
66
  answer: getAnswer(identifiers),
63
67
  instruction: getInstruction(identifiers),
@@ -84,4 +88,5 @@ export const fractionsOperations = {
84
88
  // getHint,
85
89
  // getCorrection,
86
90
  getAnswer,
91
+ getQuestionFromIdentifiers,
87
92
  };
@@ -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;AA8D1D,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,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
- $$${a.frenchify()}\\ ...... \\ ${b.frenchify()}$$`,
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;AAgE1D,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAe5D,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
- $$${a.frenchify()}\\ ...... \\ ${b.frenchify()}$$`,
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":"choseOperationToSolveEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAqJF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}
1
+ {"version":3,"file":"choseOperationToSolveEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAuJF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAoB/D,CAAC"}
@@ -130,14 +130,15 @@ const getChoseOperationToSolveEquationQuestion = (opts) => {
130
130
  break;
131
131
  }
132
132
  const identifiers = { type, a, b, c };
133
+ return getQuestionFromIdentifiers(identifiers);
134
+ };
135
+ const getQuestionFromIdentifiers = (identifiers) => {
133
136
  const question = {
134
137
  answer: getAnswer(identifiers),
135
138
  instruction: getInstruction(identifiers),
136
139
  keys: getKeys(identifiers),
137
140
  answerFormat: "tex",
138
141
  identifiers,
139
- // hint: getHint(identifiers),
140
- // correction: getCorrection(identifiers),
141
142
  };
142
143
  return question;
143
144
  };
@@ -153,8 +154,7 @@ export const choseOperationToSolveEquation = {
153
154
  isAnswerValid,
154
155
  subject: "Mathématiques",
155
156
  getInstruction,
156
- // getHint,
157
- // getCorrection,
158
157
  getAnswer,
159
158
  answerType: "QCU",
159
+ getQuestionFromIdentifiers,
160
160
  };
@@ -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;AAmGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAoBvD,CAAC"}
1
+ {"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAqBvD,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 ? `$-${a}$` : `+${Math.abs(a)}`}$ des deux côtés de l'équation :
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;
@@ -59,6 +58,9 @@ const getEquationType1ExerciseQuestion = () => {
59
58
  const b = randint(-10, 11);
60
59
  const a = randint(-10, 11, [0]);
61
60
  const identifiers = { a, b };
61
+ return getQuestionFromIdentifiers(identifiers);
62
+ };
63
+ const getQuestionFromIdentifiers = (identifiers) => {
62
64
  const question = {
63
65
  instruction: getInstruction(identifiers),
64
66
  startStatement: getStartStatement(identifiers),
@@ -105,4 +107,5 @@ export const equationType1Exercise = {
105
107
  getInstruction,
106
108
  getAnswer,
107
109
  getStartStatement,
110
+ getQuestionFromIdentifiers,
108
111
  };
@@ -1 +1 @@
1
- {"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAsBrC,OAAO,EAEL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C;;GAEG;AAGH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAmJF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAaF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBhE,CAAC"}
1
+ {"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAsBrC,OAAO,EAEL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C;;GAEG;AAGH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA0JF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAaF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAuBhE,CAAC"}
@@ -94,15 +94,18 @@ const getEquationType2ExerciseQuestion = (opts) => {
94
94
  isXRight,
95
95
  aNumberType: type,
96
96
  };
97
+ return getQuestionFromIdentifiers(identifiers, opts);
98
+ };
99
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
97
100
  const question = {
98
- instruction: getInstruction(identifiers),
99
- startStatement: getStartStatement(identifiers),
100
- answer: getAnswer(identifiers),
101
+ instruction: getInstruction(identifiers, opts),
102
+ startStatement: getStartStatement(identifiers, opts),
103
+ answer: getAnswer(identifiers, opts),
101
104
  keys: equationKeys,
102
105
  answerFormat: "tex",
103
106
  identifiers,
104
- hint: getHint(identifiers),
105
- correction: getCorrection(identifiers),
107
+ hint: getHint(identifiers, opts),
108
+ correction: getCorrection(identifiers, opts),
106
109
  };
107
110
  return question;
108
111
  };
@@ -157,4 +160,5 @@ export const equationType2Exercise = {
157
160
  getAnswer,
158
161
  getStartStatement,
159
162
  rebuildIdentifiers,
163
+ getQuestionFromIdentifiers,
160
164
  };
@@ -1 +1 @@
1
- {"version":3,"file":"equationType3Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType3Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAerC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAqBvD,CAAC"}
1
+ {"version":3,"file":"equationType3Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType3Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAerC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAsBvD,CAAC"}
@@ -60,6 +60,9 @@ const getEquationType3ExerciseQuestion = () => {
60
60
  const a = randint(-10, 11, [0, 1]);
61
61
  const c = randint(-10, 11);
62
62
  const identifiers = { a, b, c };
63
+ return getQuestionFromIdentifiers(identifiers);
64
+ };
65
+ const getQuestionFromIdentifiers = (identifiers) => {
63
66
  const question = {
64
67
  instruction: getInstruction(identifiers),
65
68
  hint: getHint(identifiers),
@@ -106,4 +109,5 @@ export const equationType3Exercise = {
106
109
  getCorrection,
107
110
  getHint,
108
111
  getStartStatement,
112
+ getQuestionFromIdentifiers,
109
113
  };
@@ -1 +1 @@
1
- {"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAerC;;GAEG;AAEH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+FF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
1
+ {"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAerC;;GAEG;AAEH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAsGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAiBvD,CAAC"}
@@ -43,6 +43,9 @@ const getEquationType4ExerciseQuestion = () => {
43
43
  c,
44
44
  d,
45
45
  };
46
+ return getQuestionFromIdentifiers(identifiers);
47
+ };
48
+ const getQuestionFromIdentifiers = (identifiers) => {
46
49
  const question = {
47
50
  instruction: getInstruction(identifiers),
48
51
  startStatement: getStartStatement(identifiers),
@@ -50,23 +53,23 @@ const getEquationType4ExerciseQuestion = () => {
50
53
  keys: equationKeys,
51
54
  answerFormat: "tex",
52
55
  identifiers,
53
- // hint: `Commence par regrouper les termes en $x$ d'un même côté de l'équation. Puis, isole $x$ en effectuant les bonnes opérations.`,
54
- // correction: `On isole $x$ à gauche en soustrayant par $${b}$ puis en divisant par $${a}$ :
55
- // ${alignTex([
56
- // [
57
- // statementTex,
58
- // "\\iff",
59
- // new EqualNode(
60
- // new Affine(a, 0).toTree(),
61
- // affines[1].add(-b).toTree(),
62
- // ).toTex(),
63
- // ],
64
- // ["", "\\iff", answer],
65
- // ])}
66
- // `,
67
56
  };
68
57
  return question;
69
58
  };
59
+ // hint: `Commence par regrouper les termes en $x$ d'un même côté de l'équation. Puis, isole $x$ en effectuant les bonnes opérations.`,
60
+ // correction: `On isole $x$ à gauche en soustrayant par $${b}$ puis en divisant par $${a}$ :
61
+ // ${alignTex([
62
+ // [
63
+ // statementTex,
64
+ // "\\iff",
65
+ // new EqualNode(
66
+ // new Affine(a, 0).toTree(),
67
+ // affines[1].add(-b).toTree(),
68
+ // ).toTex(),
69
+ // ],
70
+ // ["", "\\iff", answer],
71
+ // ])}
72
+ // `,
70
73
  const getPropositions = (n, { answer, a, b, c, d }) => {
71
74
  const propositions = [];
72
75
  addValidProp(propositions, answer);
@@ -97,4 +100,5 @@ export const equationType4Exercise = {
97
100
  subject: "Mathématiques",
98
101
  getInstruction,
99
102
  getAnswer,
103
+ getQuestionFromIdentifiers,
100
104
  };
@@ -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;AA0IF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,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 options = { svg: true };
20
- const d3n = new D3Node(options);
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
- // Define table structure
26
- const rows = 3;
27
- const cols = 5;
28
- const cellWidth = 120;
29
- const cellHeight = 50;
30
- const startX = 50;
31
- const startY = 50;
32
- // Define table values
33
- const headers = ["x", "-\\infty", "-2", "0", "+\\infty"];
34
- const firstRow = ["f'(x)", "+", "0", "-", ""];
35
- const secondRow = ["f(x)", "\\nearrow", "max", "\\searrow", ""];
36
- // Draw table grid
37
- for (let r = 0; r < rows; r++) {
38
- for (let c = 0; c < cols; c++) {
39
- svg
40
- .append("rect")
41
- .attr("x", startX + c * cellWidth)
42
- .attr("y", startY + r * cellHeight)
43
- .attr("width", cellWidth)
44
- .attr("height", cellHeight)
45
- .attr("stroke", "black")
46
- .attr("fill", "black");
47
- }
48
- }
49
- // Function to render LaTeX with KaTeX
50
- const renderLatex = (formula) => katex.renderToString(formula, { throwOnError: false });
51
- // Add LaTeX text using <foreignObject> for proper positioning
52
- const addLatexText = (x, y, latex) => {
53
- svg
54
- .append("foreignObject")
55
- .attr("x", x - cellWidth / 2)
56
- .attr("y", y - cellHeight / 2)
57
- .attr("width", cellWidth)
58
- .attr("height", cellHeight)
59
- .html(`<div xmlns="http://www.w3.org/1999/xhtml"
60
- style="display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;">
61
- ${renderLatex(latex)}
62
- </div>`);
63
- };
64
- // Insert header row
65
- headers.forEach((text, i) => addLatexText(startX + i * cellWidth + cellWidth / 2, startY + 25, text));
66
- // Insert first row (derivative sign changes)
67
- firstRow.forEach((text, i) => addLatexText(startX + i * cellWidth + cellWidth / 2, startY + cellHeight + 25, text));
68
- // Insert second row (function increasing/decreasing)
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
 
@@ -124,3 +130,70 @@ export const barChartReading = {
124
130
  getCorrection,
125
131
  getAnswer,
126
132
  };
133
+ // !signtable
134
+ // const options = { svg: true };
135
+ // const d3n = new D3Node(options);
136
+ // const d3 = d3n.d3;
137
+ // const width = 600;
138
+ // const height = 250;
139
+ // const svg = d3n.createSVG(width, height);
140
+ // // Define table structure
141
+ // const rows = 3;
142
+ // const cols = 5;
143
+ // const cellWidth = 120;
144
+ // const cellHeight = 50;
145
+ // const startX = 50;
146
+ // const startY = 50;
147
+ // // Define table values
148
+ // const headers = ["x", "-\\infty", "-2", "0", "+\\infty"];
149
+ // const firstRow = ["f'(x)", "+", "0", "-", ""];
150
+ // const secondRow = ["f(x)", "\\nearrow", "max", "\\searrow", ""];
151
+ // // Draw table grid
152
+ // for (let r = 0; r < rows; r++) {
153
+ // for (let c = 0; c < cols; c++) {
154
+ // svg
155
+ // .append("rect")
156
+ // .attr("x", startX + c * cellWidth)
157
+ // .attr("y", startY + r * cellHeight)
158
+ // .attr("width", cellWidth)
159
+ // .attr("height", cellHeight)
160
+ // .attr("stroke", "black")
161
+ // .attr("fill", "black");
162
+ // }
163
+ // }
164
+ // // Function to render LaTeX with KaTeX
165
+ // const renderLatex = (formula: any) =>
166
+ // katex.renderToString(formula, { throwOnError: false });
167
+ // // Add LaTeX text using <foreignObject> for proper positioning
168
+ // const addLatexText = (x: any, y: any, latex: any) => {
169
+ // svg
170
+ // .append("foreignObject")
171
+ // .attr("x", x - cellWidth / 2)
172
+ // .attr("y", y - cellHeight / 2)
173
+ // .attr("width", cellWidth)
174
+ // .attr("height", cellHeight)
175
+ // .html(`<div xmlns="http://www.w3.org/1999/xhtml"
176
+ // style="display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;">
177
+ // ${renderLatex(latex)}
178
+ // </div>`);
179
+ // };
180
+ // // Insert header row
181
+ // headers.forEach((text, i) =>
182
+ // addLatexText(startX + i * cellWidth + cellWidth / 2, startY + 25, text),
183
+ // );
184
+ // // Insert first row (derivative sign changes)
185
+ // firstRow.forEach((text, i) =>
186
+ // addLatexText(
187
+ // startX + i * cellWidth + cellWidth / 2,
188
+ // startY + cellHeight + 25,
189
+ // text,
190
+ // ),
191
+ // );
192
+ // // Insert second row (function increasing/decreasing)
193
+ // secondRow.forEach((text, i) =>
194
+ // addLatexText(
195
+ // startX + i * cellWidth + cellWidth / 2,
196
+ // startY + 2 * cellHeight + 25,
197
+ // text,
198
+ // ),
199
+ // );
@@ -1 +1 @@
1
- {"version":3,"file":"affineExpressionFromTwoImages.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionFromTwoImages.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAgIF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAgB/D,CAAC"}
1
+ {"version":3,"file":"affineExpressionFromTwoImages.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionFromTwoImages.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAgIF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAmB/D,CAAC"}
@@ -32,7 +32,7 @@ Donc
32
32
 
33
33
  $$
34
34
  ${yA} = ${new MultiplyNode(aSimplified, xA.toTree()).toTex()}+b
35
- $$
35
+ $$
36
36
 
37
37
  On a donc
38
38
 
@@ -124,4 +124,7 @@ export const affineExpressionFromTwoImages = {
124
124
  subject: "Mathématiques",
125
125
  hasHintAndCorrection: true,
126
126
  getCorrection,
127
+ getInstruction,
128
+ getAnswer,
129
+ getHint,
127
130
  };
@@ -1 +1 @@
1
- {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAsBrC,KAAK,WAAW,GAAG;IACjB,cAAc;IAMd,UAAU;IAMV,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;CACzB,CAAC;AAyOF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBhE,CAAC"}
1
+ {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAsBrC,KAAK,WAAW,GAAG;IACjB,cAAc;IAMd,UAAU;IAMV,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;CACzB,CAAC;AAoOF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBhE,CAAC"}
@@ -122,6 +122,18 @@ const getStartStatement = (identifiers) => {
122
122
  const { x } = identifiers;
123
123
  return `f(${x})`;
124
124
  };
125
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
126
+ const question = {
127
+ instruction: getInstruction(identifiers, opts),
128
+ startStatement: getStartStatement(identifiers, opts),
129
+ answer: getAnswer(identifiers, opts),
130
+ keys: [],
131
+ ggbOptions: getGGBOptions(identifiers, opts),
132
+ answerFormat: "tex",
133
+ identifiers,
134
+ };
135
+ return question;
136
+ };
125
137
  const getImageFunctionGeogebra = (opts) => {
126
138
  const x = randint(-8, 9);
127
139
  const y = randint(-8, 9);
@@ -154,33 +166,14 @@ const getImageFunctionGeogebra = (opts) => {
154
166
  default:
155
167
  break;
156
168
  }
157
- // const spline = new (isSpline ? Spline : Lagrange)(
158
- // new IntervalNode((-10).toTree(), (10).toTree(), ClosureType.FF),
159
- // [
160
- // new Point("A", x.toTree(), y.toTree()),
161
- // //distractor point with ordonnée = x
162
- // new Point("B", wrongY.toTree(), x.toTree()),
163
- // ],
164
- // );
165
169
  const identifiers = {
166
- // isSpline,
167
- // splinePoints: spline.points,
168
170
  x,
169
171
  y,
170
172
  functionType,
171
173
  wrongY,
172
174
  otherPoints,
173
175
  };
174
- const question = {
175
- instruction: getInstruction(identifiers),
176
- startStatement: getStartStatement(identifiers),
177
- answer: getAnswer(identifiers),
178
- keys: [],
179
- ggbOptions: getGGBOptions(identifiers),
180
- answerFormat: "tex",
181
- identifiers,
182
- };
183
- return question;
176
+ return getQuestionFromIdentifiers(identifiers, opts);
184
177
  };
185
178
  const getPropositions = (n, { answer, x, y, wrongY }, opts) => {
186
179
  const propositions = [];
@@ -223,4 +216,5 @@ export const imageFunctionGeogebra = {
223
216
  getInstruction,
224
217
  getGGBOptions,
225
218
  rebuildIdentifiers,
219
+ getQuestionFromIdentifiers,
226
220
  };
@@ -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;AAwHF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAkBhE,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
- $$\\left\\{\\begin{matrix}
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 $$\\overrightarrow{u}\\begin{pmatrix}x \\\\ y \\end{pmatrix}$$ est :
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,EAQT,MAAM,mBAAmB,CAAC;AAO3B,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAwFF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAe/C,CAAC"}
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,CAmB/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 getGlobalPercentQuestion = () => {
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
- ans = round((ans - 1) * 100, 2);
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: { evolutions },
35
- hint: "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.",
36
- correction: `On transforme les taux d'évolution en coefficients multiplicateurs puis on les multiplie entre eux :
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
  };
@@ -81,4 +99,8 @@ export const globalPercent = {
81
99
  isAnswerValid,
82
100
  subject: "Mathématiques",
83
101
  hasHintAndCorrection: true,
102
+ getInstruction,
103
+ getAnswer,
104
+ getCorrection,
105
+ getHint,
84
106
  };
@@ -1 +1 @@
1
- {"version":3,"file":"latexTester.d.ts","sourceRoot":"","sources":["../src/latexTester.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UAAW,MAAM,2CAuIxC,CAAC"}
1
+ {"version":3,"file":"latexTester.d.ts","sourceRoot":"","sources":["../src/latexTester.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UAAW,MAAM,2CAkJxC,CAAC"}
@@ -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 {
@@ -581,4 +581,3 @@ export const molecules = [
581
581
  'Acid'
582
582
  ),*/
583
583
  ];
584
- /*for (const molecule of molecules) if (molecule.iupact) console.log(molecule.iupact);*/
@@ -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;CAqVlC;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"}
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;IAoD/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"}
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")
@@ -1 +1 @@
1
- {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU,YAAW,CAAC"}
1
+ {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,UAAU,YAEtB,CAAC"}
package/lib/playground.js CHANGED
@@ -1,8 +1,3 @@
1
- import { NodeConstructor } from "./tree/nodes/nodeConstructor.js";
2
- export const playground = () => { };
3
- const logIdentifiers = () => {
4
- const ids = '{"xA":-3,"yA":-2,"yPrimeA":{"id":31,"child":{"id":3,"leftChild":{"id":7,"value":3},"rightChild":{"id":7,"value":2}}},"trinomCoeffs":[0.3888888888888889,0.833333333333333,-3]}';
5
- const parsed = JSON.parse(ids);
6
- console.log(parsed);
7
- console.log(NodeConstructor.fromIdentifiers({ ...parsed.yPrimeA }).toTex());
1
+ export const playground = () => {
2
+ // logIdentifiers();
8
3
  };
package/lib/server.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import "./prototypesEnhancement.js";
2
+ export declare const logIdentifiers: () => void;
2
3
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,4BAA4B,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,4BAA4B,CAAC;AAOpC,eAAO,MAAM,cAAc,YAW1B,CAAC"}
package/lib/server.js CHANGED
@@ -11,6 +11,18 @@ const jsonParser = bodyParser.json();
11
11
  const mathExercises = Object.values(MathExercises);
12
12
  const pcExercises = Object.values(PCExercises);
13
13
  const allExercises = [...mathExercises, ...pcExercises];
14
+ export const logIdentifiers = () => {
15
+ const log = false;
16
+ if (!log)
17
+ return;
18
+ const shortname = "fractionsOperations";
19
+ const gen = mathExercises.find((el) => el.id === shortname);
20
+ const ids = '{"statementIdentifiers":{"id":1,"leftChild":{"id":3,"leftChild":{"id":7,"value":10},"rightChild":{"id":7,"value":3}},"rightChild":{"id":2,"leftChild":{"id":3,"leftChild":{"id":7,"value":1},"rightChild":{"id":7,"value":5}},"rightChild":{"id":3,"leftChild":{"id":7,"value":7},"rightChild":{"id":7,"value":5}}}}}';
21
+ const parsed = JSON.parse(ids);
22
+ console.log(parsed);
23
+ const question = gen.getQuestionFromIdentifiers(parsed);
24
+ console.log(question.instruction);
25
+ };
14
26
  const runServer = () => {
15
27
  dotenv.config();
16
28
  const app = express();
@@ -19,6 +31,7 @@ const runServer = () => {
19
31
  console.log("math hints", mathExercises.filter((exo) => exo.hasHintAndCorrection).length);
20
32
  console.log("pc exos", `${pcExercises.length}`);
21
33
  playground();
34
+ logIdentifiers();
22
35
  app.get("/", (req, res) => {
23
36
  res.json(allExercises);
24
37
  });
@@ -28,6 +41,9 @@ const runServer = () => {
28
41
  app.get("/xplive", (req, res) => {
29
42
  res.json(pcExercises);
30
43
  });
44
+ app.get("/question", (req, res) => {
45
+ const exoId = req.query.exoId;
46
+ });
31
47
  app.get("/exo", (req, res) => {
32
48
  const exoId = req.query.exoId;
33
49
  const options = req.query.options
@@ -1,8 +1,8 @@
1
- import { pointFromParametricLine, } from "../exercises/math/index.js";
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(pointFromParametricLine);
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;AAE9E,eAAO,MAAM,mBAAmB,QAAS,QAAQ,SAwGhD,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`, `${file}`);
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;;;CAkK7D,CAAC"}
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 { calculateFrequency, } from "../exercises/math/index.js";
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(calculateFrequency);
5
+ exoTest(factoType1Exercise);
6
6
  }
7
7
  catch (err) {
8
8
  throw err;
@@ -1,11 +1,11 @@
1
1
  import { AlgebraicNode } from "./algebraicNode.js";
2
2
  import { Node, NodeIds } from "./node.js";
3
- export declare const reifyAlgebraic: (identifiers: NodeIdentifiers) => AlgebraicNode;
3
+ export declare const reifyAlgebraic: (identifiers: NodeIdentifiers, log?: boolean) => AlgebraicNode;
4
4
  export declare const reifyNode: (identifiers: NodeIdentifiers) => Node;
5
5
  export type NodeIdentifiers = {
6
6
  id: NodeIds;
7
7
  } & Record<string, any>;
8
8
  export declare abstract class NodeConstructor {
9
- static fromIdentifiers(identifiers: NodeIdentifiers): Node;
9
+ static fromIdentifiers(identifiers: NodeIdentifiers, log?: boolean): Node;
10
10
  }
11
11
  //# sourceMappingURL=nodeConstructor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeConstructor.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/nodeConstructor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAwBnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoB1C,eAAO,MAAM,cAAc,gBAAiB,eAAe,KACT,aAAa,CAAC;AAChE,eAAO,MAAM,SAAS,gBAAiB,eAAe,SACR,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACpE,8BAAsB,eAAe;IACnC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,eAAe,GAAG,IAAI;CAoS3D"}
1
+ {"version":3,"file":"nodeConstructor.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/nodeConstructor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAwBnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoB1C,eAAO,MAAM,cAAc,gBAAiB,eAAe,QAAQ,OAAO,KACxB,aAAa,CAAC;AAChE,eAAO,MAAM,SAAS,gBAAiB,eAAe,SACR,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACpE,8BAAsB,eAAe;IACnC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI;CAqS1E"}
@@ -41,10 +41,11 @@ import { DiscreteSetNode } from "./sets/discreteSetNode.js";
41
41
  import { IntervalNode } from "./sets/intervalNode.js";
42
42
  import { UnionIntervalNode } from "./sets/unionIntervalNode.js";
43
43
  import { VariableNode } from "./variables/variableNode.js";
44
- export const reifyAlgebraic = (identifiers) => NodeConstructor.fromIdentifiers(identifiers);
44
+ export const reifyAlgebraic = (identifiers, log) => NodeConstructor.fromIdentifiers(identifiers);
45
45
  export const reifyNode = (identifiers) => NodeConstructor.fromIdentifiers(identifiers);
46
46
  export class NodeConstructor {
47
- static fromIdentifiers(identifiers) {
47
+ static fromIdentifiers(identifiers, log) {
48
+ log && console.log(identifiers.id);
48
49
  switch (identifiers.id) {
49
50
  case NodeIds.variable: {
50
51
  return new VariableNode(identifiers.name);
@@ -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;AAIlE,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
+ {"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, MinusInfinityNode, ClosureType.OO),
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.6",
4
+ "version": "3.0.8",
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"