math-exercises 3.0.66 → 3.0.68
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/index.d.ts +1 -0
- package/lib/exercises/math/percent/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/index.js +1 -0
- 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 +25 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +2 -0
- package/package.json +1 -1
|
@@ -4,61 +4,100 @@ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuesti
|
|
|
4
4
|
import { round } from "../../../math/utils/round.js";
|
|
5
5
|
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
6
6
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
7
|
-
const
|
|
8
|
-
const concentration
|
|
9
|
-
const mass = round(randfloat(0.1, 5), 2); // Concentration en masse en g/L
|
|
10
|
-
const molarMass = round(randfloat(10, 200), 2); // Masse molaire en g/mol
|
|
11
|
-
const variableIndex = randint(0, 3);
|
|
12
|
-
const variables = ["C", "t", "M"];
|
|
13
|
-
const variable = variables[variableIndex];
|
|
14
|
-
let questionText, answer;
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
8
|
+
const { concentration, mass, molarMass, variable } = identifiers;
|
|
15
9
|
switch (variable) {
|
|
16
10
|
case "C":
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
return `Vous avez une solution avec une concentration en masse $t = ${frenchify(mass)}\\ \\textrm{g.L}^{-1}$ et une masse molaire $M = ${frenchify(molarMass)}\\ \\textrm{g.mol}^{-1}$.
|
|
12
|
+
|
|
13
|
+
Déterminez la concentration $C$ en $\\textrm{mol.L}^{-1}$ de cette solution.`;
|
|
20
14
|
case "t":
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
return `Vous avez une solution avec une concentration $C = ${frenchify(concentration)}\\ \\textrm{mol.L}^{-1}$ et une masse molaire $M = ${frenchify(molarMass)}\\ \\textrm{g.mol}^{-1}$.
|
|
16
|
+
|
|
17
|
+
Déterminez la concentration en masse $t$ en $\\textrm{g.L}^{-1}$ de cette solution.`;
|
|
24
18
|
case "M":
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
default:
|
|
20
|
+
return `Vous avez une solution avec une concentration en masse $t = ${frenchify(mass)}\\ \\textrm{g.L}^{-1}$ et une concentration $C = ${frenchify(concentration)}\\ \\textrm{mol.L}^{-1}$.
|
|
21
|
+
|
|
22
|
+
Déterminez la masse molaire $M$ en $\\textrm{g.mol}^{-1}$ de cette solution.`;
|
|
28
23
|
}
|
|
24
|
+
};
|
|
25
|
+
const getAnswer = (identifiers) => {
|
|
26
|
+
const { concentration, mass, molarMass, variable } = identifiers;
|
|
27
|
+
switch (variable) {
|
|
28
|
+
case "C":
|
|
29
|
+
return round(mass / molarMass, 2).frenchify();
|
|
30
|
+
case "t":
|
|
31
|
+
return round(concentration * molarMass, 2).frenchify();
|
|
32
|
+
case "M":
|
|
33
|
+
default:
|
|
34
|
+
return round(mass / concentration, 2).frenchify();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const getHint = (identifiers) => {
|
|
29
38
|
const hint = `La relation entre la concentration en quantité de matière $C$, la concentration en masse $t$, et la masse molaire $M$ est donnée par :
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
C = \\frac{t}{M}
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
Réarrange cette formule pour isoler la variable à trouver.`;
|
|
45
|
+
return hint;
|
|
46
|
+
};
|
|
47
|
+
const getCorrection = (identifiers) => {
|
|
48
|
+
const { concentration, mass, molarMass, variable } = identifiers;
|
|
49
|
+
const answer = getAnswer(identifiers);
|
|
34
50
|
const correction = `La relation entre la concentration en quantité de matière, la concentration en masse et la masse molaire est :
|
|
35
|
-
$$
|
|
36
|
-
C = \\frac{t}{M}
|
|
37
|
-
$$
|
|
38
51
|
|
|
52
|
+
$$
|
|
53
|
+
C = \\frac{t}{M}
|
|
54
|
+
$$
|
|
55
|
+
|
|
39
56
|
Pour résoudre ce problème, nous devons réorganiser la formule pour isoler la variable inconnue.
|
|
40
|
-
|
|
57
|
+
|
|
41
58
|
${variable === "C"
|
|
42
|
-
?
|
|
59
|
+
? `
|
|
60
|
+
$$
|
|
61
|
+
C = \\frac{t}{M} = \\frac{${frenchify(mass)}}{${frenchify(molarMass)}} = ${answer}\\ \\textrm{mol.L}^{-1}
|
|
62
|
+
$$`
|
|
43
63
|
: variable === "t"
|
|
44
|
-
?
|
|
45
|
-
|
|
64
|
+
? `
|
|
65
|
+
$$
|
|
66
|
+
t = C \\times M = ${frenchify(concentration)} \\times ${frenchify(molarMass)} = ${answer}\\ \\textrm{g.L}^{-1}
|
|
67
|
+
$$`
|
|
68
|
+
: `
|
|
69
|
+
$$
|
|
70
|
+
M = \\frac{t}{C} = \\frac{${frenchify(mass)}}{${frenchify(concentration)}} = ${answer}\\ \\textrm{g.mol}^{-1}
|
|
71
|
+
$$`}`;
|
|
72
|
+
return correction;
|
|
73
|
+
};
|
|
74
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
46
75
|
const question = {
|
|
47
|
-
answer:
|
|
48
|
-
instruction:
|
|
49
|
-
hint,
|
|
50
|
-
correction,
|
|
76
|
+
answer: getAnswer(identifiers),
|
|
77
|
+
instruction: getInstruction(identifiers),
|
|
78
|
+
hint: getHint(identifiers),
|
|
79
|
+
correction: getCorrection(identifiers),
|
|
51
80
|
keys: ["C", "t", "M"],
|
|
52
81
|
answerFormat: "tex",
|
|
53
|
-
identifiers
|
|
54
|
-
concentration,
|
|
55
|
-
mass,
|
|
56
|
-
molarMass,
|
|
57
|
-
variable,
|
|
58
|
-
},
|
|
82
|
+
identifiers,
|
|
59
83
|
};
|
|
60
84
|
return question;
|
|
61
85
|
};
|
|
86
|
+
const getConcentrationFromMassCalculationQuestion = () => {
|
|
87
|
+
const concentration = round(randfloat(0.1, 2), 2); // Concentration en mol/L
|
|
88
|
+
const mass = round(randfloat(0.1, 5), 2); // Concentration en masse en g/L
|
|
89
|
+
const molarMass = round(randfloat(10, 200), 2); // Masse molaire en g/mol
|
|
90
|
+
const variableIndex = randint(0, 3);
|
|
91
|
+
const variables = ["C", "t", "M"];
|
|
92
|
+
const variable = variables[variableIndex];
|
|
93
|
+
const identifiers = {
|
|
94
|
+
concentration,
|
|
95
|
+
mass,
|
|
96
|
+
molarMass,
|
|
97
|
+
variable,
|
|
98
|
+
};
|
|
99
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
100
|
+
};
|
|
62
101
|
const getPropositions = (n, { answer, concentration, mass, molarMass, variable }) => {
|
|
63
102
|
const propositions = [];
|
|
64
103
|
addValidProp(propositions, answer);
|
|
@@ -101,9 +140,7 @@ const isAnswerValid = (ans, { answer, variable, mass, molarMass, concentration }
|
|
|
101
140
|
export const concentrationFromMassCalculation = {
|
|
102
141
|
id: "concentrationFromMassCalculation",
|
|
103
142
|
label: "Calculer la concentration à partir de la concentration en masse et la masse molaire",
|
|
104
|
-
levels: ["1reSpé"],
|
|
105
143
|
isSingleStep: true,
|
|
106
|
-
sections: ["Chimie des solutions"],
|
|
107
144
|
generator: (nb) => getDistinctQuestions(getConcentrationFromMassCalculationQuestion, nb),
|
|
108
145
|
qcmTimer: 60,
|
|
109
146
|
freeTimer: 60,
|
|
@@ -111,4 +148,5 @@ export const concentrationFromMassCalculation = {
|
|
|
111
148
|
isAnswerValid,
|
|
112
149
|
subject: "Chimie",
|
|
113
150
|
hasHintAndCorrection: true,
|
|
151
|
+
getQuestionFromIdentifiers,
|
|
114
152
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateIntensity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/calculateIntensity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"calculateIntensity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/calculateIntensity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA4DF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAYpD,CAAC"}
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
|
+
const getInstruction = (identifiers) => {
|
|
5
|
+
const { l1, l2 } = identifiers;
|
|
6
|
+
const instruction = `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}\\ \\textrm{mA}$, celle traversant la lampe $L_2$ est de $${l2}\\ \\textrm{mA}$.
|
|
7
|
+
|
|
8
|
+
Calculer l'intensité du courant qui traverse la pile.
|
|
9
|
+
|
|
10
|
+
`;
|
|
11
|
+
return instruction;
|
|
12
|
+
};
|
|
13
|
+
const getAnswer = (identifiers) => {
|
|
14
|
+
const { l1, l2 } = identifiers;
|
|
15
|
+
return l1 + l2 + "";
|
|
16
|
+
};
|
|
4
17
|
const getCalculateIntensityQuestion = () => {
|
|
5
|
-
const
|
|
18
|
+
const l1 = randint(10, 60);
|
|
19
|
+
const l2 = randint(10, 60);
|
|
20
|
+
const identifiers = { l1, l2 };
|
|
21
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
22
|
+
};
|
|
23
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
6
24
|
const question = {
|
|
7
|
-
answer:
|
|
8
|
-
instruction:
|
|
9
|
-
``,
|
|
25
|
+
answer: getAnswer(identifiers),
|
|
26
|
+
instruction: getInstruction(identifiers),
|
|
10
27
|
keys: [],
|
|
11
28
|
// correction: `1 - Calculer l'instensité au bord de la lampe à l'aide de la loi des noeuds : $L_1+L_2=L$ $\\Rightarrow$ $${exo.l1}+${exo.l2}=${exo.answer}$ $mA$`,
|
|
12
29
|
answerFormat: "tex",
|
|
13
|
-
identifiers
|
|
30
|
+
identifiers,
|
|
14
31
|
};
|
|
15
32
|
return question;
|
|
16
33
|
};
|
|
@@ -27,31 +44,18 @@ const getPropositions = (n, { answer, l1, l2 }) => {
|
|
|
27
44
|
const isAnswerValid = (ans, { answer }) => {
|
|
28
45
|
return ans === answer;
|
|
29
46
|
};
|
|
30
|
-
const generateExercise = () => {
|
|
31
|
-
const l1 = randint(10, 60);
|
|
32
|
-
const l2 = randint(10, 60);
|
|
33
|
-
const instruction = `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}$ $mA$, celle traversant la lampe $L_2$ est de $${l2}$ $mA$. \n \\
|
|
34
|
-
Calculer l'intensité du courant qui traverse la pile.`;
|
|
35
|
-
return {
|
|
36
|
-
instruction,
|
|
37
|
-
answer: l1 + l2,
|
|
38
|
-
l1,
|
|
39
|
-
l2,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
47
|
const generatePropositions = (l1, l2) => {
|
|
43
48
|
return [l1 - l2, l1, l2];
|
|
44
49
|
};
|
|
45
50
|
export const calculateIntensity = {
|
|
46
51
|
id: "calculateIntensity",
|
|
47
52
|
label: "Calcul d'intnsité dans un circuit électrique en parallèle",
|
|
48
|
-
levels: ["2nde"],
|
|
49
53
|
isSingleStep: true,
|
|
50
|
-
sections: ["Électricité"],
|
|
51
54
|
generator: (nb) => getDistinctQuestions(getCalculateIntensityQuestion, nb),
|
|
52
55
|
qcmTimer: 60,
|
|
53
56
|
freeTimer: 60,
|
|
54
57
|
getPropositions,
|
|
55
58
|
isAnswerValid,
|
|
56
59
|
subject: "Physique",
|
|
60
|
+
getQuestionFromIdentifiers,
|
|
57
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateIntensityInSerieOrParallel.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/calculateIntensityInSerieOrParallel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"calculateIntensityInSerieOrParallel.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/calculateIntensityInSerieOrParallel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA4HF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAYrE,CAAC"}
|
|
@@ -2,22 +2,35 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercis
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
4
|
import { random } from "../../../utils/alea/random.js";
|
|
5
|
+
const getAnswer = (identifiers) => {
|
|
6
|
+
const { l1, l2, isAsking, circuit } = identifiers;
|
|
7
|
+
const l = circuit === "Série" ? l1 : l1 + l2;
|
|
8
|
+
const values = [l, l1, l2];
|
|
9
|
+
const answer = circuit === "Série"
|
|
10
|
+
? l1.frenchify()
|
|
11
|
+
: values[["L", "L1", "L2"].findIndex((value) => value === isAsking)].frenchify();
|
|
12
|
+
return answer;
|
|
13
|
+
};
|
|
5
14
|
const getCalculateIntensityInSerieOrParallelQuestion = () => {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
const l1 = randint(10, 60);
|
|
16
|
+
const isAsking = random(["L", "L1", "L2"]);
|
|
17
|
+
const circuit = random(["Série", "Parallèle", "Parallèle"]);
|
|
18
|
+
const l2 = circuit === "Série" ? l1 : randint(10, 60);
|
|
19
|
+
const identifiers = {
|
|
20
|
+
l1: l1,
|
|
21
|
+
l2: l2,
|
|
22
|
+
isAsking: isAsking,
|
|
23
|
+
circuit: circuit,
|
|
24
|
+
};
|
|
25
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
26
|
+
};
|
|
27
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
10
28
|
const question = {
|
|
11
|
-
answer:
|
|
12
|
-
instruction:
|
|
29
|
+
answer: getAnswer(identifiers),
|
|
30
|
+
instruction: getInstruction(identifiers),
|
|
13
31
|
keys: [],
|
|
14
32
|
answerFormat: "tex",
|
|
15
|
-
identifiers
|
|
16
|
-
l1: exo.l1,
|
|
17
|
-
l2: exo.l2,
|
|
18
|
-
isAsking: exo.isAsking,
|
|
19
|
-
circuit: exo.circuit,
|
|
20
|
-
},
|
|
33
|
+
identifiers,
|
|
21
34
|
};
|
|
22
35
|
return question;
|
|
23
36
|
};
|
|
@@ -34,41 +47,37 @@ const getPropositions = (n, { answer, isAsking, circuit, l1, l2 }) => {
|
|
|
34
47
|
const isAnswerValid = (ans, { answer }) => {
|
|
35
48
|
return ans === answer;
|
|
36
49
|
};
|
|
37
|
-
const
|
|
38
|
-
const l1
|
|
39
|
-
const isAsking = random(["L", "L1", "L2"]);
|
|
40
|
-
const circuit = random(["Série", "Parallèle", "Parallèle"]);
|
|
41
|
-
const l2 = circuit === "Série" ? l1 : randint(10, 60);
|
|
50
|
+
const getInstruction = (identifiers) => {
|
|
51
|
+
const { l1, l2, isAsking, circuit } = identifiers;
|
|
42
52
|
const l = circuit === "Série" ? l1 : l1 + l2;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
? l1
|
|
47
|
-
: values[["L", "L1", "L2"].findIndex((value) => value === isAsking)];
|
|
48
|
-
return {
|
|
49
|
-
instruction,
|
|
50
|
-
answer,
|
|
51
|
-
l1,
|
|
52
|
-
l2,
|
|
53
|
-
l,
|
|
54
|
-
isAsking,
|
|
55
|
-
circuit,
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
const getInstruction = (isAsking, circuit, l1, l2, l) => {
|
|
53
|
+
const schemaIllu = circuit === "Série"
|
|
54
|
+
? ""
|
|
55
|
+
: "";
|
|
59
56
|
if (circuit === "Série")
|
|
60
|
-
return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}
|
|
61
|
-
|
|
57
|
+
return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}\\ \\textrm{mA}$, celle traversant la lampe $L_2$ est de $${l2} \\ \\textrm{mA}$.
|
|
58
|
+
|
|
59
|
+
Calculer l'intensité du courant qui traverse la pile en $mA$.
|
|
60
|
+
|
|
61
|
+
${schemaIllu}`;
|
|
62
62
|
switch (isAsking) {
|
|
63
63
|
case "L":
|
|
64
|
-
return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}
|
|
65
|
-
|
|
64
|
+
return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}\\ \\textrm{mA}$, celle traversant la lampe $L_2$ est de $${l2}\\ \\textrm{mA}$.
|
|
65
|
+
|
|
66
|
+
Calculer l'intensité du courant qui traverse la pile en $mA$.
|
|
67
|
+
|
|
68
|
+
${schemaIllu}`;
|
|
66
69
|
case "L1":
|
|
67
|
-
return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_2$ est de $${l2}
|
|
68
|
-
|
|
70
|
+
return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_2$ est de $${l2}\\ \\textrm{mA}$, celle traversant la pile est de $${l}\\ \\textrm{mA}$.
|
|
71
|
+
|
|
72
|
+
Calculer l'intensité du courant qui traverse la lampe $L_1$ en $mA$.
|
|
73
|
+
|
|
74
|
+
${schemaIllu}`;
|
|
69
75
|
case "L2":
|
|
70
|
-
return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}
|
|
71
|
-
|
|
76
|
+
return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}\\ \\textrm{mA}$, celle traversant la pile est de $${l}\\ \\textrm{mA}$.
|
|
77
|
+
|
|
78
|
+
Calculer l'intensité du courant qui traverse la lampe $L_2$ en $mA$.
|
|
79
|
+
|
|
80
|
+
${schemaIllu}`;
|
|
72
81
|
default:
|
|
73
82
|
return "";
|
|
74
83
|
}
|
|
@@ -90,13 +99,12 @@ const generatePropositions = (l1, l2, isAsking, circuit) => {
|
|
|
90
99
|
export const calculateIntensityInSerieOrParallel = {
|
|
91
100
|
id: "calculateIntensityInSerieOrParallel",
|
|
92
101
|
label: "Calcul d'intnsité dans un circuit électrique en série/parallèle",
|
|
93
|
-
levels: ["1reSpé"],
|
|
94
102
|
isSingleStep: true,
|
|
95
|
-
sections: ["Électricité"],
|
|
96
103
|
generator: (nb) => getDistinctQuestions(getCalculateIntensityInSerieOrParallelQuestion, nb),
|
|
97
104
|
qcmTimer: 60,
|
|
98
105
|
freeTimer: 60,
|
|
99
106
|
getPropositions,
|
|
100
107
|
isAnswerValid,
|
|
101
108
|
subject: "Physique",
|
|
109
|
+
getQuestionFromIdentifiers,
|
|
102
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateVoltage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/calculateVoltage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAiKF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"calculateVoltage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/calculateVoltage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAiKF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAYlD,CAAC"}
|
|
@@ -128,9 +128,7 @@ $U=E-r \\cdot I\\ \\Rightarrow\\ U=${answer}\\ V$`;
|
|
|
128
128
|
export const calculateVoltage = {
|
|
129
129
|
id: "calculateVoltage",
|
|
130
130
|
label: "Calcul de tension au borne d'une résistance",
|
|
131
|
-
levels: ["2nde"],
|
|
132
131
|
isSingleStep: true,
|
|
133
|
-
sections: ["Électricité"],
|
|
134
132
|
generator: (nb) => getDistinctQuestions(getCalculateVoltageQuestion, nb),
|
|
135
133
|
qcmTimer: 60,
|
|
136
134
|
freeTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electricChargeFromIntensity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/electricChargeFromIntensity.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"electricChargeFromIntensity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/electricChargeFromIntensity.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAsE1D,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAY7D,CAAC"}
|
|
@@ -3,16 +3,30 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercis
|
|
|
3
3
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
4
4
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
5
|
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
6
|
+
const getAnswer = (identifiers) => {
|
|
7
|
+
const { intensity, seconds } = identifiers;
|
|
8
|
+
const electricCharge = intensity * seconds;
|
|
9
|
+
return roundSignificant(electricCharge, 1);
|
|
10
|
+
};
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
const { intensity, seconds } = identifiers;
|
|
13
|
+
return `Un conducteur électrique est parcouru par un courant d'intensité $${roundSignificant(intensity, 1)}\\ \\textrm{A}$.
|
|
14
|
+
|
|
15
|
+
Calculer la charge électrique $\\text{Q}$ (en $\\textrm{C}$) ayant traversé la section de ce conducteur durant $${seconds}\\ \\textrm{s}$.`;
|
|
16
|
+
};
|
|
6
17
|
const getElectricChargeFromIntensityQuestion = () => {
|
|
7
18
|
const intensity = randfloat(0.1, 6, 1);
|
|
8
19
|
const seconds = randint(1, 30);
|
|
9
|
-
const
|
|
20
|
+
const identifiers = { intensity, seconds };
|
|
21
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
22
|
+
};
|
|
23
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
10
24
|
const question = {
|
|
11
|
-
answer:
|
|
12
|
-
instruction:
|
|
25
|
+
answer: getAnswer(identifiers),
|
|
26
|
+
instruction: getInstruction(identifiers),
|
|
13
27
|
keys: [],
|
|
14
28
|
answerFormat: "tex",
|
|
15
|
-
identifiers
|
|
29
|
+
identifiers,
|
|
16
30
|
};
|
|
17
31
|
return question;
|
|
18
32
|
};
|
|
@@ -36,13 +50,12 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
36
50
|
export const electricChargeFromIntensity = {
|
|
37
51
|
id: "electricChargeFromIntensity",
|
|
38
52
|
label: "Calculer une charge électrique",
|
|
39
|
-
levels: ["1reSpé"],
|
|
40
53
|
isSingleStep: true,
|
|
41
|
-
sections: ["Électricité"],
|
|
42
54
|
generator: (nb) => getDistinctQuestions(getElectricChargeFromIntensityQuestion, nb),
|
|
43
55
|
qcmTimer: 60,
|
|
44
56
|
freeTimer: 60,
|
|
45
57
|
getPropositions,
|
|
46
58
|
isAnswerValid,
|
|
47
59
|
subject: "Physique",
|
|
60
|
+
getQuestionFromIdentifiers,
|
|
48
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electricEnergyFromPower.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/electricEnergyFromPower.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"electricEnergyFromPower.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/electricEnergyFromPower.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AA8BrC,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAgEtD,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAWzD,CAAC"}
|
|
@@ -24,16 +24,28 @@ import { random } from "../../../utils/alea/random.js";
|
|
|
24
24
|
// ];
|
|
25
25
|
// const durations = [{label: "année",gender: "feminine", valueInSeconds: }]
|
|
26
26
|
const powers = [15, 18, 50, 25, 65, 66, 7.5, 10];
|
|
27
|
+
const getInstruction = (identifiers) => {
|
|
28
|
+
const { power, seconds } = identifiers;
|
|
29
|
+
return `Un chargeur a une puissance maximale de $${power}\\ \\text{W}$. Calculer l'énergie électrique qu'il fournit durant $${seconds}\\ \\text{s}$ de fonctionnement (en $\\text{J}$).`;
|
|
30
|
+
};
|
|
31
|
+
const getAnswer = (identifiers) => {
|
|
32
|
+
const { power, seconds } = identifiers;
|
|
33
|
+
const energy = power * seconds;
|
|
34
|
+
return `${energy.toScientific(0).toTex({ scientific: 0 })}`;
|
|
35
|
+
};
|
|
27
36
|
const getElectricEnergyFromPowerQuestion = () => {
|
|
28
37
|
const power = random(powers);
|
|
29
38
|
const seconds = randint(10, 61);
|
|
30
|
-
const
|
|
39
|
+
const identifiers = { power, seconds };
|
|
40
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
41
|
+
};
|
|
42
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
31
43
|
const question = {
|
|
32
|
-
answer:
|
|
33
|
-
instruction:
|
|
44
|
+
answer: getAnswer(identifiers),
|
|
45
|
+
instruction: getInstruction(identifiers),
|
|
34
46
|
keys: ["timesTenPower"],
|
|
35
47
|
answerFormat: "tex",
|
|
36
|
-
identifiers
|
|
48
|
+
identifiers,
|
|
37
49
|
};
|
|
38
50
|
return question;
|
|
39
51
|
};
|
|
@@ -54,9 +66,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
54
66
|
export const electricEnergyFromPower = {
|
|
55
67
|
id: "electricEnergyFromPower",
|
|
56
68
|
label: "Calculer une énergie électrique",
|
|
57
|
-
levels: ["1reSpé"],
|
|
58
69
|
isSingleStep: true,
|
|
59
|
-
sections: ["Électricité"],
|
|
60
70
|
generator: (nb) => getDistinctQuestions(getElectricEnergyFromPowerQuestion, nb),
|
|
61
71
|
qcmTimer: 60,
|
|
62
72
|
freeTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electricPowerOrEnergyCalculation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/electricPowerOrEnergyCalculation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"electricPowerOrEnergyCalculation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/electricPowerOrEnergyCalculation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAsHF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAalE,CAAC"}
|
|
@@ -7,38 +7,69 @@ import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
|
7
7
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
8
8
|
const powers = [15, 18, 50, 25, 65, 66, 7.5, 10]; // Puissances en watts
|
|
9
9
|
const durations = [60, 3600, 86400, 604800]; // Durées en secondes (1 min, 1 h, 1 jour, 1 semaine)
|
|
10
|
-
const
|
|
11
|
-
const power =
|
|
12
|
-
const seconds = random(durations);
|
|
13
|
-
const energy = power * seconds;
|
|
14
|
-
const isCalculatingEnergy = coinFlip();
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { power, seconds, energy, isCalculatingEnergy } = identifiers;
|
|
15
12
|
const questionText = isCalculatingEnergy
|
|
16
|
-
? `Un appareil a une puissance de $P = ${frenchify(power)}\\ \\
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
? `Un appareil a une puissance de $P = ${frenchify(power)}\\ \\textrm{W}$ et fonctionne pendant $t = ${frenchify(seconds)}\\ \\textrm{s}$.
|
|
14
|
+
|
|
15
|
+
Calculer l'énergie électrique $E$ en $\\textrm{J}$ fournie par cet appareil.`
|
|
16
|
+
: `Un appareil consomme une énergie $E = ${frenchify(energy)}\\ \\textrm{J}$ en $t = ${frenchify(seconds)}\\ \\textrm{s}$.
|
|
17
|
+
|
|
18
|
+
Calculez la puissance $P$ en $\\textrm{W}$ de cet appareil.`;
|
|
19
|
+
return questionText;
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { power, seconds, energy, isCalculatingEnergy } = identifiers;
|
|
23
|
+
const answer = isCalculatingEnergy
|
|
24
|
+
? energy.frenchify()
|
|
25
|
+
: round(energy / seconds, 2).frenchify();
|
|
26
|
+
return answer;
|
|
27
|
+
};
|
|
28
|
+
const getHint = (identifiers) => {
|
|
19
29
|
const hint = `La relation entre l'énergie électrique, la puissance et le temps est donnée par la formule :
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
E = P \\times t
|
|
33
|
+
$$
|
|
34
|
+
|
|
35
|
+
Réarrangez cette formule pour isoler la variable à trouver.`;
|
|
36
|
+
return hint;
|
|
37
|
+
};
|
|
38
|
+
const getCorrection = (identifiers) => {
|
|
39
|
+
const { power, seconds, energy, isCalculatingEnergy } = identifiers;
|
|
40
|
+
const answer = getAnswer(identifiers);
|
|
24
41
|
const correction = `La relation entre l'énergie électrique, la puissance et le temps est :
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
|
|
43
|
+
$$
|
|
44
|
+
E = P \\times t
|
|
45
|
+
$$
|
|
28
46
|
|
|
29
47
|
Pour résoudre ce problème, nous devons réorganiser la formule pour isoler la variable inconnue.
|
|
30
48
|
|
|
49
|
+
$$
|
|
31
50
|
${isCalculatingEnergy
|
|
32
|
-
?
|
|
33
|
-
:
|
|
51
|
+
? `E = P \\times t = ${frenchify(power)} \\times ${frenchify(seconds)} = ${answer}\\ \\textrm{J}`
|
|
52
|
+
: `P = \\frac{E}{t} = \\frac{${frenchify(energy)}}{${frenchify(seconds)}} = ${answer}\\ \\textrm{W}`}
|
|
53
|
+
$$`;
|
|
54
|
+
return correction;
|
|
55
|
+
};
|
|
56
|
+
const getElectricPowerOrEnergyQuestion = () => {
|
|
57
|
+
const power = random(powers);
|
|
58
|
+
const seconds = random(durations);
|
|
59
|
+
const energy = power * seconds;
|
|
60
|
+
const isCalculatingEnergy = coinFlip();
|
|
61
|
+
const identifiers = { power, seconds, energy, isCalculatingEnergy };
|
|
62
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
63
|
+
};
|
|
64
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
34
65
|
const question = {
|
|
35
|
-
answer:
|
|
36
|
-
instruction:
|
|
37
|
-
hint,
|
|
38
|
-
correction,
|
|
66
|
+
answer: getAnswer(identifiers),
|
|
67
|
+
instruction: getInstruction(identifiers),
|
|
68
|
+
hint: getHint(identifiers),
|
|
69
|
+
correction: getCorrection(identifiers),
|
|
39
70
|
keys: ["P", "E", "t"],
|
|
40
71
|
answerFormat: "tex",
|
|
41
|
-
identifiers
|
|
72
|
+
identifiers,
|
|
42
73
|
};
|
|
43
74
|
return question;
|
|
44
75
|
};
|
|
@@ -65,9 +96,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
65
96
|
export const electricPowerOrEnergyCalculation = {
|
|
66
97
|
id: "electricPowerOrEnergyCalculation",
|
|
67
98
|
label: "Calculer la puissance ou l'énergie électrique",
|
|
68
|
-
levels: ["1reSpé"],
|
|
69
99
|
isSingleStep: true,
|
|
70
|
-
sections: ["Électricité"],
|
|
71
100
|
generator: (nb) => getDistinctQuestions(getElectricPowerOrEnergyQuestion, nb),
|
|
72
101
|
qcmTimer: 60,
|
|
73
102
|
freeTimer: 60,
|
|
@@ -75,4 +104,5 @@ export const electricPowerOrEnergyCalculation = {
|
|
|
75
104
|
isAnswerValid,
|
|
76
105
|
subject: "Physique",
|
|
77
106
|
hasHintAndCorrection: true,
|
|
107
|
+
getQuestionFromIdentifiers,
|
|
78
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kirchhoffVoltageLaw.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/kirchhoffVoltageLaw.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"kirchhoffVoltageLaw.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/kirchhoffVoltageLaw.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAgHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAYrD,CAAC"}
|