math-exercises 3.0.0 → 3.0.2
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/simpleDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistributivity.js +0 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +0 -2
- package/lib/exercises/math/dataRepresentations/index.d.ts +0 -1
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +1 -1
- package/lib/exercises/math/powers/powersProduct.d.ts +2 -1
- package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersProduct.js +15 -4
- package/lib/exercises/math/probaStat/basicStats/calculateFrequency.d.ts +10 -0
- package/lib/exercises/math/probaStat/basicStats/calculateFrequency.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicStats/calculateFrequency.js +100 -0
- package/lib/exercises/math/probaStat/basicStats/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/basicStats/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicStats/index.js +1 -0
- package/lib/exercises/math/probaStat/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFirstTermsSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFirstTermsSum.js +19 -8
- package/lib/exercises/math/sequences/arithmetic/firstIntegersSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/firstIntegersSum.js +52 -4
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.js +20 -9
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.js +19 -14
- package/lib/index.d.ts +6 -6
- package/lib/playground.d.ts +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +1 -14
- package/lib/tests/exoTest.d.ts +7 -0
- package/lib/tests/exoTest.d.ts.map +1 -0
- package/lib/tests/exoTest.js +46 -0
- package/lib/tests/exosTest.d.ts +3 -0
- package/lib/tests/exosTest.d.ts.map +1 -0
- package/lib/tests/exosTest.js +44 -0
- package/lib/tests/global.test.d.ts +2 -0
- package/lib/tests/global.test.d.ts.map +1 -0
- package/lib/tests/global.test.js +8 -0
- package/lib/tests/latexParser.test.d.ts +2 -0
- package/lib/tests/latexParser.test.d.ts.map +1 -0
- package/lib/tests/latexParser.test.js +51 -0
- package/lib/tests/manyPdfExos.test.d.ts +2 -0
- package/lib/tests/manyPdfExos.test.d.ts.map +1 -0
- package/lib/tests/manyPdfExos.test.js +19 -0
- package/lib/tests/ml.test.d.ts +2 -0
- package/lib/tests/ml.test.d.ts.map +1 -0
- package/lib/tests/ml.test.js +11 -0
- package/lib/tests/multiplySimplify.test.d.ts +2 -0
- package/lib/tests/multiplySimplify.test.d.ts.map +1 -0
- package/lib/tests/multiplySimplify.test.js +32 -0
- package/lib/tests/pdfExo.test.d.ts +2 -0
- package/lib/tests/pdfExo.test.d.ts.map +1 -0
- package/lib/tests/pdfExo.test.js +10 -0
- package/lib/tests/pdfs/buildPDFForExercise.d.ts +3 -0
- package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -0
- package/lib/tests/pdfs/buildPDFForExercise.js +108 -0
- package/lib/tests/pdfs/formatMdToLatex.d.ts +2 -0
- package/lib/tests/pdfs/formatMdToLatex.d.ts.map +1 -0
- package/lib/tests/pdfs/formatMdToLatex.js +9 -0
- package/lib/tests/pdfs/mdCodeToLatex.d.ts +2 -0
- package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -0
- package/lib/tests/pdfs/mdCodeToLatex.js +20 -0
- package/lib/tests/pdfs/mdTableToLatexTabular.d.ts +2 -0
- package/lib/tests/pdfs/mdTableToLatexTabular.d.ts.map +1 -0
- package/lib/tests/pdfs/mdTableToLatexTabular.js +30 -0
- package/lib/tests/pdfs/quizPdfHeader.d.ts +9 -0
- package/lib/tests/pdfs/quizPdfHeader.d.ts.map +1 -0
- package/lib/tests/pdfs/quizPdfHeader.js +44 -0
- package/lib/tests/pdfs/quizPdfPreambule.d.ts +2 -0
- package/lib/tests/pdfs/quizPdfPreambule.d.ts.map +1 -0
- package/lib/tests/pdfs/quizPdfPreambule.js +76 -0
- package/lib/tests/questionTest.d.ts +6 -0
- package/lib/tests/questionTest.d.ts.map +1 -0
- package/lib/tests/questionTest.js +156 -0
- package/lib/tests/simplify.test.d.ts +2 -0
- package/lib/tests/simplify.test.d.ts.map +1 -0
- package/lib/tests/simplify.test.js +32 -0
- package/lib/tests/singleExo.test.d.ts +2 -0
- package/lib/tests/singleExo.test.d.ts.map +1 -0
- package/lib/tests/singleExo.test.js +9 -0
- package/lib/tests/xl.test.d.ts +2 -0
- package/lib/tests/xl.test.d.ts.map +1 -0
- package/lib/tests/xl.test.js +11 -0
- package/package.json +9 -8
- package/lib/server.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleDistributivity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/simpleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"simpleDistributivity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/simpleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAyGF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAmBtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAmBrC;;;GAGG;AACH,KAAK,WAAW,GAAG;IAEjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAmBrC;;;GAGG;AACH,KAAK,WAAW,GAAG;IAEjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA8JF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
|
|
@@ -101,7 +101,6 @@ const getPropositions = (n, { answer, affinesCoeffs, operation }) => {
|
|
|
101
101
|
};
|
|
102
102
|
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
103
103
|
try {
|
|
104
|
-
console.log(ans, answer);
|
|
105
104
|
const parsed = parseAlgebraic(ans);
|
|
106
105
|
if (!parsed)
|
|
107
106
|
return false;
|
|
@@ -116,7 +115,6 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
116
115
|
forbidFactorize: true,
|
|
117
116
|
});
|
|
118
117
|
// const simp = parsed.simplify({});
|
|
119
|
-
console.log(simp.toTex());
|
|
120
118
|
return simp.toTex() === answerSimp.toTex();
|
|
121
119
|
}
|
|
122
120
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./tableReading.js";
|
|
2
|
-
export * from "./barChartReading.js";
|
|
2
|
+
// export * from "./barChartReading.js";
|
|
@@ -9,8 +9,9 @@ type Identifiers = {
|
|
|
9
9
|
};
|
|
10
10
|
type Options = {
|
|
11
11
|
useOnlyPowersOfTen: boolean;
|
|
12
|
+
forbidNegativePower?: boolean;
|
|
12
13
|
};
|
|
13
|
-
export declare const powersOfTenProduct: Exercise<Identifiers>;
|
|
14
|
+
export declare const powersOfTenProduct: Exercise<Identifiers, Options>;
|
|
14
15
|
export declare const powersProduct: Exercise<Identifiers, Options>;
|
|
15
16
|
export {};
|
|
16
17
|
//# sourceMappingURL=powersProduct.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powersProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersProduct.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"powersProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersProduct.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,OAAO,EACL,QAAQ,EAgBT,MAAM,mBAAmB,CAAC;AAM3B,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAsIF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CA+B7D,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBxD,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { multiply, } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
|
8
8
|
import { power } from "../../../tree/nodes/operators/powerNode.js";
|
|
9
9
|
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
10
10
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
11
|
-
import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
11
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
12
12
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
13
13
|
import { rationalParser } from "../../../tree/parsers/rationalParser.js";
|
|
14
14
|
import { powerParser } from "../../../tree/parsers/powerParser.js";
|
|
@@ -65,7 +65,7 @@ const getAnswer = (identifiers) => {
|
|
|
65
65
|
};
|
|
66
66
|
const getPowersProductQuestion = (opts) => {
|
|
67
67
|
const a = opts?.useOnlyPowersOfTen ? 10 : randint(-11, 11, [0]);
|
|
68
|
-
const [b, c] = [1, 2].map((el) => randint(-11, 11));
|
|
68
|
+
const [b, c] = [1, 2].map((el) => opts?.forbidNegativePower ? randint(0, 11) : randint(-11, 11));
|
|
69
69
|
const identifiers = { a, b, c };
|
|
70
70
|
const question = {
|
|
71
71
|
instruction: getInstruction(identifiers, opts),
|
|
@@ -102,6 +102,15 @@ const isAnswerValid = (ans, { a, b, c }) => {
|
|
|
102
102
|
return true;
|
|
103
103
|
return false;
|
|
104
104
|
};
|
|
105
|
+
const options = [
|
|
106
|
+
{
|
|
107
|
+
id: "forbidNegativePower",
|
|
108
|
+
label: "Ne pas utiliser les puissances négatives",
|
|
109
|
+
target: GeneratorOptionTarget.generation,
|
|
110
|
+
type: GeneratorOptionType.checkbox,
|
|
111
|
+
defaultValue: false,
|
|
112
|
+
},
|
|
113
|
+
];
|
|
105
114
|
export const powersOfTenProduct = {
|
|
106
115
|
id: "powersOfTenProduct",
|
|
107
116
|
connector: "=",
|
|
@@ -121,13 +130,14 @@ export const powersOfTenProduct = {
|
|
|
121
130
|
],
|
|
122
131
|
sections: ["Puissances"],
|
|
123
132
|
isSingleStep: true,
|
|
124
|
-
generator: (nb) => getDistinctQuestions(() => getPowersProductQuestion({ useOnlyPowersOfTen: true }), nb),
|
|
133
|
+
generator: (nb, opts) => getDistinctQuestions(() => getPowersProductQuestion({ ...opts, useOnlyPowersOfTen: true }), nb),
|
|
125
134
|
qcmTimer: 60,
|
|
126
135
|
freeTimer: 60,
|
|
127
136
|
getPropositions,
|
|
128
137
|
isAnswerValid,
|
|
129
138
|
subject: "Mathématiques",
|
|
130
139
|
hasHintAndCorrection: true,
|
|
140
|
+
options,
|
|
131
141
|
};
|
|
132
142
|
export const powersProduct = {
|
|
133
143
|
id: "powersProduct",
|
|
@@ -136,7 +146,7 @@ export const powersProduct = {
|
|
|
136
146
|
levels: ["4ème", "3ème", "2nde"],
|
|
137
147
|
sections: ["Puissances"],
|
|
138
148
|
isSingleStep: true,
|
|
139
|
-
generator: (nb, opts) => getDistinctQuestions(() => getPowersProductQuestion({ useOnlyPowersOfTen: false }), nb),
|
|
149
|
+
generator: (nb, opts) => getDistinctQuestions(() => getPowersProductQuestion({ ...opts, useOnlyPowersOfTen: false }), nb),
|
|
140
150
|
qcmTimer: 60,
|
|
141
151
|
freeTimer: 60,
|
|
142
152
|
getPropositions,
|
|
@@ -148,4 +158,5 @@ export const powersProduct = {
|
|
|
148
158
|
getHint,
|
|
149
159
|
getInstruction,
|
|
150
160
|
getStartStatement,
|
|
161
|
+
options,
|
|
151
162
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
type: number;
|
|
4
|
+
caracType: string;
|
|
5
|
+
k: number;
|
|
6
|
+
nbEssais: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const calculateFrequency: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=calculateFrequency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateFrequency.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicStats/calculateFrequency.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA+FF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAiBpD,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
8
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
10
|
+
const propositions = [];
|
|
11
|
+
const { k, nbEssais } = identifiers;
|
|
12
|
+
addValidProp(propositions, answer);
|
|
13
|
+
tryToAddWrongProp(propositions, k + "");
|
|
14
|
+
tryToAddWrongProp(propositions, frac(k, 100).toTex());
|
|
15
|
+
while (propositions.length < n) {
|
|
16
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductible().toTree().toTex());
|
|
17
|
+
}
|
|
18
|
+
return shuffleProps(propositions, n);
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { k, nbEssais } = identifiers;
|
|
22
|
+
return frac(k, nbEssais).simplify().toTex();
|
|
23
|
+
};
|
|
24
|
+
const getInstruction = (identifiers) => {
|
|
25
|
+
const { type, k, nbEssais, caracType } = identifiers;
|
|
26
|
+
switch (type) {
|
|
27
|
+
case 0: //pièce
|
|
28
|
+
return `On lance une pièce de monnaie $${nbEssais}$ fois. On tombe $${k}$ fois sur ${caracType}. Quelle est la fréquence d'apparition de ${caracType} ?`;
|
|
29
|
+
case 1: //dé 6 faces
|
|
30
|
+
return `On lance un dé à $6$ faces $${nbEssais}$ fois. On tombe $${k}$ fois sur ${caracType}. Quelle est la fréquence d'apparition de ${caracType} ?`;
|
|
31
|
+
case 2: // dé X faces
|
|
32
|
+
return `On lance un dé à $12$ faces $${nbEssais}$ fois. On tombe $${k}$ fois sur ${caracType}. Quelle est la fréquence d'apparition de ${caracType} ?`;
|
|
33
|
+
case 3:
|
|
34
|
+
default: //deux dés 6 faces
|
|
35
|
+
return `On lance deux dés à $6$ faces $${nbEssais}$ fois. On note la somme obtenue. On tombe $${k}$ fois sur ${caracType}. Quelle est la fréquence d'apparition de ${caracType} ?`;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const getHint = (identifiers) => {
|
|
39
|
+
const { type, k, nbEssais, caracType } = identifiers;
|
|
40
|
+
return `La fréquence est le nombre de fois qu'on a obtenu ${caracType} divisée par le nombre total d'essais.`;
|
|
41
|
+
};
|
|
42
|
+
const getCorrection = (identifiers) => {
|
|
43
|
+
const { type, k, nbEssais, caracType } = identifiers;
|
|
44
|
+
return `On a obtenu $${k}$ fois ${caracType} sur les $${nbEssais}$ lancers. La fréquence d'apparition de ${caracType} est donc :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
${frac(k, nbEssais).toSimplificationString()}
|
|
48
|
+
$$`;
|
|
49
|
+
};
|
|
50
|
+
const getKeys = (identifiers) => {
|
|
51
|
+
return [];
|
|
52
|
+
};
|
|
53
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
54
|
+
try {
|
|
55
|
+
return rationalVEA(ans, answer, { decimalPrecision: 2 });
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
return handleVEAError(err);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const getCalculateFrequencyQuestion = (ops) => {
|
|
62
|
+
const type = randint(0, 4);
|
|
63
|
+
const nbEssais = 5 * randint(10, 100);
|
|
64
|
+
const k = randint(1, nbEssais);
|
|
65
|
+
const caracType = type === 0
|
|
66
|
+
? random(["Pile", "Face"])
|
|
67
|
+
: type === 1
|
|
68
|
+
? `la face $${randint(1, 7)}$`
|
|
69
|
+
: type === 2
|
|
70
|
+
? `la face $${randint(1, 13)}$`
|
|
71
|
+
: `la somme $${randint(1, 13)}$`;
|
|
72
|
+
const identifiers = { type, k, nbEssais, caracType };
|
|
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
|
+
export const calculateFrequency = {
|
|
85
|
+
id: "calculateFrequency",
|
|
86
|
+
connector: "=",
|
|
87
|
+
label: "Calculer une fréquence",
|
|
88
|
+
isSingleStep: true,
|
|
89
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCalculateFrequencyQuestion(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
|
+
hasHintAndCorrection: true,
|
|
100
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicStats/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./calculateFrequency.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticFirstTermsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFirstTermsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"arithmeticFirstTermsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFirstTermsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAoDF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAgBzD,CAAC"}
|
|
@@ -2,22 +2,31 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exer
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { random } from "../../../../utils/alea/random.js";
|
|
5
|
-
const
|
|
6
|
-
const firstRank
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const getInstruction = (identifiers) => {
|
|
6
|
+
const { firstRank, firstValue, reason, nbTerms } = identifiers;
|
|
7
|
+
return `Soit $u$ une suite arithmétique de premier terme $u_${firstRank} = ${firstValue}$ et de raison $${reason}$. Calculer la somme des $${nbTerms}$ premiers termes de $u$.`;
|
|
8
|
+
};
|
|
9
|
+
const getAnswer = (identifiers) => {
|
|
10
|
+
const { firstRank, firstValue, reason, nbTerms } = identifiers;
|
|
10
11
|
const lastRank = firstRank + nbTerms - 1;
|
|
11
12
|
const answer = (lastRank - firstRank + 1) *
|
|
12
13
|
(firstRank === 0 ? firstValue : firstValue - reason) +
|
|
13
14
|
(reason * (lastRank * (lastRank + 1))) / 2;
|
|
14
15
|
const answerTex = answer + "";
|
|
16
|
+
return answerTex;
|
|
17
|
+
};
|
|
18
|
+
const getArithmeticFirstTermsSumQuestion = () => {
|
|
19
|
+
const firstRank = random([0, 1]);
|
|
20
|
+
const firstValue = randint(-9, 10);
|
|
21
|
+
const reason = randint(-5, 5, [0]);
|
|
22
|
+
const nbTerms = randint(4, 9);
|
|
23
|
+
const identifiers = { firstRank, firstValue, reason, nbTerms };
|
|
15
24
|
const question = {
|
|
16
|
-
answer:
|
|
17
|
-
instruction:
|
|
25
|
+
answer: getAnswer(identifiers),
|
|
26
|
+
instruction: getInstruction(identifiers),
|
|
18
27
|
keys: [],
|
|
19
28
|
answerFormat: "tex",
|
|
20
|
-
identifiers
|
|
29
|
+
identifiers,
|
|
21
30
|
};
|
|
22
31
|
return question;
|
|
23
32
|
};
|
|
@@ -45,4 +54,6 @@ export const arithmeticFirstTermsSum = {
|
|
|
45
54
|
getPropositions,
|
|
46
55
|
isAnswerValid,
|
|
47
56
|
subject: "Mathématiques",
|
|
57
|
+
getAnswer,
|
|
58
|
+
getInstruction,
|
|
48
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstIntegersSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/firstIntegersSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"firstIntegersSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/firstIntegersSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA8EF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAmBlD,CAAC"}
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
5
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
4
6
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
7
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
8
|
+
const getInstruction = (identifiers) => {
|
|
9
|
+
const { final } = identifiers;
|
|
10
|
+
return `Calculer la somme suivante :
|
|
11
|
+
|
|
12
|
+
$$
|
|
13
|
+
1+2+3+\\ldots + ${final}
|
|
14
|
+
$$`;
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const { final } = identifiers;
|
|
18
|
+
return `${(final * (final + 1)) / 2}`;
|
|
19
|
+
};
|
|
5
20
|
const getFirstIntegersSumQuestion = () => {
|
|
6
21
|
const final = randint(20, 100);
|
|
7
|
-
const
|
|
22
|
+
const identifiers = { final };
|
|
8
23
|
const question = {
|
|
9
|
-
answer,
|
|
10
|
-
instruction:
|
|
24
|
+
answer: getAnswer(identifiers),
|
|
25
|
+
instruction: getInstruction(identifiers),
|
|
11
26
|
keys: [],
|
|
12
27
|
answerFormat: "tex",
|
|
13
|
-
identifiers
|
|
28
|
+
identifiers,
|
|
29
|
+
hint: getHint(identifiers),
|
|
30
|
+
correction: getCorrection(identifiers),
|
|
14
31
|
};
|
|
15
32
|
return question;
|
|
16
33
|
};
|
|
@@ -28,6 +45,32 @@ const getPropositions = (n, { answer, final }) => {
|
|
|
28
45
|
const isAnswerValid = (ans, { answer }) => {
|
|
29
46
|
return ans === answer;
|
|
30
47
|
};
|
|
48
|
+
const getHint = (identifiers) => {
|
|
49
|
+
return `La somme des $n$ premiers entiers est :
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
S_n = \\frac{n(n+1)}{2}
|
|
53
|
+
$$`;
|
|
54
|
+
};
|
|
55
|
+
const getCorrection = (identifiers) => {
|
|
56
|
+
const final = identifiers.final;
|
|
57
|
+
return `La somme des $n$ premiers entiers est :
|
|
58
|
+
|
|
59
|
+
$$
|
|
60
|
+
S_n = \\frac{n(n+1)}{2}
|
|
61
|
+
$$
|
|
62
|
+
|
|
63
|
+
Ici, on a $n = ${final}$.
|
|
64
|
+
|
|
65
|
+
On a donc :
|
|
66
|
+
|
|
67
|
+
${alignTex([
|
|
68
|
+
["", `1+2+3+\\ldots + ${final}`],
|
|
69
|
+
["=", frac(multiply(final, final + 1), 2).toTex()],
|
|
70
|
+
["=", getAnswer(identifiers)],
|
|
71
|
+
])}
|
|
72
|
+
`;
|
|
73
|
+
};
|
|
31
74
|
export const firstIntegersSum = {
|
|
32
75
|
id: "firstIntegersSum",
|
|
33
76
|
connector: "=",
|
|
@@ -41,4 +84,9 @@ export const firstIntegersSum = {
|
|
|
41
84
|
getPropositions,
|
|
42
85
|
isAnswerValid,
|
|
43
86
|
subject: "Mathématiques",
|
|
87
|
+
getInstruction,
|
|
88
|
+
getAnswer,
|
|
89
|
+
getHint,
|
|
90
|
+
getCorrection,
|
|
91
|
+
hasHintAndCorrection: true,
|
|
44
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricFirstTermsGeneralSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"geometricFirstTermsGeneralSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAyDF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAgB/D,CAAC"}
|
|
@@ -2,23 +2,32 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exer
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { random } from "../../../../utils/alea/random.js";
|
|
5
|
+
const getInstruction = (identifiers) => {
|
|
6
|
+
const { firstRank, firstValue, reason, nbTerms } = identifiers;
|
|
7
|
+
return `Soit $u$ une suite géométrique de premier terme $u_${firstRank} = ${firstValue}$ et de raison $${reason}$. Calculer la somme des $${nbTerms}$ premiers termes de $u$.`;
|
|
8
|
+
};
|
|
9
|
+
const getAnswer = (identifiers) => {
|
|
10
|
+
const { firstRank, firstValue, reason, nbTerms } = identifiers;
|
|
11
|
+
const answer = (firstValue * (1 - Math.pow(reason, nbTerms))) / (1 - reason);
|
|
12
|
+
return answer.frenchify();
|
|
13
|
+
};
|
|
5
14
|
const getGeometricFirstTermsGeneralSumQuestion = () => {
|
|
6
15
|
const firstRank = random([0, 1]);
|
|
7
16
|
const firstValue = randint(-9, 10, [0]);
|
|
8
17
|
const reason = randint(-5, 5, [0, 1]);
|
|
9
18
|
const nbTerms = randint(4, 9);
|
|
10
|
-
const
|
|
19
|
+
const identifiers = {
|
|
20
|
+
firstRank,
|
|
21
|
+
firstValue,
|
|
22
|
+
reason,
|
|
23
|
+
nbTerms,
|
|
24
|
+
};
|
|
11
25
|
const question = {
|
|
12
|
-
answer:
|
|
13
|
-
instruction:
|
|
26
|
+
answer: getAnswer(identifiers),
|
|
27
|
+
instruction: getInstruction(identifiers),
|
|
14
28
|
keys: [],
|
|
15
29
|
answerFormat: "tex",
|
|
16
|
-
identifiers
|
|
17
|
-
firstRank,
|
|
18
|
-
firstValue,
|
|
19
|
-
reason,
|
|
20
|
-
nbTerms,
|
|
21
|
-
},
|
|
30
|
+
identifiers,
|
|
22
31
|
};
|
|
23
32
|
return question;
|
|
24
33
|
};
|
|
@@ -50,4 +59,6 @@ export const geometricFirstTermsGeneralSum = {
|
|
|
50
59
|
getPropositions,
|
|
51
60
|
isAnswerValid,
|
|
52
61
|
subject: "Mathématiques",
|
|
62
|
+
getInstruction,
|
|
63
|
+
getAnswer,
|
|
53
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricFirstTermsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFirstTermsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"geometricFirstTermsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFirstTermsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwDF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
|
|
@@ -2,16 +2,29 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
5
|
+
const getInstruction = (identifiers) => {
|
|
6
|
+
const { raison, final } = identifiers;
|
|
7
|
+
return `Calculer la somme suivante :
|
|
8
|
+
|
|
9
|
+
$$
|
|
10
|
+
1 + ${raison} + ${raison}^2 + \\ldots + ${raison}^{${final}}
|
|
11
|
+
$$`;
|
|
12
|
+
};
|
|
13
|
+
const getAnswer = (identifiers) => {
|
|
14
|
+
const { raison, final } = identifiers;
|
|
15
|
+
const answer = (raison ** (final + 1) - 1) / (raison - 1) + "";
|
|
16
|
+
return answer;
|
|
17
|
+
};
|
|
5
18
|
const getGeometricFirstTermsSumQuestion = () => {
|
|
6
19
|
const raison = randint(2, 8);
|
|
7
20
|
const final = randint(5, 10);
|
|
8
|
-
const
|
|
21
|
+
const identifiers = { raison, final };
|
|
9
22
|
const question = {
|
|
10
|
-
answer:
|
|
11
|
-
instruction:
|
|
23
|
+
answer: getAnswer(identifiers),
|
|
24
|
+
instruction: getInstruction(identifiers),
|
|
12
25
|
keys: [],
|
|
13
26
|
answerFormat: "tex",
|
|
14
|
-
identifiers
|
|
27
|
+
identifiers,
|
|
15
28
|
};
|
|
16
29
|
return question;
|
|
17
30
|
};
|
|
@@ -33,21 +46,13 @@ export const geometricFirstTermsSum = {
|
|
|
33
46
|
id: "geometricFirstTermsSum",
|
|
34
47
|
connector: "=",
|
|
35
48
|
label: "Somme des termes d'une suite géométrique",
|
|
36
|
-
levels: [
|
|
37
|
-
"1reESM",
|
|
38
|
-
"1rePro",
|
|
39
|
-
"1reSpé",
|
|
40
|
-
"1reTech",
|
|
41
|
-
"TermPro",
|
|
42
|
-
"TermSpé",
|
|
43
|
-
"TermTech",
|
|
44
|
-
],
|
|
45
49
|
isSingleStep: true,
|
|
46
|
-
sections: ["Suites"],
|
|
47
50
|
generator: (nb) => getDistinctQuestions(getGeometricFirstTermsSumQuestion, nb),
|
|
48
51
|
qcmTimer: 60,
|
|
49
52
|
freeTimer: 60,
|
|
50
53
|
getPropositions,
|
|
51
54
|
isAnswerValid,
|
|
52
55
|
subject: "Mathématiques",
|
|
56
|
+
getAnswer,
|
|
57
|
+
getInstruction,
|
|
53
58
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1365,12 +1365,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1365
1365
|
a: number;
|
|
1366
1366
|
b: number;
|
|
1367
1367
|
c: number;
|
|
1368
|
-
}, {}> | Exercise<{
|
|
1369
|
-
a: number;
|
|
1370
|
-
b: number;
|
|
1371
|
-
c: number;
|
|
1372
1368
|
}, {
|
|
1373
1369
|
useOnlyPowersOfTen: boolean;
|
|
1370
|
+
forbidNegativePower?: boolean;
|
|
1374
1371
|
}> | Exercise<{
|
|
1375
1372
|
tenPower: number;
|
|
1376
1373
|
decimal: number;
|
|
@@ -1531,6 +1528,11 @@ declare const mathExercises: (Exercise<{
|
|
|
1531
1528
|
}, {
|
|
1532
1529
|
instructionType: string;
|
|
1533
1530
|
}> | Exercise<{
|
|
1531
|
+
type: number;
|
|
1532
|
+
caracType: string;
|
|
1533
|
+
k: number;
|
|
1534
|
+
nbEssais: number;
|
|
1535
|
+
}, {}> | Exercise<{
|
|
1534
1536
|
firstValue: number;
|
|
1535
1537
|
askedRank: number;
|
|
1536
1538
|
reason: number;
|
|
@@ -1820,8 +1822,6 @@ declare const mathExercises: (Exercise<{
|
|
|
1820
1822
|
}, {}> | Exercise<{
|
|
1821
1823
|
values: number[][];
|
|
1822
1824
|
caseAsked: number;
|
|
1823
|
-
}, {}> | Exercise<{
|
|
1824
|
-
a: number;
|
|
1825
1825
|
}, {}>)[];
|
|
1826
1826
|
declare const pcExercises: (Exercise<{
|
|
1827
1827
|
numbers: number[];
|
package/lib/playground.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const playground: () =>
|
|
1
|
+
export declare const playground: () => void;
|
|
2
2
|
//# sourceMappingURL=playground.d.ts.map
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,YAAW,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import { NodeConstructor } from "./tree/nodes/nodeConstructor.js";
|
|
2
|
-
|
|
3
|
-
export const playground = () => {
|
|
4
|
-
const answer = "\\left(-5x-7\\right)^2";
|
|
5
|
-
const ans = "\\left(-5x-7\\right)^2";
|
|
6
|
-
const parsed = parseAlgebraic(ans);
|
|
7
|
-
if (!parsed)
|
|
8
|
-
return false;
|
|
9
|
-
console.log(parsed
|
|
10
|
-
.simplify({
|
|
11
|
-
towardsDistribute: true,
|
|
12
|
-
forbidFactorize: true,
|
|
13
|
-
})
|
|
14
|
-
.toTex());
|
|
15
|
-
};
|
|
2
|
+
export const playground = () => { };
|
|
16
3
|
const logIdentifiers = () => {
|
|
17
4
|
const ids = '{"xA":-3,"yA":-2,"yPrimeA":{"id":31,"child":{"id":3,"leftChild":{"id":7,"value":3},"rightChild":{"id":7,"value":2}}},"trinomCoeffs":[0.3888888888888889,0.833333333333333,-3]}';
|
|
18
5
|
const parsed = JSON.parse(ids);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exoTest.d.ts","sourceRoot":"","sources":["../../src/tests/exoTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIvD,eAAO,MAAM,OAAO,QAAS,QAAQ;;;;CAgDpC,CAAC"}
|