math-exercises 3.0.131 → 3.0.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/exercise.d.ts +37 -30
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +2 -2
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +44 -40
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.js +15 -10
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +0 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +2 -0
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +8 -6
- package/lib/exercises/math/calcul/rounding/rounding.d.ts +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.js +7 -6
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +8 -9
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +4 -4
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +15 -60
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +14 -10
- package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +1 -0
- package/lib/exercises/math/conversion/prefixToNumber.d.ts +0 -2
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
- package/lib/exercises/math/conversion/prefixToNumber.js +31 -24
- package/lib/exercises/math/conversion/secondsToHours.js +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +2 -2
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +4 -5
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +10 -11
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +8 -8
- package/lib/exercises/math/geometry/cartesian/index.d.ts +1 -0
- package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/index.js +1 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +6 -9
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +60 -137
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts +16 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +213 -0
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts +4 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.js +37 -21
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +24 -26
- package/lib/exercises/math/percent/percentToDecimal.d.ts +4 -1
- package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/percent/percentToDecimal.js +55 -35
- package/lib/exercises/math/powers/calculateNegativePower.d.ts +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +17 -10
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +2 -2
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts +5 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +76 -12
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +7 -7
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +2 -3
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +60 -95
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +12 -5
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +354 -94
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +4 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +43 -23
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +70 -23
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +4 -4
- package/lib/exercises/pc/index.d.ts +0 -1
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +0 -1
- package/lib/exercises/pc/motion/averageSpeed.d.ts +0 -2
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +40 -45
- package/lib/exercises/pc/optics/lensFormula.d.ts +1 -2
- package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -1
- package/lib/exercises/pc/optics/lensFormula.js +7 -10
- package/lib/exercises/pc/weight/calculateWeight.d.ts +1 -3
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +38 -30
- package/lib/index.d.ts +932 -948
- package/lib/index.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.d.ts +2 -2
- package/lib/math/progCalc/progCalc.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.js +4 -11
- package/lib/playgroundUtils.d.ts +3 -0
- package/lib/playgroundUtils.d.ts.map +1 -0
- package/lib/playgroundUtils.js +13 -0
- package/lib/server.js +121 -0
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +13 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -57,12 +57,12 @@ const situations = [
|
|
|
57
57
|
{
|
|
58
58
|
context: "Dans une émission TV, le présentateur demande son prénom à quelqu'un dans le public.",
|
|
59
59
|
strA: "Le prénom est Jean-Michel.",
|
|
60
|
-
strB:
|
|
60
|
+
strB: "La personne est un adulte.",
|
|
61
61
|
"(A)": "que le prénom soit Jean-Michel",
|
|
62
|
-
"(B)":
|
|
63
|
-
"(A \\cap B)":
|
|
64
|
-
"_A(B)":
|
|
65
|
-
"_B(A)":
|
|
62
|
+
"(B)": "que la personne soit un adulte",
|
|
63
|
+
"(A \\cap B)": "que le prénom soit Jean-Michel et que la personne soit un adulte",
|
|
64
|
+
"_A(B)": "que la personne soit un adulte, sachant que son prénom est Jean-Michel",
|
|
65
|
+
"_B(A)": "que le prénom soit Jean-Michel, sachant que la personne est un adulte",
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
context: "Il est $14$h$37$. Yohann et Sarah sont assis en classe. C'est un cours sur les probabilités.",
|
|
@@ -119,7 +119,7 @@ Soit $B$ l'évenement :
|
|
|
119
119
|
|
|
120
120
|
Écris en langage mathématique :
|
|
121
121
|
|
|
122
|
-
La probabilité ${situation[pType]}.`;
|
|
122
|
+
> La probabilité ${situation[pType]}.`;
|
|
123
123
|
return instruction;
|
|
124
124
|
};
|
|
125
125
|
const getAnswer = (identifiers) => {
|
|
@@ -207,7 +207,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
207
207
|
export const conditionalProbaWriteFromFrench = {
|
|
208
208
|
id: "conditionalProbaWriteFromFrench",
|
|
209
209
|
connector: "=",
|
|
210
|
-
label: "
|
|
210
|
+
label: "Écrire une probabilité en langage mathématique",
|
|
211
211
|
isSingleStep: false,
|
|
212
212
|
generator: (nb) => getDistinctQuestions(getConditionalProbaWriteFromFrenchQuestion, nb),
|
|
213
213
|
qcmTimer: 60,
|
|
@@ -20,9 +20,8 @@ type EventIdentifiers = {
|
|
|
20
20
|
isTailoredStr: boolean;
|
|
21
21
|
};
|
|
22
22
|
type Options = {
|
|
23
|
-
nbElem:
|
|
24
|
-
unionLength:
|
|
25
|
-
isProbasAreNumbers: boolean[];
|
|
23
|
+
nbElem: string[];
|
|
24
|
+
unionLength: string[];
|
|
26
25
|
};
|
|
27
26
|
export declare const probaAsSumOfProbas: Exercise<Identifiers, Options>;
|
|
28
27
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaAsSumOfProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaAsSumOfProbas.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAkBT,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"probaAsSumOfProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaAsSumOfProbas.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAkBT,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAa7C,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,gBAAgB,GACjB;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,eAAe,CAAC;CACpB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,eAAe,CAAC;IACnB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AA0eN,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAsQF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe7D,CAAC"}
|
|
@@ -112,7 +112,7 @@ class SituationConstructor {
|
|
|
112
112
|
const str = `On lance un dé à $${nbSides}$ faces numérotées de $1$ à $${nbSides}$.
|
|
113
113
|
Le dé n'est pas équilibré.`;
|
|
114
114
|
const strElem = `Pour $i$ allant de $1$ à $${nbSides}$, on note $E_i$ l'évènement:
|
|
115
|
-
"Le résultat est $i
|
|
115
|
+
"Le résultat est $i$".`;
|
|
116
116
|
const nbPickSomeElem = Math.min(nbSides, 6);
|
|
117
117
|
const allIndexesElem = [...Array(nbSides).keys()].map((i) => i + 1);
|
|
118
118
|
const dictAllElem = Object.fromEntries(allIndexesElem.map((index) => [
|
|
@@ -216,8 +216,7 @@ class FiniteProbDistr {
|
|
|
216
216
|
const dictPToArrayOfIndexes = {};
|
|
217
217
|
for (let i = 0; i < arrProba.length; i++) {
|
|
218
218
|
const p = arrProba[i];
|
|
219
|
-
|
|
220
|
-
const tex = p.simplify().toTex();
|
|
219
|
+
const tex = p.toTex();
|
|
221
220
|
if (dictPToArrayOfIndexes[tex] === undefined) {
|
|
222
221
|
dictPToArrayOfIndexes[tex] = [];
|
|
223
222
|
}
|
|
@@ -233,7 +232,7 @@ class FiniteProbDistr {
|
|
|
233
232
|
return p;
|
|
234
233
|
}
|
|
235
234
|
getArrIndexForP(p) {
|
|
236
|
-
return this.dictPToArrayOfIndexes[p.
|
|
235
|
+
return this.dictPToArrayOfIndexes[p.toTex()];
|
|
237
236
|
}
|
|
238
237
|
getArrFrenchStrings(isDisplayingValue) {
|
|
239
238
|
return Object.entries(this.dictPToArrayOfIndexes)
|
|
@@ -273,12 +272,15 @@ const getAnswerValueNode = (identifiers) => {
|
|
|
273
272
|
const { eventIds, arrProba } = identifiers;
|
|
274
273
|
const evUnion = EventConstructor.fromIdentifiers(eventIds);
|
|
275
274
|
const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
|
|
276
|
-
const
|
|
275
|
+
const arrFrac = evUnion
|
|
277
276
|
.getArrElem()
|
|
278
|
-
.map((evElem) => finiteProbDistr.getPForIndex(evElem.index))
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
.map((evElem) => finiteProbDistr.getPForIndex(evElem.index));
|
|
278
|
+
const nodeSumSimplified = (() => {
|
|
279
|
+
const den = arrFrac[0].rightChild.evaluate();
|
|
280
|
+
return frac(arrFrac
|
|
281
|
+
.map((fNode) => fNode.leftChild.evaluate())
|
|
282
|
+
.reduce((acc, x) => acc + x, 0), den);
|
|
283
|
+
})();
|
|
282
284
|
return nodeSumSimplified;
|
|
283
285
|
};
|
|
284
286
|
const getAnswerNode = (identifiers) => {
|
|
@@ -320,11 +322,7 @@ $$
|
|
|
320
322
|
p_{${evElem.id}} = ${finiteProbDistr.getPForIndex(evElem.index).toTex()}
|
|
321
323
|
$$`).join(`
|
|
322
324
|
`)}`;
|
|
323
|
-
const nodeSumSimplified =
|
|
324
|
-
.getArrElem()
|
|
325
|
-
.map((evElem) => finiteProbDistr.getPForIndex(evElem.index))).simplify({
|
|
326
|
-
//nbMaxSteps: 100,
|
|
327
|
-
});
|
|
325
|
+
const nodeSumSimplified = getAnswerNode(identifiers);
|
|
328
326
|
strCorrection += `
|
|
329
327
|
Donc:
|
|
330
328
|
|
|
@@ -342,9 +340,8 @@ $$`;
|
|
|
342
340
|
return strCorrection;
|
|
343
341
|
};
|
|
344
342
|
const optsDefault = {
|
|
345
|
-
nbElem: [4, 6, 10, 12],
|
|
346
|
-
unionLength: [2, 3, 4, 5],
|
|
347
|
-
isProbasAreNumbers: [true, false],
|
|
343
|
+
nbElem: ["4", "6", "10", "12"],
|
|
344
|
+
unionLength: ["2", "3", "4", "5"],
|
|
348
345
|
};
|
|
349
346
|
const options = [
|
|
350
347
|
{
|
|
@@ -352,7 +349,7 @@ const options = [
|
|
|
352
349
|
label: "Nombre d'évènements élémentaires",
|
|
353
350
|
type: GeneratorOptionType.multiselect,
|
|
354
351
|
target: GeneratorOptionTarget.generation,
|
|
355
|
-
values: [4, 6, 10, 12],
|
|
352
|
+
values: ["4", "6", "10", "12"],
|
|
356
353
|
defaultValue: optsDefault.nbElem,
|
|
357
354
|
},
|
|
358
355
|
{
|
|
@@ -360,47 +357,12 @@ const options = [
|
|
|
360
357
|
label: "Longueur de l'union",
|
|
361
358
|
type: GeneratorOptionType.multiselect,
|
|
362
359
|
target: GeneratorOptionTarget.generation,
|
|
363
|
-
values: [2, 3, 4, 5, 6],
|
|
360
|
+
values: ["2", "3", "4", "5", "6"],
|
|
364
361
|
defaultValue: optsDefault.unionLength,
|
|
365
362
|
},
|
|
366
|
-
{
|
|
367
|
-
id: "isProbasAreNumbers",
|
|
368
|
-
label: "Probabilités sous forme de nombres ?",
|
|
369
|
-
type: GeneratorOptionType.multiselect,
|
|
370
|
-
target: GeneratorOptionTarget.generation,
|
|
371
|
-
values: [true, false],
|
|
372
|
-
defaultValue: optsDefault.isProbasAreNumbers,
|
|
373
|
-
},
|
|
374
363
|
];
|
|
375
|
-
const getKeys = (
|
|
376
|
-
|
|
377
|
-
const isProbasAreNumbers = true;
|
|
378
|
-
const situation = arrayOfSituations[indexSituation];
|
|
379
|
-
return [
|
|
380
|
-
...[
|
|
381
|
-
...new Set(situation.someElem
|
|
382
|
-
.map((event) => {
|
|
383
|
-
if (isProbasAreNumbers) {
|
|
384
|
-
const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
|
|
385
|
-
return finiteProbDistr.getPForIndex(event.index).simplify();
|
|
386
|
-
}
|
|
387
|
-
else {
|
|
388
|
-
return event.p;
|
|
389
|
-
}
|
|
390
|
-
})
|
|
391
|
-
.map((node) => node.toTex())),
|
|
392
|
-
].map((tex) => {
|
|
393
|
-
return {
|
|
394
|
-
id: "custom",
|
|
395
|
-
label: tex,
|
|
396
|
-
labelType: "tex",
|
|
397
|
-
mathfieldInstructions: {
|
|
398
|
-
method: "write",
|
|
399
|
-
content: tex,
|
|
400
|
-
},
|
|
401
|
-
};
|
|
402
|
-
}),
|
|
403
|
-
];
|
|
364
|
+
const getKeys = () => {
|
|
365
|
+
return [];
|
|
404
366
|
};
|
|
405
367
|
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
406
368
|
const { eventIds, arrProba } = identifiers;
|
|
@@ -410,39 +372,41 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
410
372
|
addValidProp(propositions, answer);
|
|
411
373
|
if (isProbasAreNumbers) {
|
|
412
374
|
const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
|
|
413
|
-
|
|
414
|
-
.getArrElem()
|
|
415
|
-
.map((evElem) => finiteProbDistr.getPForIndex(evElem.index)))
|
|
416
|
-
.simplify({
|
|
417
|
-
//nbMaxSteps: 100,
|
|
418
|
-
})
|
|
419
|
-
.toTex());
|
|
420
|
-
tryToAddWrongProp(propositions, substract(1, operatorComposition(MultiplyNode, evUnion
|
|
421
|
-
.getArrElem()
|
|
422
|
-
.map((evElem) => finiteProbDistr.getPForIndex(evElem.index))))
|
|
423
|
-
.simplify({
|
|
424
|
-
//nbMaxSteps: 100,
|
|
425
|
-
})
|
|
426
|
-
.toTex());
|
|
427
|
-
tryToAddWrongProp(propositions, substract(1, operatorComposition(AddNode, evUnion
|
|
428
|
-
.getArrElem()
|
|
429
|
-
.map((evElem) => finiteProbDistr.getPForIndex(evElem.index))).simplify({
|
|
430
|
-
//nbMaxSteps: 100,
|
|
431
|
-
})).toTex());
|
|
432
|
-
tryToAddWrongProp(propositions, operatorComposition(AddNode, evUnion
|
|
433
|
-
.getArrElem()
|
|
434
|
-
.map((evElem) => multiply(evElem.index, finiteProbDistr.getPForIndex(evElem.index))))
|
|
435
|
-
.simplify({
|
|
436
|
-
//nbMaxSteps: 100,
|
|
437
|
-
})
|
|
438
|
-
.toTex());
|
|
439
|
-
tryToAddWrongProp(propositions, multiply(frac(1, evUnion.getArrElem().length), operatorComposition(AddNode, evUnion
|
|
375
|
+
const arrFrac = evUnion
|
|
440
376
|
.getArrElem()
|
|
441
|
-
.map((evElem) => finiteProbDistr.getPForIndex(evElem.index))
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
377
|
+
.map((evElem) => finiteProbDistr.getPForIndex(evElem.index));
|
|
378
|
+
tryToAddWrongProp(propositions, (() => {
|
|
379
|
+
const den = arrFrac[0].rightChild.evaluate();
|
|
380
|
+
return frac(arrFrac
|
|
381
|
+
.map((fNode) => fNode.leftChild.evaluate())
|
|
382
|
+
.reduce((acc, x) => acc * x, 0), den);
|
|
383
|
+
})().toTex());
|
|
384
|
+
tryToAddWrongProp(propositions, (() => {
|
|
385
|
+
const den = arrFrac[0].rightChild.evaluate();
|
|
386
|
+
return frac(den -
|
|
387
|
+
arrFrac
|
|
388
|
+
.map((fNode) => fNode.leftChild.evaluate())
|
|
389
|
+
.reduce((acc, x) => acc * x, 0), den);
|
|
390
|
+
})().toTex());
|
|
391
|
+
tryToAddWrongProp(propositions, (() => {
|
|
392
|
+
const den = arrFrac[0].rightChild.evaluate();
|
|
393
|
+
return frac(den -
|
|
394
|
+
arrFrac
|
|
395
|
+
.map((fNode) => fNode.leftChild.evaluate())
|
|
396
|
+
.reduce((acc, x) => acc + x, 0), den);
|
|
397
|
+
})().toTex());
|
|
398
|
+
tryToAddWrongProp(propositions, (() => {
|
|
399
|
+
const den = arrFrac[0].rightChild.evaluate();
|
|
400
|
+
return frac(arrFrac
|
|
401
|
+
.map((fNode, i) => fNode.leftChild.evaluate() * i)
|
|
402
|
+
.reduce((acc, x) => acc + x, 0), den);
|
|
403
|
+
})().toTex());
|
|
404
|
+
tryToAddWrongProp(propositions, (() => {
|
|
405
|
+
const den = arrFrac[0].rightChild.evaluate();
|
|
406
|
+
return frac(arrFrac
|
|
407
|
+
.map((fNode) => fNode.leftChild.evaluate())
|
|
408
|
+
.reduce((acc, x) => acc + x, 0), den * evUnion.getArrElem().length);
|
|
409
|
+
})().toTex());
|
|
446
410
|
}
|
|
447
411
|
else {
|
|
448
412
|
tryToAddWrongProp(propositions, operatorComposition(MultiplyNode, evUnion.getArrElem().map((evElem) => evElem.p))
|
|
@@ -479,10 +443,13 @@ const getValueNode = (tex, arrProba) => {
|
|
|
479
443
|
return parseInt(texVar.substring(texVar.indexOf("E_{") + 3, texVar.indexOf("}}")));
|
|
480
444
|
}
|
|
481
445
|
});
|
|
482
|
-
const
|
|
483
|
-
return
|
|
484
|
-
|
|
485
|
-
|
|
446
|
+
const arrFrac = arrayOfIndexes.map((i) => finiteProbDistr.getPForIndex(i));
|
|
447
|
+
return (() => {
|
|
448
|
+
const den = arrFrac[0].rightChild.evaluate();
|
|
449
|
+
return frac(arrFrac
|
|
450
|
+
.map((fNode) => fNode.leftChild.evaluate())
|
|
451
|
+
.reduce((acc, x) => acc + x, 0), den);
|
|
452
|
+
})();
|
|
486
453
|
};
|
|
487
454
|
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
488
455
|
const { arrProba } = identifiers;
|
|
@@ -499,7 +466,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
499
466
|
};
|
|
500
467
|
const getProbaAsSumOfProbasQuestion = (optsIn) => {
|
|
501
468
|
const opts = Object.assign(optsDefault, optsIn) ?? optsDefault;
|
|
502
|
-
const unionLength = random(opts.unionLength);
|
|
469
|
+
const unionLength = Number(random(opts.unionLength));
|
|
503
470
|
const indexSituation = random([...Array(arrayOfSituations.length).keys()].filter((indexSituation) => {
|
|
504
471
|
const situation = arrayOfSituations[indexSituation];
|
|
505
472
|
return situation.someElem.length >= unionLength;
|
|
@@ -509,12 +476,10 @@ const getProbaAsSumOfProbasQuestion = (optsIn) => {
|
|
|
509
476
|
const eventIds = evUnion.toIdentifiers();
|
|
510
477
|
const nbUnique = Math.min(randint(3, 7), situation.allElem.length - 1);
|
|
511
478
|
const finiteProbDistr = FiniteProbDistrConstructor.randomDistr(situation.allElem.length, nbUnique);
|
|
512
|
-
const isProbasAreNumbers = random(opts.isProbasAreNumbers);
|
|
513
479
|
const identifiers = {
|
|
514
480
|
indexSituation,
|
|
515
481
|
eventIds,
|
|
516
482
|
arrProba: finiteProbDistr.arrProba.map((node) => node.toIdentifiers()),
|
|
517
|
-
isProbasAreNumbers,
|
|
518
483
|
};
|
|
519
484
|
return getQuestionFromIdentifiers(identifiers, opts);
|
|
520
485
|
};
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
2
|
type Identifiers = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
indexSituation: number;
|
|
4
|
+
values: {
|
|
5
|
+
"A \\cap B": number;
|
|
6
|
+
"A \\cap \\overline{B}": number;
|
|
7
|
+
"\\overline{A} \\cap B": number;
|
|
8
|
+
"\\overline{A} \\cap \\overline{B}": number;
|
|
9
|
+
};
|
|
7
10
|
event: string;
|
|
8
11
|
type: string;
|
|
9
12
|
probaFrac: number[];
|
|
13
|
+
allowedAnsType: string[];
|
|
10
14
|
};
|
|
11
|
-
|
|
15
|
+
type Options = {
|
|
16
|
+
allowedAnsType: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare const probaFromTableWithContext: Exercise<Identifiers, Options>;
|
|
12
19
|
export {};
|
|
13
20
|
//# sourceMappingURL=probaFromTableWithContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,uBAAuB,EAAE,MAAM,CAAC;QAChC,uBAAuB,EAAE,MAAM,CAAC;QAChC,mCAAmC,EAAE,MAAM,CAAC;KAC7C,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAqpBF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAsBF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
|