math-exercises 3.0.188 → 3.0.190
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/calcul/decimals/decimalFractionToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.js +5 -4
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +9 -8
- package/lib/exercises/math/calculLitteral/equation/isEqualityTrue.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/isEqualityTrue.js +7 -6
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +5 -4
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.js +3 -2
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.js +3 -2
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +45 -37
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +3 -2
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +3 -2
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +3 -2
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +4 -3
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +20 -64
- package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.js +3 -2
- package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.js +3 -2
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +4 -3
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.js +27 -35
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts +8 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.js +129 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.d.ts +8 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentComplete.js +108 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts +8 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.js +92 -0
- package/lib/exercises/math/functions/affines/adjustment/index.d.ts +4 -0
- package/lib/exercises/math/functions/affines/adjustment/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/adjustment/index.js +3 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +8 -6
- package/lib/exercises/math/functions/affines/index.d.ts +2 -4
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +2 -4
- package/lib/exercises/math/functions/affines/situations/affineFromExercise.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineFromExercise.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineFromExercise.js +219 -0
- package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineModelisationSituations.js +69 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeAntecedent.js +133 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationComputeImage.js +229 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.d.ts +10 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationThreshold.js +166 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationVariation.d.ts +9 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationVariation.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/affineSituationVariation.js +78 -0
- package/lib/exercises/math/functions/affines/situations/index.d.ts +6 -0
- package/lib/exercises/math/functions/affines/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/situations/index.js +5 -0
- package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.d.ts +2 -0
- package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.js +155 -0
- package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.d.ts +8 -0
- package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.js +99 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts +3 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponentials/index.js +4 -0
- package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.d.ts +12 -0
- package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.js +138 -0
- package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.d.ts +8 -0
- package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.js +142 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +7 -6
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.js +3 -2
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.js +7 -6
- package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/percent/percentToDecimal.js +5 -4
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +5 -4
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -8
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts +1 -7
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +1 -7
- package/lib/exercises/math/probaStat/randomVariable/situations/index.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/index.js +7 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts +11 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.js +112 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.js +176 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.js +94 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationProbabilityLaw.js +166 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationStandardDeviation.js +133 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationValues.js +211 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationVariance.js +113 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.d.ts +41 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituations.js +173 -0
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +5 -4
- package/lib/exercises/math/python/list/pyListMutationMix.d.ts.map +1 -1
- package/lib/exercises/math/python/list/pyListMutationMix.js +11 -6
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +9 -9
- package/lib/exercises/utils/options/arrayedOptions.d.ts +2 -0
- package/lib/exercises/utils/options/arrayedOptions.d.ts.map +1 -0
- package/lib/exercises/utils/options/arrayedOptions.js +16 -0
- package/lib/index.d.ts +56 -24
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +20 -20
- package/lib/tree/utilities/nodeUtils.d.ts +2 -0
- package/lib/tree/utilities/nodeUtils.d.ts.map +1 -1
- package/lib/tree/utilities/nodeUtils.js +40 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { defaultArrayedOptsWhereNeeded } from "../../../../../../exercises/utils/options/arrayedOptions.js";
|
|
3
4
|
import { greenMain, orange } from "../../../../../../geogebra/colors.js";
|
|
4
5
|
import { GeogebraConstructor } from "../../../../../../geogebra/geogebraConstructor.js";
|
|
5
6
|
import { Angle } from "../../../../../../math/geometry/angle.js";
|
|
@@ -387,8 +388,8 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
387
388
|
}
|
|
388
389
|
};
|
|
389
390
|
const getScalarProductAlKashiBHQuestion = (optsIn) => {
|
|
390
|
-
const
|
|
391
|
-
const sectorOfPointH = random(
|
|
391
|
+
const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
|
|
392
|
+
const sectorOfPointH = random(arrayedOpts.sectorOfPointH);
|
|
392
393
|
function createRandomPoints() {
|
|
393
394
|
const offsetBtoC = 10;
|
|
394
395
|
const pointB = new Point("B", randfloat(0, 10), randfloat(0, 10));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scalarProductComputeBH.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAoBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"scalarProductComputeBH.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAoBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAqBtC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B,CAAC;AAkeF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC;AA+BF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CA6BjE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, GeneratorOptionType, GeneratorOptionTarget, tryToAddWrongProp, propWhile, } from "../../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { defaultArrayedOptsWhereNeeded } from "../../../../../exercises/utils/options/arrayedOptions.js";
|
|
3
4
|
import { orange } from "../../../../../geogebra/colors.js";
|
|
4
5
|
import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
|
|
5
6
|
import { Angle } from "../../../../../math/geometry/angle.js";
|
|
@@ -248,10 +249,10 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
248
249
|
}
|
|
249
250
|
};
|
|
250
251
|
const getScalarProductComputeBHQuestion = (optsIn) => {
|
|
251
|
-
const
|
|
252
|
+
const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
|
|
252
253
|
const opts = {
|
|
253
|
-
sectorOfPointH: random(
|
|
254
|
-
isPositiveCoordsOnly:
|
|
254
|
+
sectorOfPointH: random(arrayedOpts.sectorOfPointH),
|
|
255
|
+
isPositiveCoordsOnly: arrayedOpts.isPositiveCoordsOnly,
|
|
255
256
|
};
|
|
256
257
|
const { sectorOfPointH, isPositiveCoordsOnly } = opts;
|
|
257
258
|
function createRandomIdentifiers() {
|
|
@@ -406,7 +407,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
406
407
|
};
|
|
407
408
|
return question;
|
|
408
409
|
};
|
|
409
|
-
const
|
|
410
|
+
const arrayedOptsDefault = {
|
|
410
411
|
sectorOfPointH: ["Entre $B$ et $C$"],
|
|
411
412
|
isPositiveCoordsOnly: true,
|
|
412
413
|
};
|
|
@@ -417,14 +418,14 @@ const options = [
|
|
|
417
418
|
target: GeneratorOptionTarget.generation,
|
|
418
419
|
type: GeneratorOptionType.multiselect,
|
|
419
420
|
values: ["Entre $B$ et $C$", "Après $C$", "Avant $B$"],
|
|
420
|
-
defaultValue:
|
|
421
|
+
defaultValue: arrayedOptsDefault.sectorOfPointH,
|
|
421
422
|
},
|
|
422
423
|
{
|
|
423
424
|
id: "isPositiveCoordsOnly",
|
|
424
425
|
label: "Coordonnées positives uniquement",
|
|
425
426
|
target: GeneratorOptionTarget.generation,
|
|
426
427
|
type: GeneratorOptionType.checkbox,
|
|
427
|
-
defaultValue:
|
|
428
|
+
defaultValue: arrayedOptsDefault.isPositiveCoordsOnly,
|
|
428
429
|
},
|
|
429
430
|
];
|
|
430
431
|
export const scalarProductComputeBH = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percentToDecimal.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/percentToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"percentToDecimal.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/percentToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA2JF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAsBF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe3D,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { defaultArrayedOptsWhereNeeded } from "../../../exercises/utils/options/arrayedOptions.js";
|
|
3
4
|
import { Decimal, DecimalConstructor, } from "../../../math/numbers/decimals/decimal.js";
|
|
4
5
|
import { Integer, IntegerConstructor, } from "../../../math/numbers/integer/integer.js";
|
|
5
6
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
@@ -82,9 +83,9 @@ const isAnswerValid = (ans, { answer, isPercentToDecimal }) => {
|
|
|
82
83
|
}
|
|
83
84
|
};
|
|
84
85
|
const getPercentToDecimalQuestion = (optsIn) => {
|
|
85
|
-
const
|
|
86
|
+
const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
|
|
86
87
|
const opts = {
|
|
87
|
-
conversionType: random(
|
|
88
|
+
conversionType: random(arrayedOpts.conversionType),
|
|
88
89
|
};
|
|
89
90
|
const isPercentToDecimal = opts.conversionType === "Pourcentage vers Décimal";
|
|
90
91
|
const isNatural = coinFlip();
|
|
@@ -119,7 +120,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
119
120
|
};
|
|
120
121
|
return question;
|
|
121
122
|
};
|
|
122
|
-
const
|
|
123
|
+
const arrayedOptsDefault = {
|
|
123
124
|
conversionType: ["Pourcentage vers Décimal", "Décimal vers Pourcentage"],
|
|
124
125
|
};
|
|
125
126
|
const options = [
|
|
@@ -129,7 +130,7 @@ const options = [
|
|
|
129
130
|
target: GeneratorOptionTarget.generation,
|
|
130
131
|
type: GeneratorOptionType.multiselect,
|
|
131
132
|
values: ["Pourcentage vers Décimal", "Décimal vers Pourcentage"],
|
|
132
|
-
defaultValue:
|
|
133
|
+
defaultValue: arrayedOptsDefault.conversionType,
|
|
133
134
|
},
|
|
134
135
|
];
|
|
135
136
|
export const percentToDecimal = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateFrequencyInList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicStats/calculateFrequencyInList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"calculateFrequencyInList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicStats/calculateFrequencyInList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AA8LF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAsBF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBnE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
|
|
3
4
|
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { round } from "../../../../math/utils/round.js";
|
|
@@ -95,8 +96,8 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
95
96
|
}
|
|
96
97
|
};
|
|
97
98
|
const getCalculateFrequencyInListQuestion = (optsIn) => {
|
|
98
|
-
const
|
|
99
|
-
const allowedAnsType =
|
|
99
|
+
const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
|
|
100
|
+
const allowedAnsType = arrayedOpts.allowedAnsType;
|
|
100
101
|
const target = randint(1, 10);
|
|
101
102
|
const length = randint(6, 13);
|
|
102
103
|
const values = [];
|
|
@@ -150,7 +151,7 @@ const getAllValidNodes = (identifiers) => {
|
|
|
150
151
|
return identifiersCopy;
|
|
151
152
|
})()));
|
|
152
153
|
};
|
|
153
|
-
const
|
|
154
|
+
const arrayedOptsDefault = {
|
|
154
155
|
allowedAnsType: ["exacte", "arrondie à 2 décimales"],
|
|
155
156
|
};
|
|
156
157
|
const options = [
|
|
@@ -160,7 +161,7 @@ const options = [
|
|
|
160
161
|
target: GeneratorOptionTarget.generation,
|
|
161
162
|
type: GeneratorOptionType.multiselect,
|
|
162
163
|
values: ["exacte", "arrondie à 2 décimales"],
|
|
163
|
-
defaultValue:
|
|
164
|
+
defaultValue: arrayedOptsDefault.allowedAnsType,
|
|
164
165
|
},
|
|
165
166
|
];
|
|
166
167
|
export const calculateFrequencyInList = {
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAiBrC,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;AA6ZF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA+BF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { defaultArrayedOptsWhereNeeded } from "../../../exercises/utils/options/arrayedOptions.js";
|
|
3
4
|
import { rationalVEA } from "../../../exercises/vea/rationalVEA.js";
|
|
4
5
|
import { Rational } from "../../../math/numbers/rationals/rational.js";
|
|
5
6
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
@@ -74,8 +75,8 @@ const getAnswer = (identifiers) => {
|
|
|
74
75
|
return getAnswerNode(identifiers).toTex();
|
|
75
76
|
};
|
|
76
77
|
const getProbaFromTableWithContextQuestion = (optsIn) => {
|
|
77
|
-
const
|
|
78
|
-
const allowedAnsType =
|
|
78
|
+
const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
|
|
79
|
+
const allowedAnsType = arrayedOpts.allowedAnsType;
|
|
79
80
|
const aCapB = randint(1, 20);
|
|
80
81
|
const aCapBBarre = randint(1, 20, [aCapB]);
|
|
81
82
|
const aBarreCapB = randint(1, 20, [aCapB, aCapBBarre]);
|
|
@@ -93,9 +94,7 @@ const getProbaFromTableWithContextQuestion = (optsIn) => {
|
|
|
93
94
|
const bBarreTotal = aBarreCapBBarre + aCapBBarre;
|
|
94
95
|
let event = "";
|
|
95
96
|
let proba = [];
|
|
96
|
-
const frenchType =
|
|
97
|
-
? random(opts.probaTypes)
|
|
98
|
-
: random(["Événement simple", "Intersection", "Union"]);
|
|
97
|
+
const frenchType = random(arrayedOpts.probaTypes);
|
|
99
98
|
const type = frenchType === "Événement simple"
|
|
100
99
|
? "singleEvent"
|
|
101
100
|
: frenchType.toLocaleLowerCase();
|
|
@@ -284,7 +283,7 @@ const createFormattedNode = (exactNode, strInternalAllowedAnswerTypes) => {
|
|
|
284
283
|
return exactNode;
|
|
285
284
|
}
|
|
286
285
|
};
|
|
287
|
-
const
|
|
286
|
+
const arrayedOptsDefault = {
|
|
288
287
|
allowedAnsType: ["exacte", "arrondie à 2 décimales"],
|
|
289
288
|
probaTypes: ["Événement simple", "Intersection", "Union"],
|
|
290
289
|
};
|
|
@@ -295,7 +294,7 @@ const options = [
|
|
|
295
294
|
target: GeneratorOptionTarget.generation,
|
|
296
295
|
type: GeneratorOptionType.multiselect,
|
|
297
296
|
values: ["exacte", "arrondie à 2 décimales"],
|
|
298
|
-
defaultValue:
|
|
297
|
+
defaultValue: arrayedOptsDefault.allowedAnsType,
|
|
299
298
|
},
|
|
300
299
|
{
|
|
301
300
|
id: "probaTypes",
|
|
@@ -303,7 +302,7 @@ const options = [
|
|
|
303
302
|
target: GeneratorOptionTarget.generation,
|
|
304
303
|
type: GeneratorOptionType.multiselect,
|
|
305
304
|
values: ["Événement simple", "Intersection", "Union"],
|
|
306
|
-
defaultValue:
|
|
305
|
+
defaultValue: arrayedOptsDefault.probaTypes,
|
|
307
306
|
},
|
|
308
307
|
];
|
|
309
308
|
export const probaFromTableWithContext = {
|
|
@@ -4,12 +4,6 @@ export * from "./isTableProbabilityLaw.js";
|
|
|
4
4
|
export * from "./randomVariableStandardDeviation.js";
|
|
5
5
|
export * from "./findValueToMatchRandomVariableAverage.js";
|
|
6
6
|
export * from "./calculateProbaFromVATableLaw.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./randomVariableSituationComputeProbability.js";
|
|
9
|
-
export * from "./randomVariableSituationAverage.js";
|
|
10
|
-
export * from "./randomVariableSituationVariance.js";
|
|
11
|
-
export * from "./randomVariableSituationStandardDeviation.js";
|
|
12
|
-
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
13
|
-
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
7
|
+
export * from "./situations/index.js";
|
|
14
8
|
export * from "./missingValueInRandomVariableProbabilityLaw.js";
|
|
15
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AAGrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AAGrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAElD,cAAc,uBAAuB,CAAC;AAEtC,cAAc,iDAAiD,CAAC"}
|
|
@@ -6,12 +6,6 @@ export * from "./randomVariableStandardDeviation.js";
|
|
|
6
6
|
// export * from "./findValueToMatchRandomVariableAverage.js";
|
|
7
7
|
export * from "./findValueToMatchRandomVariableAverage.js";
|
|
8
8
|
export * from "./calculateProbaFromVATableLaw.js";
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./randomVariableSituationComputeProbability.js";
|
|
11
|
-
export * from "./randomVariableSituationAverage.js";
|
|
12
|
-
export * from "./randomVariableSituationVariance.js";
|
|
13
|
-
export * from "./randomVariableSituationStandardDeviation.js";
|
|
14
|
-
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
15
|
-
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
9
|
+
export * from "./situations/index.js";
|
|
16
10
|
// export * from "./decideWhichGameIsLessRisky.js";
|
|
17
11
|
export * from "./missingValueInRandomVariableProbabilityLaw.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./randomVariableSituationAverage.js";
|
|
2
|
+
export * from "./randomVariableSituationComputeProbability.js";
|
|
3
|
+
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
4
|
+
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
5
|
+
export * from "./randomVariableSituationStandardDeviation.js";
|
|
6
|
+
export * from "./randomVariableSituationValues.js";
|
|
7
|
+
export * from "./randomVariableSituationVariance.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./randomVariableSituationAverage.js";
|
|
2
|
+
export * from "./randomVariableSituationComputeProbability.js";
|
|
3
|
+
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
4
|
+
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
5
|
+
export * from "./randomVariableSituationStandardDeviation.js";
|
|
6
|
+
export * from "./randomVariableSituationValues.js";
|
|
7
|
+
export * from "./randomVariableSituationVariance.js";
|
package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { RandomVariableSituationParams } from "./randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: RandomVariableSituationParams;
|
|
5
|
+
};
|
|
6
|
+
type Options = {
|
|
7
|
+
averageFormulation: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const randomVariableSituationAverage: Exercise<Identifiers, Options>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=randomVariableSituationAverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationAverage.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;CACvC,CAAC;AAqGF,KAAK,OAAO,GAAG;IACb,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAWF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBzE,CAAC"}
|
package/lib/exercises/math/probaStat/randomVariable/situations/randomVariableSituationAverage.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType, propWhile, 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 { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
6
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
7
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./randomVariableSituations.js";
|
|
8
|
+
const getPropositions = (n, { answer }) => {
|
|
9
|
+
const propositions = [];
|
|
10
|
+
addValidProp(propositions, answer);
|
|
11
|
+
propWhile(propositions, n, () => {
|
|
12
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductibleWithSign().toTree().toTex());
|
|
13
|
+
});
|
|
14
|
+
return shuffleProps(propositions, n);
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const { params } = identifiers;
|
|
18
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
19
|
+
return va.getAverage().simplify().toTex();
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers, opts) => {
|
|
22
|
+
const { params } = identifiers;
|
|
23
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
24
|
+
const question = opts?.averageFormulation === "Calculer $E(X)$"
|
|
25
|
+
? "Déterminer l'espérance $E(X)$ de $X$."
|
|
26
|
+
: "Déterminer le gain moyen auquel un joueur peut s'attendre après un grand nombre de parties.";
|
|
27
|
+
return (context +
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
${question}`);
|
|
31
|
+
};
|
|
32
|
+
const getHint = () => {
|
|
33
|
+
return `Dresse la loi de probabilité de $X$. Pour cela, détermine les valeurs possibles $x_i$ que peut prendre $X$, puis pour chaque valeur, calcule la probabilité $p_i$ associée.
|
|
34
|
+
|
|
35
|
+
Tu peux alors calculer l'espérance de $X$ par la formule :
|
|
36
|
+
|
|
37
|
+
$$
|
|
38
|
+
E(X) = x_1\\times p_1 + \\ldots + x_n\\times p_n
|
|
39
|
+
$$`;
|
|
40
|
+
};
|
|
41
|
+
const getCorrection = (identifiers) => {
|
|
42
|
+
const { params } = identifiers;
|
|
43
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
44
|
+
return `On dresse la loi de probabilité de $X$ :
|
|
45
|
+
|
|
46
|
+
${va.getLawMdTable()}
|
|
47
|
+
|
|
48
|
+
Puis on calcule l'espérance :
|
|
49
|
+
|
|
50
|
+
${alignTex([
|
|
51
|
+
["E(X)", "=", va.getAverage().toTex()],
|
|
52
|
+
["", "=", va.getAverage().simplify().toTex()],
|
|
53
|
+
])}
|
|
54
|
+
`;
|
|
55
|
+
};
|
|
56
|
+
const getKeys = () => {
|
|
57
|
+
return [];
|
|
58
|
+
};
|
|
59
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
60
|
+
try {
|
|
61
|
+
return rationalVEA(ans, answer);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
return handleVEAError(err);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const getRandomVariableSituationAverageQuestion = (opts) => {
|
|
68
|
+
const params = buildRandomVariableSituation();
|
|
69
|
+
const identifiers = {
|
|
70
|
+
params,
|
|
71
|
+
};
|
|
72
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
73
|
+
};
|
|
74
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
75
|
+
return {
|
|
76
|
+
answer: getAnswer(identifiers),
|
|
77
|
+
instruction: getInstruction(identifiers, opts),
|
|
78
|
+
keys: getKeys(identifiers),
|
|
79
|
+
answerFormat: "tex",
|
|
80
|
+
identifiers,
|
|
81
|
+
hint: getHint(identifiers),
|
|
82
|
+
correction: getCorrection(identifiers),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const options = [
|
|
86
|
+
{
|
|
87
|
+
id: "averageFormulation",
|
|
88
|
+
label: "Formulation de la consigne",
|
|
89
|
+
target: GeneratorOptionTarget.instruction,
|
|
90
|
+
type: GeneratorOptionType.select,
|
|
91
|
+
values: ["Calculer $E(X)$", "Calculer le gain moyen"],
|
|
92
|
+
defaultValue: "Calculer $E(X)$",
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
export const randomVariableSituationAverage = {
|
|
96
|
+
id: "randomVariableSituationAverage",
|
|
97
|
+
connector: "=",
|
|
98
|
+
label: "Calculer l'espérance $E(X)$ d'une variable aléatoire dans un contexte",
|
|
99
|
+
isSingleStep: true,
|
|
100
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationAverageQuestion(opts), nb),
|
|
101
|
+
options,
|
|
102
|
+
qcmTimer: 60,
|
|
103
|
+
freeTimer: 60,
|
|
104
|
+
getPropositions,
|
|
105
|
+
isAnswerValid,
|
|
106
|
+
subject: "Mathématiques",
|
|
107
|
+
getHint,
|
|
108
|
+
getCorrection,
|
|
109
|
+
getAnswer,
|
|
110
|
+
getQuestionFromIdentifiers,
|
|
111
|
+
hasHintAndCorrection: true,
|
|
112
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { RandomVariableSituationParams } from "./randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: RandomVariableSituationParams;
|
|
5
|
+
xi: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const randomVariableSituationComputeProbability: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=randomVariableSituationComputeProbability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationComputeProbability.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/randomVariableSituationComputeProbability.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;IACtC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA4LF,eAAO,MAAM,yCAAyC,EAAE,QAAQ,CAAC,WAAW,CAuBzE,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, 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 { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
6
|
+
import { random } from "../../../../../utils/alea/random.js";
|
|
7
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
8
|
+
import { pluralize } from "../../../../../utils/strings/pluralize.js";
|
|
9
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./randomVariableSituations.js";
|
|
10
|
+
const getPropositions = (n, { answer, params }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
addValidProp(propositions, answer);
|
|
13
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
14
|
+
for (const p of va.yValues) {
|
|
15
|
+
tryToAddWrongProp(propositions, p.toTex());
|
|
16
|
+
}
|
|
17
|
+
propWhile(propositions, n, () => {
|
|
18
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductibleProba().toTree().toTex());
|
|
19
|
+
});
|
|
20
|
+
return shuffleProps(propositions, n);
|
|
21
|
+
};
|
|
22
|
+
const getAnswer = (identifiers) => {
|
|
23
|
+
const { params, xi } = identifiers;
|
|
24
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
25
|
+
const index = va.xValues.findIndex((x) => x.evaluate() === xi);
|
|
26
|
+
return va.yValues[index].toTex();
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
const { params, xi } = identifiers;
|
|
30
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
31
|
+
return (context +
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
Calculer $P(X = ${xi})$.`);
|
|
35
|
+
};
|
|
36
|
+
const getHint = (identifiers) => {
|
|
37
|
+
const { xi } = identifiers;
|
|
38
|
+
return `Détermine l'ensemble des issues possibles pour cette expérience aléatoire. Puis, détermine les issues qui réalisent l'événement $X = ${xi}$. Tu peux alors utiliser l'équiprobabilité pour déterminer $P(X = ${xi})$.`;
|
|
39
|
+
};
|
|
40
|
+
const getCorrection = (identifiers) => {
|
|
41
|
+
const { xi, params } = identifiers;
|
|
42
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
43
|
+
const index = va.xValues.findIndex((x) => x.evaluate() === xi);
|
|
44
|
+
switch (params.id) {
|
|
45
|
+
case "coin": {
|
|
46
|
+
const throws = index === 0
|
|
47
|
+
? "deux fois faces"
|
|
48
|
+
: index === 1
|
|
49
|
+
? "une fois pile, et une fois face"
|
|
50
|
+
: "deux fois piles";
|
|
51
|
+
return `Cette expérience aléatoire a $4$ issues :
|
|
52
|
+
|
|
53
|
+
- obtenir deux faces;
|
|
54
|
+
- obtenir face au premier lancer, puis pile au deuxième;
|
|
55
|
+
- obtenir pile au premier lancer, puis face au deuxième;
|
|
56
|
+
- obtenir deux piles.
|
|
57
|
+
|
|
58
|
+
L'issue $X = ${xi}$ se réalise si on obtient ${throws}.
|
|
59
|
+
|
|
60
|
+
${index === 0 || index === 2
|
|
61
|
+
? `Il n'y a qu'une issue qui réalise cet évènement sur les $4$ issues possibles. La probabilité recherchée vaut donc :
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
${frac(1, 4).toTex()}
|
|
65
|
+
$$`
|
|
66
|
+
: `Il y a deux issues qui réalise cet évènement sur les $4$ issues possibles. La probabilité recherchée vaut donc :
|
|
67
|
+
|
|
68
|
+
$$
|
|
69
|
+
${frac(2, 4).toSimplificationTex()}
|
|
70
|
+
$$`}
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
case "urne": {
|
|
74
|
+
const effectif = xi === params.gb ? params.b : xi === params.gr ? params.r : params.n;
|
|
75
|
+
const color = xi === params.gb ? "blanche" : xi === params.gr ? "rouge" : "noire";
|
|
76
|
+
return `L'issue $X = ${xi}$ se réalise si on tire une boule ${color}.
|
|
77
|
+
|
|
78
|
+
Puisqu'il y a $${effectif}$ ${pluralize("boule", effectif)} ${pluralize(color, effectif)} sur un total de $${params.b + params.r + params.n}$ boules, la probabilité recherchée vaut :
|
|
79
|
+
|
|
80
|
+
$$
|
|
81
|
+
P(X=${xi}) = ${getAnswer(identifiers)}
|
|
82
|
+
$$`;
|
|
83
|
+
}
|
|
84
|
+
case "diceMultiple": {
|
|
85
|
+
const multiples = [];
|
|
86
|
+
for (let i = 1; i < params.n; i++) {
|
|
87
|
+
if (i % params.winningMultiple === 0) {
|
|
88
|
+
multiples.push(i);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return `L'issue $X = ${xi}$ se réalise si on ${xi > 0 ? `obtient` : "n'obtient pas"} un multiple de $${params.winningMultiple}$.
|
|
92
|
+
|
|
93
|
+
Les faces du dés qui sont des multiples de $${params.winningMultiple}$ sont : $${multiples.join("\\ ; \\ ")}$.
|
|
94
|
+
|
|
95
|
+
Il y a donc $${multiples.length}$ multiples de $${params.winningMultiple}$ possibles sur les $${params.n}$ faces.
|
|
96
|
+
|
|
97
|
+
La probabilité recherchée est donc :
|
|
98
|
+
|
|
99
|
+
$$
|
|
100
|
+
P(X=${xi}) = ${frac(multiples.length, params.n).toSimplificationTex()}
|
|
101
|
+
$$
|
|
102
|
+
`;
|
|
103
|
+
// case "diceSum":
|
|
104
|
+
// return ``
|
|
105
|
+
}
|
|
106
|
+
case "cards": {
|
|
107
|
+
const effectif = xi === params.gAs ? "4" : xi === params.gFigure ? "12" : "36";
|
|
108
|
+
const card = xi === params.gAs
|
|
109
|
+
? "as"
|
|
110
|
+
: xi === params.gFigure
|
|
111
|
+
? "figures"
|
|
112
|
+
: "cartes qui ne sont ni des as ni des figures";
|
|
113
|
+
const card2 = xi === params.gAs
|
|
114
|
+
? "un as"
|
|
115
|
+
: xi === params.gFigure
|
|
116
|
+
? "une figure"
|
|
117
|
+
: "une carte qui n'est ni un as ni une figure";
|
|
118
|
+
return `L'issue $X = ${xi}$ se réalise si on tire ${card2}.
|
|
119
|
+
|
|
120
|
+
Puisqu'il y a $${effectif}$ ${card} sur un total de $52$ cartes, la probabilité recherchée vaut :
|
|
121
|
+
|
|
122
|
+
$$
|
|
123
|
+
P(X=${xi}) = ${frac(effectif, 52).toSimplificationTex()}
|
|
124
|
+
$$`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const getKeys = () => {
|
|
129
|
+
return [];
|
|
130
|
+
};
|
|
131
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
132
|
+
try {
|
|
133
|
+
return rationalVEA(ans, answer);
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
return handleVEAError(err);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const getRandomVariableSituationComputeProbabilityQuestion = () => {
|
|
140
|
+
const params = buildRandomVariableSituation();
|
|
141
|
+
const xi = random(getRandomVariableSituation(params).getVA().xValues).evaluate();
|
|
142
|
+
const identifiers = {
|
|
143
|
+
params,
|
|
144
|
+
xi,
|
|
145
|
+
};
|
|
146
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
147
|
+
};
|
|
148
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
149
|
+
return {
|
|
150
|
+
answer: getAnswer(identifiers),
|
|
151
|
+
instruction: getInstruction(identifiers),
|
|
152
|
+
keys: getKeys(identifiers),
|
|
153
|
+
answerFormat: "tex",
|
|
154
|
+
identifiers,
|
|
155
|
+
hint: getHint(identifiers),
|
|
156
|
+
correction: getCorrection(identifiers),
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
export const randomVariableSituationComputeProbability = {
|
|
160
|
+
id: "randomVariableSituationComputeProbability",
|
|
161
|
+
connector: "=",
|
|
162
|
+
label: "Calculer une probabilité du type $P(X=k)$ pour une variable aléatoire $X$ dans un contexte",
|
|
163
|
+
isSingleStep: true,
|
|
164
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationComputeProbabilityQuestion(opts), nb),
|
|
165
|
+
qcmTimer: 60,
|
|
166
|
+
freeTimer: 60,
|
|
167
|
+
getPropositions,
|
|
168
|
+
isAnswerValid,
|
|
169
|
+
subject: "Mathématiques",
|
|
170
|
+
getInstruction,
|
|
171
|
+
getHint,
|
|
172
|
+
getCorrection,
|
|
173
|
+
getAnswer,
|
|
174
|
+
getQuestionFromIdentifiers,
|
|
175
|
+
hasHintAndCorrection: true,
|
|
176
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { RandomVariableSituationParams } from "./randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: RandomVariableSituationParams;
|
|
5
|
+
};
|
|
6
|
+
export declare const randomVariableSituationIsGameFavorable: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=randomVariableSituationIsGameFavorable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationIsGameFavorable.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/situations/randomVariableSituationIsGameFavorable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;CACvC,CAAC;AA2FF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,WAAW,CAqBxE,CAAC"}
|