math-exercises 2.0.38 → 2.0.40
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/conversion/hoursToDecimal.d.ts +8 -0
- package/lib/exercises/conversion/hoursToDecimal.d.ts.map +1 -0
- package/lib/exercises/conversion/hoursToDecimal.js +72 -0
- package/lib/exercises/conversion/index.d.ts +1 -0
- package/lib/exercises/conversion/index.d.ts.map +1 -1
- package/lib/exercises/conversion/index.js +1 -0
- package/lib/exercises/functions/index.d.ts +1 -0
- package/lib/exercises/functions/index.d.ts.map +1 -1
- package/lib/exercises/functions/index.js +1 -0
- package/lib/exercises/functions/parity/index.d.ts +3 -0
- package/lib/exercises/functions/parity/index.d.ts.map +1 -0
- package/lib/exercises/functions/parity/index.js +18 -0
- package/lib/exercises/functions/parity/parityFromAlgebra.d.ts +8 -0
- package/lib/exercises/functions/parity/parityFromAlgebra.d.ts.map +1 -0
- package/lib/exercises/functions/parity/parityFromAlgebra.js +117 -0
- package/lib/exercises/functions/parity/parityFromGraph.d.ts +8 -0
- package/lib/exercises/functions/parity/parityFromGraph.d.ts.map +1 -0
- package/lib/exercises/functions/parity/parityFromGraph.js +128 -0
- package/lib/exercises/percent/index.d.ts +2 -0
- package/lib/exercises/percent/index.d.ts.map +1 -1
- package/lib/exercises/percent/index.js +2 -0
- package/lib/exercises/percent/percentToDecimal.d.ts +8 -0
- package/lib/exercises/percent/percentToDecimal.d.ts.map +1 -0
- package/lib/exercises/percent/percentToDecimal.js +69 -0
- package/lib/exercises/percent/valuePercent.d.ts +8 -0
- package/lib/exercises/percent/valuePercent.d.ts.map +1 -0
- package/lib/exercises/percent/valuePercent.js +45 -0
- package/lib/index.d.ts +98 -81
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/math/numbers/decimals/decimal.d.ts +2 -0
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +4 -0
- package/lib/math/polynomials/polynomial.d.ts.map +1 -1
- package/lib/math/polynomials/polynomial.js +11 -0
- package/lib/math/polynomials/rationalFrac.d.ts.map +1 -1
- package/lib/math/polynomials/rationalFrac.js +13 -0
- package/lib/server.d.ts +1 -0
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +5 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/lib/utils/probaLawFlip.d.ts +5 -0
- package/lib/utils/probaLawFlip.d.ts.map +1 -1
- package/lib/utils/probaLawFlip.js +6 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hoursToDecimal.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/hoursToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAwEF,eAAO,MAAM,cAAc,EAAE,YAAY,CAAC,WAAW,CAapD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hoursToDecimal = void 0;
|
|
4
|
+
const exercise_1 = require("../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const decimal_1 = require("../../math/numbers/decimals/decimal");
|
|
7
|
+
const randint_1 = require("../../math/utils/random/randint");
|
|
8
|
+
const round_1 = require("../../math/utils/round");
|
|
9
|
+
const coinFlip_1 = require("../../utils/coinFlip");
|
|
10
|
+
const getHoursToDecimalQuestion = () => {
|
|
11
|
+
const isDecimalToHours = (0, coinFlip_1.coinFlip)();
|
|
12
|
+
const dec = decimal_1.DecimalConstructor.random(0, 3, 2);
|
|
13
|
+
const hours = Math.floor(dec.value);
|
|
14
|
+
const mins = (0, round_1.round)((dec.value - hours) * 100 * 0.6, 0);
|
|
15
|
+
const decTex = dec.toTree().toTex();
|
|
16
|
+
const durationTex = isDecimalToHours
|
|
17
|
+
? decTex + "\\text{h}"
|
|
18
|
+
: `${hours}\\text{h}${mins}\\text{min}`;
|
|
19
|
+
const answer = isDecimalToHours
|
|
20
|
+
? `${hours}\\text{h}${mins}\\text{min}`
|
|
21
|
+
: `${hours},${(0, round_1.round)((mins / 60) * 100, 0)}\\text{h}`;
|
|
22
|
+
const question = {
|
|
23
|
+
answer,
|
|
24
|
+
instruction: `Convertir la durée suivante en ${isDecimalToHours ? "heures et minutes" : "nombre décimal"} : $${durationTex}$ (arrondir ${isDecimalToHours ? "à la minute près" : "au centième près"})`,
|
|
25
|
+
keys: ["hours", "minutes"],
|
|
26
|
+
answerFormat: "tex",
|
|
27
|
+
identifiers: { isDecimalToHours, dec: dec.value },
|
|
28
|
+
};
|
|
29
|
+
return question;
|
|
30
|
+
};
|
|
31
|
+
const getPropositions = (n, { answer, isDecimalToHours, dec }) => {
|
|
32
|
+
const propositions = [];
|
|
33
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
34
|
+
const hours = Math.floor(dec);
|
|
35
|
+
const mins = (0, round_1.round)((dec - hours) * 0.6 * 100, 0);
|
|
36
|
+
if (isDecimalToHours) {
|
|
37
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `${hours}\\text{h}${(0, round_1.round)((dec - hours) * 100, 0)}\\text{min}`);
|
|
38
|
+
while (propositions.length < n) {
|
|
39
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `${hours}\\text{h}${(0, randint_1.randint)(1, 100)}\\text{min}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `${hours},${mins}\\text{h}`);
|
|
44
|
+
while (propositions.length < n) {
|
|
45
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, decimal_1.DecimalConstructor.random(hours, hours + 1, 2)
|
|
46
|
+
.toTree()
|
|
47
|
+
.toTex() + "\\text{h}");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
51
|
+
};
|
|
52
|
+
const isAnswerValid = (ans, { answer, isDecimalToHours, dec }) => {
|
|
53
|
+
if (isDecimalToHours)
|
|
54
|
+
return ans === answer;
|
|
55
|
+
// const hours = Math.floor(dec);
|
|
56
|
+
// const mins = round((dec - hours) * 100 * 0.6, 0);
|
|
57
|
+
const texs = [answer, answer.replace("\\text{h}", "")];
|
|
58
|
+
return texs.includes(ans);
|
|
59
|
+
};
|
|
60
|
+
exports.hoursToDecimal = {
|
|
61
|
+
id: "hoursToDecimal",
|
|
62
|
+
connector: "=",
|
|
63
|
+
label: "Convertir une durée en nombre décimal et inversement",
|
|
64
|
+
levels: ["2nde", "2ndPro", "3ème"],
|
|
65
|
+
isSingleStep: true,
|
|
66
|
+
sections: ["Conversions"],
|
|
67
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getHoursToDecimalQuestion, nb),
|
|
68
|
+
qcmTimer: 60,
|
|
69
|
+
freeTimer: 60,
|
|
70
|
+
getPropositions,
|
|
71
|
+
isAnswerValid,
|
|
72
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
|
@@ -20,3 +20,4 @@ __exportStar(require("./lengthConversion"), exports);
|
|
|
20
20
|
__exportStar(require("./massConversion"), exports);
|
|
21
21
|
__exportStar(require("./volumeCapacityConversion"), exports);
|
|
22
22
|
__exportStar(require("./volumeConversion"), exports);
|
|
23
|
+
__exportStar(require("./hoursToDecimal"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/parity/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./parityFromAlgebra"), exports);
|
|
18
|
+
__exportStar(require("./parityFromGraph"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parityFromAlgebra.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/parity/parityFromAlgebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAoGF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,WAAW,CAavD,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parityFromAlgebra = void 0;
|
|
4
|
+
const exercise_1 = require("../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const affine_1 = require("../../../math/polynomials/affine");
|
|
7
|
+
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
8
|
+
const rationalFrac_1 = require("../../../math/polynomials/rationalFrac");
|
|
9
|
+
const trinom_1 = require("../../../math/polynomials/trinom");
|
|
10
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
11
|
+
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
12
|
+
const doWhile_1 = require("../../../utils/doWhile");
|
|
13
|
+
const probaFlip_1 = require("../../../utils/probaFlip");
|
|
14
|
+
const probaLawFlip_1 = require("../../../utils/probaLawFlip");
|
|
15
|
+
const getParityFromAlgebraQuestion = () => {
|
|
16
|
+
//paires : ax^2 + b , frac ratio trinom/tirnom
|
|
17
|
+
//impaires : linéaires, ax^3, linéaire/trinom
|
|
18
|
+
// ni l'un ni l'autre : affines, trinomes avec ax, x^3 + b
|
|
19
|
+
const type = (0, probaLawFlip_1.probaLawFlip)([
|
|
20
|
+
["even", 0.33],
|
|
21
|
+
["uneven", 0.33],
|
|
22
|
+
["neither", 0.33],
|
|
23
|
+
]);
|
|
24
|
+
let fct;
|
|
25
|
+
let answer = "";
|
|
26
|
+
switch (type) {
|
|
27
|
+
case "even":
|
|
28
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
29
|
+
fct = new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), 0, (0, randint_1.randint)(-9, 10))
|
|
30
|
+
.toTree()
|
|
31
|
+
.toTex();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
let num = new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), 0, (0, randint_1.randint)(-9, 10));
|
|
35
|
+
let denum = (0, doWhile_1.doWhile)(() => new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), 0, (0, randint_1.randint)(-9, 10)), (P) => (num.c === 0 ? P.c !== 0 : P.a / num.a === P.c / num.c));
|
|
36
|
+
fct = new rationalFrac_1.RationalFrac(num, denum).toTree().toTex();
|
|
37
|
+
}
|
|
38
|
+
answer = "Paire";
|
|
39
|
+
break;
|
|
40
|
+
case "uneven":
|
|
41
|
+
if ((0, probaFlip_1.probaFlip)(0.33)) {
|
|
42
|
+
fct = new affine_1.Affine((0, randint_1.randint)(-10, 11, [0]), 0).toTree().toTex();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
46
|
+
fct = new polynomial_1.Polynomial([0, (0, randint_1.randint)(-10, 11), 0, (0, randint_1.randint)(-10, 11, [0])])
|
|
47
|
+
.toTree()
|
|
48
|
+
.toTex();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
let num = new affine_1.Affine((0, randint_1.randint)(-9, 10, [0]), 0);
|
|
52
|
+
let denum = new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), 0, (0, randint_1.randint)(-9, 10, [0]));
|
|
53
|
+
fct = new rationalFrac_1.RationalFrac(num, denum).toTree().toTex();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
answer = "Impaire";
|
|
57
|
+
break;
|
|
58
|
+
case "neither":
|
|
59
|
+
if ((0, probaFlip_1.probaFlip)(0.33)) {
|
|
60
|
+
fct = new affine_1.Affine((0, randint_1.randint)(-9, 10, [0]), (0, randint_1.randint)(-9, 10, [0]))
|
|
61
|
+
.toTree()
|
|
62
|
+
.toTex();
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
66
|
+
fct = new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), (0, randint_1.randint)(-9, 10, [0]), (0, randint_1.randint)(-9, 10))
|
|
67
|
+
.toTree()
|
|
68
|
+
.toTex();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
fct = new polynomial_1.Polynomial([
|
|
72
|
+
(0, randint_1.randint)(-9, 10),
|
|
73
|
+
(0, randint_1.randint)(-9, 10),
|
|
74
|
+
(0, randint_1.randint)(-9, 10, [0]),
|
|
75
|
+
(0, randint_1.randint)(-9, 10, [0]),
|
|
76
|
+
])
|
|
77
|
+
.toTree()
|
|
78
|
+
.toTex();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
answer = "Ni paire, ni impaire";
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
const question = {
|
|
85
|
+
answer,
|
|
86
|
+
instruction: `Soit $f(x) = ${fct}$. La fonction $f$ est-elle paire, impaire, ou ni paire ni impaire ?`,
|
|
87
|
+
keys: [],
|
|
88
|
+
answerFormat: "tex",
|
|
89
|
+
identifiers: { type, fctTex: fct },
|
|
90
|
+
};
|
|
91
|
+
return question;
|
|
92
|
+
};
|
|
93
|
+
const getPropositions = (n, { answer }) => {
|
|
94
|
+
const propositions = [];
|
|
95
|
+
(0, exercise_1.addValidProp)(propositions, answer, "raw");
|
|
96
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Paire", "raw");
|
|
97
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Impaire", "raw");
|
|
98
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Ni paire ni impaire", "raw");
|
|
99
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir", "raw");
|
|
100
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
101
|
+
};
|
|
102
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
103
|
+
return ans === answer;
|
|
104
|
+
};
|
|
105
|
+
exports.parityFromAlgebra = {
|
|
106
|
+
id: "parityFromAlgebra",
|
|
107
|
+
label: "Déterminer algébriquement la parité d'une fonction",
|
|
108
|
+
levels: ["2nde"],
|
|
109
|
+
isSingleStep: true,
|
|
110
|
+
sections: ["Fonctions"],
|
|
111
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getParityFromAlgebraQuestion, nb),
|
|
112
|
+
qcmTimer: 60,
|
|
113
|
+
freeTimer: 60,
|
|
114
|
+
getPropositions,
|
|
115
|
+
isAnswerValid,
|
|
116
|
+
answerType: "QCM",
|
|
117
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parityFromGraph.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/parity/parityFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA4GF,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,WAAW,CAcrD,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parityFromGraph = void 0;
|
|
4
|
+
const exercise_1 = require("../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const colors_1 = require("../../../geogebra/colors");
|
|
7
|
+
const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
|
|
8
|
+
const affine_1 = require("../../../math/polynomials/affine");
|
|
9
|
+
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
10
|
+
const rationalFrac_1 = require("../../../math/polynomials/rationalFrac");
|
|
11
|
+
const trinom_1 = require("../../../math/polynomials/trinom");
|
|
12
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
13
|
+
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
14
|
+
const doWhile_1 = require("../../../utils/doWhile");
|
|
15
|
+
const probaFlip_1 = require("../../../utils/probaFlip");
|
|
16
|
+
const probaLawFlip_1 = require("../../../utils/probaLawFlip");
|
|
17
|
+
const getParityFromGraphQuestion = () => {
|
|
18
|
+
//paires : ax^2 + b , frac ratio trinom/tirnom
|
|
19
|
+
//impaires : linéaires, ax^3, linéaire/trinom
|
|
20
|
+
// ni l'un ni l'autre : affines, trinomes avec ax, x^3 + b
|
|
21
|
+
const type = (0, probaLawFlip_1.probaLawFlip)([
|
|
22
|
+
["even", 0.33],
|
|
23
|
+
["uneven", 0.33],
|
|
24
|
+
["neither", 0.33],
|
|
25
|
+
]);
|
|
26
|
+
let fct;
|
|
27
|
+
let answer = "";
|
|
28
|
+
switch (type) {
|
|
29
|
+
case "even":
|
|
30
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
31
|
+
fct = new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), 0, (0, randint_1.randint)(-9, 10))
|
|
32
|
+
.toTree()
|
|
33
|
+
.toMathString();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
let num = new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), 0, (0, randint_1.randint)(-9, 10));
|
|
37
|
+
let denum = (0, doWhile_1.doWhile)(() => new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), 0, (0, randint_1.randint)(-9, 10)), (P) => (num.c === 0 ? P.c !== 0 : P.a / num.a === P.c / num.c));
|
|
38
|
+
fct = new rationalFrac_1.RationalFrac(num, denum).toTree().toMathString();
|
|
39
|
+
}
|
|
40
|
+
answer = "Paire";
|
|
41
|
+
break;
|
|
42
|
+
case "uneven":
|
|
43
|
+
if ((0, probaFlip_1.probaFlip)(0.33)) {
|
|
44
|
+
fct = new affine_1.Affine((0, randint_1.randint)(-10, 11, [0]), 0).toTree().toMathString();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
48
|
+
fct = new polynomial_1.Polynomial([0, (0, randint_1.randint)(-10, 11), 0, (0, randint_1.randint)(-10, 11, [0])])
|
|
49
|
+
.toTree()
|
|
50
|
+
.toMathString();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
let num = new affine_1.Affine((0, randint_1.randint)(-9, 10, [0]), 0);
|
|
54
|
+
let denum = new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), 0, (0, randint_1.randint)(-9, 10, [0]));
|
|
55
|
+
fct = new rationalFrac_1.RationalFrac(num, denum).toTree().toMathString();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
answer = "Impaire";
|
|
59
|
+
break;
|
|
60
|
+
case "neither":
|
|
61
|
+
if ((0, probaFlip_1.probaFlip)(0.33)) {
|
|
62
|
+
fct = new affine_1.Affine((0, randint_1.randint)(-9, 10, [0]), (0, randint_1.randint)(-9, 10, [0]))
|
|
63
|
+
.toTree()
|
|
64
|
+
.toMathString();
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
68
|
+
fct = new trinom_1.Trinom((0, randint_1.randint)(-9, 10, [0]), (0, randint_1.randint)(-9, 10, [0]), (0, randint_1.randint)(-9, 10))
|
|
69
|
+
.toTree()
|
|
70
|
+
.toMathString();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
fct = new polynomial_1.Polynomial([
|
|
74
|
+
(0, randint_1.randint)(-9, 10),
|
|
75
|
+
(0, randint_1.randint)(-9, 10),
|
|
76
|
+
(0, randint_1.randint)(-9, 10, [0]),
|
|
77
|
+
(0, randint_1.randint)(-9, 10, [0]),
|
|
78
|
+
])
|
|
79
|
+
.toTree()
|
|
80
|
+
.toMathString();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
answer = "Ni paire, ni impaire";
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
const commands = [`f(x) = ${fct}`, `SetColor(f, "${(0, colors_1.randomColor)()}")`];
|
|
87
|
+
const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
|
|
88
|
+
isGridSimple: true,
|
|
89
|
+
isAxesRatioFixed: false,
|
|
90
|
+
});
|
|
91
|
+
const question = {
|
|
92
|
+
answer,
|
|
93
|
+
instruction: `La fonction $f$ représentée ci-dessous est-elle paire, impaire, ou ni paire ni impaire ?`,
|
|
94
|
+
keys: [],
|
|
95
|
+
options: ggb.getOptions(),
|
|
96
|
+
commands: ggb.commands,
|
|
97
|
+
coords: [-10, 10, -10, 10],
|
|
98
|
+
answerFormat: "tex",
|
|
99
|
+
identifiers: { type, fctCmd: fct },
|
|
100
|
+
};
|
|
101
|
+
return question;
|
|
102
|
+
};
|
|
103
|
+
const getPropositions = (n, { answer }) => {
|
|
104
|
+
const propositions = [];
|
|
105
|
+
(0, exercise_1.addValidProp)(propositions, answer, "raw");
|
|
106
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Paire", "raw");
|
|
107
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Impaire", "raw");
|
|
108
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Ni paire ni impaire", "raw");
|
|
109
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir", "raw");
|
|
110
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
111
|
+
};
|
|
112
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
113
|
+
return ans === answer;
|
|
114
|
+
};
|
|
115
|
+
exports.parityFromGraph = {
|
|
116
|
+
id: "parityFromGraph",
|
|
117
|
+
label: "Reconnaître graphiquement la parité d'une fonction",
|
|
118
|
+
levels: ["2nde"],
|
|
119
|
+
isSingleStep: true,
|
|
120
|
+
sections: ["Fonctions"],
|
|
121
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getParityFromGraphQuestion, nb),
|
|
122
|
+
qcmTimer: 60,
|
|
123
|
+
freeTimer: 60,
|
|
124
|
+
getPropositions,
|
|
125
|
+
isAnswerValid,
|
|
126
|
+
answerType: "QCM",
|
|
127
|
+
hasGeogebra: true,
|
|
128
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
@@ -19,3 +19,5 @@ __exportStar(require("./averageEvolutionRate"), exports);
|
|
|
19
19
|
__exportStar(require("./evolutionToCM"), exports);
|
|
20
20
|
__exportStar(require("./globalPercent"), exports);
|
|
21
21
|
__exportStar(require("./reciprocalPercentage"), exports);
|
|
22
|
+
__exportStar(require("./percentToDecimal"), exports);
|
|
23
|
+
__exportStar(require("./valuePercent"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percentToDecimal.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/percentToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAiEF,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,WAAW,CAatD,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.percentToDecimal = void 0;
|
|
4
|
+
const exercise_1 = require("../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const decimal_1 = require("../../math/numbers/decimals/decimal");
|
|
7
|
+
const randint_1 = require("../../math/utils/random/randint");
|
|
8
|
+
const coinFlip_1 = require("../../utils/coinFlip");
|
|
9
|
+
const getPercentToDecimalQuestion = () => {
|
|
10
|
+
const isPercentToDecimal = (0, coinFlip_1.coinFlip)();
|
|
11
|
+
const nb = decimal_1.DecimalConstructor.random(0, 2);
|
|
12
|
+
const tex = nb.toTree().toTex();
|
|
13
|
+
const percentTex = nb.toPercentNode().toTex();
|
|
14
|
+
const instru = isPercentToDecimal ? percentTex : tex;
|
|
15
|
+
const answer = isPercentToDecimal ? tex : percentTex;
|
|
16
|
+
const question = {
|
|
17
|
+
answer,
|
|
18
|
+
instruction: `Ecrire le nombre suivant ${isPercentToDecimal
|
|
19
|
+
? "sous forme de nombre décimal"
|
|
20
|
+
: "sous forme de pourcentage"} : $${instru}$`,
|
|
21
|
+
keys: ["percent"],
|
|
22
|
+
answerFormat: "tex",
|
|
23
|
+
identifiers: { isPercentToDecimal, nb: nb.value },
|
|
24
|
+
};
|
|
25
|
+
return question;
|
|
26
|
+
};
|
|
27
|
+
const getPropositions = (n, { answer, isPercentToDecimal, nb }) => {
|
|
28
|
+
const propositions = [];
|
|
29
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
30
|
+
const dec = new decimal_1.Decimal(nb);
|
|
31
|
+
while (propositions.length < n) {
|
|
32
|
+
if (isPercentToDecimal) {
|
|
33
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, dec
|
|
34
|
+
.multiplyByPowerOfTen((0, randint_1.randint)(-4, 4, [0, 1]))
|
|
35
|
+
.toTree()
|
|
36
|
+
.toTex());
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, dec
|
|
40
|
+
.multiplyByPowerOfTen((0, randint_1.randint)(-4, 4, [0, 1]))
|
|
41
|
+
.toPercentNode()
|
|
42
|
+
.toTex());
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
46
|
+
};
|
|
47
|
+
const isAnswerValid = (ans, { answer, isPercentToDecimal, nb }) => {
|
|
48
|
+
const dec = new decimal_1.Decimal(nb);
|
|
49
|
+
if (isPercentToDecimal) {
|
|
50
|
+
return ans === answer;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const texs = dec.toPercentNode().toAllValidTexs();
|
|
54
|
+
return texs.includes(ans);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.percentToDecimal = {
|
|
58
|
+
id: "percentToDecimal",
|
|
59
|
+
connector: "=",
|
|
60
|
+
label: "Ecrire un pourcentage sous forme décimal et vice-versa",
|
|
61
|
+
levels: ["2nde", "2ndPro", "1reESM", "1rePro"],
|
|
62
|
+
isSingleStep: true,
|
|
63
|
+
sections: ["Pourcentages"],
|
|
64
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPercentToDecimalQuestion, nb),
|
|
65
|
+
qcmTimer: 60,
|
|
66
|
+
freeTimer: 60,
|
|
67
|
+
getPropositions,
|
|
68
|
+
isAnswerValid,
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valuePercent.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/valuePercent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAmCF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,WAAW,CAYlD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.valuePercent = void 0;
|
|
4
|
+
const exercise_1 = require("../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const decimal_1 = require("../../math/numbers/decimals/decimal");
|
|
7
|
+
const randint_1 = require("../../math/utils/random/randint");
|
|
8
|
+
const round_1 = require("../../math/utils/round");
|
|
9
|
+
const getValuePercentQuestion = () => {
|
|
10
|
+
const percent = (0, randint_1.randint)(1, 100);
|
|
11
|
+
const nb = (0, randint_1.randint)(1, 100);
|
|
12
|
+
const ans = (0, round_1.round)((percent * nb) / 100, 2).frenchify();
|
|
13
|
+
const question = {
|
|
14
|
+
answer: ans + "",
|
|
15
|
+
instruction: `Calculer $${percent}\\%$ de $${nb}$.`,
|
|
16
|
+
keys: [],
|
|
17
|
+
answerFormat: "tex",
|
|
18
|
+
identifiers: { percent, nb },
|
|
19
|
+
};
|
|
20
|
+
return question;
|
|
21
|
+
};
|
|
22
|
+
const getPropositions = (n, { answer, percent, nb }) => {
|
|
23
|
+
const propositions = [];
|
|
24
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
25
|
+
while (propositions.length < n) {
|
|
26
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, decimal_1.DecimalConstructor.random(0, 100).toTree().toTex());
|
|
27
|
+
}
|
|
28
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
29
|
+
};
|
|
30
|
+
const isAnswerValid = (ans, { answer, percent, nb }) => {
|
|
31
|
+
return ans === answer;
|
|
32
|
+
};
|
|
33
|
+
exports.valuePercent = {
|
|
34
|
+
id: "valuePercent",
|
|
35
|
+
connector: "=",
|
|
36
|
+
label: "Calculer un pourcentage",
|
|
37
|
+
levels: ["3ème", "2ndPro", "2nde", "1reESM", "1rePro"],
|
|
38
|
+
isSingleStep: true,
|
|
39
|
+
sections: ["Pourcentages"],
|
|
40
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getValuePercentQuestion, nb),
|
|
41
|
+
qcmTimer: 60,
|
|
42
|
+
freeTimer: 60,
|
|
43
|
+
getPropositions,
|
|
44
|
+
isAnswerValid,
|
|
45
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
interface Number {
|
|
3
3
|
toTree: () => AlgebraicNode;
|
|
4
|
+
frenchify: () => string;
|
|
4
5
|
}
|
|
5
6
|
}
|
|
6
7
|
import { AlgebraicNode } from "./tree/nodes/algebraicNode";
|
|
@@ -37,6 +38,23 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
37
38
|
}> | import("./exercises/exercise").MathExercise<{
|
|
38
39
|
rationalNum: [number, number];
|
|
39
40
|
rationalDenum: [number, number];
|
|
41
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
42
|
+
rational: [number, number];
|
|
43
|
+
rational2: [number, number];
|
|
44
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
45
|
+
num: number;
|
|
46
|
+
denum: number;
|
|
47
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
48
|
+
num: number;
|
|
49
|
+
denum: number;
|
|
50
|
+
leadingPart: number;
|
|
51
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
52
|
+
numbers: number[];
|
|
53
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
54
|
+
rand: number;
|
|
55
|
+
a: number;
|
|
56
|
+
b: number;
|
|
57
|
+
c: number;
|
|
40
58
|
}> | import("./exercises/exercise").MathExercise<{
|
|
41
59
|
/**
|
|
42
60
|
* TODO
|
|
@@ -70,23 +88,6 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
70
88
|
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
71
89
|
|
|
72
90
|
*/
|
|
73
|
-
rational: [number, number];
|
|
74
|
-
rational2: [number, number];
|
|
75
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
76
|
-
num: number;
|
|
77
|
-
denum: number;
|
|
78
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
79
|
-
num: number;
|
|
80
|
-
denum: number;
|
|
81
|
-
leadingPart: number;
|
|
82
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
83
|
-
numbers: number[];
|
|
84
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
85
|
-
rand: number;
|
|
86
|
-
a: number;
|
|
87
|
-
b: number;
|
|
88
|
-
c: number;
|
|
89
|
-
}> | import("./exercises/exercise").MathExercise<{
|
|
90
91
|
numbers: number[];
|
|
91
92
|
}> | import("./exercises/exercise").MathExercise<{
|
|
92
93
|
rand: number;
|
|
@@ -255,6 +256,38 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
255
256
|
z1: number[];
|
|
256
257
|
z2: number[];
|
|
257
258
|
}> | import("./exercises/exercise").MathExercise<{
|
|
259
|
+
/**
|
|
260
|
+
* TODO
|
|
261
|
+
* Décimal : permettre facilement -0.xxx
|
|
262
|
+
* Tree shaking export
|
|
263
|
+
*
|
|
264
|
+
* VEA:
|
|
265
|
+
* -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
|
|
266
|
+
* ->> faire le meme delire que pour les power mais pour les opposite ?
|
|
267
|
+
* c'est à dire créer toutes les permuts en déplacant le moins qquepart
|
|
268
|
+
* -> faire des nodes pour les Ensembles de nombre
|
|
269
|
+
*
|
|
270
|
+
* !-> choses pour lesquelles la v1 ne marchera pas :
|
|
271
|
+
* !-- fractions non réduites
|
|
272
|
+
* !-- nbs décimaux avec des 0
|
|
273
|
+
* !-- nb quelconque de moins, genre -3*-4 ou -x/-y
|
|
274
|
+
* !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
|
|
275
|
+
*
|
|
276
|
+
* Passer les sqrtNode en tree-iable
|
|
277
|
+
*
|
|
278
|
+
*
|
|
279
|
+
*
|
|
280
|
+
* !!!à fix :
|
|
281
|
+
* ! fraction réductible
|
|
282
|
+
* ! 0,20 au lieu de 0,2
|
|
283
|
+
* ! moins partout dans fraction
|
|
284
|
+
* !puissances négatives vers inverse fraction
|
|
285
|
+
* ! simplification du ln
|
|
286
|
+
* ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
|
|
287
|
+
* !aussi en tapant [ puis diviser, le crochet passe en numérateur
|
|
288
|
+
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
289
|
+
|
|
290
|
+
*/
|
|
258
291
|
re: number;
|
|
259
292
|
im: number;
|
|
260
293
|
}> | import("./exercises/exercise").MathExercise<{
|
|
@@ -292,6 +325,9 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
292
325
|
randomUnitIndex: number;
|
|
293
326
|
randomUnitInstructionIndex: number;
|
|
294
327
|
randomVolume: number;
|
|
328
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
329
|
+
dec: number;
|
|
330
|
+
isDecimalToHours: boolean;
|
|
295
331
|
}> | import("./exercises/exercise").MathExercise<{
|
|
296
332
|
tex: string;
|
|
297
333
|
}> | import("./exercises/exercise").MathExercise<{
|
|
@@ -524,38 +560,12 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
524
560
|
signs: number[];
|
|
525
561
|
isLog10: boolean;
|
|
526
562
|
}> | import("./exercises/exercise").MathExercise<{
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
* -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
|
|
534
|
-
* ->> faire le meme delire que pour les power mais pour les opposite ?
|
|
535
|
-
* c'est à dire créer toutes les permuts en déplacant le moins qquepart
|
|
536
|
-
* -> faire des nodes pour les Ensembles de nombre
|
|
537
|
-
*
|
|
538
|
-
* !-> choses pour lesquelles la v1 ne marchera pas :
|
|
539
|
-
* !-- fractions non réduites
|
|
540
|
-
* !-- nbs décimaux avec des 0
|
|
541
|
-
* !-- nb quelconque de moins, genre -3*-4 ou -x/-y
|
|
542
|
-
* !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
|
|
543
|
-
*
|
|
544
|
-
* Passer les sqrtNode en tree-iable
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
* !!!à fix :
|
|
549
|
-
* ! fraction réductible
|
|
550
|
-
* ! 0,20 au lieu de 0,2
|
|
551
|
-
* ! moins partout dans fraction
|
|
552
|
-
* !puissances négatives vers inverse fraction
|
|
553
|
-
* ! simplification du ln
|
|
554
|
-
* ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
|
|
555
|
-
* !aussi en tapant [ puis diviser, le crochet passe en numérateur
|
|
556
|
-
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
557
|
-
|
|
558
|
-
*/
|
|
563
|
+
type: string;
|
|
564
|
+
fctTex: string;
|
|
565
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
566
|
+
type: string;
|
|
567
|
+
fctCmd: string;
|
|
568
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
559
569
|
coin: boolean;
|
|
560
570
|
radius: number;
|
|
561
571
|
diametre: number;
|
|
@@ -623,6 +633,38 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
623
633
|
}> | import("./exercises/exercise").MathExercise<{
|
|
624
634
|
xu: number;
|
|
625
635
|
yu: number;
|
|
636
|
+
/**
|
|
637
|
+
* TODO
|
|
638
|
+
* Décimal : permettre facilement -0.xxx
|
|
639
|
+
* Tree shaking export
|
|
640
|
+
*
|
|
641
|
+
* VEA:
|
|
642
|
+
* -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
|
|
643
|
+
* ->> faire le meme delire que pour les power mais pour les opposite ?
|
|
644
|
+
* c'est à dire créer toutes les permuts en déplacant le moins qquepart
|
|
645
|
+
* -> faire des nodes pour les Ensembles de nombre
|
|
646
|
+
*
|
|
647
|
+
* !-> choses pour lesquelles la v1 ne marchera pas :
|
|
648
|
+
* !-- fractions non réduites
|
|
649
|
+
* !-- nbs décimaux avec des 0
|
|
650
|
+
* !-- nb quelconque de moins, genre -3*-4 ou -x/-y
|
|
651
|
+
* !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
|
|
652
|
+
*
|
|
653
|
+
* Passer les sqrtNode en tree-iable
|
|
654
|
+
*
|
|
655
|
+
*
|
|
656
|
+
*
|
|
657
|
+
* !!!à fix :
|
|
658
|
+
* ! fraction réductible
|
|
659
|
+
* ! 0,20 au lieu de 0,2
|
|
660
|
+
* ! moins partout dans fraction
|
|
661
|
+
* !puissances négatives vers inverse fraction
|
|
662
|
+
* ! simplification du ln
|
|
663
|
+
* ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
|
|
664
|
+
* !aussi en tapant [ puis diviser, le crochet passe en numérateur
|
|
665
|
+
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
666
|
+
|
|
667
|
+
*/
|
|
626
668
|
xv: number;
|
|
627
669
|
yv: number;
|
|
628
670
|
}> | import("./exercises/exercise").MathExercise<{
|
|
@@ -713,44 +755,19 @@ declare const mathExercises: (import("./exercises/exercise").MathExercise<{
|
|
|
713
755
|
rate: number;
|
|
714
756
|
nbMois: number;
|
|
715
757
|
}> | import("./exercises/exercise").MathExercise<{
|
|
716
|
-
isFromEvolutionToCM: boolean;
|
|
717
|
-
* TODO
|
|
718
|
-
* Décimal : permettre facilement -0.xxx
|
|
719
|
-
* Tree shaking export
|
|
720
|
-
*
|
|
721
|
-
* VEA:
|
|
722
|
-
* -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
|
|
723
|
-
* ->> faire le meme delire que pour les power mais pour les opposite ?
|
|
724
|
-
* c'est à dire créer toutes les permuts en déplacant le moins qquepart
|
|
725
|
-
* -> faire des nodes pour les Ensembles de nombre
|
|
726
|
-
*
|
|
727
|
-
* !-> choses pour lesquelles la v1 ne marchera pas :
|
|
728
|
-
* !-- fractions non réduites
|
|
729
|
-
* !-- nbs décimaux avec des 0
|
|
730
|
-
* !-- nb quelconque de moins, genre -3*-4 ou -x/-y
|
|
731
|
-
* !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
|
|
732
|
-
*
|
|
733
|
-
* Passer les sqrtNode en tree-iable
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
* !!!à fix :
|
|
738
|
-
* ! fraction réductible
|
|
739
|
-
* ! 0,20 au lieu de 0,2
|
|
740
|
-
* ! moins partout dans fraction
|
|
741
|
-
* !puissances négatives vers inverse fraction
|
|
742
|
-
* ! simplification du ln
|
|
743
|
-
* ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
|
|
744
|
-
* !aussi en tapant [ puis diviser, le crochet passe en numérateur
|
|
745
|
-
* ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
|
|
746
|
-
|
|
747
|
-
*/
|
|
758
|
+
isFromEvolutionToCM: boolean;
|
|
748
759
|
evolution: number;
|
|
749
760
|
}> | import("./exercises/exercise").MathExercise<{
|
|
750
761
|
evolutions: string[];
|
|
751
762
|
}> | import("./exercises/exercise").MathExercise<{
|
|
752
763
|
randPercent: number;
|
|
753
764
|
isUp: boolean;
|
|
765
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
766
|
+
isPercentToDecimal: boolean;
|
|
767
|
+
nb: number;
|
|
768
|
+
}> | import("./exercises/exercise").MathExercise<{
|
|
769
|
+
percent: number;
|
|
770
|
+
nb: number;
|
|
754
771
|
}> | import("./exercises/exercise").MathExercise<{
|
|
755
772
|
int: number;
|
|
756
773
|
power: number;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;KACzB;CACF;AAgDD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;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;;;;;;;;;;;;KAO4C,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -34,6 +34,9 @@ Number.prototype.toTree = function () {
|
|
|
34
34
|
return infiniteNode_1.MinusInfinityNode;
|
|
35
35
|
return new numberNode_1.NumberNode(value);
|
|
36
36
|
};
|
|
37
|
+
Number.prototype.frenchify = function () {
|
|
38
|
+
return (this.valueOf() + "").replace(".", ",");
|
|
39
|
+
};
|
|
37
40
|
/**
|
|
38
41
|
* TODO
|
|
39
42
|
* Décimal : permettre facilement -0.xxx
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode";
|
|
2
|
+
import { PercentNode } from "../../../tree/nodes/numbers/percentNode";
|
|
2
3
|
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode";
|
|
3
4
|
import { Nombre, NumberType } from "../nombre";
|
|
4
5
|
import { Rational } from "../rationals/rational";
|
|
@@ -28,5 +29,6 @@ export declare class Decimal implements Nombre {
|
|
|
28
29
|
toScientificNotation(): NumberNode | MultiplyNode;
|
|
29
30
|
toRational(): Rational | import("../integer/integer").Integer;
|
|
30
31
|
toTree(): NumberNode;
|
|
32
|
+
toPercentNode(): PercentNode;
|
|
31
33
|
}
|
|
32
34
|
//# sourceMappingURL=decimal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/decimals/decimal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,cAAc,CAAC,SA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M,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;IAMpE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAK/D,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;CAMrD;AAED,qBAAa,OAAQ,YAAW,MAAM;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,aAAsB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;gBACR,KAAK,EAAE,MAAM;IASzB,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIhC,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAkClC,gBAAgB;IA2BhB,oBAAoB;IAsBpB,UAAU;IAMV,MAAM;IAIN,aAAa;CAGd"}
|
|
@@ -4,6 +4,7 @@ exports.Decimal = exports.DecimalConstructor = void 0;
|
|
|
4
4
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
5
5
|
const round_1 = require("../../../math/utils/round");
|
|
6
6
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
7
|
+
const percentNode_1 = require("../../../tree/nodes/numbers/percentNode");
|
|
7
8
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
8
9
|
const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
|
|
9
10
|
const nombre_1 = require("../nombre");
|
|
@@ -138,5 +139,8 @@ class Decimal {
|
|
|
138
139
|
toTree() {
|
|
139
140
|
return new numberNode_1.NumberNode(this.value);
|
|
140
141
|
}
|
|
142
|
+
toPercentNode() {
|
|
143
|
+
return new percentNode_1.PercentNode(this.multiplyByPowerOfTen(2).value);
|
|
144
|
+
}
|
|
141
145
|
}
|
|
142
146
|
exports.Decimal = Decimal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polynomial.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/polynomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAcjE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,8BAAsB,qBAAqB;IACzC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY;IAa5D,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY;IActD;;;;;;OAMG;IACH,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAY;IAoBxB,MAAM,CAAC,4BAA4B,CACjC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAY;IAqBxB,MAAM,CAAC,UAAU,CACf,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,UAAU,GAAG,UAAU,EAC3B,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,GAAE,MAAY;CAmCzB;AAED,qBAAa,UAAU;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB;;;;OAIG;gBACS,YAAY,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAE,MAAY;IAY1D,MAAM,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO;IAM9B,QAAQ,IAAI,MAAM,EAAE;IAkCpB,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU;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AG,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU;IAyBvC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU;IAQ7B,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU;IAuBnC,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU;IAqBnC,QAAQ,IAAI,UAAU;IAOtB,QAAQ,IAAI,UAAU;IAmBtB,eAAe,CAAC,IAAI,CAAC,EAAE,WAAW;IA+BlC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAO5B,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM;IAiB7C,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU;IAiBxC,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW;IAuCzB,KAAK,IAAI,MAAM;IAyBf,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -213,6 +213,17 @@ class Polynomial {
|
|
|
213
213
|
scalarDivide(n) {
|
|
214
214
|
return new Polynomial(this.coefficients.map((coeff) => coeff / n), this.variable);
|
|
215
215
|
}
|
|
216
|
+
// divide(Q: Polynomial): Polynomial {
|
|
217
|
+
// function n / d is
|
|
218
|
+
// require d ≠ 0
|
|
219
|
+
// q ← 0
|
|
220
|
+
// r ← n // At each step n = d × q + r
|
|
221
|
+
// while r ≠ 0 and degree(r) ≥ degree(d) do
|
|
222
|
+
// t ← lead(r) / lead(d) // Divide the leading terms
|
|
223
|
+
// q ← q + t
|
|
224
|
+
// r ← r − t × d
|
|
225
|
+
// return (q, r)
|
|
226
|
+
// }
|
|
216
227
|
opposite() {
|
|
217
228
|
return new Polynomial(this.coefficients.map((coeff) => -coeff), this.variable);
|
|
218
229
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rationalFrac.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/rationalFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGrD,qBAAa,YAAY;IACvB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;gBACN,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAI9C,MAAM;
|
|
1
|
+
{"version":3,"file":"rationalFrac.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/rationalFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGrD,qBAAa,YAAY;IACvB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;gBACN,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAI9C,MAAM;IAiBN,QAAQ;CAuCT"}
|
|
@@ -14,6 +14,19 @@ class RationalFrac {
|
|
|
14
14
|
toTree() {
|
|
15
15
|
return new fractionNode_1.FractionNode(this.num.toTree(), this.denum.toTree());
|
|
16
16
|
}
|
|
17
|
+
// isSimplified(){
|
|
18
|
+
// if (this.num.coefficients.length === 1 && this.num.coefficients[0] === 0)
|
|
19
|
+
// return true;
|
|
20
|
+
// const numCoeffs = this.num.coefficients.filter((c) => c !== 0);
|
|
21
|
+
// const numPGCD = numCoeffs.length > 1 ? gcd(...numCoeffs) : numCoeffs[0];
|
|
22
|
+
// const denumCoeffs = this.denum.coefficients.filter((c) => c !== 0);
|
|
23
|
+
// const denumPGCD =
|
|
24
|
+
// denumCoeffs.length > 1 ? gcd(...denumCoeffs) : denumCoeffs[0];
|
|
25
|
+
// const rational = new Rational(numPGCD, denumPGCD);
|
|
26
|
+
// if (rational.isIrreductible()) {
|
|
27
|
+
// return this;
|
|
28
|
+
// }
|
|
29
|
+
// }
|
|
17
30
|
simplify() {
|
|
18
31
|
if (this.num.coefficients.length === 1 && this.num.coefficients[0] === 0)
|
|
19
32
|
return new integer_1.Integer(0);
|
package/lib/server.d.ts
CHANGED
package/lib/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAarB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAarB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAgB3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;KACzB;CACF"}
|
package/lib/server.js
CHANGED
|
@@ -37,6 +37,7 @@ const dotenv_1 = __importDefault(require("dotenv"));
|
|
|
37
37
|
const cors_1 = __importDefault(require("cors"));
|
|
38
38
|
const numberNode_1 = require("./tree/nodes/numbers/numberNode");
|
|
39
39
|
const infiniteNode_1 = require("./tree/nodes/numbers/infiniteNode");
|
|
40
|
+
const round_1 = require("./math/utils/round");
|
|
40
41
|
const jsonParser = body_parser_1.default.json();
|
|
41
42
|
const allExercises = [...exercises];
|
|
42
43
|
Number.prototype.toTree = function () {
|
|
@@ -47,11 +48,15 @@ Number.prototype.toTree = function () {
|
|
|
47
48
|
return infiniteNode_1.MinusInfinityNode;
|
|
48
49
|
return new numberNode_1.NumberNode(value);
|
|
49
50
|
};
|
|
51
|
+
Number.prototype.frenchify = function () {
|
|
52
|
+
return (this.valueOf() + "").replace(".", ",");
|
|
53
|
+
};
|
|
50
54
|
const runServer = () => {
|
|
51
55
|
dotenv_1.default.config();
|
|
52
56
|
const app = (0, express_1.default)();
|
|
53
57
|
app.use((0, cors_1.default)());
|
|
54
58
|
console.log(exercises.length);
|
|
59
|
+
console.log((0, round_1.round)((35 * 10) / 6, 2) * 100);
|
|
55
60
|
app.get("/", (req, res) => {
|
|
56
61
|
res.json(allExercises);
|
|
57
62
|
});
|
package/lib/types/keyIds.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type KeyId =
|
|
2
2
|
/**units */
|
|
3
|
-
"cm" | "cm2" | "celsius" | "Hz" | "mol" | "kJ" | "mL"
|
|
3
|
+
"cm" | "cm2" | "celsius" | "Hz" | "mol" | "kJ" | "mL" | "minutes" | "hours"
|
|
4
4
|
/**utility */
|
|
5
5
|
| "custom" | "right" | "left" | "rightarrow" | "del" | "close" | "switch" | "maj"
|
|
6
6
|
/**words */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyIds.d.ts","sourceRoot":"","sources":["../../src/types/keyIds.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK;AACf,WAAW;AACT,IAAI,GACJ,KAAK,GACL,SAAS,GACT,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI;
|
|
1
|
+
{"version":3,"file":"keyIds.d.ts","sourceRoot":"","sources":["../../src/types/keyIds.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK;AACf,WAAW;AACT,IAAI,GACJ,KAAK,GACL,SAAS,GACT,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,SAAS,GACT,OAAO;AAET,aAAa;GACX,QAAQ,GACR,OAAO,GACP,MAAM,GACN,YA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AAW,GACX,oBAAoB,GACpB,KAAK,GACL,mBAAmB,GACnB,QAAQ,GACR,UAAU,GACV,SAAS,GACT,SAAS,GACT,iBAAiB,GACjB,QAAQ,GACR,SAAS,GACT,aAAa,GACb,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,QAAQ,GACR,SAAS,GACT,eAAe,GACf,UAAU,GACV,gBAAgB,GAChB,SAAS,GACT,qBAAqB,GACrB,qBAAqB,GACrB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,sBAAsB,GACtB,oBAAoB,GACpB,mBAAmB,GACnB,yBAAyB,GACzB,mBAAmB,GACnB,MAAM,GACN,kBAAkB,GAClB,wBAAwB,GACxB,sBAAsB,GACtB,sBAAsB,GACtB,uBAAuB,GACvB,qBAAqB,GACrB,qBAAqB,GACrB,uBAAuB,GACvB,mBAAmB,GACnB,QAAQ,GACR,mBAAmB,GACnB,mBAAmB,GACnB,QAAQ,GACR,uBAAuB,GACvB,QAAQ,GACR,sBAAsB,GACtB,QAAQ,GACR,sBAAsB,GACtB,OAAO,GACP,sBAAsB,GACtB,sBAAsB,GACtB,kBAAkB,GAClB,wBAAwB,GACxB,qBAAqB,GACrB,UAAU,GACV,mBAAmB,GACnB,yBAAyB,GACzB,iBAAiB,GACjB,uBAAuB,GACvB,iBAAiB,GACjB,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,sBAAsB,GACtB,oBAAoB,GACpB,eAAe,GACf,aAAa,GACb,aAAa,GACb,eAAe,GACf,eAAe,GACf,eAAe,GACf,uBAAuB,GACvB,gBAAgB,GAChB,mBAAmB,GACnB,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,GAClB,wBAAwB,GACxB,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaLawFlip.d.ts","sourceRoot":"","sources":["../../src/utils/probaLawFlip.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"probaLawFlip.d.ts","sourceRoot":"","sources":["../../src/utils/probaLawFlip.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,YAAY,8BAaxB,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param arr [T, proba]
|
|
5
|
+
* @returns element T_i with proba p_i
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.probaLawFlip = void 0;
|
|
4
9
|
const probaLawFlip = (arr) => {
|
|
5
10
|
if (Math.abs(arr.reduce((acc, curr) => (acc += curr[1]), 0) - 1) > 0.1)
|
|
6
|
-
throw Error(
|
|
11
|
+
throw Error("proba law does not add up t 1");
|
|
7
12
|
const rand = Math.random();
|
|
8
13
|
const sorted = [...arr].sort((a, b) => b[1] - a[1]);
|
|
9
14
|
let probaAcc = 0;
|