math-exercises 3.0.79 → 3.0.80
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/exercise.d.ts +0 -6
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.js +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +2 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +2 -0
- package/lib/exercises/math/calcul/arithmetics/isNumberDecimal.d.ts +11 -0
- package/lib/exercises/math/calcul/arithmetics/isNumberDecimal.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isNumberDecimal.js +133 -0
- package/lib/exercises/math/calcul/arithmetics/isNumberInInterval.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/isNumberInInterval.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isNumberInInterval.js +174 -0
- package/lib/exercises/math/calcul/index.d.ts +1 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +1 -0
- package/lib/exercises/math/calcul/rationals/index.d.ts +2 -0
- package/lib/exercises/math/calcul/rationals/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/rationals/index.js +1 -0
- package/lib/exercises/math/calcul/rationals/rationalNumbers.d.ts +11 -0
- package/lib/exercises/math/calcul/rationals/rationalNumbers.d.ts.map +1 -0
- package/lib/exercises/math/calcul/rationals/rationalNumbers.js +185 -0
- package/lib/exercises/math/dataRepresentations/index.js +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts +0 -1
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -1
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts +1 -2
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/valueTableCompletion.js +29 -103
- package/lib/exercises/math/probaStat/averageLinearity.d.ts +16 -0
- package/lib/exercises/math/probaStat/averageLinearity.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/averageLinearity.js +217 -0
- package/lib/exercises/math/probaStat/cumulativeSum.d.ts +9 -0
- package/lib/exercises/math/probaStat/cumulativeSum.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/cumulativeSum.js +105 -0
- package/lib/exercises/math/probaStat/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +2 -0
- package/lib/index.d.ts +27 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.d.ts +1 -1
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +5 -5
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +2 -9
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +2 -21
- package/lib/tree/nodes/numbers/numberNode.d.ts +1 -1
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +2 -2
- package/lib/utils/markdown/mdTable.d.ts +1 -1
- package/lib/utils/markdown/mdTable.d.ts.map +1 -1
- package/lib/utils/markdown/mdTable.js +5 -10
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
|
+
import { AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
6
|
+
import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
|
|
7
|
+
import { dollarize } from "../../../utils/latex/dollarize.js";
|
|
8
|
+
import { mdTable } from "../../../utils/markdown/mdTable.js";
|
|
9
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
10
|
+
const propositions = [];
|
|
11
|
+
const { xVals, yVals, x } = identifiers;
|
|
12
|
+
addValidProp(propositions, answer);
|
|
13
|
+
tryToAddWrongProp(propositions, `${xVals[x]}`);
|
|
14
|
+
tryToAddWrongProp(propositions, `${xVals[x]}`);
|
|
15
|
+
for (let k = 0; k < yVals.length; k++) {
|
|
16
|
+
let sum = 0;
|
|
17
|
+
for (let i = 0; i <= k; i++) {
|
|
18
|
+
sum += yVals[i];
|
|
19
|
+
}
|
|
20
|
+
tryToAddWrongProp(propositions, `${sum}`);
|
|
21
|
+
}
|
|
22
|
+
return shuffleProps(propositions, n);
|
|
23
|
+
};
|
|
24
|
+
const getAnswer = (identifiers) => {
|
|
25
|
+
const { yVals, x } = identifiers;
|
|
26
|
+
let sum = 0;
|
|
27
|
+
for (let i = 0; i <= x; i++) {
|
|
28
|
+
sum += yVals[i];
|
|
29
|
+
}
|
|
30
|
+
return `${sum}`;
|
|
31
|
+
};
|
|
32
|
+
const getInstruction = (identifiers) => {
|
|
33
|
+
const { xVals, yVals, x } = identifiers;
|
|
34
|
+
return `On considère la série statistique suivante :
|
|
35
|
+
|
|
36
|
+
${mdTable([
|
|
37
|
+
["Valeur", ...xVals.map((x) => dollarize(x))],
|
|
38
|
+
["Effectif", ...yVals.map((y) => dollarize(y))],
|
|
39
|
+
])}
|
|
40
|
+
|
|
41
|
+
Calculez l'effectif cumulé croissant de la valeur $${xVals[x]}$.
|
|
42
|
+
`;
|
|
43
|
+
};
|
|
44
|
+
const getHint = (identifiers) => {
|
|
45
|
+
return `L'effectif cumulé croissant d'une valeur correspond à la somme des effectifs des valeurs inférieures ou égales à cette valeur`;
|
|
46
|
+
};
|
|
47
|
+
const getCorrection = (identifiers) => {
|
|
48
|
+
const { xVals, yVals, x } = identifiers;
|
|
49
|
+
let sum = 0;
|
|
50
|
+
for (let i = 0; i <= x; i++) {
|
|
51
|
+
sum += yVals[i];
|
|
52
|
+
}
|
|
53
|
+
return `L'effectif cumulé croissant de $${xVals[x]}$ correspond à la somme des effectifs des valeurs inférieures ou égales à $${xVals[x]}$ :
|
|
54
|
+
|
|
55
|
+
$$
|
|
56
|
+
${x > 0
|
|
57
|
+
? `${operatorComposition(AddNode, yVals.slice(0, x + 1).map((e) => e.toTree())).toTex()} = ${sum}`
|
|
58
|
+
: `${sum}`}
|
|
59
|
+
$$`;
|
|
60
|
+
};
|
|
61
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
62
|
+
return numberVEA(ans, answer);
|
|
63
|
+
};
|
|
64
|
+
const getCumulativeSumQuestion = (ops) => {
|
|
65
|
+
let xVals = [randint(1, 10)];
|
|
66
|
+
let yVals = [randint(1, 10, xVals)];
|
|
67
|
+
for (let i = 1; i < randint(3, 6); i++) {
|
|
68
|
+
xVals.push(xVals[i - 1] + randint(1, 10));
|
|
69
|
+
yVals.push(yVals[i - 1] + randint(1, 10));
|
|
70
|
+
}
|
|
71
|
+
const identifiers = {
|
|
72
|
+
xVals,
|
|
73
|
+
yVals,
|
|
74
|
+
x: randint(1, xVals.length),
|
|
75
|
+
};
|
|
76
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
77
|
+
};
|
|
78
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
79
|
+
return {
|
|
80
|
+
answer: getAnswer(identifiers),
|
|
81
|
+
instruction: getInstruction(identifiers),
|
|
82
|
+
keys: [],
|
|
83
|
+
answerFormat: "tex",
|
|
84
|
+
identifiers,
|
|
85
|
+
hint: getHint(identifiers),
|
|
86
|
+
correction: getCorrection(identifiers),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export const cumulativeSum = {
|
|
90
|
+
id: "cumulativeSum",
|
|
91
|
+
label: "Calculer des effectifs cumulés croissants",
|
|
92
|
+
isSingleStep: true,
|
|
93
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCumulativeSumQuestion(opts), nb),
|
|
94
|
+
qcmTimer: 60,
|
|
95
|
+
freeTimer: 60,
|
|
96
|
+
getPropositions,
|
|
97
|
+
isAnswerValid,
|
|
98
|
+
subject: "Mathématiques",
|
|
99
|
+
getInstruction,
|
|
100
|
+
getHint,
|
|
101
|
+
getCorrection,
|
|
102
|
+
getAnswer,
|
|
103
|
+
getQuestionFromIdentifiers,
|
|
104
|
+
hasHintAndCorrection: true,
|
|
105
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./averageLinearity.js";
|
|
1
2
|
export * from "./ballsBasicProbas.js";
|
|
2
3
|
export * from "./cardBasicProbas.js";
|
|
3
4
|
export * from "./conditionalProbability.js";
|
|
@@ -20,4 +21,5 @@ export * from "./mostLeastProbable.js";
|
|
|
20
21
|
export * from "./checkEquiprobability.js";
|
|
21
22
|
export * from "./getSampleCountAndSize.js";
|
|
22
23
|
export * from "./describeEvent.js";
|
|
24
|
+
export * from "./cumulativeSum.js";
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./averageLinearity.js";
|
|
1
2
|
export * from "./ballsBasicProbas.js";
|
|
2
3
|
export * from "./cardBasicProbas.js";
|
|
3
4
|
export * from "./conditionalProbability.js";
|
|
@@ -20,3 +21,4 @@ export * from "./mostLeastProbable.js";
|
|
|
20
21
|
export * from "./checkEquiprobability.js";
|
|
21
22
|
export * from "./getSampleCountAndSize.js";
|
|
22
23
|
export * from "./describeEvent.js";
|
|
24
|
+
export * from "./cumulativeSum.js";
|
package/lib/index.d.ts
CHANGED
|
@@ -41,6 +41,11 @@ declare const mathExercises: (Exercise<{
|
|
|
41
41
|
n: number;
|
|
42
42
|
}, {}> | Exercise<{
|
|
43
43
|
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
44
|
+
}, {}> | Exercise<{
|
|
45
|
+
options: {
|
|
46
|
+
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
47
|
+
isDecimal: boolean;
|
|
48
|
+
}[];
|
|
44
49
|
}, {}> | Exercise<{
|
|
45
50
|
a: number;
|
|
46
51
|
b: number;
|
|
@@ -95,6 +100,9 @@ declare const mathExercises: (Exercise<{
|
|
|
95
100
|
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
96
101
|
b: number;
|
|
97
102
|
c: number;
|
|
103
|
+
}, {}> | Exercise<{
|
|
104
|
+
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
105
|
+
interval: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
98
106
|
}, {}> | Exercise<{
|
|
99
107
|
integerFirst: boolean;
|
|
100
108
|
integer: number;
|
|
@@ -298,6 +306,11 @@ declare const mathExercises: (Exercise<{
|
|
|
298
306
|
}, {}> | Exercise<{
|
|
299
307
|
dec: number;
|
|
300
308
|
pow: number;
|
|
309
|
+
}, {}> | Exercise<{
|
|
310
|
+
choices: {
|
|
311
|
+
node: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
312
|
+
irrationalUsed: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers | null;
|
|
313
|
+
}[];
|
|
301
314
|
}, {}> | Exercise<{
|
|
302
315
|
a: number;
|
|
303
316
|
sign: number;
|
|
@@ -879,9 +892,6 @@ declare const mathExercises: (Exercise<{
|
|
|
879
892
|
inegalitySymbol: import("./math/inequations/inequation.js").InegalitySymbols;
|
|
880
893
|
a: number;
|
|
881
894
|
b: number;
|
|
882
|
-
}, {}> | Exercise<{
|
|
883
|
-
coeffs: number[];
|
|
884
|
-
initTable: string[][];
|
|
885
895
|
}, {}> | Exercise<{
|
|
886
896
|
k: number;
|
|
887
897
|
}, {}> | Exercise<{
|
|
@@ -1744,6 +1754,16 @@ declare const mathExercises: (Exercise<{
|
|
|
1744
1754
|
}, {}> | Exercise<{
|
|
1745
1755
|
kIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1746
1756
|
uCoeffs: number[];
|
|
1757
|
+
}, {}> | Exercise<{
|
|
1758
|
+
kind: "factor";
|
|
1759
|
+
a: number;
|
|
1760
|
+
operator: "multiplication" | "division" | "soustraction" | "addition";
|
|
1761
|
+
factor: number;
|
|
1762
|
+
} | {
|
|
1763
|
+
kind: "series";
|
|
1764
|
+
series: number[];
|
|
1765
|
+
operator: "multiplication" | "division" | "soustraction" | "addition";
|
|
1766
|
+
factor: number;
|
|
1747
1767
|
}, {}> | Exercise<{
|
|
1748
1768
|
repartitions: number[];
|
|
1749
1769
|
colorAskedIndex: number;
|
|
@@ -1929,6 +1949,10 @@ declare const mathExercises: (Exercise<{
|
|
|
1929
1949
|
isComplementary: boolean;
|
|
1930
1950
|
};
|
|
1931
1951
|
question: "union" | "intersection" | "comp";
|
|
1952
|
+
}, {}> | Exercise<{
|
|
1953
|
+
xVals: number[];
|
|
1954
|
+
yVals: number[];
|
|
1955
|
+
x: number;
|
|
1932
1956
|
}, {}> | Exercise<{
|
|
1933
1957
|
firstValue: number;
|
|
1934
1958
|
askedRank: number;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa
|
|
1
|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QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -31,7 +31,7 @@ export declare class Decimal implements Nombre {
|
|
|
31
31
|
toScientificPart(): number;
|
|
32
32
|
toScientificNotation(decimals?: number): NumberNode | MultiplyNode;
|
|
33
33
|
getDigitAtRank(rank: number): number;
|
|
34
|
-
toRational(
|
|
34
|
+
toRational(shouldSimplify?: boolean): Rational | import("../integer/integer.js").Integer;
|
|
35
35
|
toTree(): NumberNode;
|
|
36
36
|
toPercentNode(): PercentNode;
|
|
37
37
|
toLowerBound(tenthPower: number): Decimal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/decimals/decimal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAE1E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,eAAO,MAAM,iBAAiB,UAAyC,CAAC;AACxE,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,GAAE,MAAU,GAAG,MAAM;IAY1E,MAAM,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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,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;IACpB,kBAAkB,EAAE,MAAM,CAAC;gBACf,KAAK,EAAE,MAAM,GAAG,MAAM;IASlC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IASxB,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIhC,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAiClC,gBAAgB;IA6BhB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM;IAuCtC,cAAc,CAAC,IAAI,EAAE,MAAM;IAS3B,UAAU,CAAC,cAAc,UAAO;IAQhC,MAAM;IAIN,aAAa;IAIb,YAAY,CAAC,UAAU,EAAE,MAAM;IAS/B,YAAY,CAAC,UAAU,EAAE,MAAM;CAShC"}
|
|
@@ -173,11 +173,11 @@ export class Decimal {
|
|
|
173
173
|
return Number(this.decimalPart[-rank - 1]);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
toRational(
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
179
|
-
return
|
|
180
|
-
return
|
|
176
|
+
toRational(shouldSimplify = true) {
|
|
177
|
+
const rational = new Rational(this.multiplyByPowerOfTen(this.precision).value, 10 ** this.precision);
|
|
178
|
+
if (shouldSimplify)
|
|
179
|
+
return rational.simplify();
|
|
180
|
+
return rational;
|
|
181
181
|
}
|
|
182
182
|
toTree() {
|
|
183
183
|
return new NumberNode(this.value, this.tex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exoTest.d.ts","sourceRoot":"","sources":["../../src/tests/exoTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIvD,eAAO,MAAM,OAAO,QAAS,QAAQ;;;;
|
|
1
|
+
{"version":3,"file":"exoTest.d.ts","sourceRoot":"","sources":["../../src/tests/exoTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIvD,eAAO,MAAM,OAAO,QAAS,QAAQ;;;;CA8EpC,CAAC"}
|
package/lib/tests/exoTest.js
CHANGED
|
@@ -19,16 +19,13 @@ export const exoTest = (exo) => {
|
|
|
19
19
|
const questions = exo.generator(30);
|
|
20
20
|
let after = Date.now();
|
|
21
21
|
generatorTime = after - before;
|
|
22
|
-
if (exo.answerType !== "free" &&
|
|
23
|
-
exo.answerType !== "GGB" &&
|
|
24
|
-
exo.answerType !== "valueTable") {
|
|
22
|
+
if (exo.answerType !== "free" && exo.answerType !== "GGB") {
|
|
25
23
|
if (!exo.getPropositions)
|
|
26
24
|
throw new Error(`exo ${exo.id} has no getPropositions`);
|
|
27
25
|
}
|
|
28
26
|
if (exo.answerType !== "QCM" &&
|
|
29
27
|
exo.answerType !== "QCU" &&
|
|
30
|
-
exo.answerType !== "GGB"
|
|
31
|
-
exo.answerType !== "valueTable") {
|
|
28
|
+
exo.answerType !== "GGB") {
|
|
32
29
|
if (!exo.isAnswerValid)
|
|
33
30
|
throw new Error(`exo ${exo.id} has no isAnswerValid`);
|
|
34
31
|
}
|
|
@@ -36,10 +33,6 @@ export const exoTest = (exo) => {
|
|
|
36
33
|
if (!exo.isGGBAnswerValid)
|
|
37
34
|
throw new Error(`exo ${exo.id} has no isGGBAnswerValid`);
|
|
38
35
|
}
|
|
39
|
-
if (exo.answerType === "valueTable") {
|
|
40
|
-
if (!exo.isAnswerTableValid)
|
|
41
|
-
throw new Error(`exo ${exo.id} has no isAnswerTableValid`);
|
|
42
|
-
}
|
|
43
36
|
questions.forEach((question) => {
|
|
44
37
|
const times = questionTest(exo, question);
|
|
45
38
|
qcmTime = times.qcmTime;
|
|
@@ -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;AAIjE,eAAO,MAAM,YAAY,QAAS,QAAQ,YAAY,QAAQ;;;
|
|
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;AAIjE,eAAO,MAAM,YAAY,QAAS,QAAQ,YAAY,QAAQ;;;CAoL7D,CAAC"}
|
|
@@ -43,10 +43,6 @@ export const questionTest = (exo, question) => {
|
|
|
43
43
|
if (!question.studentGgbOptions?.coords?.length)
|
|
44
44
|
throw new Error(`exo ${exo.id} has no studentGgbOptions Coords`);
|
|
45
45
|
}
|
|
46
|
-
else if (exo.answerType === "valueTable") {
|
|
47
|
-
if (!question.answerTable?.length)
|
|
48
|
-
throw new Error(`exo ${exo.id} has no answerTable`);
|
|
49
|
-
}
|
|
50
46
|
else if (exo.answerType !== "QCU" && exo.answerType !== "QCM") {
|
|
51
47
|
if (!question.answer)
|
|
52
48
|
throw new Error(`exo ${exo.id} has no answer`);
|
|
@@ -61,18 +57,6 @@ export const questionTest = (exo, question) => {
|
|
|
61
57
|
throw new Error(`exo ${exo.id} has invalid answer`);
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
|
-
if (question.answerTable) {
|
|
65
|
-
for (const cell of question.answerTable.flat()) {
|
|
66
|
-
if (cell.match(dotDecimalPattern))
|
|
67
|
-
throw new Error(`exo ${exo.id} has invalid number format`);
|
|
68
|
-
if (cell.includes("[object Object]"))
|
|
69
|
-
throw new Error(`exo ${exo.id} has invalid answer`);
|
|
70
|
-
if (question.answerFormat !== "raw") {
|
|
71
|
-
if (!latexTester(cell, true))
|
|
72
|
-
throw new Error(`exo ${exo.id} has invalid answer`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
60
|
if (!question.instruction.length) {
|
|
77
61
|
throw new Error(`exo ${exo.id} has no instruction`);
|
|
78
62
|
}
|
|
@@ -119,8 +103,7 @@ export const questionTest = (exo, question) => {
|
|
|
119
103
|
// }
|
|
120
104
|
if (exo.answerType !== "QCM" &&
|
|
121
105
|
exo.answerType !== "QCU" &&
|
|
122
|
-
exo.answerType !== "GGB"
|
|
123
|
-
exo.answerType !== "valueTable") {
|
|
106
|
+
exo.answerType !== "GGB") {
|
|
124
107
|
if (!question.keys)
|
|
125
108
|
throw new Error(`exo ${exo.id} has no keys`);
|
|
126
109
|
const answer = question.answer;
|
|
@@ -132,9 +115,7 @@ export const questionTest = (exo, question) => {
|
|
|
132
115
|
let after = Date.now();
|
|
133
116
|
veaTime = after - before;
|
|
134
117
|
}
|
|
135
|
-
if (exo.answerType !== "free" &&
|
|
136
|
-
exo.answerType !== "GGB" &&
|
|
137
|
-
exo.answerType !== "valueTable") {
|
|
118
|
+
if (exo.answerType !== "free" && exo.answerType !== "GGB") {
|
|
138
119
|
let before = Date.now();
|
|
139
120
|
console.log("will generate props : ", exo.id, "ids :", question.identifiers);
|
|
140
121
|
const props = exo.getPropositions(4, {
|
|
@@ -29,7 +29,7 @@ export declare class NumberNode implements AlgebraicNode {
|
|
|
29
29
|
equals(node: AlgebraicNode): boolean;
|
|
30
30
|
toDetailedEvaluation(vars: Record<string, AlgebraicNode>): this;
|
|
31
31
|
derivative(varName?: string | undefined): AlgebraicNode;
|
|
32
|
-
toFrac(): AlgebraicNode | NumberNode;
|
|
32
|
+
toFrac(shouldSimplify?: boolean): AlgebraicNode | NumberNode;
|
|
33
33
|
toPrimeDecomposition(usePowers?: boolean): AlgebraicNode | this | MultiplyNode;
|
|
34
34
|
}
|
|
35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AE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,WAAW;IASpB,YAAY,IAAI,MAAM;IAGtB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAiBrC,QAAQ;IAGR,aAAa;;;;IAMb,cAAc;IAOd,iBAAiB;IAGjB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAQ/C,MAAM,CAAC,IAAI,EAAE,aAAa;IAG1B,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAGxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GACd,aAAa;IAGtC,MAAM,CAAC,cAAc,UAAO;IAI5B,oBAAoB,CAAC,SAAS,CAAC,EAAE,OAAO;CAsBzC"}
|
|
@@ -88,8 +88,8 @@ export class NumberNode {
|
|
|
88
88
|
derivative(varName) {
|
|
89
89
|
return (0).toTree();
|
|
90
90
|
}
|
|
91
|
-
toFrac() {
|
|
92
|
-
return new Decimal(this.value).toRational(
|
|
91
|
+
toFrac(shouldSimplify = true) {
|
|
92
|
+
return new Decimal(this.value).toRational(shouldSimplify).toTree();
|
|
93
93
|
}
|
|
94
94
|
toPrimeDecomposition(usePowers) {
|
|
95
95
|
if (!isInt(this.value)) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const mdTable: (rows: (string | number)[][]
|
|
1
|
+
export declare const mdTable: (rows: (string | number)[][]) => string;
|
|
2
2
|
//# sourceMappingURL=mdTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdTable.d.ts","sourceRoot":"","sources":["../../../src/utils/markdown/mdTable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mdTable.d.ts","sourceRoot":"","sources":["../../../src/utils/markdown/mdTable.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,SAAU,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,WASlD,CAAC"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const rowFormated = shouldDollarize ? row.map((e) => dollarize(e)) : row;
|
|
4
|
-
return "|" + rowFormated.join("|") + "|";
|
|
1
|
+
const rowBuilder = (row) => {
|
|
2
|
+
return "|" + row.join("|") + "|";
|
|
5
3
|
};
|
|
6
|
-
export const mdTable = (rows
|
|
4
|
+
export const mdTable = (rows) => {
|
|
7
5
|
const width = rows[0].length;
|
|
8
6
|
return `
|
|
9
7
|
<!-- table -->
|
|
10
|
-
${rowBuilder(rows[0]
|
|
8
|
+
${rowBuilder(rows[0])}
|
|
11
9
|
${rowBuilder(new Array(width).fill("-"))}
|
|
12
|
-
${rows
|
|
13
|
-
.slice(1)
|
|
14
|
-
.map((e) => rowBuilder(e, shouldDollarize))
|
|
15
|
-
.join("\n")}
|
|
10
|
+
${rows.slice(1).map(rowBuilder).join("\n")}
|
|
16
11
|
<!-- !table -->
|
|
17
12
|
`;
|
|
18
13
|
};
|