math-exercises 2.2.53 → 2.2.54

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":"findCoeffInProportionalTableNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkHF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAAC,WAAW,CAoBzE,CAAC"}
1
+ {"version":3,"file":"findCoeffInProportionalTableNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkIF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAAC,WAAW,CAoBzE,CAAC"}
@@ -10,6 +10,7 @@ const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
10
10
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
11
11
  const latexParser_1 = require("../../../../tree/parsers/latexParser");
12
12
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
13
+ const doWhile_1 = require("../../../../utils/doWhile");
13
14
  const dollarize_1 = require("../../../../utils/latex/dollarize");
14
15
  const mdTable_1 = require("../../../../utils/markdown/mdTable");
15
16
  const getPropositions = (n, { answer, type }) => {
@@ -63,28 +64,36 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
63
64
  case 1:
64
65
  //coeff entier, valeurs décimal/frac
65
66
  coeff = (0, randint_1.randint)(2, 10).toTree();
66
- xValues = [0, 1, 2]
67
- .map((e) => (0, coinFlip_1.coinFlip)()
68
- ? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
69
- : rational_1.RationalConstructor.randomIrreductible().toTree())
70
- .sort((a, b) => a.evaluate() - b.evaluate());
67
+ for (let i = 0; i < 3; i++) {
68
+ let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
69
+ ? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
70
+ : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
71
+ xValues.push(x);
72
+ }
73
+ xValues.sort((a, b) => a.evaluate() - b.evaluate());
71
74
  break;
72
75
  case 2:
73
76
  //coeff décimal, valeurs entieres/décimal
74
77
  coeff = (0, randfloat_1.randfloat)(1.1, 10, 1).toTree();
75
- xValues = [0, 1, 2]
76
- .map((e) => (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(1, 10).toTree() : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree())
77
- .sort((a, b) => a.evaluate() - b.evaluate());
78
+ for (let i = 0; i < 3; i++) {
79
+ let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
80
+ ? (0, randint_1.randint)(1, 10).toTree()
81
+ : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => y.equals(x));
82
+ xValues.push(x);
83
+ }
84
+ xValues.sort((a, b) => a.evaluate() - b.evaluate());
78
85
  break;
79
86
  case 3:
80
87
  //coeff frac, valeurs frac / entieres
81
88
  default:
82
89
  coeff = rational_1.RationalConstructor.randomPureRational().toTree();
83
- xValues = [0, 1, 2]
84
- .map((e) => (0, coinFlip_1.coinFlip)()
85
- ? (0, randint_1.randint)(1, 10).toTree()
86
- : rational_1.RationalConstructor.randomIrreductible().toTree())
87
- .sort((a, b) => a.evaluate() - b.evaluate());
90
+ for (let i = 0; i < 3; i++) {
91
+ let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
92
+ ? (0, randint_1.randint)(1, 10).toTree()
93
+ : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
94
+ xValues.push(x);
95
+ }
96
+ xValues.sort((a, b) => a.evaluate() - b.evaluate());
88
97
  }
89
98
  const yValues = xValues.map((x) => (0, multiplyNode_1.multiply)(x, coeff).simplify());
90
99
  const identifiers = {
@@ -101,6 +110,9 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
101
110
  identifiers,
102
111
  // hint: getHint(identifiers),
103
112
  // correction: getCorrection(identifiers),
113
+ style: {
114
+ tableHasNoHeader: true,
115
+ },
104
116
  };
105
117
  return question;
106
118
  };
@@ -1 +1 @@
1
- {"version":3,"file":"isTableProportionalNonInteger.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportionalNonInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwGF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAgB/D,CAAC"}
1
+ {"version":3,"file":"isTableProportionalNonInteger.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportionalNonInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA0HF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAgB/D,CAAC"}
@@ -11,14 +11,15 @@ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
11
11
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
12
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
13
13
  const random_1 = require("../../../../utils/alea/random");
14
+ const doWhile_1 = require("../../../../utils/doWhile");
14
15
  const dollarize_1 = require("../../../../utils/latex/dollarize");
15
16
  const mdTable_1 = require("../../../../utils/markdown/mdTable");
16
17
  const getPropositions = (n, { answer }) => {
17
18
  const propositions = [];
18
- (0, exercise_1.addValidProp)(propositions, answer);
19
- (0, exercise_1.tryToAddWrongProp)(propositions, "Non");
20
- (0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir");
21
- (0, exercise_1.tryToAddWrongProp)(propositions, "Oui");
19
+ (0, exercise_1.addValidProp)(propositions, answer, "raw");
20
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Non", "raw");
21
+ (0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir", "raw");
22
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Oui", "raw");
22
23
  return (0, exercise_1.shuffleProps)(propositions, n);
23
24
  };
24
25
  const getAnswer = (identifiers) => {
@@ -51,28 +52,36 @@ const getIsTableProportionalNonIntegerQuestion = () => {
51
52
  case 1:
52
53
  //coeff entier, valeurs décimal/frac
53
54
  coeff = (0, randint_1.randint)(2, 10).toTree();
54
- xValues = [0, 1, 2]
55
- .map((e) => (0, coinFlip_1.coinFlip)()
56
- ? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
57
- : rational_1.RationalConstructor.randomIrreductible().toTree())
58
- .sort((a, b) => a.evaluate() - b.evaluate());
55
+ for (let i = 0; i < 3; i++) {
56
+ let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
57
+ ? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
58
+ : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
59
+ xValues.push(x);
60
+ }
61
+ xValues.sort((a, b) => a.evaluate() - b.evaluate());
59
62
  break;
60
63
  case 2:
61
64
  //coeff décimal, valeurs entieres/décimal
62
65
  coeff = (0, randfloat_1.randfloat)(1.1, 10, 1).toTree();
63
- xValues = [0, 1, 2]
64
- .map((e) => (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(1, 10).toTree() : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree())
65
- .sort((a, b) => a.evaluate() - b.evaluate());
66
+ for (let i = 0; i < 3; i++) {
67
+ let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
68
+ ? (0, randint_1.randint)(1, 10).toTree()
69
+ : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => y.equals(x));
70
+ xValues.push(x);
71
+ }
72
+ xValues.sort((a, b) => a.evaluate() - b.evaluate());
66
73
  break;
67
74
  case 3:
68
75
  //coeff frac, valeurs frac / entieres
69
76
  default:
70
77
  coeff = rational_1.RationalConstructor.randomPureRational().toTree();
71
- xValues = [0, 1, 2]
72
- .map((e) => (0, coinFlip_1.coinFlip)()
73
- ? (0, randint_1.randint)(1, 10).toTree()
74
- : rational_1.RationalConstructor.randomIrreductible().toTree())
75
- .sort((a, b) => a.evaluate() - b.evaluate());
78
+ for (let i = 0; i < 3; i++) {
79
+ let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
80
+ ? (0, randint_1.randint)(1, 10).toTree()
81
+ : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
82
+ xValues.push(x);
83
+ }
84
+ xValues.sort((a, b) => a.evaluate() - b.evaluate());
76
85
  }
77
86
  const yValues = isProportionnal
78
87
  ? xValues.map((x) => (0, multiplyNode_1.multiply)(x, coeff).simplify())
@@ -88,10 +97,13 @@ const getIsTableProportionalNonIntegerQuestion = () => {
88
97
  answer: getAnswer(identifiers),
89
98
  instruction: getInstruction(identifiers),
90
99
  keys: getKeys(identifiers),
91
- answerFormat: "tex",
100
+ answerFormat: "raw",
92
101
  identifiers,
93
102
  // hint: getHint(identifiers),
94
103
  // correction: getCorrection(identifiers),
104
+ style: {
105
+ tableHasNoHeader: true,
106
+ },
95
107
  };
96
108
  return question;
97
109
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.2.53",
3
+ "version": "2.2.54",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [