math-exercises 3.0.123 → 3.0.125
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/arithmetics/primeNumbers.d.ts +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +20 -14
- package/lib/exercises/math/calcul/fractions/fractionsMix.js +1 -1
- package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/volumeConversion.js +7 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +9 -3
- package/lib/exercises/math/functions/affines/affineFromExercise.d.ts +1 -1
- package/lib/exercises/math/functions/affines/affineFromExercise.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineFromExercise.js +123 -48
- package/lib/exercises/math/functions/affines/drawAffineFromLitExp.js +5 -5
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts +2 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +41 -24
- package/lib/exercises/math/functions/basics/findZeroesProductQuotient.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/findZeroesProductQuotient.js +29 -2
- package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.js +72 -61
- package/lib/exercises/math/functions/logarithm/powerEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/powerEquation.js +0 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +41 -16
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +3 -2
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts +1 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.js +21 -13
- package/lib/exercises/math/geometry/perimeters/circleCircumference.d.ts.map +1 -1
- package/lib/exercises/math/geometry/perimeters/circleCircumference.js +15 -7
- package/lib/exercises/math/geometry/shapes/basicShapesNaming.d.ts.map +1 -1
- package/lib/exercises/math/geometry/shapes/basicShapesNaming.js +5 -3
- package/lib/exercises/math/geometry/vectors/vectorLinearCombination.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +0 -1
- package/lib/exercises/math/percent/evolutions/evolutionToCM.js +2 -2
- package/lib/exercises/math/percent/findProportion.d.ts +6 -1
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +162 -45
- package/lib/exercises/math/powers/calculateNegativePower.d.ts +5 -1
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +93 -29
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +10 -2
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +2 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts +4 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +46 -27
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +14 -2
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts +1 -0
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +43 -19
- package/lib/exercises/math/sequences/sequenceEvaluation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/sequenceEvaluation.js +18 -1
- package/lib/exercises/pc/chemicalReactions/chemicalEquations.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/chemicalEquations.js +17 -2
- package/lib/exercises/pc/mole/molarMass.d.ts.map +1 -1
- package/lib/exercises/pc/mole/molarMass.js +7 -1
- package/lib/exercises/pc/motion/averageSpeed.d.ts +9 -4
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +132 -61
- package/lib/exercises/pc/motion/averageSpeedCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeedCalculation.js +10 -4
- package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.d.ts +2 -2
- package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.js +15 -15
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
- package/lib/exercises/utils/geogebra/toolBarConstructor.js +3 -1
- package/lib/index.d.ts +49 -13
- package/lib/index.d.ts.map +1 -1
- package/lib/pc/units/timeUnits.d.ts +5 -3
- package/lib/pc/units/timeUnits.d.ts.map +1 -1
- package/lib/pc/units/timeUnits.js +25 -19
- package/package.json +1 -1
|
@@ -56,74 +56,85 @@ const getGGBOptions = (identifiers) => {
|
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
58
|
const getInverseImageFunctionGeogebra = () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
else {
|
|
76
|
-
yValue = randint(-6, 7, [0]);
|
|
77
|
-
const constante = randint(-6, 7, [yValue]);
|
|
78
|
-
points.push([0, constante], [1, constante]);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
if (hasAntecedent) {
|
|
83
|
-
yValue = randint(-6, 7);
|
|
84
|
-
const xIsDecimal = coinFlip();
|
|
85
|
-
const xValue = xIsDecimal
|
|
86
|
-
? randfloat(-6, 7, 2, [yValue])
|
|
87
|
-
: randint(-6, 7, [yValue]);
|
|
88
|
-
const hasTwoAntecedents = probaFlip(0.8);
|
|
89
|
-
if (hasTwoAntecedents) {
|
|
90
|
-
const wrongY = randint(-6, 7, [yValue]);
|
|
91
|
-
const secondAntecedentPoint = [
|
|
92
|
-
randint(-6, 7, [xValue, yValue]),
|
|
93
|
-
yValue,
|
|
94
|
-
];
|
|
95
|
-
points.push([xValue, yValue], [yValue, wrongY], secondAntecedentPoint);
|
|
59
|
+
function generateIdentifiers() {
|
|
60
|
+
const isLine = coinFlip();
|
|
61
|
+
const hasAntecedent = probaFlip(0.8);
|
|
62
|
+
// const isLine = false;
|
|
63
|
+
// const hasAntecedent = true;
|
|
64
|
+
let yValue;
|
|
65
|
+
const points = [];
|
|
66
|
+
if (isLine) {
|
|
67
|
+
if (hasAntecedent) {
|
|
68
|
+
yValue = randint(-6, 7);
|
|
69
|
+
const xIsDecimal = probaFlip(0.3);
|
|
70
|
+
const xValue = xIsDecimal
|
|
71
|
+
? randfloat(-6, 7, 2, [yValue])
|
|
72
|
+
: randint(-6, 7, [yValue]);
|
|
73
|
+
const wrongY = randint(-6, 7);
|
|
74
|
+
points.push([xValue, yValue], [yValue, wrongY]);
|
|
96
75
|
}
|
|
97
76
|
else {
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
points.push([
|
|
77
|
+
yValue = randint(-6, 7, [0]);
|
|
78
|
+
const constante = randint(-6, 7, [yValue]);
|
|
79
|
+
points.push([0, constante], [1, constante]);
|
|
101
80
|
}
|
|
102
81
|
}
|
|
103
82
|
else {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
83
|
+
if (hasAntecedent) {
|
|
84
|
+
yValue = randint(-6, 7);
|
|
85
|
+
const xIsDecimal = coinFlip();
|
|
86
|
+
const xValue = xIsDecimal
|
|
87
|
+
? randfloat(-6, 7, 2, [yValue])
|
|
88
|
+
: randint(-6, 7, [yValue]);
|
|
89
|
+
const hasTwoAntecedents = probaFlip(0.8);
|
|
90
|
+
if (hasTwoAntecedents) {
|
|
91
|
+
const wrongY = randint(-6, 7, [yValue]);
|
|
92
|
+
const secondAntecedentPoint = [
|
|
93
|
+
randint(-6, 7, [xValue, yValue]),
|
|
94
|
+
yValue,
|
|
95
|
+
];
|
|
96
|
+
points.push([xValue, yValue], [yValue, wrongY], secondAntecedentPoint);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
//(x,y) is summit
|
|
100
|
+
const wrongY = randint(-6, 7, [yValue]);
|
|
101
|
+
points.push([xValue, yValue], [yValue, wrongY], [2 * xValue - yValue, wrongY]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
yValue = randint(-8, 9);
|
|
106
|
+
const wrongY = randint(-3, 4, [yValue, yValue - 1, yValue + 1]);
|
|
107
|
+
const below = wrongY < yValue;
|
|
108
|
+
const summit = [
|
|
109
|
+
randint(-6, 7, [yValue]),
|
|
110
|
+
below
|
|
111
|
+
? randint(wrongY + 1, yValue, [wrongY])
|
|
112
|
+
: randint(yValue + 1, wrongY, [wrongY]),
|
|
113
|
+
];
|
|
114
|
+
const thirdPoint = [2 * summit[0] - yValue, wrongY];
|
|
115
|
+
//construire deux autrs points au pif avec y sous/audssu yValus
|
|
116
|
+
points.push([yValue, wrongY], summit, thirdPoint);
|
|
117
|
+
}
|
|
116
118
|
}
|
|
119
|
+
points.sort((p1, p2) => p1[0] - p2[0]);
|
|
120
|
+
const identifiers = {
|
|
121
|
+
// xValue,
|
|
122
|
+
// affineCoeffs: isAffine ? affine!.coefficients : undefined,
|
|
123
|
+
// trinomCoeffs: isAffine ? undefined : trinom!.coefficients,
|
|
124
|
+
yValue,
|
|
125
|
+
points,
|
|
126
|
+
// isAffine,
|
|
127
|
+
};
|
|
128
|
+
return identifiers;
|
|
117
129
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
130
|
+
function isInfinityOfSolutions(identifiers) {
|
|
131
|
+
const { yValue, points } = identifiers;
|
|
132
|
+
return points.every((point) => point[1] === yValue);
|
|
133
|
+
}
|
|
134
|
+
let identifiers;
|
|
135
|
+
do {
|
|
136
|
+
identifiers = generateIdentifiers();
|
|
137
|
+
} while (isInfinityOfSolutions(identifiers));
|
|
127
138
|
return getQuestionFromIdentifiers(identifiers);
|
|
128
139
|
};
|
|
129
140
|
const getHint = (identifiers) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/powerEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"powerEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/powerEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmJF,KAAK,OAAO,GAAG;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAUF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBxD,CAAC"}
|
|
@@ -90,7 +90,6 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
90
90
|
const parsed = parseAlgebraic(ans);
|
|
91
91
|
const value = parsed.evaluate();
|
|
92
92
|
const answerValue = parseAlgebraic(answer).evaluate();
|
|
93
|
-
console.log(value, answerValue);
|
|
94
93
|
if (Math.abs(value - answerValue) < 0.01)
|
|
95
94
|
return true;
|
|
96
95
|
return parsed.simplify().toTex() === answer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"rootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4GF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
|
|
@@ -2,9 +2,11 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exer
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
4
4
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
7
|
+
import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
|
|
7
8
|
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
8
10
|
const getInstruction = (identifiers) => {
|
|
9
11
|
const { a, b, c } = identifiers;
|
|
10
12
|
const trinom = new Trinom(a, b, c);
|
|
@@ -49,20 +51,43 @@ const getPropositions = (n, { answer }) => {
|
|
|
49
51
|
return shuffle(propositions);
|
|
50
52
|
};
|
|
51
53
|
const isAnswerValid = (ans, { a, b, c }) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
try {
|
|
55
|
+
const parsed = discreteSetParser(ans);
|
|
56
|
+
if (!parsed)
|
|
57
|
+
return false;
|
|
58
|
+
const trinom = new Trinom(a, b, c);
|
|
59
|
+
const roots = trinom.getRootsNode();
|
|
60
|
+
return isArrayOfNodesValid(parsed.elements, roots);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
return handleVEAError(err);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const isArrayOfNodesValid = (arrAns, arrAnswer) => {
|
|
67
|
+
//tried with toAllValidTexs() but there is always an unhandled case
|
|
68
|
+
function isNodesEqual(node1, node2) {
|
|
69
|
+
return [1, 1_000, 1_000_000].every((factor) => substract(multiply(factor, node1), multiply(factor, node2)).evaluate() === 0);
|
|
70
|
+
}
|
|
71
|
+
const dictAnswer = Object.fromEntries(arrAnswer.map((node, i) => [i, node]));
|
|
72
|
+
let isValid = true;
|
|
73
|
+
for (let i = 0; i < arrAns.length; i++) {
|
|
74
|
+
const nodeAns = arrAns[i];
|
|
75
|
+
let isFound = false;
|
|
76
|
+
const keys = Object.keys(dictAnswer);
|
|
77
|
+
for (let j = 0; j < keys.length; j++) {
|
|
78
|
+
const key = keys[j];
|
|
79
|
+
const answerNode = dictAnswer[key];
|
|
80
|
+
if (isNodesEqual(nodeAns, answerNode)) {
|
|
81
|
+
isFound = true;
|
|
82
|
+
delete dictAnswer[key]; //one-to-one correspondence
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
isValid = isValid && isFound;
|
|
87
|
+
if (!isValid)
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
return isValid;
|
|
66
91
|
};
|
|
67
92
|
export const rootsFromDevForm = {
|
|
68
93
|
id: "rootsFromDevForm",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootsReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"rootsReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoGF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAY9C,CAAC"}
|
|
@@ -80,8 +80,9 @@ const isAnswerValid = (ans, { a, b, c }) => {
|
|
|
80
80
|
return ans === "\\text{Aucun}";
|
|
81
81
|
}
|
|
82
82
|
const studentNumbers = ans
|
|
83
|
-
.replaceAll("\\text{
|
|
84
|
-
.
|
|
83
|
+
.replaceAll("\\text{", "")
|
|
84
|
+
.replaceAll("}", "") //as long as there's no \\frac{}{} involved, it's ok
|
|
85
|
+
.split("et")
|
|
85
86
|
.map((n) => Number(n.replace(",", ".")))
|
|
86
87
|
.filter((n) => !isNaN(n))
|
|
87
88
|
.sort((a, b) => a - b);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinomSignFromFacto.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/sign/trinomSignFromFacto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"trinomSignFromFacto.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/sign/trinomSignFromFacto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAgJF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAqBrD,CAAC"}
|
|
@@ -8,11 +8,12 @@ import { UnionIntervalNode } from "../../../../../tree/nodes/sets/unionIntervalN
|
|
|
8
8
|
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
9
9
|
import { unionIntervalParser } from "../../../../../tree/parsers/unionIntervalParser.js";
|
|
10
10
|
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
11
|
-
const getPropositions = (n, { answer, trinomCoeffs, isAskingPositive }) => {
|
|
11
|
+
const getPropositions = (n, { answer, trinomCoeffs, isAskingPositive, isStrict }) => {
|
|
12
12
|
const propositions = [];
|
|
13
13
|
addValidProp(propositions, answer);
|
|
14
14
|
const trinom = TrinomNodeConstructor.fromCoeffs(trinomCoeffs);
|
|
15
|
-
tryToAddWrongProp(propositions, getAnswer({ trinomCoeffs, isAskingPositive: !isAskingPositive }));
|
|
15
|
+
tryToAddWrongProp(propositions, getAnswer({ trinomCoeffs, isAskingPositive: !isAskingPositive, isStrict }));
|
|
16
|
+
tryToAddWrongProp(propositions, getAnswer({ trinomCoeffs, isAskingPositive, isStrict: !isStrict }));
|
|
16
17
|
tryToAddWrongProp(propositions, new IntervalNode(trinom.a, trinom.b, ClosureType.FF).toTex());
|
|
17
18
|
propWhile(propositions, n, () => {
|
|
18
19
|
const interval = IntervalNodeConstructor.random();
|
|
@@ -21,36 +22,41 @@ const getPropositions = (n, { answer, trinomCoeffs, isAskingPositive }) => {
|
|
|
21
22
|
return shuffleProps(propositions, n);
|
|
22
23
|
};
|
|
23
24
|
const getAnswerNode = (identifiers) => {
|
|
24
|
-
const
|
|
25
|
+
const { trinomCoeffs, isAskingPositive, isStrict } = identifiers;
|
|
26
|
+
const trinom = TrinomNodeConstructor.fromCoeffs(trinomCoeffs);
|
|
25
27
|
const roots = trinom.getRoots();
|
|
26
|
-
const a =
|
|
27
|
-
return a > 0 ===
|
|
28
|
+
const a = trinomCoeffs[2];
|
|
29
|
+
return a > 0 === isAskingPositive
|
|
28
30
|
? new UnionIntervalNode([
|
|
29
|
-
new IntervalNode(MinusInfinityNode, roots[0], ClosureType.OF),
|
|
30
|
-
new IntervalNode(roots[1], PlusInfinityNode, ClosureType.FO),
|
|
31
|
+
new IntervalNode(MinusInfinityNode, roots[0], isStrict ? ClosureType.OO : ClosureType.OF),
|
|
32
|
+
new IntervalNode(roots[1], PlusInfinityNode, isStrict ? ClosureType.OO : ClosureType.FO),
|
|
31
33
|
])
|
|
32
|
-
: new IntervalNode(roots[0], roots[1], ClosureType.FF);
|
|
34
|
+
: new IntervalNode(roots[0], roots[1], isStrict ? ClosureType.OO : ClosureType.FF);
|
|
33
35
|
};
|
|
34
36
|
const getAnswer = (identifiers) => {
|
|
35
37
|
return getAnswerNode(identifiers).toTex();
|
|
36
38
|
};
|
|
37
39
|
const getInstruction = (identifiers) => {
|
|
38
|
-
const
|
|
40
|
+
const { trinomCoeffs, isAskingPositive, isStrict } = identifiers;
|
|
41
|
+
const trinom = TrinomNodeConstructor.fromCoeffs(trinomCoeffs);
|
|
39
42
|
return `Soit $f$ une fonction polynôme de degré $2$ définie sur $\\mathbb{R}$ par :
|
|
40
43
|
|
|
41
44
|
$$
|
|
42
45
|
f(x) = ${trinom.toFactorized().toTex()}
|
|
43
46
|
$$
|
|
44
47
|
|
|
45
|
-
Sur quel(s) intervalle(s) les valeurs de la fonction $f$ sont-elles
|
|
48
|
+
Sur quel(s) intervalle(s) les valeurs de la fonction $f$ sont-elles
|
|
49
|
+
${isStrict ? "strictement" : ""} ${isAskingPositive ? "positives" : "négatives"}
|
|
50
|
+
?`;
|
|
46
51
|
};
|
|
47
52
|
const getHint = () => {
|
|
48
53
|
return `Une fonction polynôme de degré $2$ est du signe de son coefficient $a$, sauf entre ses racines.`;
|
|
49
54
|
};
|
|
50
55
|
const getCorrection = (identifiers) => {
|
|
51
|
-
const
|
|
56
|
+
const { trinomCoeffs, isAskingPositive, isStrict } = identifiers;
|
|
57
|
+
const trinom = TrinomNodeConstructor.fromCoeffs(trinomCoeffs);
|
|
52
58
|
const roots = trinom.getRoots();
|
|
53
|
-
const a =
|
|
59
|
+
const a = trinomCoeffs[2];
|
|
54
60
|
const answer = getAnswer(identifiers);
|
|
55
61
|
const ineqSign = a > 0 ? ">" : "<";
|
|
56
62
|
const sign = a > 0 ? "positive" : "négative";
|
|
@@ -60,7 +66,7 @@ Ici, $a = ${a}${ineqSign}0$, et les racines de $f$ sont $${roots[0].toTex()}$ et
|
|
|
60
66
|
|
|
61
67
|
$f$ est donc ${sign} sauf sur l'intervalle $${new IntervalNode(roots[0], roots[1], ClosureType.FF).toTex()}$.
|
|
62
68
|
|
|
63
|
-
On en déduit que $f$ est ${
|
|
69
|
+
On en déduit que $f$ est ${isStrict ? "strictement" : ""} ${isAskingPositive ? "positive" : "négative"} sur :
|
|
64
70
|
|
|
65
71
|
$$
|
|
66
72
|
${answer}
|
|
@@ -83,8 +89,10 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
83
89
|
const getTrinomSignFromFactoQuestion = () => {
|
|
84
90
|
const trinom = TrinomNodeConstructor.randomNiceRoots(2);
|
|
85
91
|
const isAskingPositive = coinFlip();
|
|
92
|
+
const isStrict = coinFlip();
|
|
86
93
|
const identifiers = {
|
|
87
94
|
isAskingPositive,
|
|
95
|
+
isStrict,
|
|
88
96
|
trinomCoeffs: trinom.getCoeffs(),
|
|
89
97
|
};
|
|
90
98
|
return getQuestionFromIdentifiers(identifiers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circleCircumference.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/circleCircumference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"circleCircumference.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/circleCircumference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA2GF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { addValidProp, tryToAddWrongProp, propWhile, } from "../../../../exercis
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { round } from "../../../../math/utils/round.js";
|
|
5
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
6
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
5
7
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
6
8
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
7
9
|
const getInstruction = (identifiers) => {
|
|
@@ -10,14 +12,15 @@ const getInstruction = (identifiers) => {
|
|
|
10
12
|
? "rayon " + `$${radius}\\ \\textrm{cm}$`
|
|
11
13
|
: "diamètre " + `$${diametre} \\ \\textrm{cm}$`} (arrondir au centième de $\\textrm{cm}$).`;
|
|
12
14
|
};
|
|
13
|
-
const
|
|
15
|
+
const getAnswerNode = (identifiers) => {
|
|
14
16
|
const { coin, radius, diametre } = identifiers;
|
|
15
17
|
const answerNb = coin
|
|
16
18
|
? round(2 * Math.PI * radius, 2)
|
|
17
19
|
: round(Math.PI * diametre, 2);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
return answerNb.toTree();
|
|
21
|
+
};
|
|
22
|
+
const getAnswer = (identifiers) => {
|
|
23
|
+
return `${getAnswerNode(identifiers).toTex()} \\text{cm}`;
|
|
21
24
|
};
|
|
22
25
|
const getHint = () => {
|
|
23
26
|
return `Le périmètre d'un cercle de rayon $r$ est donné par :
|
|
@@ -79,9 +82,14 @@ const getPropositions = (n, { answer }) => {
|
|
|
79
82
|
});
|
|
80
83
|
return shuffle(propositions);
|
|
81
84
|
};
|
|
82
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
86
|
+
if (ans.includes("\\text{cm}^2")) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const refinedAns = ans.replace("\\text{cm}", "");
|
|
90
|
+
const ansNode = parseAlgebraic(refinedAns);
|
|
91
|
+
const answerNode = getAnswerNode(identifiers);
|
|
92
|
+
return substract(ansNode, answerNode).evaluate() === 0;
|
|
85
93
|
};
|
|
86
94
|
export const circleCircumference = {
|
|
87
95
|
id: "circleCircumference",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basicShapesNaming.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/shapes/basicShapesNaming.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAKxC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,GAAG,cAAc,GAAG,eAAe,CAAC;CAC/D,CAAC;
|
|
1
|
+
{"version":3,"file":"basicShapesNaming.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/shapes/basicShapesNaming.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAKxC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,GAAG,cAAc,GAAG,eAAe,CAAC;CAC/D,CAAC;AAmKF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAenD,CAAC"}
|
|
@@ -31,7 +31,7 @@ const getAnswer = (identifiers) => {
|
|
|
31
31
|
break;
|
|
32
32
|
case 3: //droite
|
|
33
33
|
default:
|
|
34
|
-
return obj.toTexNoLeftRight()
|
|
34
|
+
return `(${obj.toTexNoLeftRight()})`;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
37
|
};
|
|
@@ -105,12 +105,14 @@ const getBasicShapesNamingQuestion = () => {
|
|
|
105
105
|
const type = randint(1, 4);
|
|
106
106
|
let objIds;
|
|
107
107
|
switch (type) {
|
|
108
|
-
case 1: {
|
|
108
|
+
case 1: {
|
|
109
|
+
//segment
|
|
109
110
|
const segment = SegmentConstructor.random();
|
|
110
111
|
objIds = segment.toIdentifiers();
|
|
111
112
|
break;
|
|
112
113
|
}
|
|
113
|
-
case 2: {
|
|
114
|
+
case 2: {
|
|
115
|
+
//demi-droite
|
|
114
116
|
const ray = RayConstructor.random();
|
|
115
117
|
objIds = ray.toIdentifiers();
|
|
116
118
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectorLinearCombination.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/vectorLinearCombination.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,YAAY,CAAC;IAChB,CAAC,EAAE,YAAY,CAAC;CACjB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"vectorLinearCombination.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/vectorLinearCombination.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,YAAY,CAAC;IAChB,CAAC,EAAE,YAAY,CAAC;CACjB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqNF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
|
|
@@ -154,7 +154,6 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
154
154
|
if (!isBinomialCoefficientNode(parsed))
|
|
155
155
|
return false;
|
|
156
156
|
const vec = new Vector("u", parsed.leftChild, parsed.rightChild);
|
|
157
|
-
console.log(solVector.toCoords(), vec.toCoords());
|
|
158
157
|
return solVector.simplify().toCoords() === vec.toCoords();
|
|
159
158
|
}
|
|
160
159
|
else {
|
|
@@ -32,7 +32,7 @@ $$
|
|
|
32
32
|
1${isHausse ? "+" : "-"}\\frac{${Math.abs(evolution)}}{100} = ${CM}
|
|
33
33
|
$$
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
`;
|
|
36
36
|
};
|
|
37
37
|
const getEvolutionToCmQuestion = () => {
|
|
38
38
|
const evolution = randint(-99, 101, [0]);
|
|
@@ -43,7 +43,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
43
43
|
const question = {
|
|
44
44
|
answer: getAnswer(identifiers),
|
|
45
45
|
instruction: getInstruction(identifiers),
|
|
46
|
-
keys: [
|
|
46
|
+
keys: [],
|
|
47
47
|
answerFormat: "tex",
|
|
48
48
|
identifiers,
|
|
49
49
|
hint: getHint(identifiers),
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
2
|
type Identifiers = {
|
|
3
|
+
indexSituation: number;
|
|
3
4
|
total: number;
|
|
4
5
|
lefties: number;
|
|
6
|
+
opts: Options;
|
|
5
7
|
};
|
|
6
|
-
|
|
8
|
+
type Options = {
|
|
9
|
+
isPercentSymbolRequired: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const findProportion: Exercise<Identifiers, Options>;
|
|
7
12
|
export {};
|
|
8
13
|
//# sourceMappingURL=findProportion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findProportion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/findProportion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"findProportion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/findProportion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAwNF,KAAK,OAAO,GAAG;IACb,uBAAuB,EAAE,OAAO,CAAC;CAClC,CAAC;AAeF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBzD,CAAC"}
|