math-exercises 2.2.78 → 2.2.79

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.
Files changed (87) hide show
  1. package/lib/exercises/math/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -1
  2. package/lib/exercises/math/derivation/derivative/firstDegreeDerivative.js +44 -5
  3. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  4. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +57 -26
  5. package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
  6. package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.js +50 -8
  7. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
  8. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +67 -13
  9. package/lib/exercises/math/derivation/derivative/usualderivative.d.ts.map +1 -1
  10. package/lib/exercises/math/derivation/derivative/usualderivative.js +1 -2
  11. package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts +9 -0
  12. package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts.map +1 -0
  13. package/lib/exercises/math/functions/exponentials/exponentialsVariations.js +124 -0
  14. package/lib/exercises/math/functions/exponentials/index.d.ts +2 -0
  15. package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -0
  16. package/lib/exercises/math/functions/exponentials/index.js +17 -0
  17. package/lib/exercises/math/functions/index.d.ts +1 -0
  18. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  19. package/lib/exercises/math/functions/index.js +1 -0
  20. package/lib/exercises/math/geometry/areas/rectangleArea.d.ts.map +1 -1
  21. package/lib/exercises/math/geometry/areas/rectangleArea.js +5 -2
  22. package/lib/exercises/math/index.d.ts +1 -0
  23. package/lib/exercises/math/index.d.ts.map +1 -1
  24. package/lib/exercises/math/index.js +1 -0
  25. package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
  26. package/lib/exercises/math/percent/applyPercent.js +2 -0
  27. package/lib/exercises/math/percent/findEndValueAfterEvolution.d.ts +8 -0
  28. package/lib/exercises/math/percent/findEndValueAfterEvolution.d.ts.map +1 -0
  29. package/lib/exercises/math/percent/findEndValueAfterEvolution.js +104 -0
  30. package/lib/exercises/math/percent/index.d.ts +1 -0
  31. package/lib/exercises/math/percent/index.d.ts.map +1 -1
  32. package/lib/exercises/math/percent/index.js +1 -0
  33. package/lib/exercises/math/powers/index.d.ts +1 -0
  34. package/lib/exercises/math/powers/index.d.ts.map +1 -1
  35. package/lib/exercises/math/powers/index.js +1 -0
  36. package/lib/exercises/math/powers/powersMixOperations.d.ts +11 -0
  37. package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -0
  38. package/lib/exercises/math/powers/powersMixOperations.js +99 -0
  39. package/lib/exercises/math/sampling/confidenceInterval.d.ts +9 -0
  40. package/lib/exercises/math/sampling/confidenceInterval.d.ts.map +1 -0
  41. package/lib/exercises/math/sampling/confidenceInterval.js +134 -0
  42. package/lib/exercises/math/sampling/fluctuationInterval.d.ts +9 -0
  43. package/lib/exercises/math/sampling/fluctuationInterval.d.ts.map +1 -0
  44. package/lib/exercises/math/sampling/fluctuationInterval.js +131 -0
  45. package/lib/exercises/math/sampling/index.d.ts +4 -0
  46. package/lib/exercises/math/sampling/index.d.ts.map +1 -0
  47. package/lib/exercises/math/sampling/index.js +19 -0
  48. package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts +11 -0
  49. package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts.map +1 -0
  50. package/lib/exercises/math/sampling/isSamplingRepresentative.js +116 -0
  51. package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts +9 -0
  52. package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts.map +1 -0
  53. package/lib/exercises/math/sequences/geometric/geometricVariations.js +124 -0
  54. package/lib/exercises/math/sequences/geometric/index.d.ts +1 -0
  55. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  56. package/lib/exercises/math/sequences/geometric/index.js +1 -0
  57. package/lib/index.d.ts +29 -0
  58. package/lib/index.d.ts.map +1 -1
  59. package/lib/math/numbers/rationals/rational.d.ts +3 -1
  60. package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
  61. package/lib/math/numbers/rationals/rational.js +3 -1
  62. package/lib/playground.d.ts.map +1 -1
  63. package/lib/playground.js +6 -1
  64. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  65. package/lib/tree/nodes/operators/addNode.js +15 -1
  66. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  67. package/lib/tree/nodes/operators/fractionNode.js +8 -0
  68. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  69. package/lib/tree/nodes/operators/multiplyNode.js +4 -0
  70. package/lib/tree/nodes/polynomials/monomNode.d.ts +6 -0
  71. package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
  72. package/lib/tree/nodes/polynomials/monomNode.js +126 -2
  73. package/lib/tree/parsers/affineParser.d.ts.map +1 -1
  74. package/lib/tree/parsers/affineParser.js +2 -1
  75. package/lib/tree/parsers/intervalParser.d.ts +8 -0
  76. package/lib/tree/parsers/intervalParser.d.ts.map +1 -0
  77. package/lib/tree/parsers/intervalParser.js +38 -0
  78. package/lib/tree/parsers/monomParser.d.ts +1 -3
  79. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  80. package/lib/tree/parsers/monomParser.js +7 -129
  81. package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
  82. package/lib/tree/parsers/polynomialParser.js +2 -1
  83. package/lib/tree/parsers/powerParser.d.ts +1 -1
  84. package/lib/tree/parsers/powerParser.d.ts.map +1 -1
  85. package/lib/tree/parsers/powerParser.js +2 -1
  86. package/lib/tree/parsers/trinomParser.js +2 -2
  87. package/package.json +1 -1
@@ -35,3 +35,4 @@ __exportStar(require("./spaceGeometry"), exports);
35
35
  __exportStar(require("./squareRoots"), exports);
36
36
  __exportStar(require("./trigonometry"), exports);
37
37
  __exportStar(require("./python"), exports);
38
+ __exportStar(require("./sampling"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"applyPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/applyPercent.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAmFF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAwB9C,CAAC"}
1
+ {"version":3,"file":"applyPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/applyPercent.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAoFF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAwB9C,CAAC"}
@@ -65,6 +65,8 @@ const getPropositions = (n, { answer }) => {
65
65
  (0, exercise_1.addValidProp)(propositions, answer);
66
66
  while (propositions.length < n) {
67
67
  const ansNb = Number(answer.replace(",", "."));
68
+ if (ansNb === 0)
69
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-10, 10) + "");
68
70
  const deviation = Math.random() < 0.5 ? -1 : 1;
69
71
  const percentDeviation = Math.random() * 20 + 1;
70
72
  let wrongAnswer = ansNb + deviation * (percentDeviation / 100) * ansNb;
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ vd: number;
4
+ percentRate: number;
5
+ };
6
+ export declare const findEndValueAfterEvolution: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=findEndValueAfterEvolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findEndValueAfterEvolution.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/findEndValueAfterEvolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA4FF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAkB5D,CAAC"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findEndValueAfterEvolution = 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 round_1 = require("../../../math/utils/round");
8
+ const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
9
+ const euroParser_1 = require("../../../tree/parsers/euroParser");
10
+ const alignTex_1 = require("../../../utils/latex/alignTex");
11
+ const approxOrEqual_1 = require("../../../utils/latex/approxOrEqual");
12
+ const getPropositions = (n, { answer, percentRate, vd }) => {
13
+ const propositions = [];
14
+ (0, exercise_1.addValidProp)(propositions, answer);
15
+ const cm = 1 + percentRate / 100;
16
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, round_1.round)(vd * percentRate, 2).frenchify());
17
+ const invCm = 1 - percentRate / 100;
18
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, round_1.round)(vd * invCm, 2).frenchify());
19
+ while (propositions.length < n) {
20
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, round_1.round)((0, randfloat_1.randfloat)(1, 100, 2), 2).frenchify());
21
+ }
22
+ return (0, exercise_1.shuffleProps)(propositions, n);
23
+ };
24
+ const getAnswer = (identifiers) => {
25
+ const cm = 1 + identifiers.percentRate / 100;
26
+ const vf = (0, round_1.round)(identifiers.vd * cm, 2);
27
+ return vf.frenchify();
28
+ };
29
+ const getInstruction = (identifiers) => {
30
+ const evolution = identifiers.percentRate < 0 ? "baisse" : "hausse";
31
+ return `Le prix initial d'un objet est $${identifiers.vd.frenchify()}€$. Quel sera son prix après une ${evolution} de $${identifiers.percentRate.frenchify()}\\%$ ? Arrondir au centième.`;
32
+ };
33
+ const getHint = (identifiers) => {
34
+ return `Transforme le taux d'évolution en coefficient multiplicateur. Puis, multiplie le prix initial par ce coefficient multiplicateur.`;
35
+ };
36
+ const getCorrection = (identifiers) => {
37
+ const evolution = identifiers.percentRate < 0 ? "baisse" : "hausse";
38
+ const answer = getAnswer(identifiers);
39
+ const cm = (0, round_1.round)(1 + identifiers.percentRate / 100, 4);
40
+ const vd = identifiers.vd;
41
+ const percentRate = identifiers.percentRate;
42
+ return `Le coefficient multiplicateur associé à une ${evolution} de $${percentRate.frenchify()}\\%$ est :
43
+
44
+ ${(0, alignTex_1.alignTex)([
45
+ ["CM", "=", "1+\\frac{t}{100}"],
46
+ ["", "=", `1+\\frac{${percentRate.frenchify()}}{100}`],
47
+ ["", "=", cm.frenchify()],
48
+ ])}
49
+
50
+ Si on note $V_d$ la valeur de départ et $V_a$ la valeur d'arrivée, alors on sait que :
51
+
52
+ $$
53
+ V_d\\times CM = V_a
54
+ $$
55
+
56
+ Le prix final arrondi au centième est donc :
57
+
58
+ ${(0, alignTex_1.alignTex)([
59
+ ["V_a", "=", (0, multiplyNode_1.multiply)(vd.frenchify(), cm.frenchify()).toTex()],
60
+ ["", ...(0, approxOrEqual_1.approxOrEqual)(cm * vd, 2)],
61
+ ])}
62
+ `;
63
+ };
64
+ const getKeys = (identifiers) => {
65
+ return [];
66
+ };
67
+ const isAnswerValid = (ans, { answer }) => {
68
+ return (0, euroParser_1.euroParser)(ans) === answer + "€";
69
+ };
70
+ const getFindEndValueAfterEvolutionQuestion = () => {
71
+ const vd = (0, randfloat_1.randfloat)(1, 100, 2);
72
+ const percentRate = (0, randfloat_1.randfloat)(-100, 100, 2, [0]);
73
+ const identifiers = {
74
+ vd,
75
+ percentRate,
76
+ };
77
+ const question = {
78
+ answer: getAnswer(identifiers),
79
+ instruction: getInstruction(identifiers),
80
+ keys: getKeys(identifiers),
81
+ answerFormat: "tex",
82
+ identifiers,
83
+ hint: getHint(identifiers),
84
+ correction: getCorrection(identifiers),
85
+ };
86
+ return question;
87
+ };
88
+ exports.findEndValueAfterEvolution = {
89
+ id: "findEndValueAfterEvolution",
90
+ connector: "=",
91
+ label: "Retrouver un prix final à partir du prix initial et du taux d'évolution",
92
+ isSingleStep: true,
93
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFindEndValueAfterEvolutionQuestion, nb),
94
+ qcmTimer: 60,
95
+ freeTimer: 60,
96
+ ggbTimer: 60,
97
+ getPropositions,
98
+ isAnswerValid,
99
+ subject: "Mathématiques",
100
+ getAnswer,
101
+ getCorrection,
102
+ getHint,
103
+ hasHintAndCorrection: true,
104
+ };
@@ -14,4 +14,5 @@ export * from "./evolutionRateFromValues";
14
14
  export * from "./findStartValueAfterEvolution";
15
15
  export * from "./subPopulationEffectifFromPercent";
16
16
  export * from "./populationEffectifFromSubPopulation";
17
+ export * from "./findEndValueAfterEvolution";
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC"}
@@ -30,3 +30,4 @@ __exportStar(require("./evolutionRateFromValues"), exports);
30
30
  __exportStar(require("./findStartValueAfterEvolution"), exports);
31
31
  __exportStar(require("./subPopulationEffectifFromPercent"), exports);
32
32
  __exportStar(require("./populationEffectifFromSubPopulation"), exports);
33
+ __exportStar(require("./findEndValueAfterEvolution"), exports);
@@ -7,4 +7,5 @@ export * from "./powersOfTenToDecimal";
7
7
  export * from "./powersPower";
8
8
  export * from "./powersProduct";
9
9
  export * from "./scientificToDecimal";
10
+ export * from "./powersMixOperations";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -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
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ k: number;
4
+ n: number;
5
+ wordingType: number;
6
+ };
7
+ export declare const confidenceInterval: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=confidenceInterval.d.ts.map
@@ -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,4 @@
1
+ export * from "./fluctuationInterval";
2
+ export * from "./confidenceInterval";
3
+ export * from "./isSamplingRepresentative";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}