math-exercises 3.0.65 → 3.0.67
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/fractions/periodicWritingToFraction.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +41 -20
- package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/simplifyFraction.js +4 -4
- package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.js +13 -21
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.js +4 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.js +5 -6
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.js +4 -4
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +4 -4
- package/lib/exercises/math/calculLitteral/distributivity/idRmq1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/idRmq1.js +4 -7
- package/lib/exercises/math/calculLitteral/distributivity/idRmq2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/idRmq2.js +4 -5
- package/lib/exercises/math/calculLitteral/distributivity/idRmq3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/idRmq3.js +4 -5
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +4 -4
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.js +4 -4
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +4 -6
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.js +4 -3
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.js +4 -6
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.js +4 -4
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.js +4 -6
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType3.js +4 -4
- package/lib/exercises/math/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/fractionEquation.js +4 -4
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.js +4 -4
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.js +4 -6
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.js +4 -6
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.js +4 -6
- package/lib/exercises/math/calculLitteral/factorisation/factoType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType2.js +4 -3
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.js +4 -4
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.js +4 -4
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.js +4 -7
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +4 -3
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +4 -5
- package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.js +4 -4
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +4 -2
- package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.js +4 -4
- package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/varTableExtremaReading.js +4 -5
- package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/recognizeAngleType.js +4 -5
- package/lib/exercises/math/geometry/areas/circleRadiusFromArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/circleRadiusFromArea.js +3 -0
- package/lib/exercises/math/geometry/areas/rectangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rectangleArea.js +4 -7
- package/lib/exercises/math/geometry/areas/rectangleSideFromArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rectangleSideFromArea.js +4 -3
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.js +32 -16
- package/lib/exercises/math/geometry/areas/squareSideFromArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/squareSideFromArea.js +3 -0
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.js +4 -4
- package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/midpoint.js +4 -4
- package/lib/exercises/math/geometry/cartesian/placeAPoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAPoint.js +25 -11
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnLine.js +4 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +4 -4
- package/lib/exercises/math/geometry/cartesian/pointCoordinates.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/pointCoordinates.js +4 -0
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.js +4 -0
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.js +33 -17
- package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -1
- package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +4 -5
- package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.d.ts.map +1 -1
- package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.js +4 -3
- package/lib/exercises/math/matrices/matrixGeneralTerm.d.ts.map +1 -1
- package/lib/exercises/math/matrices/matrixGeneralTerm.js +0 -2
- package/lib/exercises/math/percent/evolutions/index.d.ts +0 -1
- package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/index.js +0 -1
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +21 -1
- package/lib/exercises/math/percent/interests/compoundInterest.d.ts +12 -0
- package/lib/exercises/math/percent/interests/compoundInterest.d.ts.map +1 -0
- package/lib/exercises/math/percent/interests/compoundInterest.js +127 -0
- package/lib/exercises/math/percent/interests/compoundInterestDuration.d.ts +2 -0
- package/lib/exercises/math/percent/interests/compoundInterestDuration.d.ts.map +1 -0
- package/lib/exercises/math/percent/interests/compoundInterestDuration.js +166 -0
- package/lib/exercises/math/percent/interests/compoundInterestStartValue.d.ts +12 -0
- package/lib/exercises/math/percent/interests/compoundInterestStartValue.d.ts.map +1 -0
- package/lib/exercises/math/percent/interests/compoundInterestStartValue.js +132 -0
- package/lib/exercises/math/percent/interests/index.d.ts +3 -0
- package/lib/exercises/math/percent/interests/index.d.ts.map +1 -0
- package/lib/exercises/math/percent/interests/index.js +2 -0
- package/lib/exercises/math/primitive/constantPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/constantPrimitive.js +0 -2
- package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/polynomialPrimitive.js +4 -0
- package/lib/exercises/math/primitive/sinCosPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/sinCosPrimitive.js +25 -12
- package/lib/exercises/math/probaStat/binomial/binomialInequation.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/binomial/binomialInequation.js +4 -3
- package/lib/exercises/math/probaStat/binomial/expectedValueOfBinomialProba.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/binomial/expectedValueOfBinomialProba.js +52 -28
- package/lib/exercises/math/probaStat/binomial/varianceOfBinomialProba.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/binomial/varianceOfBinomialProba.js +59 -39
- package/lib/exercises/math/probaStat/diceBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/diceBasicProbas.js +1 -4
- package/lib/exercises/math/sequences/sequencePlot.d.ts.map +1 -1
- package/lib/exercises/math/sequences/sequencePlot.js +59 -32
- package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.js +23 -7
- package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.js +23 -8
- package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.d.ts +6 -1
- package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.js +61 -27
- package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.js +28 -10
- package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.js +43 -17
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.js +23 -8
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.js +22 -8
- package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.js +18 -5
- package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.d.ts +1 -0
- package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.js +49 -24
- package/lib/exercises/pc/chemicalElements/weightPercent.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/weightPercent.js +42 -13
- package/lib/exercises/pc/chemicalReactions/calculateCombustionEnergy.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/calculateCombustionEnergy.js +26 -9
- package/lib/exercises/pc/chemicalReactions/calculateSynthesisEfficiency.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/calculateSynthesisEfficiency.js +48 -15
- package/lib/exercises/pc/chemicalReactions/identifyLimitingReagent.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/identifyLimitingReagent.js +22 -9
- package/lib/exercises/pc/chemicalReactions/identifyStoichiometricMixture.d.ts +1 -0
- package/lib/exercises/pc/chemicalReactions/identifyStoichiometricMixture.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/identifyStoichiometricMixture.js +30 -15
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.d.ts +7 -2
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.js +49 -33
- package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.d.ts +1 -2
- package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.js +104 -67
- package/lib/exercises/pc/dosage/beerLambertRandomValue.d.ts +1 -1
- package/lib/exercises/pc/dosage/beerLambertRandomValue.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/beerLambertRandomValue.js +99 -82
- package/lib/exercises/pc/dosage/concentrationCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/concentrationCalculation.js +69 -40
- package/lib/exercises/pc/dosage/concentrationFromMassCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/concentrationFromMassCalculation.js +78 -40
- package/lib/exercises/pc/electricity/calculateIntensity.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/calculateIntensity.js +23 -19
- package/lib/exercises/pc/electricity/calculateIntensityInSerieOrParallel.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/calculateIntensityInSerieOrParallel.js +51 -43
- package/lib/exercises/pc/electricity/calculateVoltage.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/calculateVoltage.js +0 -2
- package/lib/exercises/pc/electricity/electricChargeFromIntensity.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/electricChargeFromIntensity.js +19 -6
- package/lib/exercises/pc/electricity/electricEnergyFromPower.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/electricEnergyFromPower.js +16 -6
- package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.d.ts +1 -0
- package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.js +54 -24
- package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.js +44 -44
- package/lib/exercises/pc/electricity/ohmLaw.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/ohmLaw.js +67 -24
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts +1 -1
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.js +36 -43
- package/lib/index.d.ts +19 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +2 -0
- package/package.json +1 -1
|
@@ -1,36 +1,62 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
6
7
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
8
|
import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
8
10
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
const { nX, a, b } = identifiers;
|
|
13
|
+
const p = new Rational(a, b);
|
|
14
|
+
return `Soit $X$ une variable aléatoire qui suit une loi binomiale de paramètres $n=${nX}$ et $p=${p
|
|
15
|
+
.toTree()
|
|
16
|
+
.simplify()
|
|
17
|
+
.toTex()}$.
|
|
18
|
+
|
|
19
|
+
Calculez l'espérance de $X$.`;
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { nX, a, b } = identifiers;
|
|
23
|
+
const p = new Rational(a, b);
|
|
24
|
+
const nNode = new NumberNode(nX);
|
|
25
|
+
const node = new MultiplyNode(nNode, p.toTree().simplify()).simplify();
|
|
26
|
+
const answer = node.toTex();
|
|
27
|
+
return answer;
|
|
28
|
+
};
|
|
29
|
+
const getHint = (identifiers) => {
|
|
30
|
+
return `L'espérance d'une variable aléatoire $X$ qui suit une loi binomiale de paramètres $n$ et $p$ est donnée par $E(X) = np$.`;
|
|
31
|
+
};
|
|
32
|
+
const getCorrection = (identifiers) => {
|
|
33
|
+
const { nX, a, b } = identifiers;
|
|
34
|
+
const p = new Rational(a, b);
|
|
35
|
+
return `L'espérance d'une variable aléatoire $X$ qui suit une loi binomiale de paramètres $n$ et $p$ est donnée par $E(X) = np$.
|
|
36
|
+
|
|
37
|
+
Ici, on a donc :
|
|
38
|
+
|
|
39
|
+
${alignTex([
|
|
40
|
+
["E(X)", "=", new MultiplyNode(nX.toTree(), p.toTree()).toTex()],
|
|
41
|
+
["", "=", getAnswer(identifiers)],
|
|
42
|
+
])}`;
|
|
43
|
+
};
|
|
9
44
|
const getExpectedValueOfBinomialProbaQuestion = () => {
|
|
10
45
|
const nX = randint(1, 9);
|
|
11
46
|
const b = randint(2, 11);
|
|
12
47
|
const a = randint(1, b);
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
48
|
+
const identifiers = { nX, a, b };
|
|
49
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
50
|
+
};
|
|
51
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
16
52
|
const question = {
|
|
17
|
-
answer,
|
|
18
|
-
instruction:
|
|
19
|
-
.toTree()
|
|
20
|
-
.simplify()
|
|
21
|
-
.toTex()}$. Calculez l'espérance de $X$.`,
|
|
53
|
+
answer: getAnswer(identifiers),
|
|
54
|
+
instruction: getInstruction(identifiers),
|
|
22
55
|
keys: [],
|
|
23
56
|
answerFormat: "tex",
|
|
24
|
-
identifiers
|
|
25
|
-
hint:
|
|
26
|
-
correction:
|
|
27
|
-
|
|
28
|
-
Ici, on a donc :
|
|
29
|
-
|
|
30
|
-
${alignTex([
|
|
31
|
-
["E(X)", "=", new MultiplyNode(nX.toTree(), p.toTree()).toTex()],
|
|
32
|
-
["", "=", answer],
|
|
33
|
-
])}`,
|
|
57
|
+
identifiers,
|
|
58
|
+
hint: getHint(identifiers),
|
|
59
|
+
correction: getCorrection(identifiers),
|
|
34
60
|
};
|
|
35
61
|
return question;
|
|
36
62
|
};
|
|
@@ -46,12 +72,13 @@ const getPropositions = (n, { answer, nX, a, b }) => {
|
|
|
46
72
|
}
|
|
47
73
|
return shuffleProps(propositions, n);
|
|
48
74
|
};
|
|
49
|
-
const isAnswerValid = (ans, {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
75
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
76
|
+
try {
|
|
77
|
+
return rationalVEA(ans, answer);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return handleVEAError(err);
|
|
81
|
+
}
|
|
55
82
|
};
|
|
56
83
|
const generatePropositions = (n, p) => {
|
|
57
84
|
const pTree = p.toTree().simplify();
|
|
@@ -66,10 +93,6 @@ const generatePropositions = (n, p) => {
|
|
|
66
93
|
thirdProposition.toTex(),
|
|
67
94
|
];
|
|
68
95
|
};
|
|
69
|
-
const getCorrectAnswer = (n, p) => {
|
|
70
|
-
const nNode = new NumberNode(n);
|
|
71
|
-
return new MultiplyNode(nNode, p.toTree().simplify()).simplify();
|
|
72
|
-
};
|
|
73
96
|
export const expectedValueOfBinomialProba = {
|
|
74
97
|
id: "expectedValueOfBinomialProba",
|
|
75
98
|
label: "Calcul de l'espérance d'une loi binomiale",
|
|
@@ -83,4 +106,5 @@ export const expectedValueOfBinomialProba = {
|
|
|
83
106
|
isAnswerValid,
|
|
84
107
|
subject: "Mathématiques",
|
|
85
108
|
hasHintAndCorrection: true,
|
|
109
|
+
getQuestionFromIdentifiers,
|
|
86
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"varianceOfBinomialProba.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/binomial/varianceOfBinomialProba.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"varianceOfBinomialProba.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/binomial/varianceOfBinomialProba.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqHF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAYzD,CAAC"}
|
|
@@ -1,46 +1,72 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
6
7
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
8
|
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
8
9
|
import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
11
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const nX = randint(1, 9);
|
|
13
|
-
const b = randint(2, 11);
|
|
14
|
-
const a = randint(1, b);
|
|
12
|
+
const getAnswer = (identifiers) => {
|
|
13
|
+
const { nX, a, b } = identifiers;
|
|
15
14
|
const p = new Rational(a, b);
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
const pTree = p.toTree().simplify();
|
|
16
|
+
const oneMinusP = new SubstractNode((1).toTree(), pTree);
|
|
17
|
+
return new MultiplyNode(new NumberNode(nX), new MultiplyNode(pTree, oneMinusP).simplify())
|
|
18
|
+
.simplify()
|
|
19
|
+
.toTex();
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers) => {
|
|
22
|
+
const { nX, a, b } = identifiers;
|
|
23
|
+
const p = new Rational(a, b);
|
|
24
|
+
return `Soit $X$ une variable aléatoire qui suit une loi binomiale de paramètres $n=${nX}$ et $p=${p
|
|
25
|
+
.toTree()
|
|
26
|
+
.simplify()
|
|
27
|
+
.toTex()}$. Calculez la variance de $X$.`;
|
|
28
|
+
};
|
|
29
|
+
const getHint = (identifiers) => {
|
|
30
|
+
return `L'espérance d'une variable aléatoire $X$ qui suit une loi binomiale de paramètres $n$ et $p$ est donnée par :
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
$$
|
|
33
|
+
V(X) = np(1-p)
|
|
34
|
+
$$`;
|
|
35
|
+
};
|
|
36
|
+
const getCorrection = (identifiers) => {
|
|
37
|
+
const { nX, a, b } = identifiers;
|
|
38
|
+
const p = new Rational(a, b);
|
|
39
|
+
return `L'espérance d'une variable aléatoire $X$ qui suit une loi binomiale de paramètres $n$ et $p$ est donnée par :
|
|
31
40
|
|
|
32
41
|
$V(X) = np(1-p)$.
|
|
33
42
|
|
|
34
43
|
Ici, on a donc :
|
|
35
44
|
|
|
36
45
|
${alignTex([
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
[
|
|
47
|
+
"V(X)",
|
|
48
|
+
"=",
|
|
49
|
+
new MultiplyNode(nX.toTree(), new MultiplyNode(p.toTree(), new SubstractNode((1).toTree(), p.toTree())), { forceTimesSign: true }).toTex(),
|
|
50
|
+
],
|
|
51
|
+
["", "=", getAnswer(identifiers)],
|
|
52
|
+
])}`;
|
|
53
|
+
};
|
|
54
|
+
const getVarianceOfBinomialProbaQuestion = () => {
|
|
55
|
+
const nX = randint(1, 9);
|
|
56
|
+
const b = randint(2, 11);
|
|
57
|
+
const a = randint(1, b);
|
|
58
|
+
const identifiers = { nX, a, b };
|
|
59
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
60
|
+
};
|
|
61
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
62
|
+
const question = {
|
|
63
|
+
answer: getAnswer(identifiers),
|
|
64
|
+
instruction: getInstruction(identifiers),
|
|
65
|
+
keys: [],
|
|
66
|
+
answerFormat: "tex",
|
|
67
|
+
identifiers,
|
|
68
|
+
hint: getHint(identifiers),
|
|
69
|
+
correction: getCorrection(identifiers),
|
|
44
70
|
};
|
|
45
71
|
return question;
|
|
46
72
|
};
|
|
@@ -56,12 +82,13 @@ const getPropositions = (n, { answer, nX, a, b }) => {
|
|
|
56
82
|
}
|
|
57
83
|
return shuffleProps(propositions, n);
|
|
58
84
|
};
|
|
59
|
-
const isAnswerValid = (ans, { nX, a, b }) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
85
|
+
const isAnswerValid = (ans, { answer, nX, a, b }) => {
|
|
86
|
+
try {
|
|
87
|
+
return rationalVEA(ans, answer);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
return handleVEAError(err);
|
|
91
|
+
}
|
|
65
92
|
};
|
|
66
93
|
const generatePropositions = (n, p) => {
|
|
67
94
|
const pTree = p.toTree().simplify();
|
|
@@ -70,17 +97,10 @@ const generatePropositions = (n, p) => {
|
|
|
70
97
|
const secondProposition = new MultiplyNode(nNode, new PowerNode(pTree, new NumberNode(2)).simplify()).simplify();
|
|
71
98
|
return [firstProposition.toTex(), secondProposition.toTex()];
|
|
72
99
|
};
|
|
73
|
-
const getCorrectAnswer = (n, p) => {
|
|
74
|
-
const pTree = p.toTree().simplify();
|
|
75
|
-
const oneMinusP = new SubstractNode(nbOneNode, pTree);
|
|
76
|
-
return new MultiplyNode(new NumberNode(n), new MultiplyNode(pTree, oneMinusP).simplify()).simplify();
|
|
77
|
-
};
|
|
78
100
|
export const varianceOfBinomialProba = {
|
|
79
101
|
id: "varianceOfBinomialProba",
|
|
80
102
|
label: "Calcul de la variance d'une loi binomiale",
|
|
81
|
-
levels: ["TermTech"],
|
|
82
103
|
isSingleStep: true,
|
|
83
|
-
sections: ["Probabilités"],
|
|
84
104
|
generator: (nb) => getDistinctQuestions(getVarianceOfBinomialProbaQuestion, nb),
|
|
85
105
|
qcmTimer: 60,
|
|
86
106
|
freeTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diceBasicProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/diceBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA8IF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"diceBasicProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/diceBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA8IF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencePlot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sequences/sequencePlot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"sequencePlot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sequences/sequencePlot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AA0HF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAc9C,CAAC"}
|
|
@@ -4,6 +4,54 @@ import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
|
4
4
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
5
|
import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
|
|
6
6
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
8
|
+
const { nValue, points, isArithmetic } = identifiers;
|
|
9
|
+
return `Ci-dessous est tracé un nuage de points représentant les valeurs d'une suite $(u_n)$. Quelle est la valeur de $u_{${nValue}}$ ?`;
|
|
10
|
+
};
|
|
11
|
+
const getAnswer = (identifiers) => {
|
|
12
|
+
const { nValue, points, isArithmetic } = identifiers;
|
|
13
|
+
const u_nValue = points[nValue][1];
|
|
14
|
+
const answer = u_nValue.toString();
|
|
15
|
+
return answer;
|
|
16
|
+
};
|
|
17
|
+
const getGGBOptions = (identifiers) => {
|
|
18
|
+
const { nValue, points, isArithmetic } = identifiers;
|
|
19
|
+
const commands = points.map((point, index) => {
|
|
20
|
+
return `A${index}=(${point[0]},${point[1]})`;
|
|
21
|
+
});
|
|
22
|
+
commands.push(...points.map((_, index) => {
|
|
23
|
+
return `SetFixed(A${index},true)`;
|
|
24
|
+
}), ...points.map((_, index) => {
|
|
25
|
+
return `SetLabelMode(A${index},1)`;
|
|
26
|
+
}));
|
|
27
|
+
const ggb = new GeogebraConstructor({
|
|
28
|
+
commands,
|
|
29
|
+
xAxis: { natural: true },
|
|
30
|
+
});
|
|
31
|
+
return ggb.getOptions({
|
|
32
|
+
coords: ggb.getAdaptedCoords({
|
|
33
|
+
xMin: 0,
|
|
34
|
+
xMax: 10,
|
|
35
|
+
yMin: Math.min(...points.map((p) => p[1])) - 2,
|
|
36
|
+
yMax: Math.max(...points.map((p) => p[1])) + 2,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const getHint = (identifiers) => {
|
|
41
|
+
const { nValue, points, isArithmetic } = identifiers;
|
|
42
|
+
return `$u_{${nValue}}$ est l'ordonnée du point d'absicsse $${nValue}$ dans le nuage de points.`;
|
|
43
|
+
};
|
|
44
|
+
const getCorrection = (identifiers) => {
|
|
45
|
+
const { nValue, points, isArithmetic } = identifiers;
|
|
46
|
+
return `$u_{${nValue}}$ est l'ordonnée du point d'absicsse $${nValue}$ dans le nuage de points.
|
|
47
|
+
|
|
48
|
+
On lit donc :
|
|
49
|
+
|
|
50
|
+
$$
|
|
51
|
+
u_{${nValue}}=${getAnswer(identifiers)}
|
|
52
|
+
$$
|
|
53
|
+
`;
|
|
54
|
+
};
|
|
7
55
|
const getSequencePlotQuestion = () => {
|
|
8
56
|
const isArithmetic = coinFlip();
|
|
9
57
|
const a = isArithmetic ? randfloat(0.1, 0.5, 1) : randfloat(1.01, 1.1, 2);
|
|
@@ -23,39 +71,19 @@ const getSequencePlotQuestion = () => {
|
|
|
23
71
|
points.push([n, Math.round(u_n)]);
|
|
24
72
|
}
|
|
25
73
|
const nValue = randint(0, nMax);
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
commands.push(...points.map((_, index) => {
|
|
31
|
-
return `SetFixed(A${index},true)`;
|
|
32
|
-
}), ...points.map((_, index) => {
|
|
33
|
-
return `SetLabelMode(A${index},1)`;
|
|
34
|
-
}));
|
|
35
|
-
const ggb = new GeogebraConstructor({
|
|
36
|
-
commands,
|
|
37
|
-
xAxis: { natural: true },
|
|
38
|
-
});
|
|
39
|
-
const answer = u_nValue.toString();
|
|
74
|
+
const identifiers = { nValue, points, isArithmetic };
|
|
75
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
76
|
+
};
|
|
77
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
40
78
|
const question = {
|
|
41
|
-
answer,
|
|
42
|
-
instruction:
|
|
43
|
-
ggbOptions:
|
|
44
|
-
coords: ggb.getAdaptedCoords({
|
|
45
|
-
xMin: 0,
|
|
46
|
-
xMax: nMax,
|
|
47
|
-
yMin: Math.min(...points.map((p) => p[1])) - 2,
|
|
48
|
-
yMax: Math.max(...points.map((p) => p[1])) + 2,
|
|
49
|
-
}),
|
|
50
|
-
}),
|
|
79
|
+
answer: getAnswer(identifiers),
|
|
80
|
+
instruction: getInstruction(identifiers),
|
|
81
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
51
82
|
keys: [],
|
|
52
83
|
answerFormat: "raw",
|
|
53
|
-
identifiers
|
|
54
|
-
hint:
|
|
55
|
-
correction:
|
|
56
|
-
|
|
57
|
-
On lit donc : $u_{${nValue}}=${answer}$.
|
|
58
|
-
`,
|
|
84
|
+
identifiers,
|
|
85
|
+
hint: getHint(identifiers),
|
|
86
|
+
correction: getCorrection(identifiers),
|
|
59
87
|
};
|
|
60
88
|
return question;
|
|
61
89
|
};
|
|
@@ -75,10 +103,8 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
75
103
|
export const sequencePlot = {
|
|
76
104
|
id: "sequencePlot",
|
|
77
105
|
label: "Lire graphiquement un terme d'une suite à partir d'un nuage de points",
|
|
78
|
-
levels: ["1reSpé"],
|
|
79
106
|
isSingleStep: true,
|
|
80
107
|
hasGeogebra: true,
|
|
81
|
-
sections: ["Suites"],
|
|
82
108
|
generator: (nb) => getDistinctQuestions(getSequencePlotQuestion, nb),
|
|
83
109
|
qcmTimer: 60,
|
|
84
110
|
freeTimer: 60,
|
|
@@ -86,4 +112,5 @@ export const sequencePlot = {
|
|
|
86
112
|
isAnswerValid,
|
|
87
113
|
subject: "Mathématiques",
|
|
88
114
|
hasHintAndCorrection: true,
|
|
115
|
+
getQuestionFromIdentifiers,
|
|
89
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atomicStructureOfNucleus.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalElements/atomicStructureOfNucleus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"atomicStructureOfNucleus.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalElements/atomicStructureOfNucleus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAKnF,KAAK,WAAW,GAAG;IAAE,UAAU,EAAE,WAAW,CAAA;CAAE,CAAC;AA0F/C,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAa1D,CAAC"}
|
|
@@ -5,16 +5,33 @@ import { round } from "../../../math/utils/round.js";
|
|
|
5
5
|
import { atomes } from "../../../pc/constants/molecularChemistry/atome.js";
|
|
6
6
|
import { random } from "../../../utils/alea/random.js";
|
|
7
7
|
import { requiresApostropheBefore } from "../../../utils/strings/requiresApostropheBefore.js";
|
|
8
|
+
const getAnswer = (identifiers) => {
|
|
9
|
+
const { atomSymbol } = identifiers;
|
|
10
|
+
const atom = atomes.find((a) => a.symbole === atomSymbol);
|
|
11
|
+
const mass = round(atom.masseAtomique, 0);
|
|
12
|
+
return `^{${mass}}_{${atom.numeroAtomique}}${atom.symbole}`;
|
|
13
|
+
};
|
|
14
|
+
const getInstruction = (identifiers) => {
|
|
15
|
+
const { atomSymbol } = identifiers;
|
|
16
|
+
const atom = atomes.find((a) => a.symbole === atomSymbol);
|
|
17
|
+
const mass = round(atom.masseAtomique, 0);
|
|
18
|
+
const instruction = `Le noyau d'un atome ${requiresApostropheBefore(atom.name) ? "d'" : "de "}${atom.name} possède $${mass}$ nucléons, $${mass - atom.numeroAtomique}$ neutrons et $${atom.numeroAtomique}$ protons.
|
|
19
|
+
|
|
20
|
+
Quelle est son écriture conventionnelle ?`;
|
|
21
|
+
return instruction;
|
|
22
|
+
};
|
|
8
23
|
const getAtomicStructureOfNucleusQuestion = () => {
|
|
9
24
|
const atom = random(atomes.slice(0, 50));
|
|
10
|
-
const
|
|
11
|
-
|
|
25
|
+
const identifiers = { atomSymbol: atom.symbole };
|
|
26
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
27
|
+
};
|
|
28
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
12
29
|
const question = {
|
|
13
|
-
answer:
|
|
14
|
-
instruction:
|
|
30
|
+
answer: getAnswer(identifiers),
|
|
31
|
+
instruction: getInstruction(identifiers),
|
|
15
32
|
keys: [],
|
|
16
33
|
answerFormat: "tex",
|
|
17
|
-
identifiers
|
|
34
|
+
identifiers,
|
|
18
35
|
};
|
|
19
36
|
return question;
|
|
20
37
|
};
|
|
@@ -42,9 +59,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
42
59
|
export const atomicStructureOfNucleus = {
|
|
43
60
|
id: "atomicStructureOfNucleus",
|
|
44
61
|
label: "Trouver l'écriture conventionnelle d'un atome",
|
|
45
|
-
levels: ["2nde"],
|
|
46
62
|
isSingleStep: true,
|
|
47
|
-
sections: ["Chimie organique"],
|
|
48
63
|
generator: (nb) => getDistinctQuestions(getAtomicStructureOfNucleusQuestion, nb),
|
|
49
64
|
qcmTimer: 60,
|
|
50
65
|
freeTimer: 60,
|
|
@@ -52,4 +67,5 @@ export const atomicStructureOfNucleus = {
|
|
|
52
67
|
isAnswerValid,
|
|
53
68
|
subject: "Chimie",
|
|
54
69
|
answerType: "QCU",
|
|
70
|
+
getQuestionFromIdentifiers,
|
|
55
71
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateProtonsNumberFromMass.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"calculateProtonsNumberFromMass.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAQnF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,WAAW,CAAC;CACzB,CAAC;AAqFF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAYhE,CAAC"}
|
|
@@ -7,22 +7,38 @@ import { atomes } from "../../../pc/constants/molecularChemistry/atome.js";
|
|
|
7
7
|
import { random } from "../../../utils/alea/random.js";
|
|
8
8
|
import { requiresApostropheBefore } from "../../../utils/strings/requiresApostropheBefore.js";
|
|
9
9
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { atomSymbol } = identifiers;
|
|
12
|
+
const atom = atomes.find((a) => a.symbole === atomSymbol);
|
|
12
13
|
const atomNucleusMass = nucleonMass.value.times(atom.masseAtomique);
|
|
13
14
|
const instruction = `Le noyau d'un atome ${requiresApostropheBefore(atom.name) ? "d'" : "de "}${atom.name} a pour masse $m = ${atomNucleusMass.toTex({
|
|
14
15
|
scientific: 2,
|
|
15
|
-
})}$ et possède $${round(atom.masseAtomique, 0) - atom.numeroAtomique}$ neutrons.
|
|
16
|
+
})}$ et possède $${round(atom.masseAtomique, 0) - atom.numeroAtomique}$ neutrons.
|
|
17
|
+
|
|
18
|
+
Déterminer le nombre de protons de cet atome.`;
|
|
19
|
+
return instruction;
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { atomSymbol } = identifiers;
|
|
23
|
+
const atom = atomes.find((a) => a.symbole === atomSymbol);
|
|
24
|
+
return `${atom.numeroAtomique}`;
|
|
25
|
+
};
|
|
26
|
+
const getCalculateProtonsNumberFromMassQuestion = () => {
|
|
27
|
+
const atom = random(atomes.slice(0, 50));
|
|
16
28
|
// const help = ` $m_{\\text{nucléon}} = ${nucleonMass.value.toTex({
|
|
17
29
|
// scientific: 2,
|
|
18
30
|
// })}\\ ${nucleonMass.unit}$`;
|
|
31
|
+
const identifiers = { atomSymbol: atom.symbole };
|
|
32
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
33
|
+
};
|
|
34
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
19
35
|
const question = {
|
|
20
|
-
answer:
|
|
21
|
-
instruction:
|
|
36
|
+
answer: getAnswer(identifiers),
|
|
37
|
+
instruction: getInstruction(identifiers),
|
|
22
38
|
// instruction: instruction + help,
|
|
23
39
|
keys: [],
|
|
24
40
|
answerFormat: "tex",
|
|
25
|
-
identifiers
|
|
41
|
+
identifiers,
|
|
26
42
|
};
|
|
27
43
|
return question;
|
|
28
44
|
};
|
|
@@ -48,13 +64,12 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
48
64
|
export const calculateProtonsNumberFromMass = {
|
|
49
65
|
id: "calculateProtonsNumberFromMass",
|
|
50
66
|
label: "Déterminer le nombre de protons par la masse",
|
|
51
|
-
levels: ["2nde"],
|
|
52
67
|
isSingleStep: true,
|
|
53
|
-
sections: ["Chimie organique"],
|
|
54
68
|
generator: (nb) => getDistinctQuestions(getCalculateProtonsNumberFromMassQuestion, nb),
|
|
55
69
|
qcmTimer: 60,
|
|
56
70
|
freeTimer: 60,
|
|
57
71
|
getPropositions,
|
|
58
72
|
isAnswerValid,
|
|
59
73
|
subject: "Chimie",
|
|
74
|
+
getQuestionFromIdentifiers,
|
|
60
75
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
-
type Identifiers = {
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
m: number;
|
|
4
|
+
t: number;
|
|
5
|
+
v: number;
|
|
6
|
+
type: number;
|
|
7
|
+
};
|
|
3
8
|
export declare const calculateVolumetricMass: Exercise<Identifiers>;
|
|
4
9
|
export {};
|
|
5
10
|
//# sourceMappingURL=calculateVolumetricMass.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateVolumetricMass.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalElements/calculateVolumetricMass.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"calculateVolumetricMass.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalElements/calculateVolumetricMass.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AA4HrE,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAazD,CAAC"}
|