math-exercises 2.2.78 → 2.2.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/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts +5 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.js +95 -20
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.js +104 -26
- package/lib/exercises/math/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/firstDegreeDerivative.js +44 -5
- package/lib/exercises/math/derivation/derivative/lnDerivativeOne.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeOne.js +17 -7
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +46 -27
- package/lib/exercises/math/derivation/derivative/lnDerivativeTwo.js +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +57 -26
- package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.js +50 -8
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.js +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +67 -13
- package/lib/exercises/math/derivation/derivative/usualderivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/usualderivative.js +1 -2
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.js +66 -27
- package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequation.js +57 -36
- package/lib/exercises/math/functions/exponential/expEquation.js +1 -1
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts +9 -0
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.js +124 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts +2 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/index.js +17 -0
- package/lib/exercises/math/functions/index.d.ts +1 -0
- package/lib/exercises/math/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/index.js +1 -0
- package/lib/exercises/math/functions/integral/integralFractions.js +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.js +6 -2
- package/lib/exercises/math/functions/logarithm/logEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logEquation.js +22 -14
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logPowerEquation.js +14 -12
- package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logSimplifiying.js +36 -16
- package/lib/exercises/math/geometry/areas/rectangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rectangleArea.js +5 -2
- package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +4 -4
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/matrices/matrixInversibilityDomain.js +1 -0
- package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/applyPercent.js +2 -0
- package/lib/exercises/math/percent/findEndValueAfterEvolution.d.ts +8 -0
- package/lib/exercises/math/percent/findEndValueAfterEvolution.d.ts.map +1 -0
- package/lib/exercises/math/percent/findEndValueAfterEvolution.js +104 -0
- package/lib/exercises/math/percent/index.d.ts +1 -0
- package/lib/exercises/math/percent/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/index.js +1 -0
- package/lib/exercises/math/powers/index.d.ts +1 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +1 -0
- package/lib/exercises/math/powers/powersMixOperations.d.ts +11 -0
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -0
- package/lib/exercises/math/powers/powersMixOperations.js +99 -0
- package/lib/exercises/math/primitive/logarithmePrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/logarithmePrimitive.js +11 -3
- package/lib/exercises/math/sampling/confidenceInterval.d.ts +9 -0
- package/lib/exercises/math/sampling/confidenceInterval.d.ts.map +1 -0
- package/lib/exercises/math/sampling/confidenceInterval.js +134 -0
- package/lib/exercises/math/sampling/fluctuationInterval.d.ts +9 -0
- package/lib/exercises/math/sampling/fluctuationInterval.d.ts.map +1 -0
- package/lib/exercises/math/sampling/fluctuationInterval.js +131 -0
- package/lib/exercises/math/sampling/index.d.ts +4 -0
- package/lib/exercises/math/sampling/index.d.ts.map +1 -0
- package/lib/exercises/math/sampling/index.js +19 -0
- package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts +11 -0
- package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts.map +1 -0
- package/lib/exercises/math/sampling/isSamplingRepresentative.js +116 -0
- package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts +9 -0
- package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricVariations.js +124 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts +1 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +1 -0
- package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.js +11 -11
- package/lib/exercises/options/inequationSolutionFormat.d.ts +3 -0
- package/lib/exercises/options/inequationSolutionFormat.d.ts.map +1 -0
- package/lib/exercises/options/inequationSolutionFormat.js +12 -0
- package/lib/exercises/pc/pH.js +1 -1
- package/lib/index.d.ts +35 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/integer/integer.d.ts +1 -1
- package/lib/math/numbers/rationals/rational.d.ts +3 -1
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.js +3 -1
- package/lib/math/numbers/reals/real.d.ts +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +6 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.d.ts +5 -2
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +40 -3
- package/lib/tree/nodes/numbers/numberNode.d.ts +2 -2
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +7 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +15 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +8 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +4 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts +6 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +126 -2
- package/lib/tree/nodes/sets/intervalNode.d.ts +2 -2
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +2 -2
- package/lib/tree/nodes/sets/setNode.d.ts +1 -0
- package/lib/tree/nodes/sets/setNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +1 -1
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +2 -1
- package/lib/tree/parsers/inequationParser.d.ts +7 -0
- package/lib/tree/parsers/inequationParser.d.ts.map +1 -0
- package/lib/tree/parsers/inequationParser.js +30 -0
- package/lib/tree/parsers/intervalParser.d.ts +8 -0
- package/lib/tree/parsers/intervalParser.d.ts.map +1 -0
- package/lib/tree/parsers/intervalParser.js +44 -0
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +29 -6
- package/lib/tree/parsers/monomParser.d.ts +1 -3
- package/lib/tree/parsers/monomParser.d.ts.map +1 -1
- package/lib/tree/parsers/monomParser.js +7 -129
- package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
- package/lib/tree/parsers/polynomialParser.js +2 -1
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/powerParser.d.ts.map +1 -1
- package/lib/tree/parsers/powerParser.js +2 -1
- package/lib/tree/parsers/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/trinomParser.js +2 -2
- package/lib/tree/parsers/unionIntervalParser.d.ts +9 -0
- package/lib/tree/parsers/unionIntervalParser.d.ts.map +1 -0
- package/lib/tree/parsers/unionIntervalParser.js +26 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
|
|
@@ -23,3 +23,4 @@ __exportStar(require("./powersOfTenToDecimal"), exports);
|
|
|
23
23
|
__exportStar(require("./powersPower"), exports);
|
|
24
24
|
__exportStar(require("./powersProduct"), exports);
|
|
25
25
|
__exportStar(require("./scientificToDecimal"), exports);
|
|
26
|
+
__exportStar(require("./powersMixOperations"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
k: number;
|
|
6
|
+
l: number;
|
|
7
|
+
m: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const powersMixOperations: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=powersMixOperations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"powersMixOperations.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersMixOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwFF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAgBrD,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.powersMixOperations = void 0;
|
|
4
|
+
const exercise_1 = require("../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
|
+
const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
|
|
8
|
+
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
9
|
+
const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
|
|
10
|
+
const powerParser_1 = require("../../../tree/parsers/powerParser");
|
|
11
|
+
const doWhile_1 = require("../../../utils/doWhile");
|
|
12
|
+
const getStatementNode = (identifiers) => {
|
|
13
|
+
const { a, b, k, l, m } = identifiers;
|
|
14
|
+
const n = k + l * m;
|
|
15
|
+
return (0, fractionNode_1.frac)((0, multiplyNode_1.multiply)((0, powerNode_1.power)(a, k), (0, powerNode_1.power)((0, powerNode_1.power)(a, l), m)), (0, powerNode_1.power)(b, n));
|
|
16
|
+
};
|
|
17
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
18
|
+
const propositions = [];
|
|
19
|
+
const { a, b, k, l, m } = identifiers;
|
|
20
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
21
|
+
const ratio = (0, fractionNode_1.frac)(a, b).simplify();
|
|
22
|
+
while (propositions.length < n) {
|
|
23
|
+
const rand = (0, randint_1.randint)(2, 10);
|
|
24
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, powerNode_1.power)(ratio, rand).toTex());
|
|
25
|
+
}
|
|
26
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
27
|
+
};
|
|
28
|
+
const getAnswer = (identifiers) => {
|
|
29
|
+
const statement = getStatementNode(identifiers);
|
|
30
|
+
return statement.simplify({ keepPowers: true }).toTex();
|
|
31
|
+
};
|
|
32
|
+
const getInstruction = (identifiers) => {
|
|
33
|
+
return `Écrire sous la forme d'une seule puissance :
|
|
34
|
+
|
|
35
|
+
$$
|
|
36
|
+
${getStatementNode(identifiers).toTex()}
|
|
37
|
+
$$`;
|
|
38
|
+
};
|
|
39
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {
|
|
40
|
+
// return ``;
|
|
41
|
+
// };
|
|
42
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
|
|
43
|
+
// return ``;
|
|
44
|
+
// };
|
|
45
|
+
const getKeys = (identifiers) => {
|
|
46
|
+
return [];
|
|
47
|
+
};
|
|
48
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
49
|
+
try {
|
|
50
|
+
const parsed = (0, powerParser_1.powerParser)(ans);
|
|
51
|
+
if (!parsed)
|
|
52
|
+
return false;
|
|
53
|
+
return parsed.simplify({ keepPowers: true }).toTex() === answer;
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const getPowersMixOperationsQuestion = (ops) => {
|
|
60
|
+
const finalPower = (0, randint_1.randint)(2, 10);
|
|
61
|
+
const a = (0, randint_1.randint)(2, 10);
|
|
62
|
+
const b = (0, randint_1.randint)(2, 10, [a]);
|
|
63
|
+
const l = (0, randint_1.randint)(-5, 6, [0, 1]);
|
|
64
|
+
const m = (0, doWhile_1.doWhile)(() => (0, randint_1.randint)(2, 6), (x) => x * l === finalPower);
|
|
65
|
+
const k = finalPower - l * m;
|
|
66
|
+
const identifiers = {
|
|
67
|
+
a,
|
|
68
|
+
b,
|
|
69
|
+
k,
|
|
70
|
+
l,
|
|
71
|
+
m,
|
|
72
|
+
};
|
|
73
|
+
const question = {
|
|
74
|
+
answer: getAnswer(identifiers),
|
|
75
|
+
instruction: getInstruction(identifiers),
|
|
76
|
+
keys: getKeys(identifiers),
|
|
77
|
+
answerFormat: "tex",
|
|
78
|
+
identifiers,
|
|
79
|
+
// hint: getHint(identifiers),
|
|
80
|
+
// correction: getCorrection(identifiers),
|
|
81
|
+
};
|
|
82
|
+
return question;
|
|
83
|
+
};
|
|
84
|
+
exports.powersMixOperations = {
|
|
85
|
+
id: "powersMixOperations",
|
|
86
|
+
connector: "=",
|
|
87
|
+
label: "Calculs avec des puissances : mélange d'opérations",
|
|
88
|
+
isSingleStep: true,
|
|
89
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getPowersMixOperationsQuestion(opts), nb),
|
|
90
|
+
qcmTimer: 60,
|
|
91
|
+
freeTimer: 60,
|
|
92
|
+
getPropositions,
|
|
93
|
+
isAnswerValid,
|
|
94
|
+
subject: "Mathématiques",
|
|
95
|
+
getInstruction,
|
|
96
|
+
// getHint,
|
|
97
|
+
// getCorrection,
|
|
98
|
+
getAnswer,
|
|
99
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logarithmePrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/logarithmePrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"logarithmePrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/logarithmePrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGR,YAAY,EAEZ,iBAAiB,EAIlB,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAKF,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,WAAW,CAsBjE,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,YAAY,CAAC,WAAW,CAsCxE,CAAC;AAeF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
|
|
@@ -13,19 +13,27 @@ const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
|
|
|
13
13
|
const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
|
|
14
14
|
const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
|
|
15
15
|
const shuffle_1 = require("../../../utils/alea/shuffle");
|
|
16
|
+
const getKeys = () => {
|
|
17
|
+
return ["x", "C", "lnBrackets", "abs"];
|
|
18
|
+
};
|
|
16
19
|
const getLogarithmePrimitive = () => {
|
|
17
20
|
const u = polynomial_1.PolynomialConstructor.randomWithOrder((0, randint_1.randint)(1, 3));
|
|
18
21
|
const uTree = u.toTree();
|
|
19
22
|
const selectedFunction = new fractionNode_1.FractionNode(u.derivate().toTree(), uTree);
|
|
20
23
|
const integratedFuction = new logNode_1.LogNode(new absNode_1.AbsNode(uTree));
|
|
21
24
|
const answer = new addNode_1.AddNode(integratedFuction, new variableNode_1.VariableNode("C")).toTex();
|
|
25
|
+
const identifiers = { coeffs: u.coefficients };
|
|
22
26
|
const question = {
|
|
23
|
-
instruction: `Déterminer la forme générale des primitives de la fonction $f$ définie par
|
|
27
|
+
instruction: `Déterminer la forme générale des primitives de la fonction $f$ définie par :
|
|
28
|
+
|
|
29
|
+
$$
|
|
30
|
+
f(x) = ${selectedFunction.toTex()}
|
|
31
|
+
$$`,
|
|
24
32
|
startStatement: `F(x)`,
|
|
25
33
|
answer,
|
|
26
|
-
keys:
|
|
34
|
+
keys: getKeys(identifiers),
|
|
27
35
|
answerFormat: "tex",
|
|
28
|
-
identifiers
|
|
36
|
+
identifiers,
|
|
29
37
|
};
|
|
30
38
|
return question;
|
|
31
39
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confidenceInterval.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sampling/confidenceInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAyHF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAiBpD,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.confidenceInterval = void 0;
|
|
4
|
+
const exercise_1 = require("../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const randfloat_1 = require("../../../math/utils/random/randfloat");
|
|
7
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
8
|
+
const round_1 = require("../../../math/utils/round");
|
|
9
|
+
const sqrtNode_1 = require("../../../tree/nodes/functions/sqrtNode");
|
|
10
|
+
const addNode_1 = require("../../../tree/nodes/operators/addNode");
|
|
11
|
+
const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
|
|
12
|
+
const substractNode_1 = require("../../../tree/nodes/operators/substractNode");
|
|
13
|
+
const closure_1 = require("../../../tree/nodes/sets/closure");
|
|
14
|
+
const intervalNode_1 = require("../../../tree/nodes/sets/intervalNode");
|
|
15
|
+
const intervalParser_1 = require("../../../tree/parsers/intervalParser");
|
|
16
|
+
const coinFlip_1 = require("../../../utils/alea/coinFlip");
|
|
17
|
+
const alignTex_1 = require("../../../utils/latex/alignTex");
|
|
18
|
+
const approxOrEqual_1 = require("../../../utils/latex/approxOrEqual");
|
|
19
|
+
const getPropositions = (nb, { answer, n, k, wordingType }) => {
|
|
20
|
+
const propositions = [];
|
|
21
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
22
|
+
while (propositions.length < nb) {
|
|
23
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, getAnswer({
|
|
24
|
+
n: (0, coinFlip_1.coinFlip)() ? n : 50 * (0, randint_1.randint)(1, 20),
|
|
25
|
+
k: (0, coinFlip_1.coinFlip)() ? k : (0, randfloat_1.randfloat)(0.2, 0.8, 2),
|
|
26
|
+
wordingType,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
return (0, exercise_1.shuffleProps)(propositions, nb);
|
|
30
|
+
};
|
|
31
|
+
const getAnswer = (identifiers) => {
|
|
32
|
+
const { k, n } = identifiers;
|
|
33
|
+
const freq = k / n;
|
|
34
|
+
const oneOverSqrt = 1 / Math.sqrt(n);
|
|
35
|
+
const a = (0, round_1.round)(freq - oneOverSqrt, 2);
|
|
36
|
+
const b = (0, round_1.round)(freq + oneOverSqrt, 2);
|
|
37
|
+
return new intervalNode_1.IntervalNode(a.toTree(), b.toTree(), closure_1.ClosureType.FF).toTex();
|
|
38
|
+
};
|
|
39
|
+
const getInstruction = (identifiers) => {
|
|
40
|
+
const { k, n, wordingType } = identifiers;
|
|
41
|
+
switch (wordingType) {
|
|
42
|
+
case 1:
|
|
43
|
+
return `Un sondage effectué au sein d'un lycée montre que $${k}$ des $${n}$ élèves ont subi du harcèlement scolaire au lycée. À partir de ce sondage, à quel intervalle devrait appartenir la proportion nationale $p$ du harcèlement scolaire au lycée, au seuil de $95\\%$ ?`;
|
|
44
|
+
case 2:
|
|
45
|
+
return `Une étude sur la consommation de boissons énergétiques révèle que, sur un échantillon de $${n}$ personnes, $${k}$ déclarent en consommer régulièrement. À partir de cette étude, à quel intervalle devrait appartenir la proportion nationale $p$ de consomateurs de boissons énergétiques, au seuil de $95\\%$ ?`;
|
|
46
|
+
case 3:
|
|
47
|
+
default:
|
|
48
|
+
return `Une enquête relève que sur un échantillon de $${n}$ collégiens, $${k}$ utilisent les réseaux sociaux quotidiennement. À partir de cette enquête, à quel intervalle devrait appartenir la proportion nationale $p$ de collégiens qui utilisent les réseaux sociaux quotidiennement, au seuil de $95\\%$ ?`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const getHint = (identifiers) => {
|
|
52
|
+
return `Si $f$ est la fréquence observée et $n$ est la taille de l'échantillon, alors l'intervalle de confiance au seuil de $95\\%$ est :
|
|
53
|
+
|
|
54
|
+
$$
|
|
55
|
+
\\left[f-\\frac{1}{\\sqrt{n}}; f+\\frac{1}{\\sqrt{n}}\\right]
|
|
56
|
+
$$
|
|
57
|
+
|
|
58
|
+
Cela signifie qu'on peut affirmer avec un taux de certitude de $95\\%$ que la proportion théorique est comprise entre $f-\\frac{1}{\\sqrt{n}}$ et $f+\\frac{1}{\\sqrt{n}}$.`;
|
|
59
|
+
};
|
|
60
|
+
const getCorrection = (identifiers) => {
|
|
61
|
+
const { k, n } = identifiers;
|
|
62
|
+
const freq = (0, round_1.round)(k / n, 2);
|
|
63
|
+
const oneOverSqrt = 1 / Math.sqrt(n);
|
|
64
|
+
const answer = getAnswer(identifiers);
|
|
65
|
+
const a = (0, substractNode_1.substract)(freq, (0, fractionNode_1.frac)(1, (0, sqrtNode_1.sqrt)(n))).toTex();
|
|
66
|
+
const b = (0, addNode_1.add)(freq, (0, fractionNode_1.frac)(1, (0, sqrtNode_1.sqrt)(n))).toTex();
|
|
67
|
+
return `La fréquence observée $f$ est $f = ${(0, fractionNode_1.frac)(k, n).toTex()} ${(0, approxOrEqual_1.approxOrEqual)(k / n, 2).join("")}$.
|
|
68
|
+
|
|
69
|
+
La taille de l'échantillon $n$ est $n = ${n.frenchify()}$.
|
|
70
|
+
|
|
71
|
+
On sait que l'intervalle de confiance au seuil de $95\\%$ est :
|
|
72
|
+
|
|
73
|
+
$$
|
|
74
|
+
\\left[f-\\frac{1}{\\sqrt{n}}; f+\\frac{1}{\\sqrt{n}}\\right]
|
|
75
|
+
$$
|
|
76
|
+
|
|
77
|
+
On peut donc affirmer avec un taux de certitude de $95\\%$ que la probabilité théorique $p$ devrait appartenir à l'intervalle :
|
|
78
|
+
|
|
79
|
+
${(0, alignTex_1.alignTex)([
|
|
80
|
+
["", `\\left[ ${a} ; ${b} \\right]`],
|
|
81
|
+
["=", answer],
|
|
82
|
+
])}
|
|
83
|
+
`;
|
|
84
|
+
};
|
|
85
|
+
const getKeys = (identifiers) => {
|
|
86
|
+
return ["lbracket", "semicolon", "rbracket"];
|
|
87
|
+
};
|
|
88
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
89
|
+
try {
|
|
90
|
+
const parsed = (0, intervalParser_1.intervalParser)(ans);
|
|
91
|
+
if (!parsed)
|
|
92
|
+
return false;
|
|
93
|
+
return parsed.toTex() === answer;
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const getConfidenceIntervalQuestion = (ops) => {
|
|
100
|
+
const n = 50 * (0, randint_1.randint)(1, 20);
|
|
101
|
+
const k = (0, randint_1.randint)(10, n - 10);
|
|
102
|
+
const identifiers = {
|
|
103
|
+
k,
|
|
104
|
+
n,
|
|
105
|
+
wordingType: (0, randint_1.randint)(1, 4),
|
|
106
|
+
};
|
|
107
|
+
const question = {
|
|
108
|
+
answer: getAnswer(identifiers),
|
|
109
|
+
instruction: getInstruction(identifiers),
|
|
110
|
+
keys: getKeys(identifiers),
|
|
111
|
+
answerFormat: "tex",
|
|
112
|
+
identifiers,
|
|
113
|
+
hint: getHint(identifiers),
|
|
114
|
+
correction: getCorrection(identifiers),
|
|
115
|
+
};
|
|
116
|
+
return question;
|
|
117
|
+
};
|
|
118
|
+
exports.confidenceInterval = {
|
|
119
|
+
id: "confidenceInterval",
|
|
120
|
+
connector: "=",
|
|
121
|
+
label: "Déterminer l'intervalle de confiance au seuil de $95\\%$",
|
|
122
|
+
isSingleStep: true,
|
|
123
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getConfidenceIntervalQuestion(opts), nb),
|
|
124
|
+
qcmTimer: 60,
|
|
125
|
+
freeTimer: 60,
|
|
126
|
+
getPropositions,
|
|
127
|
+
isAnswerValid,
|
|
128
|
+
subject: "Mathématiques",
|
|
129
|
+
getInstruction,
|
|
130
|
+
getHint,
|
|
131
|
+
getCorrection,
|
|
132
|
+
getAnswer,
|
|
133
|
+
hasHintAndCorrection: true,
|
|
134
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
p: number;
|
|
4
|
+
n: number;
|
|
5
|
+
wordingType: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const fluctuationInterval: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=fluctuationInterval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluctuationInterval.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sampling/fluctuationInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAiHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fluctuationInterval = void 0;
|
|
4
|
+
const exercise_1 = require("../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const randfloat_1 = require("../../../math/utils/random/randfloat");
|
|
7
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
8
|
+
const round_1 = require("../../../math/utils/round");
|
|
9
|
+
const sqrtNode_1 = require("../../../tree/nodes/functions/sqrtNode");
|
|
10
|
+
const addNode_1 = require("../../../tree/nodes/operators/addNode");
|
|
11
|
+
const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
|
|
12
|
+
const substractNode_1 = require("../../../tree/nodes/operators/substractNode");
|
|
13
|
+
const closure_1 = require("../../../tree/nodes/sets/closure");
|
|
14
|
+
const intervalNode_1 = require("../../../tree/nodes/sets/intervalNode");
|
|
15
|
+
const intervalParser_1 = require("../../../tree/parsers/intervalParser");
|
|
16
|
+
const coinFlip_1 = require("../../../utils/alea/coinFlip");
|
|
17
|
+
const alignTex_1 = require("../../../utils/latex/alignTex");
|
|
18
|
+
const getPropositions = (nb, { answer, n, p, wordingType }) => {
|
|
19
|
+
const propositions = [];
|
|
20
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
21
|
+
while (propositions.length < nb) {
|
|
22
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, getAnswer({
|
|
23
|
+
n: (0, coinFlip_1.coinFlip)() ? n : 50 * (0, randint_1.randint)(1, 20),
|
|
24
|
+
p: (0, coinFlip_1.coinFlip)() ? p : (0, randfloat_1.randfloat)(0.2, 0.8, 2),
|
|
25
|
+
wordingType,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
return (0, exercise_1.shuffleProps)(propositions, nb);
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
//p-1/sqrt(n), p+1/sqrt(n)
|
|
32
|
+
const { p, n } = identifiers;
|
|
33
|
+
const oneOverSqrt = 1 / Math.sqrt(n);
|
|
34
|
+
const a = (0, round_1.round)(p - oneOverSqrt, 2);
|
|
35
|
+
const b = (0, round_1.round)(p + oneOverSqrt, 2);
|
|
36
|
+
return new intervalNode_1.IntervalNode(a.toTree(), b.toTree(), closure_1.ClosureType.FF).toTex();
|
|
37
|
+
};
|
|
38
|
+
const getInstruction = (identifiers) => {
|
|
39
|
+
const { p, n } = identifiers;
|
|
40
|
+
const pPercent = (0, round_1.round)(p * 100, 1);
|
|
41
|
+
switch (identifiers.wordingType) {
|
|
42
|
+
case 1:
|
|
43
|
+
return `Une urne opaque contient $${pPercent}\\%$ de boules rouges. On effectue $${n}$ tirages avec remise. On note $f$ la fréquence des boules rouges tirées. Au seuil de $95\\%$, à quel intervalle devrait appartenir $f$ ? Arrondir les données au centième.`;
|
|
44
|
+
case 2:
|
|
45
|
+
return `Une loterie contient $${pPercent}\\%$ de tickets gagnants. Un joueur achète $${n}$ tickets. On note $f$ la fréquence des tickets gagnants achetés par le joueur. Au seuil de $95\\%$, à quel intervalle devrait appartenir $f$ ? Arrondir les données au centième.`;
|
|
46
|
+
case 3:
|
|
47
|
+
default:
|
|
48
|
+
return `Un fabricant prétend que $${pPercent}\\%$ de ses produits sont recyclables. Dans un contrôle qualité sur un échantillon de $${n}$ produits, quel sera l'intervalle probable pour la fréquence observée de produits recyclables, avec un seuil de confiance de 99% ?`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const getHint = (identifiers) => {
|
|
52
|
+
return `Si $p$ est la proportion théorique et $n$ est la taille de l'échantillon, alors l'intervalle de fluctuation au seuil de $95\\%$ est :
|
|
53
|
+
|
|
54
|
+
$$
|
|
55
|
+
\\left[p-\\frac{1}{\\sqrt{n}}; p+\\frac{1}{\\sqrt{n}}\\right]
|
|
56
|
+
$$
|
|
57
|
+
|
|
58
|
+
Cela signifie que dans $95\\%$ des cas, la fréquence $f$ observée est comprise entre $p-\\frac{1}{\\sqrt{n}}$ et $p+\\frac{1}{\\sqrt{n}}$.`;
|
|
59
|
+
};
|
|
60
|
+
const getCorrection = (identifiers) => {
|
|
61
|
+
const { p, n } = identifiers;
|
|
62
|
+
const pPercent = (0, round_1.round)(p * 100, 1);
|
|
63
|
+
const answer = getAnswer(identifiers);
|
|
64
|
+
const a = (0, substractNode_1.substract)(p, (0, fractionNode_1.frac)(1, (0, sqrtNode_1.sqrt)(n))).toTex();
|
|
65
|
+
const b = (0, addNode_1.add)(p, (0, fractionNode_1.frac)(1, (0, sqrtNode_1.sqrt)(n))).toTex();
|
|
66
|
+
return `La proportion théorique $p$ est $p = ${p.frenchify()}$. La taille de l'échantillon $n$ est $n = ${n.frenchify()}$.
|
|
67
|
+
|
|
68
|
+
On sait que l'intervalle de fluctuation au seuil de $95\\%$ est :
|
|
69
|
+
|
|
70
|
+
$$
|
|
71
|
+
\\left[p-\\frac{1}{\\sqrt{n}}; p+\\frac{1}{\\sqrt{n}}\\right]
|
|
72
|
+
$$
|
|
73
|
+
|
|
74
|
+
Dans $95\\%$ des cas, on peut donc affirmer que la fréquence $f$ observée devrait appartenir à l'intervalle :
|
|
75
|
+
|
|
76
|
+
${(0, alignTex_1.alignTex)([
|
|
77
|
+
["", `\\left[ ${a} ; ${b} \\right]`],
|
|
78
|
+
["=", answer],
|
|
79
|
+
])}
|
|
80
|
+
`;
|
|
81
|
+
};
|
|
82
|
+
const getKeys = (identifiers) => {
|
|
83
|
+
return ["lbracket", "semicolon", "rbracket"];
|
|
84
|
+
};
|
|
85
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
86
|
+
try {
|
|
87
|
+
const parsed = (0, intervalParser_1.intervalParser)(ans);
|
|
88
|
+
if (!parsed)
|
|
89
|
+
return false;
|
|
90
|
+
return parsed.toTex() === answer;
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const getFluctuationIntervalQuestion = (ops) => {
|
|
97
|
+
const p = (0, randfloat_1.randfloat)(0.2, 0.8, 2);
|
|
98
|
+
const n = 50 * (0, randint_1.randint)(1, 20);
|
|
99
|
+
const identifiers = {
|
|
100
|
+
p,
|
|
101
|
+
n,
|
|
102
|
+
wordingType: (0, randint_1.randint)(1, 4),
|
|
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.fluctuationInterval = {
|
|
116
|
+
id: "fluctuationInterval",
|
|
117
|
+
connector: "=",
|
|
118
|
+
label: "Déterminer l'intervalle de fluctuation au seuil de $95\\%$",
|
|
119
|
+
isSingleStep: true,
|
|
120
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFluctuationIntervalQuestion(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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sampling/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./fluctuationInterval"), exports);
|
|
18
|
+
__exportStar(require("./confidenceInterval"), exports);
|
|
19
|
+
__exportStar(require("./isSamplingRepresentative"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
p: number;
|
|
4
|
+
k: number;
|
|
5
|
+
n: number;
|
|
6
|
+
isRepresentative: boolean;
|
|
7
|
+
wordingType: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const isSamplingRepresentative: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=isSamplingRepresentative.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSamplingRepresentative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sampling/isSamplingRepresentative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA4GF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAiB1D,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSamplingRepresentative = void 0;
|
|
4
|
+
const exercise_1 = require("../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const randfloat_1 = require("../../../math/utils/random/randfloat");
|
|
7
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
8
|
+
const round_1 = require("../../../math/utils/round");
|
|
9
|
+
const coinFlip_1 = require("../../../utils/alea/coinFlip");
|
|
10
|
+
const getPropositions = (n, { answer }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
(0, exercise_1.addValidProp)(propositions, answer, "raw");
|
|
13
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Oui", "raw");
|
|
14
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Non", "raw");
|
|
15
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir", "raw");
|
|
16
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
return identifiers.isRepresentative ? "Oui" : "Non";
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers) => {
|
|
22
|
+
const { p, k, n, wordingType } = identifiers;
|
|
23
|
+
switch (wordingType) {
|
|
24
|
+
case 1:
|
|
25
|
+
return `La fréquence des yeux bleus en France est d'environ $${p.frenchify()}$. On a prélevé un échantillon de $${n}$ individus dont $${k}$ ont les yeux bleus. Cet échantillon est-il représentatif de la population pour ce caractère ?`;
|
|
26
|
+
case 2:
|
|
27
|
+
return `La proportion de français possédant un animal de compagnie est d'environ $${p.frenchify()}$. On a prélevé un échantillon de $${n}$ individus dont $${k}$ possèdent un animal de compagnie. Cet échantillon est-il représentatif de la population pour ce caractère ?`;
|
|
28
|
+
case 3:
|
|
29
|
+
default:
|
|
30
|
+
return `La proportion de français lisant au moins un livre par an est d'environ $${p.frenchify()}$. On a prélevé un échantillon de $${n}$ individus dont $${k}$ lisent au moins un livre par an. Cet échantillon est-il représentatif de la population pour ce caractère ?`;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const getHint = (identifiers) => {
|
|
34
|
+
return `Déterminer l'intervalle de fluctuation au seuil de $95\\%$ :
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
\\left[p-\\frac{1}{\\sqrt{n}}; p+\\frac{1}{\\sqrt{n}}\\right]
|
|
38
|
+
$$
|
|
39
|
+
|
|
40
|
+
où $p$ est la proportion théorique et $n$ est la taille de l'échantillon.
|
|
41
|
+
|
|
42
|
+
Si la fréquence $f$ observée est comprise dans cet intervalle, alors l'échantillon est représentatif de la population pour ce caractère, au seuil de $95\\%$.
|
|
43
|
+
`;
|
|
44
|
+
};
|
|
45
|
+
const getCorrection = (identifiers) => {
|
|
46
|
+
const { p, n, k } = identifiers;
|
|
47
|
+
return `L'échantillon est représentatif si la fréquence $f$ observée est comprise dans l'intervalle de fluctuation.
|
|
48
|
+
|
|
49
|
+
On détermine l'intervalle de fluctuation au seuil de $95\\%$ :
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
\\left[p-\\frac{1}{\\sqrt{n}}; p+\\frac{1}{\\sqrt{n}}\\right] \\approx \\left[${(0, round_1.round)(p - 1 / Math.sqrt(n), 2).frenchify()} ; ${(0, round_1.round)(p + 1 / Math.sqrt(n), 2).frenchify()} \\right]
|
|
53
|
+
$$
|
|
54
|
+
|
|
55
|
+
Puis, on calcule la fréquence $f$ observée :
|
|
56
|
+
|
|
57
|
+
$$
|
|
58
|
+
f = \\frac{${k}}{${n}} \\approx ${(0, round_1.round)(k / n, 2).frenchify()}
|
|
59
|
+
$$
|
|
60
|
+
|
|
61
|
+
${identifiers.isRepresentative
|
|
62
|
+
? `Puisque $f$ appartient bien à l'intervalle de fluctuation, on peut affirmer que l'échantillon est représentatif au seuil de $95\\%$.`
|
|
63
|
+
: `Puisque $f$ n'appartient pas à l'intervalle de fluctuation, on peut affirmer que l'échantillon n'est pas représentatif au seuil de $95\\%$.`}`;
|
|
64
|
+
};
|
|
65
|
+
const getKeys = (identifiers) => {
|
|
66
|
+
return [];
|
|
67
|
+
};
|
|
68
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
69
|
+
throw Error("VEA not implemented");
|
|
70
|
+
};
|
|
71
|
+
const getIsSamplingRepresentativeQuestion = (ops) => {
|
|
72
|
+
const p = (0, randfloat_1.randfloat)(0.2, 0.8, 2);
|
|
73
|
+
const n = 50 * (0, randint_1.randint)(1, 20);
|
|
74
|
+
const isRepresentative = (0, coinFlip_1.coinFlip)();
|
|
75
|
+
//k est dans n*(p-1/sqrt(n)), n*(p+1/sqrt(n))
|
|
76
|
+
const interval = [p - 1 / Math.sqrt(n), p + 1 / Math.sqrt(n)];
|
|
77
|
+
const k = isRepresentative
|
|
78
|
+
? (0, randint_1.randint)(Math.ceil(n * interval[0]), Math.floor(n * interval[1]))
|
|
79
|
+
: (0, coinFlip_1.coinFlip)()
|
|
80
|
+
? (0, randint_1.randint)(1, Math.floor(n * interval[0]))
|
|
81
|
+
: (0, randint_1.randint)(Math.ceil(n * interval[1]), n - 1);
|
|
82
|
+
const identifiers = {
|
|
83
|
+
p,
|
|
84
|
+
k,
|
|
85
|
+
n,
|
|
86
|
+
isRepresentative,
|
|
87
|
+
wordingType: (0, randint_1.randint)(1, 4),
|
|
88
|
+
};
|
|
89
|
+
const question = {
|
|
90
|
+
answer: getAnswer(identifiers),
|
|
91
|
+
instruction: getInstruction(identifiers),
|
|
92
|
+
keys: getKeys(identifiers),
|
|
93
|
+
answerFormat: "tex",
|
|
94
|
+
identifiers,
|
|
95
|
+
hint: getHint(identifiers),
|
|
96
|
+
correction: getCorrection(identifiers),
|
|
97
|
+
};
|
|
98
|
+
return question;
|
|
99
|
+
};
|
|
100
|
+
exports.isSamplingRepresentative = {
|
|
101
|
+
id: "isSamplingRepresentative",
|
|
102
|
+
label: "Déterminer si un échantillon est représentatif",
|
|
103
|
+
isSingleStep: true,
|
|
104
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getIsSamplingRepresentativeQuestion(opts), nb),
|
|
105
|
+
qcmTimer: 60,
|
|
106
|
+
freeTimer: 60,
|
|
107
|
+
getPropositions,
|
|
108
|
+
isAnswerValid,
|
|
109
|
+
subject: "Mathématiques",
|
|
110
|
+
getInstruction,
|
|
111
|
+
getHint,
|
|
112
|
+
getCorrection,
|
|
113
|
+
getAnswer,
|
|
114
|
+
hasHintAndCorrection: true,
|
|
115
|
+
answerType: "QCU",
|
|
116
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
q: NodeIdentifiers;
|
|
5
|
+
a: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const geometricVariations: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=geometricVariations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricVariations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricVariations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAM1C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
|