math-exercises 2.2.25 → 2.2.26

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":"operationsPrioritiesParenthesis.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesParenthesis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkHF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAcjE,CAAC"}
1
+ {"version":3,"file":"operationsPrioritiesParenthesis.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesParenthesis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAsHF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAcjE,CAAC"}
@@ -18,7 +18,7 @@ const getOperationsPrioritiesParenthesisQuestion = () => {
18
18
  case 1: //a*(b+-c)
19
19
  a = (0, randint_1.randint)(-10, 11, [0, 1, -1]);
20
20
  [b, c] = [1, 2].map((el) => (0, randint_1.randint)(-10, 11, [0]));
21
- statement = new multiplyNode_1.MultiplyNode(a.toTree(), new addNode_1.AddNode(b.toTree(), c.toTree()));
21
+ statement = new multiplyNode_1.MultiplyNode(a.toTree(), new addNode_1.AddNode(b.toTree(), c.toTree()), { forceTimesSign: true });
22
22
  statement.shuffle();
23
23
  answer = (a * (b + c)).frenchify();
24
24
  break;
@@ -45,7 +45,7 @@ const getOperationsPrioritiesParenthesisQuestion = () => {
45
45
  if ((0, coinFlip_1.coinFlip)()) {
46
46
  //(a+-b)*(c+-d)
47
47
  [a, b, c, d] = [1, 2, 3, 4].map((el) => (0, randint_1.randint)(-10, 11, [0]));
48
- statement = new multiplyNode_1.MultiplyNode(new addNode_1.AddNode(a.toTree(), b.toTree()), new addNode_1.AddNode(c.toTree(), d.toTree()));
48
+ statement = new multiplyNode_1.MultiplyNode(new addNode_1.AddNode(a.toTree(), b.toTree()), new addNode_1.AddNode(c.toTree(), d.toTree()), { forceTimesSign: true });
49
49
  answer = ((a + b) * (c + d)).frenchify();
50
50
  }
51
51
  else {
@@ -71,7 +71,9 @@ const getOperationsPrioritiesParenthesisQuestion = () => {
71
71
  else
72
72
  c = (0, randint_1.randint)(-10, 11, [0]);
73
73
  const isAdd2 = (0, coinFlip_1.coinFlip)();
74
- statement = new (isAdd ? addNode_1.AddNode : substractNode_1.SubstractNode)(a.toTree(), new (isAdd2 ? addNode_1.AddNode : substractNode_1.SubstractNode)(b.toTree(), new (isDivide ? divideNode_1.DivideNode : multiplyNode_1.MultiplyNode)(c.toTree(), d.toTree()), { forceParenthesis: isAdd }));
74
+ statement = new (isAdd ? addNode_1.AddNode : substractNode_1.SubstractNode)(a.toTree(), new (isAdd2 ? addNode_1.AddNode : substractNode_1.SubstractNode)(b.toTree(), new (isDivide ? divideNode_1.DivideNode : multiplyNode_1.MultiplyNode)(c.toTree(), d.toTree(), {
75
+ forceTimesSign: true,
76
+ }), { forceParenthesis: isAdd }));
75
77
  answer = statement.evaluate({}).toString();
76
78
  break;
77
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"usualderivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/usualderivative.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAMT,MAAM,mBAAmB,CAAC;AAuB3B,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AA0FF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAqBjD,CAAC"}
1
+ {"version":3,"file":"usualderivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/usualderivative.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAMT,MAAM,mBAAmB,CAAC;AAuB3B,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AA4FF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAqBjD,CAAC"}
@@ -26,6 +26,8 @@ const getUsualDerivative = () => {
26
26
  break;
27
27
  case 4:
28
28
  question = (0, constanteDerivative_1.getConstanteDerivative)();
29
+ question.hint = undefined;
30
+ question.correction = undefined;
29
31
  identifiers = { ...question.identifiers, type: 4 };
30
32
  break;
31
33
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"circleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/circleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAyCF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAa5C,CAAC"}
1
+ {"version":3,"file":"circleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/circleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAwCF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAa5C,CAAC"}
@@ -95,7 +95,7 @@ ${(0, alignTex_1.alignTex)([
95
95
  pB = (0, randint_1.randint)(2, 100);
96
96
  pBStr = (pB / 100).frenchify();
97
97
  pA_B = (0, randint_1.randint)(1, pB);
98
- pA_BStr = pA_B.frenchify();
98
+ pA_BStr = (pA_B / 100).frenchify();
99
99
  pAB = (0, round_1.round)((pA_B * pB) / 10000, 2);
100
100
  pABStr = pAB.frenchify();
101
101
  instruction += `$P(B) = ${pBStr}\\ $ et $\\ P_B(A) = ${pA_BStr}$.$\\\\$Déterminer $P(A \\cap B)$ (arrondir au centième).`;
@@ -1 +1 @@
1
- {"version":3,"file":"setBelonging.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/setBelonging.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAuEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAa9C,CAAC"}
1
+ {"version":3,"file":"setBelonging.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sets/setBelonging.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA8EF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAc9C,CAAC"}
@@ -8,6 +8,13 @@ const rational_1 = require("../../../math/numbers/rationals/rational");
8
8
  const randint_1 = require("../../../math/utils/random/randint");
9
9
  const random_1 = require("../../../utils/random");
10
10
  const shuffle_1 = require("../../../utils/shuffle");
11
+ const getAnswer = (identifiers) => {
12
+ const sets = ["N", "Z", "D", "Q", "R"];
13
+ if (identifiers.type > -1) {
14
+ return `\\mathbb{${sets[identifiers.type]}}`;
15
+ }
16
+ return "";
17
+ };
11
18
  const getSetBelongingQuestion = () => {
12
19
  //N Z D Q R (racine2, pi)
13
20
  //fraction simplifiable en décimal/entier
@@ -27,7 +34,7 @@ const getSetBelongingQuestion = () => {
27
34
  break;
28
35
  case 2:
29
36
  nb = decimal_1.DecimalConstructor.random(-50, 50, (0, randint_1.randint)(1, 4)).toTree().toTex();
30
- answer = "\\mathrm{D}";
37
+ answer = "\\mathbb{D}";
31
38
  break;
32
39
  case 3:
33
40
  nb = rational_1.RationalConstructor.randomIrreductible().toTree().toTex();
@@ -67,7 +74,7 @@ const getPropositions = (n, { answer }) => {
67
74
  return (0, shuffle_1.shuffle)(propositions);
68
75
  };
69
76
  const isAnswerValid = (ans, { answer }) => {
70
- return [answer, answer.replace("mathbb", "mathrm")].includes(ans);
77
+ return [answer].includes(ans);
71
78
  };
72
79
  exports.setBelonging = {
73
80
  id: "setBelonging",
@@ -82,4 +89,5 @@ exports.setBelonging = {
82
89
  getPropositions,
83
90
  isAnswerValid,
84
91
  subject: "Mathématiques",
92
+ getAnswer,
85
93
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.2.25",
3
+ "version": "2.2.26",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [