math-exercises 3.0.194 → 3.0.195

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.
@@ -1 +1 @@
1
- {"version":3,"file":"buildDoubleTableFromContext.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC;CAClC,CAAC;AA0NF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAoB7D,CAAC"}
1
+ {"version":3,"file":"buildDoubleTableFromContext.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC;CAClC,CAAC;AAyOF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAoB7D,CAAC"}
@@ -49,10 +49,16 @@ const getAnswerTable = (identifiers) => {
49
49
  done = rightCoeffs.every((line) => line.every((a) => a !== undefined));
50
50
  }
51
51
  return [
52
- [" ", "Hommes", "Femmes", "Total"],
53
- ["Plus de $40$ ans", ...rightCoeffs[0].map((e) => e.frenchify())],
54
- ["Moins de $40$ ans", ...rightCoeffs[1].map((e) => e.frenchify())],
55
- ["Total", ...rightCoeffs[2].map((e) => e.frenchify())],
52
+ [" ", "\\text{Hommes}", "\\text{Femmes}", "\\text{Total}"],
53
+ [
54
+ "\\text{Plus de } 40 \\text{ ans}",
55
+ ...rightCoeffs[0].map((e) => e.frenchify()),
56
+ ],
57
+ [
58
+ "\\text{Moins de } 40 \\text{ ans}",
59
+ ...rightCoeffs[1].map((e) => e.frenchify()),
60
+ ],
61
+ ["\\text{Total}", ...rightCoeffs[2].map((e) => e.frenchify())],
56
62
  ];
57
63
  };
58
64
  const getInstruction = (identifiers) => {
@@ -97,7 +103,16 @@ Puis, détermine les cases manquantes en faisant des additions ou des soustracti
97
103
  const getCorrection = (identifiers) => {
98
104
  const { coeffs } = identifiers;
99
105
  const ansTable = getAnswerTable(identifiers);
100
- const dollarized = ansTable.map((e, i) => i === 0 ? e : [e[0], ...e.slice(1).map((e) => dollarize(e))]);
106
+ const dollarized = ansTable.map((e, i) => i === 0
107
+ ? [" ", "Hommes", "Femmes", "Total"]
108
+ : [
109
+ i === 1
110
+ ? "Plus de $40$ ans"
111
+ : i === 2
112
+ ? "Moins de $40$ ans"
113
+ : "Total",
114
+ ...e.slice(1).map((e) => dollarize(e)),
115
+ ]);
101
116
  return `On commence par remplir les cases que l'on peut déterminer grâce aux données de l'énoncé :
102
117
 
103
118
  ${mdTable([
@@ -189,10 +204,10 @@ const getQuestionFromIdentifiers = (identifiers) => {
189
204
  hint: getHint(identifiers),
190
205
  correction: getCorrection(identifiers),
191
206
  initTable: [
192
- [" ", "Hommes", "Femmes", "Total"],
193
- ["Plus de $40$ ans", "", "", ""],
194
- ["Moins de $40$ ans", "", "", ""],
195
- ["Total", "", "", ""],
207
+ [" ", "\\text{Hommes}", "\\text{Femmes}", "\\text{Total}"],
208
+ ["\\text{Plus de } 40 \\text{ ans}", "", "", ""],
209
+ ["\\text{Moins de } 40 \\text{ ans}", "", "", ""],
210
+ ["\\text{Total}", "", "", ""],
196
211
  ],
197
212
  style: {
198
213
  tableOptions: {
@@ -49,10 +49,10 @@ const getAnswerTable = (identifiers) => {
49
49
  done = rightCoeffs.every((line) => line.every((a) => a !== undefined));
50
50
  }
51
51
  return [
52
- [" ", "A", "A'", "Total"],
52
+ [" ", "A", "A'", "\\text{Total}"],
53
53
  ["B", ...rightCoeffs[0].map((e) => e.frenchify())],
54
54
  ["B'", ...rightCoeffs[1].map((e) => e.frenchify())],
55
- ["Total", ...rightCoeffs[2].map((e) => e.frenchify())],
55
+ ["\\text{Total} ", ...rightCoeffs[2].map((e) => e.frenchify())],
56
56
  ];
57
57
  };
58
58
  const getInstruction = (identifiers) => {
@@ -154,10 +154,10 @@ const getQuestionFromIdentifiers = (identifiers) => {
154
154
  hint: getHint(identifiers),
155
155
  correction: getCorrection(identifiers),
156
156
  initTable: [
157
- [" ", "A", "A'", "Total"],
157
+ [" ", "A", "A'", "\\text{Total}"],
158
158
  ["B", ...coeffs[0].map((e) => (e ? e.frenchify() : ""))],
159
159
  ["B'", ...coeffs[1].map((e) => (e ? e.frenchify() : ""))],
160
- ["Total", ...coeffs[2].map((e) => (e ? e.frenchify() : ""))],
160
+ ["\\text{Total}", ...coeffs[2].map((e) => (e ? e.frenchify() : ""))],
161
161
  ],
162
162
  style: {
163
163
  tableOptions: {
@@ -24,8 +24,8 @@ const getAnswerTable = (identifiers) => {
24
24
  const penteTree = pente.toTree();
25
25
  const deriv = penteTree.toTex();
26
26
  return [
27
- [`$f(${xA})$`, yA.frenchify()],
28
- [`$f'(${xA})$`, deriv],
27
+ [`f(${xA})`, yA.frenchify()],
28
+ [`f'(${xA})`, deriv],
29
29
  ];
30
30
  };
31
31
  const getGGBOptions = (identifiers) => {
@@ -124,8 +124,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
124
124
  hint: getHint(identifiers),
125
125
  correction: getCorrection(identifiers),
126
126
  initTable: [
127
- [`$f(${xA})$`, ""],
128
- [`$f'(${xA})$`, ""],
127
+ [`f(${xA})`, ""],
128
+ [`f'(${xA})`, ""],
129
129
  ],
130
130
  };
131
131
  return question;
@@ -18,19 +18,19 @@ const getAnswerTable = (identifiers) => {
18
18
  const pb = add(aNb, abarreNb).simplify();
19
19
  return [
20
20
  [
21
- "$\\ $",
21
+ "\\ ",
22
22
  `${situation.secondEvent}`,
23
23
  `\\overline{${situation.secondEvent}}`,
24
24
  "\\text{Total}",
25
25
  ],
26
26
  [
27
- `$${situation.mainEvent}$`,
27
+ `${situation.mainEvent}`,
28
28
  `${aNb.toTex()}`,
29
29
  `${substract(mainEventProbaDec, aNb).simplify().toTex()}`,
30
30
  `${mainEventProbaDec.frenchify()}`,
31
31
  ],
32
32
  [
33
- `$\\overline{${situation.mainEvent}}$`,
33
+ `\\overline{${situation.mainEvent}}`,
34
34
  `${abarreNb.toTex()}`,
35
35
  `${substract(1 - mainEventProbaDec, abarreNb)
36
36
  .simplify()
@@ -197,13 +197,13 @@ const getQuestionFromIdentifiers = (identifiers) => {
197
197
  correction: getCorrection(identifiers),
198
198
  initTable: [
199
199
  [
200
- "$\\ $",
200
+ "\\ ",
201
201
  `${situation.secondEvent}`,
202
202
  `\\overline{${situation.secondEvent}}`,
203
203
  "\\text{Total}",
204
204
  ],
205
- [`$${situation.mainEvent}$`, "", "", ""],
206
- [`$\\overline{${situation.mainEvent}}$`, "", "", ""],
205
+ [`${situation.mainEvent}`, "", "", ""],
206
+ [`\\overline{${situation.mainEvent}}`, "", "", ""],
207
207
  ["\\text{Total}", "", "", "1"],
208
208
  ],
209
209
  };
@@ -132,8 +132,8 @@ const getRandomVariableSituationValuesQuestion = () => {
132
132
  const identifiers = {
133
133
  params,
134
134
  initTable: [
135
- [`$x_i$`, ...values.map((_e) => "")],
136
- [`$P(X=x_i)$`, ...values.map((_e) => "")],
135
+ [`x_i`, ...values.map((_e) => "")],
136
+ [`P(X=x_i)`, ...values.map((_e) => "")],
137
137
  ],
138
138
  };
139
139
  return getQuestionFromIdentifiers(identifiers);
@@ -49,8 +49,8 @@ export class RandomVariable {
49
49
  }
50
50
  getLawTable() {
51
51
  return [
52
- ["$x_i$", ...this.xValues.map((x) => `${x.toTex()}`)],
53
- ["$P(X = x_i)$", ...this.yValues.map((x) => `${x.toTex()}`)],
52
+ ["x_i", ...this.xValues.map((x) => `${x.toTex()}`)],
53
+ ["P(X = x_i)", ...this.yValues.map((x) => `${x.toTex()}`)],
54
54
  ];
55
55
  }
56
56
  getAverage() {
@@ -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;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CAgU3B,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;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CAqU3B,CAAC"}
@@ -110,7 +110,7 @@ export const questionTest = (exo, question) => {
110
110
  if (cell.includes("[object Object]"))
111
111
  throw new Error(`exo ${exo.id} has invalid answer`);
112
112
  if (question.answerFormat !== "raw") {
113
- if (!latexTester(cell, j === 0 ? false : true))
113
+ if (!latexTester(cell, exo.answerType === "valueTable" ? true : j === 0 ? false : true))
114
114
  throw new Error(`exo ${exo.id} has invalid answer`);
115
115
  }
116
116
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.194",
4
+ "version": "3.0.195",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [