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
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { round } from "../../../../math/utils/round.js";
|
|
5
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
6
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
8
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
9
|
+
const { duration, initialCapital, rate } = identifiers;
|
|
10
|
+
const propositions = [];
|
|
11
|
+
addValidProp(propositions, answer);
|
|
12
|
+
tryToAddWrongProp(propositions, round(initialCapital + initialCapital * (1 + rate / 100) * duration, 2).frenchify());
|
|
13
|
+
while (propositions.length < n) {
|
|
14
|
+
tryToAddWrongProp(propositions, round(initialCapital * (1 + randint(1, 10) / 100) ** duration, 2).frenchify());
|
|
15
|
+
}
|
|
16
|
+
return shuffleProps(propositions, n);
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { duration, initialCapital, rate } = identifiers;
|
|
20
|
+
const value = initialCapital * (1 + rate / 100) ** duration;
|
|
21
|
+
return round(value, 2).frenchify();
|
|
22
|
+
};
|
|
23
|
+
const getInstruction = (identifiers, opts) => {
|
|
24
|
+
const { duration, initialCapital, rate } = identifiers;
|
|
25
|
+
if (opts?.withFormula) {
|
|
26
|
+
return `Lors d'un placement à intérêt composé, le capital disponible peut se calculer avec la formule :
|
|
27
|
+
|
|
28
|
+
$$
|
|
29
|
+
C_n=C_0\\times\\left(1+\\frac{t}{100}\\right)^n
|
|
30
|
+
$$
|
|
31
|
+
|
|
32
|
+
où $C_0$ est le capital en début de placement, $C_n$ le capital obtenu après $n$ années de placement, et $t$ le taux annuel.
|
|
33
|
+
|
|
34
|
+
Calculer le capital $C_${duration}$ disponible à la fin de la $${duration}^{\\text{ème}}$ année de placement, avec un taux de $${rate}\\%$ et un capital initial de $${initialCapital}€$.
|
|
35
|
+
|
|
36
|
+
Arrondir au centième.`;
|
|
37
|
+
}
|
|
38
|
+
return `On place un capital initial de $${initialCapital}€$ à un taux d'intérêt composé annuel de $${rate}\\%$.
|
|
39
|
+
|
|
40
|
+
À combien s'élèvera le capital accumulé dans $${duration}$ ans ? Arrondir au centième.`;
|
|
41
|
+
};
|
|
42
|
+
const getHint = (identifiers, options) => {
|
|
43
|
+
const { duration, initialCapital, rate } = identifiers;
|
|
44
|
+
if (options?.withFormula) {
|
|
45
|
+
return `Utilise la formule avec $C_0 = ${initialCapital}$, $t = ${rate}$ et $n = ${duration}$.`;
|
|
46
|
+
}
|
|
47
|
+
return `Chaque année, le capital augmente de $${rate}\\%$ de sa valeur de l'année précédente.`;
|
|
48
|
+
};
|
|
49
|
+
const getCorrection = (identifiers) => {
|
|
50
|
+
const { duration, initialCapital, rate } = identifiers;
|
|
51
|
+
return `Le capital $C_n$ accumulé à l'année $n$ est donné par :
|
|
52
|
+
|
|
53
|
+
$$
|
|
54
|
+
C_n = C_0 \\times \\left(1+\\frac{t}{100}\\right)^n
|
|
55
|
+
$$
|
|
56
|
+
|
|
57
|
+
où $C_0$ est le capital initial, $t$ est le taux d'intérêt annuel.
|
|
58
|
+
|
|
59
|
+
Ici, on a donc
|
|
60
|
+
|
|
61
|
+
${alignTex([
|
|
62
|
+
[
|
|
63
|
+
`C_${duration}`,
|
|
64
|
+
"=",
|
|
65
|
+
`${initialCapital} \\times \\left(1+\\frac{${rate}}{100}\\right)^{${duration}}`,
|
|
66
|
+
],
|
|
67
|
+
["", "\\approx", getAnswer(identifiers)],
|
|
68
|
+
])}`;
|
|
69
|
+
};
|
|
70
|
+
const getKeys = (identifiers) => {
|
|
71
|
+
return [];
|
|
72
|
+
};
|
|
73
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
74
|
+
try {
|
|
75
|
+
const parsed = parseAlgebraic(ans);
|
|
76
|
+
return parsed.simplify().toTex() === answer;
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
return handleVEAError(err);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const getCompoundInterestQuestion = (opts) => {
|
|
83
|
+
const rate = randint(1, 10);
|
|
84
|
+
const duration = randint(3, 8);
|
|
85
|
+
const initialCapital = 1000 * randint(1, 10);
|
|
86
|
+
const identifiers = {
|
|
87
|
+
duration,
|
|
88
|
+
initialCapital,
|
|
89
|
+
rate,
|
|
90
|
+
};
|
|
91
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
92
|
+
};
|
|
93
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
94
|
+
return {
|
|
95
|
+
answer: getAnswer(identifiers, opts),
|
|
96
|
+
instruction: getInstruction(identifiers, opts),
|
|
97
|
+
keys: getKeys(identifiers, opts),
|
|
98
|
+
answerFormat: "tex",
|
|
99
|
+
identifiers,
|
|
100
|
+
hint: getHint(identifiers, opts),
|
|
101
|
+
correction: getCorrection(identifiers, opts),
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const options = [
|
|
105
|
+
{
|
|
106
|
+
id: "withFormula",
|
|
107
|
+
label: "Donner la formule dans la consigne",
|
|
108
|
+
target: GeneratorOptionTarget.instruction,
|
|
109
|
+
type: GeneratorOptionType.checkbox,
|
|
110
|
+
defaultValue: false,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
export const compoundInterest = {
|
|
114
|
+
id: "compoundInterest",
|
|
115
|
+
connector: "=",
|
|
116
|
+
label: "Calcul du capital acquis dans un placement à taux d'intérêt composé",
|
|
117
|
+
isSingleStep: true,
|
|
118
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCompoundInterestQuestion(opts), nb),
|
|
119
|
+
qcmTimer: 60,
|
|
120
|
+
freeTimer: 60,
|
|
121
|
+
getPropositions,
|
|
122
|
+
isAnswerValid,
|
|
123
|
+
subject: "Mathématiques",
|
|
124
|
+
getQuestionFromIdentifiers,
|
|
125
|
+
hasHintAndCorrection: true,
|
|
126
|
+
options,
|
|
127
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compoundInterestDuration.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/interests/compoundInterestDuration.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// import {
|
|
2
|
+
// Exercise,
|
|
3
|
+
// Proposition,
|
|
4
|
+
// QCMGenerator,
|
|
5
|
+
// Question,
|
|
6
|
+
// QuestionGenerator,
|
|
7
|
+
// VEA,
|
|
8
|
+
// addValidProp,
|
|
9
|
+
// shuffleProps,
|
|
10
|
+
// GetAnswer,
|
|
11
|
+
// GetHint,
|
|
12
|
+
// GetCorrection,
|
|
13
|
+
// GetInstruction,
|
|
14
|
+
// GetKeys,
|
|
15
|
+
// GetQuestionFromIdentifiers,
|
|
16
|
+
// tryToAddWrongProp,
|
|
17
|
+
// GeneratorOption,
|
|
18
|
+
// GeneratorOptionTarget,
|
|
19
|
+
// GeneratorOptionType,
|
|
20
|
+
// } from "../../../../exercises/exercise.js";
|
|
21
|
+
// import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
22
|
+
// import { randint } from "../../../../math/utils/random/randint.js";
|
|
23
|
+
// import { round } from "../../../../math/utils/round.js";
|
|
24
|
+
// import { Log10Node } from "../../../../tree/nodes/functions/log10Node.js";
|
|
25
|
+
// import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
26
|
+
// import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
27
|
+
// import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
28
|
+
// import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
29
|
+
// import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
30
|
+
export {};
|
|
31
|
+
// type Identifiers = {
|
|
32
|
+
// //initila, intéret, durée
|
|
33
|
+
// finalCapital: number;
|
|
34
|
+
// rate: number;
|
|
35
|
+
// initialCapital: number;
|
|
36
|
+
// };
|
|
37
|
+
// type Options = {
|
|
38
|
+
// withFormula?: boolean;
|
|
39
|
+
// };
|
|
40
|
+
// const getPropositions: QCMGenerator<Identifiers> = (
|
|
41
|
+
// n,
|
|
42
|
+
// { answer, ...identifiers },
|
|
43
|
+
// ) => {
|
|
44
|
+
// const { finalCapital, rate } = identifiers;
|
|
45
|
+
// const propositions: Proposition[] = [];
|
|
46
|
+
// addValidProp(propositions, answer);
|
|
47
|
+
// while (propositions.length < n) {
|
|
48
|
+
// tryToAddWrongProp(
|
|
49
|
+
// propositions,
|
|
50
|
+
// randint(1, 10).frenchify(),
|
|
51
|
+
// );
|
|
52
|
+
// }
|
|
53
|
+
// return shuffleProps(propositions, n);
|
|
54
|
+
// };
|
|
55
|
+
// const getAnswer: GetAnswer<Identifiers> = (identifiers) => {
|
|
56
|
+
// const { initialCapital, finalCapital, rate } = identifiers;
|
|
57
|
+
// const value = frac(
|
|
58
|
+
// new Log10Node(frac(finalCapital, initialCapital)),
|
|
59
|
+
// new Log10Node(add(1, frac(rate, 100))),
|
|
60
|
+
// ).evaluate()
|
|
61
|
+
// return round(value, 2).frenchify();
|
|
62
|
+
// };
|
|
63
|
+
// const getInstruction: GetInstruction<Identifiers, Options> = (
|
|
64
|
+
// identifiers,
|
|
65
|
+
// opts,
|
|
66
|
+
// ) => {
|
|
67
|
+
// const { initialCapital, finalCapital, rate } = identifiers;
|
|
68
|
+
// if (opts?.withFormula) {
|
|
69
|
+
// return `Lors d'un placement à intérêt composé, le capital disponible peut se calculer avec la formule :
|
|
70
|
+
// $$
|
|
71
|
+
// C_n=C_0\\times\\left(1+\\frac{t}{100}\\right)^n
|
|
72
|
+
// $$
|
|
73
|
+
// où $C_0$ est le capital en début de placement, $C_n$ le capital obtenu après $n$ années de placement, et $t$ le taux annuel.
|
|
74
|
+
// Calculer la durée de placement de $${initialCapital}€$ au taux annuel de $${rate}\\%$ si la valeur acquise à la fin du placement à intérêts composés est de $${finalCapital}€$.`;
|
|
75
|
+
// }
|
|
76
|
+
// return `On place un capital initial de $${initialCapital}€$ dans un placement à intérêt composé au taux annuel de $${rate}\\%$.
|
|
77
|
+
// Au bout de combien d'années le capital obtenu sera-t-il de $${finalCapital}€$ ?`;
|
|
78
|
+
// };
|
|
79
|
+
// const getHint: GetHint<Identifiers, Options> = (identifiers, options) => {
|
|
80
|
+
// const { initialCapital, finalCapital, rate } = identifiers;
|
|
81
|
+
// if (options?.withFormula) {
|
|
82
|
+
// return `Utilise la formule avec $C_n = ${finalCapital}$, $t = ${rate}$ et $n = ${duration}$.`;
|
|
83
|
+
// }
|
|
84
|
+
// return `Chaque année, le capital augmente de $${rate}\\%$ de sa valeur de l'année précédente. Pour retrouver sa valeur à l'année précédente, il faut donc le diviser par $1 + \\frac{${rate}}{100}$.`;
|
|
85
|
+
// };
|
|
86
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
|
|
87
|
+
// const { duration, finalCapital, rate } = identifiers;
|
|
88
|
+
// const cm = add(1, frac(rate, 100));
|
|
89
|
+
// return `Le capital $C_n$ accumulé à l'année $n$ est donné par :
|
|
90
|
+
// $$
|
|
91
|
+
// C_n = C_0 \\times \\left(1+\\frac{t}{100}\\right)^n
|
|
92
|
+
// $$
|
|
93
|
+
// où $C_0$ est le capital initial, $t$ est le taux d'intérêt annuel.
|
|
94
|
+
// Ici, on a donc
|
|
95
|
+
// $$
|
|
96
|
+
// ${finalCapital} = C_0 \\times \\left(1+\\frac{${rate}}{100}\\right)^{${duration}}
|
|
97
|
+
// $$
|
|
98
|
+
// d'où
|
|
99
|
+
// ${alignTex([
|
|
100
|
+
// ["C_0", "=", frac(finalCapital, cm).toTex()],
|
|
101
|
+
// ["", "\\approx", getAnswer(identifiers)],
|
|
102
|
+
// ])}`;
|
|
103
|
+
// };
|
|
104
|
+
// const getKeys: GetKeys<Identifiers> = (identifiers) => {
|
|
105
|
+
// return [];
|
|
106
|
+
// };
|
|
107
|
+
// const isAnswerValid: VEA<Identifiers> = (ans, { answer }) => {
|
|
108
|
+
// try {
|
|
109
|
+
// const parsed = parseAlgebraic(ans);
|
|
110
|
+
// return parsed.simplify().toTex() === answer;
|
|
111
|
+
// } catch (err) {
|
|
112
|
+
// return handleVEAError(err);
|
|
113
|
+
// }
|
|
114
|
+
// };
|
|
115
|
+
// const getCompoundInterestQuestion: QuestionGenerator<Identifiers, Options> = (
|
|
116
|
+
// opts,
|
|
117
|
+
// ) => {
|
|
118
|
+
// const rate = randint(1, 10);
|
|
119
|
+
// const duration = randint(3, 8);
|
|
120
|
+
// const initialCapital = 1000 * randint(1, 10);
|
|
121
|
+
// const identifiers: Identifiers = {
|
|
122
|
+
// initialCapital,
|
|
123
|
+
// finalCapital,
|
|
124
|
+
// rate,
|
|
125
|
+
// };
|
|
126
|
+
// return getQuestionFromIdentifiers(identifiers, opts);
|
|
127
|
+
// };
|
|
128
|
+
// const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<
|
|
129
|
+
// Identifiers,
|
|
130
|
+
// Options
|
|
131
|
+
// > = (identifiers, opts) => {
|
|
132
|
+
// return {
|
|
133
|
+
// answer: getAnswer(identifiers, opts),
|
|
134
|
+
// instruction: getInstruction(identifiers, opts),
|
|
135
|
+
// keys: getKeys(identifiers, opts),
|
|
136
|
+
// answerFormat: "tex",
|
|
137
|
+
// identifiers,
|
|
138
|
+
// hint: getHint(identifiers, opts),
|
|
139
|
+
// correction: getCorrection(identifiers, opts),
|
|
140
|
+
// };
|
|
141
|
+
// };
|
|
142
|
+
// const options: GeneratorOption[] = [
|
|
143
|
+
// {
|
|
144
|
+
// id: "withFormula",
|
|
145
|
+
// label: "Donner la formule dans la consigne",
|
|
146
|
+
// target: GeneratorOptionTarget.instruction,
|
|
147
|
+
// type: GeneratorOptionType.checkbox,
|
|
148
|
+
// defaultValue: false,
|
|
149
|
+
// },
|
|
150
|
+
// ];
|
|
151
|
+
// export const compoundInterestDuration: Exercise<Identifiers, Options> = {
|
|
152
|
+
// id: "compoundInterestDuration",
|
|
153
|
+
// connector: "=",
|
|
154
|
+
// label: "Calcul du capital initial dans un placement à taux d'intérêt composé",
|
|
155
|
+
// isSingleStep: true,
|
|
156
|
+
// generator: (nb, opts) =>
|
|
157
|
+
// getDistinctQuestions(() => getCompoundInterestQuestion(opts), nb),
|
|
158
|
+
// qcmTimer: 60,
|
|
159
|
+
// freeTimer: 60,
|
|
160
|
+
// getPropositions,
|
|
161
|
+
// isAnswerValid,
|
|
162
|
+
// subject: "Mathématiques",
|
|
163
|
+
// getQuestionFromIdentifiers,
|
|
164
|
+
// hasHintAndCorrection: true,
|
|
165
|
+
// options,
|
|
166
|
+
// };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
finalCapital: number;
|
|
4
|
+
rate: number;
|
|
5
|
+
duration: number;
|
|
6
|
+
};
|
|
7
|
+
type Options = {
|
|
8
|
+
withFormula?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const compoundInterestStartValue: Exercise<Identifiers, Options>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=compoundInterestStartValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compoundInterestStartValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/interests/compoundInterestStartValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IAEjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,KAAK,OAAO,GAAG;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AA8IF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAerE,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { round } from "../../../../math/utils/round.js";
|
|
5
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
8
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
10
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
11
|
+
const { duration, finalCapital, rate } = identifiers;
|
|
12
|
+
const propositions = [];
|
|
13
|
+
addValidProp(propositions, answer);
|
|
14
|
+
tryToAddWrongProp(propositions, round(finalCapital - finalCapital * (1 + rate / 100) * duration, 2).frenchify());
|
|
15
|
+
while (propositions.length < n) {
|
|
16
|
+
tryToAddWrongProp(propositions, round(finalCapital / (1 + randint(1, 10) / 100) ** duration, 2).frenchify());
|
|
17
|
+
}
|
|
18
|
+
return shuffleProps(propositions, n);
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { duration, finalCapital, rate } = identifiers;
|
|
22
|
+
const value = finalCapital / (1 + rate / 100) ** duration;
|
|
23
|
+
return round(value, 2).frenchify();
|
|
24
|
+
};
|
|
25
|
+
const getInstruction = (identifiers, opts) => {
|
|
26
|
+
const { duration, finalCapital, rate } = identifiers;
|
|
27
|
+
if (opts?.withFormula) {
|
|
28
|
+
return `Lors d'un placement à intérêt composé, le capital disponible peut se calculer avec la formule :
|
|
29
|
+
|
|
30
|
+
$$
|
|
31
|
+
C_n=C_0\\times\\left(1+\\frac{t}{100}\\right)^n
|
|
32
|
+
$$
|
|
33
|
+
|
|
34
|
+
où $C_0$ est le capital en début de placement, $C_n$ le capital obtenu après $n$ années de placement, et $t$ le taux annuel.
|
|
35
|
+
|
|
36
|
+
Le capital obtenu après $${duration}$ années de placement avec un taux de $${rate}\\%$ est $C_${duration} = ${finalCapital}€$.
|
|
37
|
+
|
|
38
|
+
Calculer le capital initial $C_0$ du placement. Arrondir au centième.`;
|
|
39
|
+
}
|
|
40
|
+
return `Après $${duration}$ années de placement à un taux d'intérêt composé de $${rate}\\%$, le capital obtenu est de $${finalCapital}€$.
|
|
41
|
+
|
|
42
|
+
Quel était le capital initial du placement ? Arrondir au centième.`;
|
|
43
|
+
};
|
|
44
|
+
const getHint = (identifiers, options) => {
|
|
45
|
+
const { duration, finalCapital, rate } = identifiers;
|
|
46
|
+
if (options?.withFormula) {
|
|
47
|
+
return `Utilise la formule avec $C_n = ${finalCapital}$, $t = ${rate}$ et $n = ${duration}$.`;
|
|
48
|
+
}
|
|
49
|
+
return `Chaque année, le capital augmente de $${rate}\\%$ de sa valeur de l'année précédente. Pour retrouver sa valeur à l'année précédente, il faut donc le diviser par $1 + \\frac{${rate}}{100}$.`;
|
|
50
|
+
};
|
|
51
|
+
const getCorrection = (identifiers) => {
|
|
52
|
+
const { duration, finalCapital, rate } = identifiers;
|
|
53
|
+
const cm = add(1, frac(rate, 100));
|
|
54
|
+
return `Le capital $C_n$ accumulé à l'année $n$ est donné par :
|
|
55
|
+
|
|
56
|
+
$$
|
|
57
|
+
C_n = C_0 \\times \\left(1+\\frac{t}{100}\\right)^n
|
|
58
|
+
$$
|
|
59
|
+
|
|
60
|
+
où $C_0$ est le capital initial, $t$ est le taux d'intérêt annuel.
|
|
61
|
+
|
|
62
|
+
Ici, on a donc
|
|
63
|
+
|
|
64
|
+
$$
|
|
65
|
+
${finalCapital} = C_0 \\times \\left(1+\\frac{${rate}}{100}\\right)^{${duration}}
|
|
66
|
+
$$
|
|
67
|
+
|
|
68
|
+
d'où
|
|
69
|
+
|
|
70
|
+
${alignTex([
|
|
71
|
+
["C_0", "=", frac(finalCapital, cm).toTex()],
|
|
72
|
+
["", "\\approx", getAnswer(identifiers)],
|
|
73
|
+
])}`;
|
|
74
|
+
};
|
|
75
|
+
const getKeys = (identifiers) => {
|
|
76
|
+
return [];
|
|
77
|
+
};
|
|
78
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
79
|
+
try {
|
|
80
|
+
const parsed = parseAlgebraic(ans);
|
|
81
|
+
return parsed.simplify().toTex() === answer;
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
return handleVEAError(err);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const getCompoundInterestQuestion = (opts) => {
|
|
88
|
+
const rate = randint(1, 10);
|
|
89
|
+
const duration = randint(3, 8);
|
|
90
|
+
const finalCapital = 1000 * randint(1, 10);
|
|
91
|
+
const identifiers = {
|
|
92
|
+
duration,
|
|
93
|
+
finalCapital,
|
|
94
|
+
rate,
|
|
95
|
+
};
|
|
96
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
97
|
+
};
|
|
98
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
99
|
+
return {
|
|
100
|
+
answer: getAnswer(identifiers, opts),
|
|
101
|
+
instruction: getInstruction(identifiers, opts),
|
|
102
|
+
keys: getKeys(identifiers, opts),
|
|
103
|
+
answerFormat: "tex",
|
|
104
|
+
identifiers,
|
|
105
|
+
hint: getHint(identifiers, opts),
|
|
106
|
+
correction: getCorrection(identifiers, opts),
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
const options = [
|
|
110
|
+
{
|
|
111
|
+
id: "withFormula",
|
|
112
|
+
label: "Donner la formule dans la consigne",
|
|
113
|
+
target: GeneratorOptionTarget.instruction,
|
|
114
|
+
type: GeneratorOptionType.checkbox,
|
|
115
|
+
defaultValue: false,
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
export const compoundInterestStartValue = {
|
|
119
|
+
id: "compoundInterestStartValue",
|
|
120
|
+
connector: "=",
|
|
121
|
+
label: "Calcul du capital initial dans un placement à taux d'intérêt composé",
|
|
122
|
+
isSingleStep: true,
|
|
123
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCompoundInterestQuestion(opts), nb),
|
|
124
|
+
qcmTimer: 60,
|
|
125
|
+
freeTimer: 60,
|
|
126
|
+
getPropositions,
|
|
127
|
+
isAnswerValid,
|
|
128
|
+
subject: "Mathématiques",
|
|
129
|
+
getQuestionFromIdentifiers,
|
|
130
|
+
hasHintAndCorrection: true,
|
|
131
|
+
options,
|
|
132
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/interests/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constantPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/constantPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAKR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoBF,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,WAAW,CAI/D,CAAC;AAgBF,eAAO,MAAM,gCAAgC,EAAE,YAAY,CAAC,WAAW,CActE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,GAAG,CAAC,WAAW,CAO3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"constantPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/constantPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAKR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoBF,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,WAAW,CAI/D,CAAC;AAgBF,eAAO,MAAM,gCAAgC,EAAE,YAAY,CAAC,WAAW,CActE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,GAAG,CAAC,WAAW,CAO3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAYnD,CAAC"}
|
|
@@ -55,8 +55,6 @@ export const constantPrimitive = {
|
|
|
55
55
|
id: "constantPrimitive",
|
|
56
56
|
connector: "=",
|
|
57
57
|
label: "Primitive d'une constante",
|
|
58
|
-
levels: ["TermSpé", "MathComp"],
|
|
59
|
-
sections: ["Primitives"],
|
|
60
58
|
isSingleStep: false,
|
|
61
59
|
generator: (nb) => getDistinctQuestions(getConstantPrimitive, nb),
|
|
62
60
|
qcmTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polynomialPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/polynomialPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"polynomialPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/polynomialPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAKR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAiBF,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,WAAW,CAKjE,CAAC;AAiBF,eAAO,MAAM,kCAAkC,EAAE,YAAY,CAAC,WAAW,CAexE,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,GAAG,CAAC,WAAW,CAqB7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAYrD,CAAC"}
|
|
@@ -23,6 +23,9 @@ export const getPolynomialPrimitive = () => {
|
|
|
23
23
|
const degree = randint(1, 4);
|
|
24
24
|
const polynomial = PolynomialConstructor.randomWithOrder(degree);
|
|
25
25
|
const identifiers = { coeffs: polynomial.coefficients };
|
|
26
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
27
|
+
};
|
|
28
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
26
29
|
const question = {
|
|
27
30
|
instruction: getInstruction(identifiers),
|
|
28
31
|
startStatement: `F(x)`,
|
|
@@ -72,4 +75,5 @@ export const polynomialPrimitive = {
|
|
|
72
75
|
getPropositions: getPolynomialPrimitivePropositions,
|
|
73
76
|
isAnswerValid: isPolynomialPrimitiveAnswerValid,
|
|
74
77
|
subject: "Mathématiques",
|
|
78
|
+
getQuestionFromIdentifiers,
|
|
75
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sinCosPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/sinCosPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"sinCosPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/sinCosPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAKR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAwBF,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,WAAW,CAM7D,CAAC;AAgBF,eAAO,MAAM,8BAA8B,EAAE,YAAY,CAAC,WAAW,CA4BpE,CAAC;AACF,eAAO,MAAM,4BAA4B,EAAE,GAAG,CAAC,WAAW,CAYzD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAYjD,CAAC"}
|
|
@@ -9,25 +9,39 @@ import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
|
9
9
|
import { VariableNode } from "../../../tree/nodes/variables/variableNode.js";
|
|
10
10
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
11
11
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
12
|
-
|
|
13
|
-
const a
|
|
14
|
-
|
|
15
|
-
let integratedFuction;
|
|
16
|
-
const isCos = coinFlip();
|
|
17
|
-
selectedFunction = isCos
|
|
12
|
+
const getInstruction = (identifiers) => {
|
|
13
|
+
const { a, isCos } = identifiers;
|
|
14
|
+
const selectedFunction = isCos
|
|
18
15
|
? new MultiplyNode(new NumberNode(a), new CosNode(new VariableNode("x")))
|
|
19
16
|
: new MultiplyNode(new NumberNode(a), new SinNode(new VariableNode("x")));
|
|
20
|
-
|
|
17
|
+
return `Déterminer la forme générale des primitives de la fonction $f$ définie par :
|
|
18
|
+
|
|
19
|
+
$$
|
|
20
|
+
f(x) = ${selectedFunction.toTex()}
|
|
21
|
+
$$`;
|
|
22
|
+
};
|
|
23
|
+
const getAnswer = (identifiers) => {
|
|
24
|
+
const { a, isCos } = identifiers;
|
|
25
|
+
const integratedFuction = isCos
|
|
21
26
|
? new MultiplyNode(new NumberNode(a), new SinNode(new VariableNode("x")))
|
|
22
27
|
: new MultiplyNode(new NumberNode(-a), new CosNode(new VariableNode("x")));
|
|
23
28
|
const answer = new AddNode(integratedFuction, new VariableNode("C")).toTex();
|
|
29
|
+
return answer;
|
|
30
|
+
};
|
|
31
|
+
export const getSinCosPrimitive = () => {
|
|
32
|
+
const a = randint(-9, 10, [0]);
|
|
33
|
+
const isCos = coinFlip();
|
|
34
|
+
const identifiers = { a, isCos };
|
|
35
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
36
|
+
};
|
|
37
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
24
38
|
const question = {
|
|
25
|
-
instruction:
|
|
39
|
+
instruction: getInstruction(identifiers),
|
|
26
40
|
startStatement: `F(x)`,
|
|
27
|
-
answer,
|
|
41
|
+
answer: getAnswer(identifiers),
|
|
28
42
|
keys: ["x", "C", "sin", "cos"],
|
|
29
43
|
answerFormat: "tex",
|
|
30
|
-
identifiers
|
|
44
|
+
identifiers,
|
|
31
45
|
};
|
|
32
46
|
return question;
|
|
33
47
|
};
|
|
@@ -61,8 +75,6 @@ export const sinCosPrimitive = {
|
|
|
61
75
|
id: "sinCosPrimitive",
|
|
62
76
|
connector: "=",
|
|
63
77
|
label: "Primitive de sin et cos",
|
|
64
|
-
levels: ["TermSpé", "MathComp"],
|
|
65
|
-
sections: ["Primitives", "Trigonométrie"],
|
|
66
78
|
isSingleStep: false,
|
|
67
79
|
generator: (nb) => getDistinctQuestions(getSinCosPrimitive, nb),
|
|
68
80
|
qcmTimer: 60,
|
|
@@ -70,4 +82,5 @@ export const sinCosPrimitive = {
|
|
|
70
82
|
getPropositions: getSinCosPrimitivePropositions,
|
|
71
83
|
isAnswerValid: isSinCosPrimitiveAnswerValid,
|
|
72
84
|
subject: "Mathématiques",
|
|
85
|
+
getQuestionFromIdentifiers,
|
|
73
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binomialInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/binomial/binomialInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"binomialInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/binomial/binomialInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAM7C,OAAO,EAEL,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAK/C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAuKF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAgBF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB7D,CAAC"}
|
|
@@ -113,6 +113,9 @@ const getBinomialInequationQuestion = (opts) => {
|
|
|
113
113
|
type,
|
|
114
114
|
isSentence,
|
|
115
115
|
};
|
|
116
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
117
|
+
};
|
|
118
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
116
119
|
const question = {
|
|
117
120
|
answer: getAnswer(identifiers),
|
|
118
121
|
instruction: getInstruction(identifiers, opts),
|
|
@@ -150,9 +153,7 @@ export const binomialInequation = {
|
|
|
150
153
|
getPropositions,
|
|
151
154
|
isAnswerValid,
|
|
152
155
|
subject: "Mathématiques",
|
|
153
|
-
|
|
154
|
-
// getCorrection,
|
|
155
|
-
getAnswer,
|
|
156
|
+
getQuestionFromIdentifiers,
|
|
156
157
|
options,
|
|
157
158
|
validateOptions: (opts) => {
|
|
158
159
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectedValueOfBinomialProba.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/binomial/expectedValueOfBinomialProba.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"expectedValueOfBinomialProba.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/binomial/expectedValueOfBinomialProba.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2GF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAe9D,CAAC"}
|