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.
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +25 -13
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +30 -18
- package/package.json +1 -1
package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js
CHANGED
|
@@ -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
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
.
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.
|
|
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;
|
|
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
|
-
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
72
|
-
.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
.
|
|
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: "
|
|
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
|
};
|