math-exercises 2.2.71 → 2.2.72
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/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +138 -0
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/index.js +1 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts +6 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/index.js +6 -0
- package/lib/exercises/math/probaStat/stats1var/interquartilesList.d.ts +7 -0
- package/lib/exercises/math/probaStat/stats1var/interquartilesList.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/interquartilesList.js +93 -0
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts +8 -0
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +98 -0
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +1 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationList.d.ts +7 -0
- package/lib/exercises/math/probaStat/stats1var/standardDeviationList.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/standardDeviationList.js +131 -0
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts +8 -0
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +144 -0
- package/lib/exercises/math/probaStat/stats1var/varianceList.d.ts +7 -0
- package/lib/exercises/math/probaStat/stats1var/varianceList.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/varianceList.js +121 -0
- package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts +8 -0
- package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/varianceTable.js +133 -0
- package/lib/exercises/vea/sqrtVEA.d.ts +2 -1
- package/lib/exercises/vea/sqrtVEA.d.ts.map +1 -1
- package/lib/exercises/vea/sqrtVEA.js +6 -3
- package/lib/index.d.ts +19 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/quartiles.d.ts +3 -0
- package/lib/math/utils/quartiles.d.ts.map +1 -0
- package/lib/math/utils/quartiles.js +47 -0
- package/lib/math/utils/standardDeviation.d.ts +3 -0
- package/lib/math/utils/standardDeviation.d.ts.map +1 -0
- package/lib/math/utils/standardDeviation.js +13 -0
- package/lib/math/utils/variance.d.ts +1 -0
- package/lib/math/utils/variance.d.ts.map +1 -1
- package/lib/math/utils/variance.js +9 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +8 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +3 -1
- package/lib/tree/parsers/monomParser.d.ts.map +1 -1
- package/lib/tree/parsers/monomParser.js +25 -0
- package/lib/tree/parsers/polynomialParser.d.ts +3 -0
- package/lib/tree/parsers/polynomialParser.d.ts.map +1 -0
- package/lib/tree/parsers/polynomialParser.js +50 -0
- package/lib/utils/average.d.ts +1 -0
- package/lib/utils/average.d.ts.map +1 -1
- package/lib/utils/average.js +9 -1
- package/lib/utils/latex/approxOrEqual.d.ts +2 -0
- package/lib/utils/latex/approxOrEqual.d.ts.map +1 -0
- package/lib/utils/latex/approxOrEqual.js +11 -0
- package/lib/utils/variance.d.ts +2 -0
- package/lib/utils/variance.d.ts.map +1 -0
- package/lib/utils/variance.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
type: number;
|
|
5
|
+
a: NodeIdentifiers;
|
|
6
|
+
b: NodeIdentifiers;
|
|
7
|
+
};
|
|
8
|
+
export declare const identitiesWithNonIntegers: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=identitiesWithNonIntegers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identitiesWithNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAS1C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AA2HF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAgB3D,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.identitiesWithNonIntegers = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
7
|
+
const real_1 = require("../../../../math/numbers/reals/real");
|
|
8
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
|
+
const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
|
|
10
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
11
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
12
|
+
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
13
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
14
|
+
const trinomNode_1 = require("../../../../tree/nodes/polynomials/trinomNode");
|
|
15
|
+
const polynomialParser_1 = require("../../../../tree/parsers/polynomialParser");
|
|
16
|
+
const random_1 = require("../../../../utils/alea/random");
|
|
17
|
+
const getPropositions = (n, { answer, a, b, type }) => {
|
|
18
|
+
const propositions = [];
|
|
19
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
20
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, getAnswer({
|
|
21
|
+
a,
|
|
22
|
+
b,
|
|
23
|
+
type: ((type + 1) % 3) + 1,
|
|
24
|
+
}));
|
|
25
|
+
while (propositions.length < n) {
|
|
26
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, trinomNode_1.TrinomNodeConstructor.random().toTex());
|
|
27
|
+
}
|
|
28
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
const answer = getStatementNode(identifiers)
|
|
32
|
+
.simplify({
|
|
33
|
+
towardsDistribute: true,
|
|
34
|
+
forbidFactorize: true,
|
|
35
|
+
forceDistributeFractions: true,
|
|
36
|
+
})
|
|
37
|
+
.toTex();
|
|
38
|
+
return answer;
|
|
39
|
+
};
|
|
40
|
+
const getStatementNode = (identifiers) => {
|
|
41
|
+
const { type, a, b } = identifiers;
|
|
42
|
+
const aNode = (0, nodeConstructor_1.reifyAlgebraic)(a);
|
|
43
|
+
const bNode = (0, nodeConstructor_1.reifyAlgebraic)(b);
|
|
44
|
+
if (type === 1) {
|
|
45
|
+
return (0, powerNode_1.square)((0, addNode_1.add)((0, multiplyNode_1.multiply)(aNode, "x"), bNode));
|
|
46
|
+
}
|
|
47
|
+
else if (type === 2) {
|
|
48
|
+
return (0, powerNode_1.square)((0, substractNode_1.substract)((0, multiplyNode_1.multiply)(aNode, "x"), bNode));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return (0, multiplyNode_1.multiply)((0, addNode_1.add)((0, multiplyNode_1.multiply)(aNode, "x"), bNode), (0, substractNode_1.substract)((0, multiplyNode_1.multiply)(aNode, "x"), bNode));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const getInstruction = (identifiers) => {
|
|
55
|
+
const statement = getStatementNode(identifiers);
|
|
56
|
+
return `Développer et simplifier :
|
|
57
|
+
|
|
58
|
+
$$
|
|
59
|
+
${statement.toTex()}
|
|
60
|
+
$$`;
|
|
61
|
+
};
|
|
62
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
63
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
64
|
+
const getKeys = (identifiers) => {
|
|
65
|
+
return ["x"];
|
|
66
|
+
};
|
|
67
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
68
|
+
try {
|
|
69
|
+
//this is either genius or dumb
|
|
70
|
+
const parsed = (0, polynomialParser_1.polynomialParser)(ans);
|
|
71
|
+
if (!parsed)
|
|
72
|
+
return false;
|
|
73
|
+
return (parsed
|
|
74
|
+
.simplify({
|
|
75
|
+
forbidFactorize: true,
|
|
76
|
+
forceDistributeFractions: true,
|
|
77
|
+
towardsDistribute: true,
|
|
78
|
+
})
|
|
79
|
+
.toTex() === answer);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
//type1 (ax+b)^2
|
|
86
|
+
//type2 (ax-b)^2
|
|
87
|
+
//type3 (ax+b)(ax-b)
|
|
88
|
+
//a est frac/sqrt -> b entier
|
|
89
|
+
//b est frac/sqrt -> a entier
|
|
90
|
+
const getIdentitiesWithNonIntegersQuestion = (ops) => {
|
|
91
|
+
const identityType = (0, randint_1.randint)(1, 4);
|
|
92
|
+
const typeA = (0, random_1.random)(["entier", "sqrt", "frac"]);
|
|
93
|
+
const typeB = typeA === "entier" ? (0, random_1.random)(["sqrt", "frac"]) : "entier";
|
|
94
|
+
const buildNb = (type) => {
|
|
95
|
+
if (type === "entier") {
|
|
96
|
+
return (0, randint_1.randint)(1, 11).toTree();
|
|
97
|
+
}
|
|
98
|
+
else if (type === "sqrt") {
|
|
99
|
+
return real_1.SquareRootConstructor.randomIrreductible(10).toTree();
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return rational_1.RationalConstructor.randomIrreductible().toTree();
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const a = buildNb(typeA);
|
|
106
|
+
const b = buildNb(typeB);
|
|
107
|
+
const identifiers = {
|
|
108
|
+
type: identityType,
|
|
109
|
+
a: a.toIdentifiers(),
|
|
110
|
+
b: b.toIdentifiers(),
|
|
111
|
+
};
|
|
112
|
+
const question = {
|
|
113
|
+
answer: getAnswer(identifiers),
|
|
114
|
+
instruction: getInstruction(identifiers),
|
|
115
|
+
keys: getKeys(identifiers),
|
|
116
|
+
answerFormat: "tex",
|
|
117
|
+
identifiers,
|
|
118
|
+
// hint: getHint(identifiers),
|
|
119
|
+
// correction: getCorrection(identifiers),
|
|
120
|
+
};
|
|
121
|
+
return question;
|
|
122
|
+
};
|
|
123
|
+
exports.identitiesWithNonIntegers = {
|
|
124
|
+
id: "identitiesWithNonIntegers",
|
|
125
|
+
connector: "=",
|
|
126
|
+
label: "Identités remarquables avec coefficients non entiers",
|
|
127
|
+
isSingleStep: true,
|
|
128
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getIdentitiesWithNonIntegersQuestion(opts), nb),
|
|
129
|
+
qcmTimer: 60,
|
|
130
|
+
freeTimer: 60,
|
|
131
|
+
getPropositions,
|
|
132
|
+
isAnswerValid,
|
|
133
|
+
subject: "Mathématiques",
|
|
134
|
+
getInstruction,
|
|
135
|
+
// getHint,
|
|
136
|
+
// getCorrection,
|
|
137
|
+
getAnswer,
|
|
138
|
+
};
|
|
@@ -8,4 +8,5 @@ export * from "./doubleDistributivityWithCoeff";
|
|
|
8
8
|
export * from "./canonicalFormDevelopment";
|
|
9
9
|
export * from "./simpleDistriXCoeff";
|
|
10
10
|
export * from "./doubleDistributivitySubstract";
|
|
11
|
+
export * from "./identitiesWithNonIntegers";
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
|
|
@@ -28,3 +28,4 @@ __exportStar(require("./doubleDistributivityWithCoeff"), exports);
|
|
|
28
28
|
__exportStar(require("./canonicalFormDevelopment"), exports);
|
|
29
29
|
__exportStar(require("./simpleDistriXCoeff"), exports);
|
|
30
30
|
__exportStar(require("./doubleDistributivitySubstract"), exports);
|
|
31
|
+
__exportStar(require("./identitiesWithNonIntegers"), exports);
|
|
@@ -6,4 +6,10 @@ export * from "./quartiles";
|
|
|
6
6
|
export * from "./quartilesList";
|
|
7
7
|
export * from "./averageList";
|
|
8
8
|
export * from "./etendueList";
|
|
9
|
+
export * from "./varianceList";
|
|
10
|
+
export * from "./varianceTable";
|
|
11
|
+
export * from "./standardDeviationList";
|
|
12
|
+
export * from "./standardDeviationTable";
|
|
13
|
+
export * from "./interquartilesList";
|
|
14
|
+
export * from "./interquartilesTable";
|
|
9
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
@@ -22,3 +22,9 @@ __exportStar(require("./quartiles"), exports);
|
|
|
22
22
|
__exportStar(require("./quartilesList"), exports);
|
|
23
23
|
__exportStar(require("./averageList"), exports);
|
|
24
24
|
__exportStar(require("./etendueList"), exports);
|
|
25
|
+
__exportStar(require("./varianceList"), exports);
|
|
26
|
+
__exportStar(require("./varianceTable"), exports);
|
|
27
|
+
__exportStar(require("./standardDeviationList"), exports);
|
|
28
|
+
__exportStar(require("./standardDeviationTable"), exports);
|
|
29
|
+
__exportStar(require("./interquartilesList"), exports);
|
|
30
|
+
__exportStar(require("./interquartilesTable"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interquartilesList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/interquartilesList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAoFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAiBpD,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.interquartilesList = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const numberVEA_1 = require("../../../../exercises/vea/numberVEA");
|
|
7
|
+
const quartiles_1 = require("../../../../math/utils/quartiles");
|
|
8
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
|
+
const approxOrEqual_1 = require("../../../../utils/latex/approxOrEqual");
|
|
10
|
+
const getPropositions = (n, { answer }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
13
|
+
while (propositions.length < n) {
|
|
14
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(1, 10).frenchify());
|
|
15
|
+
}
|
|
16
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const first = (0, quartiles_1.firstQuartile)(identifiers.sortedValues);
|
|
20
|
+
const thrid = (0, quartiles_1.thirdQuartile)(identifiers.sortedValues);
|
|
21
|
+
return (thrid - first).frenchify();
|
|
22
|
+
};
|
|
23
|
+
const getInstruction = (identifiers) => {
|
|
24
|
+
return `Calculer l'écart interquartiles de la série statistique suivante :
|
|
25
|
+
|
|
26
|
+
$$
|
|
27
|
+
${identifiers.sortedValues.map((e) => e.frenchify()).join("\\ ; \\ ")}
|
|
28
|
+
$$
|
|
29
|
+
`;
|
|
30
|
+
};
|
|
31
|
+
const getHint = (identifiers) => {
|
|
32
|
+
return `L'écart interquartiles est la différence entre le troisième quartile et le premier quartile, c'est à dire $Q_3-Q_1$.`;
|
|
33
|
+
};
|
|
34
|
+
const getCorrection = (identifiers) => {
|
|
35
|
+
const first = (0, quartiles_1.firstQuartile)(identifiers.sortedValues);
|
|
36
|
+
const thrid = (0, quartiles_1.thirdQuartile)(identifiers.sortedValues);
|
|
37
|
+
const n = identifiers.sortedValues.length;
|
|
38
|
+
return `Il y a $${n}$ valeurs dans cette liste.
|
|
39
|
+
|
|
40
|
+
Puisque $0,25 \\times ${n} ${(0, approxOrEqual_1.approxOrEqual)(0.25 * n, 2).join("")}$, le premier quartile est la valeur de rang $${Math.ceil(n / 4)}$. On a donc $Q_1 = ${first}$.
|
|
41
|
+
|
|
42
|
+
Puisque $0,75 \\times ${n} ${(0, approxOrEqual_1.approxOrEqual)(0.75 * n, 2).join("")}$, le troisième quartile est la valeur de rang $${Math.ceil((3 * n) / 4)}$. On a donc $Q_3 = ${thrid}$.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
L'écart interquartile est donc égal à :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
Q_3-Q_1 = ${thrid}-${first} = ${thrid - first}
|
|
49
|
+
$$`;
|
|
50
|
+
};
|
|
51
|
+
const getKeys = (identifiers) => {
|
|
52
|
+
return [];
|
|
53
|
+
};
|
|
54
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
55
|
+
return (0, numberVEA_1.numberVEA)(ans, answer);
|
|
56
|
+
};
|
|
57
|
+
const getInterquartilesListQuestion = (ops) => {
|
|
58
|
+
const nbValues = (0, randint_1.randint)(4, 7);
|
|
59
|
+
const values = [];
|
|
60
|
+
for (let i = 0; i < nbValues; i++) {
|
|
61
|
+
values.push((0, randint_1.randint)(1, 15));
|
|
62
|
+
}
|
|
63
|
+
const identifiers = {
|
|
64
|
+
sortedValues: values.sort((a, b) => a - b),
|
|
65
|
+
};
|
|
66
|
+
const question = {
|
|
67
|
+
answer: getAnswer(identifiers),
|
|
68
|
+
instruction: getInstruction(identifiers),
|
|
69
|
+
keys: getKeys(identifiers),
|
|
70
|
+
answerFormat: "tex",
|
|
71
|
+
identifiers,
|
|
72
|
+
hint: getHint(identifiers),
|
|
73
|
+
correction: getCorrection(identifiers),
|
|
74
|
+
};
|
|
75
|
+
return question;
|
|
76
|
+
};
|
|
77
|
+
exports.interquartilesList = {
|
|
78
|
+
id: "interquartilesList",
|
|
79
|
+
connector: "=",
|
|
80
|
+
label: "Calcul de l'écart interquartiles d'une liste de valeurs",
|
|
81
|
+
isSingleStep: true,
|
|
82
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getInterquartilesListQuestion(opts), nb),
|
|
83
|
+
qcmTimer: 60,
|
|
84
|
+
freeTimer: 60,
|
|
85
|
+
getPropositions,
|
|
86
|
+
isAnswerValid,
|
|
87
|
+
subject: "Mathématiques",
|
|
88
|
+
getInstruction,
|
|
89
|
+
getHint,
|
|
90
|
+
getCorrection,
|
|
91
|
+
getAnswer,
|
|
92
|
+
hasHintAndCorrection: true,
|
|
93
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
sortedValues: number[];
|
|
4
|
+
effectifs: number[];
|
|
5
|
+
};
|
|
6
|
+
export declare const interquartilesTable: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=interquartilesTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interquartilesTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/interquartilesTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AA0FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAkBrD,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.interquartilesTable = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const numberVEA_1 = require("../../../../exercises/vea/numberVEA");
|
|
7
|
+
const quartiles_1 = require("../../../../math/utils/quartiles");
|
|
8
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
|
+
const approxOrEqual_1 = require("../../../../utils/latex/approxOrEqual");
|
|
10
|
+
const mdTable_1 = require("../../../../utils/markdown/mdTable");
|
|
11
|
+
const getPropositions = (n, { answer }) => {
|
|
12
|
+
const propositions = [];
|
|
13
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
14
|
+
while (propositions.length < n) {
|
|
15
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(1, 10).frenchify());
|
|
16
|
+
}
|
|
17
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const first = (0, quartiles_1.firstQuartile)(identifiers.sortedValues, identifiers.effectifs);
|
|
21
|
+
const thrid = (0, quartiles_1.thirdQuartile)(identifiers.sortedValues, identifiers.effectifs);
|
|
22
|
+
return (thrid - first).frenchify();
|
|
23
|
+
};
|
|
24
|
+
const getInstruction = (identifiers) => {
|
|
25
|
+
return `Calculer l'écart interquartiles de la série statistique suivante :
|
|
26
|
+
|
|
27
|
+
${(0, mdTable_1.mdTable)([
|
|
28
|
+
["$x_i$", ...identifiers.sortedValues.map((e) => `$${e.frenchify()}$`)],
|
|
29
|
+
["$n_i$", ...identifiers.effectifs.map((e) => `$${e.frenchify()}$`)],
|
|
30
|
+
])}
|
|
31
|
+
`;
|
|
32
|
+
};
|
|
33
|
+
const getHint = (identifiers) => {
|
|
34
|
+
return `L'écart interquartiles est la différence entre le troisième quartile et le premier quartile, c'est à dire $Q_3-Q_1$.`;
|
|
35
|
+
};
|
|
36
|
+
const getCorrection = (identifiers) => {
|
|
37
|
+
const first = (0, quartiles_1.firstQuartile)(identifiers.sortedValues, identifiers.effectifs);
|
|
38
|
+
const thrid = (0, quartiles_1.thirdQuartile)(identifiers.sortedValues, identifiers.effectifs);
|
|
39
|
+
const n = identifiers.effectifs.reduce((acc, curr) => acc + curr, 0);
|
|
40
|
+
return `Il y a $${n}$ valeurs dans cette liste.
|
|
41
|
+
|
|
42
|
+
Puisque $0,25 \\times ${n} ${(0, approxOrEqual_1.approxOrEqual)(0.25 * n, 2).join("")}$, le premier quartile est la valeur de rang $${Math.ceil(n / 4)}$. On a donc $Q_1 = ${first}$.
|
|
43
|
+
|
|
44
|
+
Puisque $0,75 \\times ${n} ${(0, approxOrEqual_1.approxOrEqual)(0.75 * n, 2).join("")}$, le troisième quartile est la valeur de rang $${Math.ceil((3 * n) / 4)}$. On a donc $Q_3 = ${thrid}$.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
L'écart interquartile est donc égal à :
|
|
48
|
+
|
|
49
|
+
$$
|
|
50
|
+
Q_3-Q_1 = ${thrid}-${first} = ${thrid - first}
|
|
51
|
+
$$`;
|
|
52
|
+
};
|
|
53
|
+
const getKeys = (identifiers) => {
|
|
54
|
+
return [];
|
|
55
|
+
};
|
|
56
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
57
|
+
return (0, numberVEA_1.numberVEA)(ans, answer);
|
|
58
|
+
};
|
|
59
|
+
const getInterquartilesTableQuestion = (ops) => {
|
|
60
|
+
const nbValues = (0, randint_1.randint)(4, 7);
|
|
61
|
+
const values = [];
|
|
62
|
+
const effectifs = [];
|
|
63
|
+
for (let i = 0; i < nbValues; i++) {
|
|
64
|
+
values.push((0, randint_1.randint)(1, 15, values));
|
|
65
|
+
effectifs.push((0, randint_1.randint)(1, 7));
|
|
66
|
+
}
|
|
67
|
+
const identifiers = {
|
|
68
|
+
sortedValues: values.sort((a, b) => a - b),
|
|
69
|
+
effectifs,
|
|
70
|
+
};
|
|
71
|
+
const question = {
|
|
72
|
+
answer: getAnswer(identifiers),
|
|
73
|
+
instruction: getInstruction(identifiers),
|
|
74
|
+
keys: getKeys(identifiers),
|
|
75
|
+
answerFormat: "tex",
|
|
76
|
+
identifiers,
|
|
77
|
+
hint: getHint(identifiers),
|
|
78
|
+
correction: getCorrection(identifiers),
|
|
79
|
+
};
|
|
80
|
+
return question;
|
|
81
|
+
};
|
|
82
|
+
exports.interquartilesTable = {
|
|
83
|
+
id: "interquartilesTable",
|
|
84
|
+
connector: "=",
|
|
85
|
+
label: "Calcul de l'écart interquartiles d'un tableau d'effectifs",
|
|
86
|
+
isSingleStep: true,
|
|
87
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getInterquartilesTableQuestion(opts), nb),
|
|
88
|
+
qcmTimer: 60,
|
|
89
|
+
freeTimer: 60,
|
|
90
|
+
getPropositions,
|
|
91
|
+
isAnswerValid,
|
|
92
|
+
subject: "Mathématiques",
|
|
93
|
+
getInstruction,
|
|
94
|
+
getHint,
|
|
95
|
+
getCorrection,
|
|
96
|
+
hasHintAndCorrection: true,
|
|
97
|
+
getAnswer,
|
|
98
|
+
};
|
|
@@ -62,7 +62,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
62
62
|
exports.quartilesList = {
|
|
63
63
|
id: "quartilesList",
|
|
64
64
|
connector: "=",
|
|
65
|
-
label: "Calcul des quartiles d'une liste",
|
|
65
|
+
label: "Calcul des quartiles d'une liste de valeurs",
|
|
66
66
|
levels: ["3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
|
|
67
67
|
isSingleStep: false,
|
|
68
68
|
sections: ["Statistiques"],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standardDeviationList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/standardDeviationList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAwHF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAiBvD,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.standardDeviationList = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const sqrtVEA_1 = require("../../../../exercises/vea/sqrtVEA");
|
|
7
|
+
const randfloat_1 = require("../../../../math/utils/random/randfloat");
|
|
8
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
|
+
const round_1 = require("../../../../math/utils/round");
|
|
10
|
+
const standardDeviation_1 = require("../../../../math/utils/standardDeviation");
|
|
11
|
+
const variance_1 = require("../../../../math/utils/variance");
|
|
12
|
+
const average_1 = require("../../../../utils/average");
|
|
13
|
+
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
14
|
+
const approxOrEqual_1 = require("../../../../utils/latex/approxOrEqual");
|
|
15
|
+
const getPropositions = (n, { answer, sortedValues }) => {
|
|
16
|
+
const propositions = [];
|
|
17
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
18
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, round_1.round)((0, variance_1.variance)(sortedValues, (0, average_1.average)(sortedValues)), 2).frenchify());
|
|
19
|
+
while (propositions.length < n) {
|
|
20
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, randfloat_1.randfloat)(0, 5, 2).frenchify());
|
|
21
|
+
}
|
|
22
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
23
|
+
};
|
|
24
|
+
const getAnswer = (identifiers) => {
|
|
25
|
+
const sigma = (0, standardDeviation_1.standardDeviation)(identifiers.sortedValues);
|
|
26
|
+
return (0, round_1.round)(sigma, 2).frenchify();
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
return `Calculer l'écart-type de la série statistique suivante :
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
${identifiers.sortedValues.map((e) => e.frenchify()).join("\\ ; \\ ")}
|
|
33
|
+
$$
|
|
34
|
+
|
|
35
|
+
Arrondir au centième.`;
|
|
36
|
+
};
|
|
37
|
+
const getHint = (identifiers) => {
|
|
38
|
+
return `Si on note $N$ le nombre de valeurs, $\\overline x$ la moyenne de cette liste, et $x_1$, $x_2$, $\\ldots$, $x_N$ les valeurs de la liste, alors la variance est :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
V = \\frac{(x_1-\\overline{x})^2 + (x_2-\\overline{x})^2 + \\ldots + (x_N-\\overline{x})^2}{N}
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
Puis, l'écart-type est la racine carrée de la variance.`;
|
|
45
|
+
};
|
|
46
|
+
const getCorrection = (identifiers) => {
|
|
47
|
+
const n = identifiers.sortedValues.length;
|
|
48
|
+
const avg = (0, average_1.average)(identifiers.sortedValues);
|
|
49
|
+
const roundedAvg = (0, round_1.round)(avg, 2);
|
|
50
|
+
const vce = (0, variance_1.variance)(identifiers.sortedValues, (0, average_1.average)(identifiers.sortedValues));
|
|
51
|
+
const sigma = Math.sqrt(vce);
|
|
52
|
+
return `La moyenne $\\overline{x}$ de cette série vaut :
|
|
53
|
+
|
|
54
|
+
${(0, alignTex_1.alignTex)([
|
|
55
|
+
[
|
|
56
|
+
`\\overline{x}`,
|
|
57
|
+
"=",
|
|
58
|
+
`\\frac{${identifiers.sortedValues
|
|
59
|
+
.map((e) => e.frenchify())
|
|
60
|
+
.join("+")}}{${n}}`,
|
|
61
|
+
],
|
|
62
|
+
["", ...(0, approxOrEqual_1.approxOrEqual)(avg, 2)],
|
|
63
|
+
])}
|
|
64
|
+
|
|
65
|
+
La variance est donc :
|
|
66
|
+
|
|
67
|
+
${(0, alignTex_1.alignTex)([
|
|
68
|
+
[
|
|
69
|
+
"V",
|
|
70
|
+
"=",
|
|
71
|
+
`\\frac{(x_1-\\overline{x})^2 + (x_2-\\overline{x})^2 + \\ldots + (x_n-\\overline{x})^2}{N}`,
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
"",
|
|
75
|
+
"=",
|
|
76
|
+
`\\frac{${identifiers.sortedValues
|
|
77
|
+
.map((e) => `(${e.frenchify()} - ${roundedAvg.frenchify()})^2`)
|
|
78
|
+
.join("+")}}{${n}}`,
|
|
79
|
+
],
|
|
80
|
+
["", ...(0, approxOrEqual_1.approxOrEqual)(vce, 2)],
|
|
81
|
+
])}
|
|
82
|
+
|
|
83
|
+
L'écart-type est donc :
|
|
84
|
+
|
|
85
|
+
$$
|
|
86
|
+
\\sigma = \\sqrt{V} ${(0, approxOrEqual_1.approxOrEqual)(sigma, 2).join("")}
|
|
87
|
+
$$`;
|
|
88
|
+
};
|
|
89
|
+
const getKeys = (identifiers) => {
|
|
90
|
+
return [];
|
|
91
|
+
};
|
|
92
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
93
|
+
return (0, sqrtVEA_1.sqrtVEA)(ans, answer, { decimalApproxAllowed: 0.01 });
|
|
94
|
+
};
|
|
95
|
+
const getStandardDeviationListQuestion = (ops) => {
|
|
96
|
+
const nbValues = (0, randint_1.randint)(4, 7);
|
|
97
|
+
const values = [];
|
|
98
|
+
for (let i = 0; i < nbValues; i++) {
|
|
99
|
+
values.push((0, randint_1.randint)(1, 15));
|
|
100
|
+
}
|
|
101
|
+
const identifiers = {
|
|
102
|
+
sortedValues: values.sort((a, b) => a - b),
|
|
103
|
+
};
|
|
104
|
+
const question = {
|
|
105
|
+
answer: getAnswer(identifiers),
|
|
106
|
+
instruction: getInstruction(identifiers),
|
|
107
|
+
keys: getKeys(identifiers),
|
|
108
|
+
answerFormat: "tex",
|
|
109
|
+
identifiers,
|
|
110
|
+
hint: getHint(identifiers),
|
|
111
|
+
correction: getCorrection(identifiers),
|
|
112
|
+
};
|
|
113
|
+
return question;
|
|
114
|
+
};
|
|
115
|
+
exports.standardDeviationList = {
|
|
116
|
+
id: "standardDeviationList",
|
|
117
|
+
connector: "=",
|
|
118
|
+
label: "Calcul de l'écart-type d'une liste de valeurs",
|
|
119
|
+
isSingleStep: true,
|
|
120
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getStandardDeviationListQuestion(opts), nb),
|
|
121
|
+
qcmTimer: 60,
|
|
122
|
+
freeTimer: 60,
|
|
123
|
+
getPropositions,
|
|
124
|
+
isAnswerValid,
|
|
125
|
+
subject: "Mathématiques",
|
|
126
|
+
getInstruction,
|
|
127
|
+
getHint,
|
|
128
|
+
getCorrection,
|
|
129
|
+
getAnswer,
|
|
130
|
+
hasHintAndCorrection: true,
|
|
131
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
sortedValues: number[];
|
|
4
|
+
effectifs: number[];
|
|
5
|
+
};
|
|
6
|
+
export declare const standardDeviationTable: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=standardDeviationTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standardDeviationTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/standardDeviationTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AA0IF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
|