math-exercises 3.0.131 → 3.0.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/exercise.d.ts +37 -30
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +2 -2
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +44 -40
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.js +15 -10
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +0 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +2 -0
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +8 -6
- package/lib/exercises/math/calcul/rounding/rounding.d.ts +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.js +7 -6
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +8 -9
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +4 -4
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +15 -60
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +14 -10
- package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +1 -0
- package/lib/exercises/math/conversion/prefixToNumber.d.ts +0 -2
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
- package/lib/exercises/math/conversion/prefixToNumber.js +31 -24
- package/lib/exercises/math/conversion/secondsToHours.js +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +2 -2
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +4 -5
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +10 -11
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +8 -8
- package/lib/exercises/math/geometry/cartesian/index.d.ts +1 -0
- package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/index.js +1 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +6 -9
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +60 -137
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts +16 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +213 -0
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts +4 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.js +37 -21
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +24 -26
- package/lib/exercises/math/percent/percentToDecimal.d.ts +4 -1
- package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/percent/percentToDecimal.js +55 -35
- package/lib/exercises/math/powers/calculateNegativePower.d.ts +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +17 -10
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +2 -2
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts +5 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +76 -12
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +7 -7
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +2 -3
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +60 -95
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +12 -5
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +354 -94
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +4 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +43 -23
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +70 -23
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +4 -4
- package/lib/exercises/pc/index.d.ts +0 -1
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +0 -1
- package/lib/exercises/pc/motion/averageSpeed.d.ts +0 -2
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +40 -45
- package/lib/exercises/pc/optics/lensFormula.d.ts +1 -2
- package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -1
- package/lib/exercises/pc/optics/lensFormula.js +7 -10
- package/lib/exercises/pc/weight/calculateWeight.d.ts +1 -3
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +38 -30
- package/lib/index.d.ts +932 -948
- package/lib/index.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.d.ts +2 -2
- package/lib/math/progCalc/progCalc.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.js +4 -11
- package/lib/playgroundUtils.d.ts +3 -0
- package/lib/playgroundUtils.d.ts.map +1 -0
- package/lib/playgroundUtils.js +13 -0
- package/lib/server.js +121 -0
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +13 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { random } from "../../../utils/alea/random.js";
|
|
|
8
8
|
const g = +earthGravity.measure.significantPart.toFixed(2);
|
|
9
9
|
const optsDefault = {
|
|
10
10
|
inputType: "sci",
|
|
11
|
-
nbDigits: 2,
|
|
11
|
+
nbDigits: "2",
|
|
12
12
|
};
|
|
13
13
|
const options = [
|
|
14
14
|
{
|
|
@@ -24,12 +24,13 @@ const options = [
|
|
|
24
24
|
label: "Nombre de décimales",
|
|
25
25
|
type: GeneratorOptionType.multiselect,
|
|
26
26
|
target: GeneratorOptionTarget.generation,
|
|
27
|
-
values: [0, 1, 2],
|
|
27
|
+
values: ["0", "1", "2"],
|
|
28
28
|
defaultValue: [optsDefault.nbDigits],
|
|
29
29
|
},
|
|
30
30
|
];
|
|
31
|
-
const getInstruction = (identifiers) => {
|
|
32
|
-
const
|
|
31
|
+
const getInstruction = (identifiers, optsIn) => {
|
|
32
|
+
const opts = optsIn ?? optsDefault;
|
|
33
|
+
const { mass } = identifiers;
|
|
33
34
|
const instruction = `Soit un objet avec une masse de $${mass}\\ \\textrm{kg}$.
|
|
34
35
|
|
|
35
36
|
L'accélération due à la gravité vaut $${g.frenchify()}$ $\\textrm{m} \\cdot \\textrm{s}^{${-2}}$.
|
|
@@ -37,7 +38,7 @@ L'accélération due à la gravité vaut $${g.frenchify()}$ $\\textrm{m} \\cdot
|
|
|
37
38
|
Calculer le poids de cet objet en Newtons.
|
|
38
39
|
Donner le résultat
|
|
39
40
|
${(() => {
|
|
40
|
-
switch (
|
|
41
|
+
switch (opts.inputType) {
|
|
41
42
|
case "decimal":
|
|
42
43
|
return `en écriture décimale`;
|
|
43
44
|
case "sci":
|
|
@@ -45,12 +46,12 @@ ${(() => {
|
|
|
45
46
|
}
|
|
46
47
|
})()}
|
|
47
48
|
${(() => {
|
|
48
|
-
switch (
|
|
49
|
-
case 0:
|
|
49
|
+
switch (opts.nbDigits) {
|
|
50
|
+
case "0":
|
|
50
51
|
return `arrondie à l'unité`;
|
|
51
|
-
case 1:
|
|
52
|
+
case "1":
|
|
52
53
|
return `arrondie à une décimale`;
|
|
53
|
-
case 2:
|
|
54
|
+
case "2":
|
|
54
55
|
return `arrondie à deux décimales`;
|
|
55
56
|
}
|
|
56
57
|
})()}.
|
|
@@ -77,25 +78,30 @@ const getCorrection = (identifiers) => {
|
|
|
77
78
|
const correction = `Pour calculer le poids de l'objet, on utilise la formule :
|
|
78
79
|
|
|
79
80
|
$$
|
|
80
|
-
P=m \\cdot g
|
|
81
|
+
P = m \\cdot g
|
|
81
82
|
$$
|
|
82
83
|
|
|
83
84
|
On a :
|
|
84
85
|
|
|
85
86
|
$$
|
|
86
|
-
P = ${mass.frenchify()} \\times ${g.frenchify()}
|
|
87
|
+
P = ${mass.frenchify()} \\times ${g.frenchify()}
|
|
88
|
+
$$
|
|
89
|
+
|
|
90
|
+
$$
|
|
91
|
+
P \\approx ${answer}
|
|
87
92
|
$$`;
|
|
88
93
|
return correction;
|
|
89
94
|
};
|
|
90
|
-
const getAnswer = (identifiers) => {
|
|
91
|
-
const
|
|
92
|
-
|
|
95
|
+
const getAnswer = (identifiers, optsIn) => {
|
|
96
|
+
const opts = optsIn ?? optsDefault;
|
|
97
|
+
const { mass } = identifiers;
|
|
98
|
+
switch (opts.inputType) {
|
|
93
99
|
case "decimal": {
|
|
94
|
-
const answer = round(mass * g,
|
|
100
|
+
const answer = round(mass * g, Number(opts.nbDigits));
|
|
95
101
|
return `${answer.frenchify()}N`;
|
|
96
102
|
}
|
|
97
103
|
case "sci": {
|
|
98
|
-
const answer = (mass * g).toScientific(
|
|
104
|
+
const answer = (mass * g).toScientific(Number(opts.nbDigits));
|
|
99
105
|
return `${answer.toTex()}N`;
|
|
100
106
|
}
|
|
101
107
|
}
|
|
@@ -103,30 +109,32 @@ const getAnswer = (identifiers) => {
|
|
|
103
109
|
const isAnswerValid = (ans, { answer }) => {
|
|
104
110
|
return ans === answer;
|
|
105
111
|
};
|
|
106
|
-
const getPropositions = (n, { answer, mass,
|
|
112
|
+
const getPropositions = (n, { answer, mass }, optsIn) => {
|
|
113
|
+
const opts = optsIn ?? optsDefault;
|
|
107
114
|
const propositions = [];
|
|
108
115
|
const weight = mass * g;
|
|
109
116
|
addValidProp(propositions, answer);
|
|
110
|
-
|
|
117
|
+
const nbDigits = Number(opts.nbDigits);
|
|
118
|
+
switch (opts.inputType) {
|
|
111
119
|
case "decimal":
|
|
112
120
|
{
|
|
113
|
-
tryToAddWrongProp(propositions, `${round(weight * 10,
|
|
114
|
-
tryToAddWrongProp(propositions, `${round(randfloat(weight - 100, weight + 100, 2, [weight]) / 10,
|
|
121
|
+
tryToAddWrongProp(propositions, `${round(weight * 10, nbDigits).frenchify()}N`);
|
|
122
|
+
tryToAddWrongProp(propositions, `${round(randfloat(weight - 100, weight + 100, 2, [weight]) / 10, nbDigits).frenchify()}N`);
|
|
115
123
|
propWhile(propositions, n, () => {
|
|
116
124
|
const random = randfloat(weight - 50, weight + 50, 2, [weight]);
|
|
117
|
-
tryToAddWrongProp(propositions, `${round(random,
|
|
125
|
+
tryToAddWrongProp(propositions, `${round(random, nbDigits).frenchify()}N`);
|
|
118
126
|
});
|
|
119
127
|
}
|
|
120
128
|
break;
|
|
121
129
|
case "sci":
|
|
122
130
|
{
|
|
123
|
-
tryToAddWrongProp(propositions, `${(weight * 10).toScientific(
|
|
131
|
+
tryToAddWrongProp(propositions, `${(weight * 10).toScientific(nbDigits).toTex()}N`);
|
|
124
132
|
tryToAddWrongProp(propositions, `${(randfloat(weight - 100, weight + 100, 2, [weight]) / 10)
|
|
125
|
-
.toScientific(
|
|
133
|
+
.toScientific(nbDigits)
|
|
126
134
|
.toTex()}N`);
|
|
127
135
|
propWhile(propositions, n, () => {
|
|
128
136
|
const random = randfloat(weight - 50, weight + 50, 2, [weight]);
|
|
129
|
-
tryToAddWrongProp(propositions, `${random.toScientific(
|
|
137
|
+
tryToAddWrongProp(propositions, `${random.toScientific(nbDigits).toTex()}N`);
|
|
130
138
|
});
|
|
131
139
|
}
|
|
132
140
|
break;
|
|
@@ -137,20 +145,20 @@ const getCalculateWeightQuestion = (optsIn) => {
|
|
|
137
145
|
const opts = optsIn
|
|
138
146
|
? Object.assign(optsDefault, {
|
|
139
147
|
inputType: random(optsIn.inputType),
|
|
140
|
-
nbDigits:
|
|
148
|
+
nbDigits: random(optsIn.nbDigits),
|
|
141
149
|
})
|
|
142
150
|
: optsDefault;
|
|
143
151
|
const mass = randint(30, 151);
|
|
144
|
-
const identifiers = { mass: mass
|
|
152
|
+
const identifiers = { mass: mass };
|
|
145
153
|
return getQuestionFromIdentifiers(identifiers, opts);
|
|
146
154
|
};
|
|
147
155
|
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
148
156
|
const question = {
|
|
149
|
-
answer: getAnswer(identifiers),
|
|
150
|
-
instruction: getInstruction(identifiers),
|
|
157
|
+
answer: getAnswer(identifiers, opts),
|
|
158
|
+
instruction: getInstruction(identifiers, opts),
|
|
151
159
|
keys: ["N"],
|
|
152
|
-
hint: getHint(identifiers),
|
|
153
|
-
correction: getCorrection(identifiers),
|
|
160
|
+
hint: getHint(identifiers, opts),
|
|
161
|
+
correction: getCorrection(identifiers, opts),
|
|
154
162
|
answerFormat: "tex",
|
|
155
163
|
identifiers,
|
|
156
164
|
options: opts,
|