math-exercises 3.0.107 → 3.0.109
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/addAndSub.d.ts +1 -1
- package/lib/exercises/math/calcul/addAndSub.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSub.js +18 -4
- package/lib/exercises/math/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSubWithoutRelatives.js +8 -3
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.d.ts.map +1 -1
- package/lib/exercises/math/calcul/digitDecimalRankNumber.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.d.ts +7 -0
- package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.d.ts.map +1 -0
- package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.js +197 -0
- package/lib/exercises/math/calcul/rounding/index.d.ts +1 -0
- package/lib/exercises/math/calcul/rounding/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/index.js +1 -0
- package/lib/exercises/math/calcul/writing/numberToFrenchWriting.js +0 -1
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.js +6 -2
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +4 -4
- package/lib/exercises/math/calculLitteral/factorisation/factoType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/formulas/index.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/formulas/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/formulas/index.js +1 -0
- package/lib/exercises/math/calculLitteral/formulas/useFormula.d.ts +18 -0
- package/lib/exercises/math/calculLitteral/formulas/useFormula.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/formulas/useFormula.js +208 -0
- package/lib/exercises/math/calculLitteral/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/index.js +1 -0
- package/lib/exercises/math/calculLitteral/writing/index.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/writing/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/writing/index.js +1 -0
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts +33 -0
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +348 -0
- package/lib/exercises/math/dataRepresentations/functionGraphReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/pieChartReading.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/derivativeTangentEquationReading.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/index.d.ts +1 -0
- package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/index.js +1 -0
- package/lib/exercises/math/derivation/variations/thirdDegreeDerivativeVariation.d.ts +10 -0
- package/lib/exercises/math/derivation/variations/thirdDegreeDerivativeVariation.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/thirdDegreeDerivativeVariation.js +201 -0
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +3 -0
- package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.js +2 -0
- package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/index.d.ts +1 -0
- package/lib/exercises/math/functions/logarithm/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/index.js +1 -0
- package/lib/exercises/math/functions/logarithm/powerEquation.d.ts +11 -0
- package/lib/exercises/math/functions/logarithm/powerEquation.d.ts.map +1 -0
- package/lib/exercises/math/functions/logarithm/powerEquation.js +148 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +28 -5
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.js +3 -1
- package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAPoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAPoint.js +14 -0
- package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramAngles.d.ts.map +1 -1
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.js +1 -1
- package/lib/exercises/math/percent/evolutions/evolutionRateFromValues.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/findEndValueAfterEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/findStartValueAfterEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/populationEffectifFromSubPopulation.d.ts.map +1 -1
- package/lib/exercises/math/percent/subPopulationEffectifFromPercent.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +6 -4
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.d.ts +9 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.js +110 -0
- package/lib/exercises/math/sequences/arithmetic/index.d.ts +1 -0
- package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/index.js +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/arcLength.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/basicEquationCos.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/basicEquationSin.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/basicTrigoSystemEquation.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/degreeToRadians.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/mainAngleMeasure.d.ts.map +1 -1
- package/lib/index.d.ts +26 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/polynomials/polynomial.d.ts.map +1 -1
- package/lib/math/polynomials/polynomial.js +25 -29
- package/lib/math/utils/random/randfloat.d.ts +7 -1
- package/lib/math/utils/random/randfloat.d.ts.map +1 -1
- package/lib/math/utils/random/randfloat.js +2 -1
- package/lib/math/utils/random/randfrac.d.ts +9 -0
- package/lib/math/utils/random/randfrac.d.ts.map +1 -0
- package/lib/math/utils/random/randfrac.js +19 -0
- package/lib/math/utils/random/randint.d.ts +7 -1
- package/lib/math/utils/random/randint.d.ts.map +1 -1
- package/lib/math/utils/random/randint.js +2 -1
- package/lib/playground.d.ts +1 -1
- package/lib/playground.js +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +5 -5
- package/lib/tree/nodes/functions/expNode.d.ts +1 -1
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +1 -1
- package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -1
- package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sqrtNode.js +1 -3
- package/lib/tree/nodes/operators/addNode.d.ts +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +3 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +44 -38
- package/lib/tree/nodes/operators/powerNode.d.ts +1 -1
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +1 -1
- package/lib/tree/nodes/randomReal.d.ts +15 -0
- package/lib/tree/nodes/randomReal.d.ts.map +1 -0
- package/lib/tree/nodes/randomReal.js +32 -0
- package/lib/tree/parsers/latexParser.js +5 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSub.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSub.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAeT,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AAEH,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAgBzC,KAAK,OAAO,GAAG;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AA0FF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB5D,CAAC"}
|
|
@@ -3,15 +3,21 @@ import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
|
3
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
4
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
5
5
|
import { AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
6
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
6
7
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
7
8
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
8
9
|
const options = [
|
|
9
10
|
{
|
|
10
11
|
id: "explicitWriting",
|
|
11
|
-
label: "
|
|
12
|
+
label: "Type d'écriture",
|
|
12
13
|
target: GeneratorOptionTarget.instruction,
|
|
13
|
-
type: GeneratorOptionType.
|
|
14
|
-
|
|
14
|
+
type: GeneratorOptionType.select,
|
|
15
|
+
values: [
|
|
16
|
+
"Explicite (parenthèses autour de chaque nombre)",
|
|
17
|
+
"Simplifiée",
|
|
18
|
+
"Les deux",
|
|
19
|
+
],
|
|
20
|
+
defaultValue: "Simplifiée",
|
|
15
21
|
},
|
|
16
22
|
];
|
|
17
23
|
const getStatementNode = (identifiers, opts) => {
|
|
@@ -24,8 +30,16 @@ const getStatementNode = (identifiers, opts) => {
|
|
|
24
30
|
return statementTree;
|
|
25
31
|
};
|
|
26
32
|
const getStartStatement = (identifiers, opts) => {
|
|
33
|
+
// "Explicite (parenthèses autour de chaque nombre)",
|
|
34
|
+
// "Simplifiée",
|
|
35
|
+
// "Les deux",
|
|
36
|
+
const explicitNumberWriting = !opts?.explicitWriting || opts.explicitWriting === "Simplifiée"
|
|
37
|
+
? false
|
|
38
|
+
: opts?.explicitWriting === "Les deux"
|
|
39
|
+
? coinFlip()
|
|
40
|
+
: true;
|
|
27
41
|
return getStatementNode(identifiers, opts).toTex({
|
|
28
|
-
explicitNumberWriting:
|
|
42
|
+
explicitNumberWriting: explicitNumberWriting,
|
|
29
43
|
});
|
|
30
44
|
};
|
|
31
45
|
const getInstruction = (identifiers, opts) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAcT,MAAM,mBAAmB,CAAC;AAG3B;;GAEG;AAEH,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AA+EzC,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
1
2
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
2
3
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
3
4
|
import { AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
4
5
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
6
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
5
7
|
import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
6
8
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
7
9
|
const getInstruction = (identifiers) => {
|
|
@@ -65,9 +67,12 @@ const getPropositions = (n, { answer }) => {
|
|
|
65
67
|
return shuffle(propositions);
|
|
66
68
|
};
|
|
67
69
|
const isAnswerValid = (studentAns, { answer }) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
try {
|
|
71
|
+
return numberVEA(studentAns, answer);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
return handleVEAError(err);
|
|
75
|
+
}
|
|
71
76
|
};
|
|
72
77
|
export const addAndSubWithoutRelatives = {
|
|
73
78
|
id: "addAndSubWithoutRelatives",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA4FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAerD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digitDecimalRankNumber.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/digitDecimalRankNumber.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"digitDecimalRankNumber.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/digitDecimalRankNumber.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAsEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPhysicalOrderOfMagnitude.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AA2HrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAmFF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAuB7D,CAAC"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
5
|
+
import { doWhile } from "../../../../utils/doWhile.js";
|
|
6
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
|
+
const physicalFacts = [
|
|
8
|
+
{
|
|
9
|
+
question: "du diamètre d'un atome d'hydrogène",
|
|
10
|
+
value: 1e-10,
|
|
11
|
+
unit: "\\textrm{m}",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
question: "de la taille d'un noyau atomique",
|
|
15
|
+
value: 1e-15,
|
|
16
|
+
unit: "\\textrm{m}",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
question: "de l'épaisseur d'un cheveu humain",
|
|
20
|
+
value: 1e-5,
|
|
21
|
+
unit: "\\textrm{m}",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
question: "de la hauteur d'un être humain",
|
|
25
|
+
value: 1.7,
|
|
26
|
+
unit: "\\textrm{m}",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
question: "de la distance entre Paris et Marseille",
|
|
30
|
+
value: 750000,
|
|
31
|
+
unit: "\\textrm{m}",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
question: "de la distance entre la Terre et la Lune",
|
|
35
|
+
value: 3.84e8,
|
|
36
|
+
unit: "\\textrm{m}",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
question: "de la distance entre la Terre et le Soleil",
|
|
40
|
+
value: 1.5e11,
|
|
41
|
+
unit: "\\textrm{m}",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
question: "de la circonférence de la Terre",
|
|
45
|
+
value: 4e7,
|
|
46
|
+
unit: "\\textrm{m}",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
question: "de la masse d'un être humain",
|
|
50
|
+
value: 70,
|
|
51
|
+
unit: "\\textrm{kg}",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
question: "de la masse d'une voiture",
|
|
55
|
+
value: 1.5e3,
|
|
56
|
+
unit: "\\textrm{kg}",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
question: "de la masse de la Terre",
|
|
60
|
+
value: 6e24,
|
|
61
|
+
unit: "\\textrm{kg}",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
question: "de la masse de la Lune",
|
|
65
|
+
value: 7.3e22,
|
|
66
|
+
unit: "\\textrm{kg}",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
question: "de la durée d'une journée",
|
|
70
|
+
value: 86400,
|
|
71
|
+
unit: "\\textrm{s}",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
question: "de la durée d'un battement de cœur",
|
|
75
|
+
value: 1,
|
|
76
|
+
unit: "\\textrm{s}",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
question: "de l'âge de l'Univers",
|
|
80
|
+
value: 4.3e17,
|
|
81
|
+
unit: "\\textrm{s}",
|
|
82
|
+
},
|
|
83
|
+
// {
|
|
84
|
+
// question: "de la charge élémentaire",
|
|
85
|
+
// value: 1.6e-19,
|
|
86
|
+
// unit: "\\textrm{C}",
|
|
87
|
+
// },
|
|
88
|
+
// {
|
|
89
|
+
// question: "de la constante de Planck",
|
|
90
|
+
// value: 6.63e-34,
|
|
91
|
+
// unit: "\\textrm{J}\\cdot \\textrm{s}",
|
|
92
|
+
// },
|
|
93
|
+
// {
|
|
94
|
+
// question:
|
|
95
|
+
// "de l'énergie libérée par une bombe atomique",
|
|
96
|
+
// value: 1e14,
|
|
97
|
+
// unit: "\\textrm{J}",
|
|
98
|
+
// },
|
|
99
|
+
// {
|
|
100
|
+
// question:
|
|
101
|
+
// "de l'énergie d'une pomme tombant d'un mètre",
|
|
102
|
+
// value: 1,
|
|
103
|
+
// unit: "\\textrm{J}",
|
|
104
|
+
// },
|
|
105
|
+
{
|
|
106
|
+
question: "de la vitesse de la lumière dans le vide",
|
|
107
|
+
value: 3e8,
|
|
108
|
+
unit: "\\textrm{m}/\\textrm{s}",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
question: "de la température du corps humain",
|
|
112
|
+
value: 37,
|
|
113
|
+
unit: "^\\circ\\textrm{C}",
|
|
114
|
+
},
|
|
115
|
+
// {
|
|
116
|
+
// question: "de la pression atmosphérique",
|
|
117
|
+
// value: 1e5,
|
|
118
|
+
// unit: "\\textrm{Pa}",
|
|
119
|
+
// },
|
|
120
|
+
];
|
|
121
|
+
const getPropositions = (n, { answer, factIndex }) => {
|
|
122
|
+
const propositions = [];
|
|
123
|
+
addValidProp(propositions, answer);
|
|
124
|
+
const item = physicalFacts[factIndex];
|
|
125
|
+
const power = Math.floor(Math.log10(item.value));
|
|
126
|
+
while (propositions.length < n) {
|
|
127
|
+
const exp = doWhile(() => randint(-15, 16), (x) => Math.abs(power - x) < 5);
|
|
128
|
+
const wrongVal = `10^{${exp}}\\ ${item.unit}`;
|
|
129
|
+
tryToAddWrongProp(propositions, wrongVal);
|
|
130
|
+
}
|
|
131
|
+
return shuffleProps(propositions, n);
|
|
132
|
+
};
|
|
133
|
+
const getAnswer = ({ factIndex }) => {
|
|
134
|
+
const item = physicalFacts[factIndex];
|
|
135
|
+
const power = Math.floor(Math.log10(item.value));
|
|
136
|
+
return `10^{${power}}\\ ${item.unit}`;
|
|
137
|
+
};
|
|
138
|
+
const getInstruction = ({ factIndex }) => {
|
|
139
|
+
return `Un ordre de grandeur ${physicalFacts[factIndex].question} est : `;
|
|
140
|
+
};
|
|
141
|
+
const getHint = ({ factIndex }) => {
|
|
142
|
+
return `Il ne s'agit pas de connaître la valeur exacte, mais de l'estimer dans les puissances de $10$.`;
|
|
143
|
+
};
|
|
144
|
+
const getCorrection = ({ factIndex }) => {
|
|
145
|
+
const item = physicalFacts[factIndex];
|
|
146
|
+
const power = Math.floor(Math.log10(item.value));
|
|
147
|
+
return `La valeur réelle est environ $${item.value.frenchify()}\\ ${item.unit}$.
|
|
148
|
+
|
|
149
|
+
On cherche la puissance de $10$ la plus proche : c'est $10^{${power}}$.
|
|
150
|
+
|
|
151
|
+
Un ordre de grandeur ${item.question} est donc $10^{${power}}\\ ${item.unit}$.`;
|
|
152
|
+
};
|
|
153
|
+
const getKeys = () => [];
|
|
154
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
155
|
+
try {
|
|
156
|
+
const ansNode = parseAlgebraic(ans);
|
|
157
|
+
const answerNode = parseAlgebraic(answer);
|
|
158
|
+
return ansNode.simplify().equals(answerNode.simplify());
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
return handleVEAError(err);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const getGetPhysicalOrderOfMagnitudeQuestion = () => {
|
|
165
|
+
const factIndex = Math.floor(Math.random() * physicalFacts.length);
|
|
166
|
+
const identifiers = { factIndex };
|
|
167
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
168
|
+
};
|
|
169
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
170
|
+
return {
|
|
171
|
+
answer: getAnswer(identifiers),
|
|
172
|
+
instruction: getInstruction(identifiers),
|
|
173
|
+
keys: getKeys(identifiers),
|
|
174
|
+
answerFormat: "tex",
|
|
175
|
+
identifiers,
|
|
176
|
+
hint: getHint(identifiers),
|
|
177
|
+
correction: getCorrection(identifiers),
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
export const getPhysicalOrderOfMagnitude = {
|
|
181
|
+
id: "getPhysicalOrderOfMagnitude",
|
|
182
|
+
label: "Estimer l'ordre de grandeur d'une grandeur physique",
|
|
183
|
+
isSingleStep: true,
|
|
184
|
+
generator: (nb, opts) => getDistinctQuestions(() => getGetPhysicalOrderOfMagnitudeQuestion(), nb, physicalFacts.length),
|
|
185
|
+
qcmTimer: 60,
|
|
186
|
+
freeTimer: 60,
|
|
187
|
+
getPropositions,
|
|
188
|
+
isAnswerValid,
|
|
189
|
+
subject: "Mathématiques",
|
|
190
|
+
getInstruction,
|
|
191
|
+
getHint,
|
|
192
|
+
getCorrection,
|
|
193
|
+
getAnswer,
|
|
194
|
+
getQuestionFromIdentifiers,
|
|
195
|
+
hasHintAndCorrection: true,
|
|
196
|
+
answerType: "QCU",
|
|
197
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kCAAkC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalFormDevelopment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"canonicalFormDevelopment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAqGF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAkB1D,CAAC"}
|
|
@@ -45,7 +45,9 @@ ${alignTex([
|
|
|
45
45
|
])}`;
|
|
46
46
|
};
|
|
47
47
|
const getCanonicalFormDevelopmentQuestion = () => {
|
|
48
|
-
const trinom = TrinomConstructor.randomCanonical(
|
|
48
|
+
const trinom = TrinomConstructor.randomCanonical(undefined, {
|
|
49
|
+
excludes: [0],
|
|
50
|
+
});
|
|
49
51
|
const identifiers = { coeffs: trinom.coefficients };
|
|
50
52
|
return getQuestionFromIdentifiers(identifiers);
|
|
51
53
|
};
|
|
@@ -65,7 +67,9 @@ const getPropositions = (n, { answer }) => {
|
|
|
65
67
|
const propositions = [];
|
|
66
68
|
addValidProp(propositions, answer);
|
|
67
69
|
while (propositions.length < n) {
|
|
68
|
-
tryToAddWrongProp(propositions, TrinomConstructor.random({ min: -100, max: 100 }, { min: -100, max: 100 }, { min: -100, max: 100 })
|
|
70
|
+
tryToAddWrongProp(propositions, TrinomConstructor.random({ min: -100, max: 100 }, { min: -100, max: 100 }, { min: -100, max: 100 })
|
|
71
|
+
.toTree()
|
|
72
|
+
.toTex());
|
|
69
73
|
}
|
|
70
74
|
return shuffleProps(propositions, n);
|
|
71
75
|
};
|
|
@@ -113,7 +113,7 @@ ${alignTex([
|
|
|
113
113
|
],
|
|
114
114
|
[
|
|
115
115
|
"=",
|
|
116
|
-
add(square(firstTerm).simplify(simpOpts), add(multiply(multiply(2, firstTerm), secondTerm).simplify(), square(secondTerm).simplify(simpOpts))).toTex(),
|
|
116
|
+
add(square(firstTerm).simplify(simpOpts), add(multiply(multiply(2, firstTerm), secondTerm).simplify(simpOpts), square(secondTerm).simplify(simpOpts))).toTex(),
|
|
117
117
|
],
|
|
118
118
|
])}
|
|
119
119
|
|
|
@@ -135,9 +135,9 @@ ${alignTex([
|
|
|
135
135
|
],
|
|
136
136
|
[
|
|
137
137
|
"=",
|
|
138
|
-
add(square(firstTerm).simplify(simpOpts), add(multiply(-2, multiply(firstTerm, secondTerm)).simplify(), square(secondTerm).simplify(simpOpts)).simplify()).toTex(),
|
|
138
|
+
add(square(firstTerm).simplify(simpOpts), add(multiply(-2, multiply(firstTerm, secondTerm)).simplify(simpOpts), square(secondTerm).simplify(simpOpts)).simplify(simpOpts)).toTex(),
|
|
139
139
|
],
|
|
140
|
-
["=", getAnswer(identifiers)],
|
|
140
|
+
// ["=", getAnswer(identifiers)],
|
|
141
141
|
])}
|
|
142
142
|
|
|
143
143
|
`;
|
|
@@ -161,7 +161,7 @@ ${alignTex([
|
|
|
161
161
|
"=",
|
|
162
162
|
substract(square(firstTerm).simplify(simpOpts), square(secondTerm).simplify(simpOpts)).toTex(),
|
|
163
163
|
],
|
|
164
|
-
["=", getAnswer(identifiers)],
|
|
164
|
+
// ["=", getAnswer(identifiers)],
|
|
165
165
|
])}
|
|
166
166
|
`;
|
|
167
167
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factoType2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"factoType2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAuIF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAe5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/formulas/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useFormula.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
import { KeyId } from "../../../../types/keyIds.js";
|
|
4
|
+
import { KeyProps } from "../../../../types/keyProps.js";
|
|
5
|
+
type Formula = {
|
|
6
|
+
title: string;
|
|
7
|
+
func: (variables: NodeIdentifiers[]) => NodeIdentifiers;
|
|
8
|
+
variables: NodeIdentifiers[];
|
|
9
|
+
variableNames: string[];
|
|
10
|
+
keys: (KeyId | KeyProps)[];
|
|
11
|
+
};
|
|
12
|
+
type Identifiers = {
|
|
13
|
+
formula: Formula;
|
|
14
|
+
values: NodeIdentifiers[];
|
|
15
|
+
};
|
|
16
|
+
export declare const useFormula: Exercise<Identifiers>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=useFormula.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/formulas/useFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAInD,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,eAAe,CAAC;IACxD,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,CAAC,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC5B,CAAC;AAkGF,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B,CAAC;AA6JF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAiB5C,CAAC"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
5
|
+
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
6
|
+
import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
|
|
7
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { power, square } from "../../../../tree/nodes/operators/powerNode.js";
|
|
10
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
12
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
13
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
const FORMULAS = [
|
|
15
|
+
{
|
|
16
|
+
title: "Le volume d'une sphère",
|
|
17
|
+
func: (vars) => multiply(frac(4, 3), multiply(PiNode, power(reifyAlgebraic(vars[0]), 3))).toIdentifiers(),
|
|
18
|
+
variables: [new VariableNode("r").toIdentifiers()],
|
|
19
|
+
variableNames: ["le rayon"],
|
|
20
|
+
keys: ["pi"],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: "Le volume d'un cône",
|
|
24
|
+
func: (vars) => frac(multiply(PiNode, multiply(square(reifyAlgebraic(vars[0])), reifyAlgebraic(vars[1]))), 3).toIdentifiers(),
|
|
25
|
+
variables: [
|
|
26
|
+
new VariableNode("r").toIdentifiers(),
|
|
27
|
+
new VariableNode("h").toIdentifiers(),
|
|
28
|
+
],
|
|
29
|
+
variableNames: ["le rayon", "la hauteur"],
|
|
30
|
+
keys: ["pi"],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: "Le volume d'une pyramide",
|
|
34
|
+
func: (vars) => multiply(frac(1, 3), multiply(reifyAlgebraic(vars[0]), reifyAlgebraic(vars[1]))).toIdentifiers(),
|
|
35
|
+
variables: [
|
|
36
|
+
new VariableNode("B").toIdentifiers(),
|
|
37
|
+
new VariableNode("h").toIdentifiers(),
|
|
38
|
+
],
|
|
39
|
+
variableNames: ["l'aire de la base", "la hauteur"],
|
|
40
|
+
keys: [],
|
|
41
|
+
},
|
|
42
|
+
// {
|
|
43
|
+
// title: "L'accélération gravitationnelle",
|
|
44
|
+
// func: (vars) =>
|
|
45
|
+
// multiply(
|
|
46
|
+
// new VariableNode("G"),
|
|
47
|
+
// frac(reifyAlgebraic(vars[0]), square(reifyAlgebraic(vars[1]))),
|
|
48
|
+
// ).toIdentifiers(),
|
|
49
|
+
// variables: [
|
|
50
|
+
// new VariableNode("M").toIdentifiers(),
|
|
51
|
+
// new VariableNode("r").toIdentifiers(),
|
|
52
|
+
// ],
|
|
53
|
+
// variableNames: ["la masse de l'objet", "la distance entre les deux objets"],
|
|
54
|
+
// keys: [],
|
|
55
|
+
// },
|
|
56
|
+
// {
|
|
57
|
+
// title: "La force gravitationnelle",
|
|
58
|
+
// func: (vars) =>
|
|
59
|
+
// multiply(
|
|
60
|
+
// new VariableNode("G"),
|
|
61
|
+
// frac(
|
|
62
|
+
// multiply(reifyAlgebraic(vars[0]), reifyAlgebraic(vars[1])),
|
|
63
|
+
// square(reifyAlgebraic(vars[2])),
|
|
64
|
+
// ),
|
|
65
|
+
// ).toIdentifiers(),
|
|
66
|
+
// variables: [
|
|
67
|
+
// new VariableNode("m_1").toIdentifiers(),
|
|
68
|
+
// new VariableNode("m_2").toIdentifiers(),
|
|
69
|
+
// new VariableNode("r").toIdentifiers(),
|
|
70
|
+
// ],
|
|
71
|
+
// variableNames: [
|
|
72
|
+
// "la masse du premier objet",
|
|
73
|
+
// "la masse du second objet",
|
|
74
|
+
// "la distance entre les deux objets",
|
|
75
|
+
// ],
|
|
76
|
+
// keys: [],
|
|
77
|
+
// },
|
|
78
|
+
// {
|
|
79
|
+
// title: "La force centripète",
|
|
80
|
+
// func: (vars) =>
|
|
81
|
+
// frac(
|
|
82
|
+
// multiply(reifyAlgebraic(vars[0]), square(reifyAlgebraic(vars[1]))),
|
|
83
|
+
// reifyAlgebraic(vars[2]),
|
|
84
|
+
// ).toIdentifiers(),
|
|
85
|
+
// variables: [
|
|
86
|
+
// new VariableNode("m").toIdentifiers(),
|
|
87
|
+
// new VariableNode("v").toIdentifiers(),
|
|
88
|
+
// new VariableNode("r").toIdentifiers(),
|
|
89
|
+
// ],
|
|
90
|
+
// variableNames: ["la masse", "la vitesse", "le rayon"],
|
|
91
|
+
// keys: [],
|
|
92
|
+
// },
|
|
93
|
+
];
|
|
94
|
+
const getPropositions = (n, { answer, formula, values }) => {
|
|
95
|
+
const propositions = [];
|
|
96
|
+
addValidProp(propositions, answer);
|
|
97
|
+
tryToAddWrongProp(propositions, reifyAlgebraic(formula.func(values.map((x) => multiply(reifyAlgebraic(x), -1)
|
|
98
|
+
.simplify(SIMPLIFY_OPTIONS)
|
|
99
|
+
.toIdentifiers())))
|
|
100
|
+
.simplify(SIMPLIFY_OPTIONS)
|
|
101
|
+
.toTex());
|
|
102
|
+
tryToAddWrongProp(propositions, reifyAlgebraic(formula.func(values.map((x) => frac(reifyAlgebraic(x), 2).simplify(SIMPLIFY_OPTIONS).toIdentifiers())))
|
|
103
|
+
.simplify(SIMPLIFY_OPTIONS)
|
|
104
|
+
.toTex());
|
|
105
|
+
tryToAddWrongProp(propositions, reifyAlgebraic(formula.func(values.map((x) => multiply(reifyAlgebraic(x), 2)
|
|
106
|
+
.simplify(SIMPLIFY_OPTIONS)
|
|
107
|
+
.toIdentifiers())))
|
|
108
|
+
.simplify(SIMPLIFY_OPTIONS)
|
|
109
|
+
.toTex());
|
|
110
|
+
return shuffleProps(propositions, n);
|
|
111
|
+
};
|
|
112
|
+
const SIMPLIFY_OPTIONS = {
|
|
113
|
+
calculatePowers: true,
|
|
114
|
+
towardsDistribute: true,
|
|
115
|
+
distributePowersOnFrac: true,
|
|
116
|
+
};
|
|
117
|
+
const getAnswer = (identifiers) => {
|
|
118
|
+
const { formula, values } = identifiers;
|
|
119
|
+
return reifyAlgebraic(formula.func(values))
|
|
120
|
+
.simplify(SIMPLIFY_OPTIONS)
|
|
121
|
+
.toTex();
|
|
122
|
+
};
|
|
123
|
+
const getInstruction = (identifiers) => {
|
|
124
|
+
const { formula, values } = identifiers;
|
|
125
|
+
let valuesString = [];
|
|
126
|
+
for (let i = 0; i < formula.variables.length; i++) {
|
|
127
|
+
valuesString.push(`${formula.variableNames[i]} vaut $${reifyAlgebraic(values[i]).toTex()}$`);
|
|
128
|
+
}
|
|
129
|
+
let variablesString = [];
|
|
130
|
+
for (let i = 0; i < formula.variables.length; i++) {
|
|
131
|
+
variablesString.push(`$${reifyAlgebraic(formula.variables[i]).toTex()}$ est ${formula.variableNames[i]}`);
|
|
132
|
+
}
|
|
133
|
+
return `${formula.title} est donnée par la formule suivante :
|
|
134
|
+
|
|
135
|
+
$$
|
|
136
|
+
${reifyAlgebraic(formula.func(formula.variables)).toTex()}
|
|
137
|
+
$$
|
|
138
|
+
|
|
139
|
+
où ${variablesString.join(", ")}.
|
|
140
|
+
|
|
141
|
+
Calculer ${formula.title.toLocaleLowerCase()} dont ${valuesString.join(" et ")}.`;
|
|
142
|
+
};
|
|
143
|
+
const getHint = (identifiers) => {
|
|
144
|
+
return `Dans la formule, remplace les variables par les valeurs données dans l'énoncé.`;
|
|
145
|
+
};
|
|
146
|
+
const getCorrection = (identifiers) => {
|
|
147
|
+
const { formula, values } = identifiers;
|
|
148
|
+
let substitutions = [];
|
|
149
|
+
for (let i = 0; i < formula.variables.length; i++) {
|
|
150
|
+
substitutions.push(`- $${reifyAlgebraic(formula.variables[i]).toTex()} = ${reifyAlgebraic(values[i]).toTex()}$`);
|
|
151
|
+
}
|
|
152
|
+
return `On remplace les variables dans la formule par les valeurs données dans l'énoncé :
|
|
153
|
+
|
|
154
|
+
${substitutions.join("\n")}
|
|
155
|
+
|
|
156
|
+
Ce qui nous donne :
|
|
157
|
+
|
|
158
|
+
$$
|
|
159
|
+
${reifyAlgebraic(formula.func(values)).toTex()} = ${getAnswer(identifiers)}
|
|
160
|
+
$$`;
|
|
161
|
+
};
|
|
162
|
+
const getKeys = (identifiers) => {
|
|
163
|
+
return identifiers.formula.keys;
|
|
164
|
+
};
|
|
165
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
166
|
+
try {
|
|
167
|
+
const ansNode = parseAlgebraic(ans).simplify(SIMPLIFY_OPTIONS);
|
|
168
|
+
const answerNode = parseAlgebraic(answer).simplify(SIMPLIFY_OPTIONS);
|
|
169
|
+
return ansNode.equals(answerNode);
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
return handleVEAError(err);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const getUseFormulaQuestion = (ops) => {
|
|
176
|
+
const formula = random(FORMULAS);
|
|
177
|
+
const values = formula.variables.map(() => new NumberNode(randint(1, 10)).toIdentifiers());
|
|
178
|
+
const identifiers = { formula, values };
|
|
179
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
180
|
+
};
|
|
181
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
182
|
+
return {
|
|
183
|
+
answer: getAnswer(identifiers),
|
|
184
|
+
instruction: getInstruction(identifiers),
|
|
185
|
+
keys: getKeys(identifiers),
|
|
186
|
+
answerFormat: "tex",
|
|
187
|
+
identifiers,
|
|
188
|
+
hint: getHint(identifiers),
|
|
189
|
+
correction: getCorrection(identifiers),
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
export const useFormula = {
|
|
193
|
+
id: "useFormula",
|
|
194
|
+
label: "Appliquer numériquement des valeurs dans une formule",
|
|
195
|
+
isSingleStep: true,
|
|
196
|
+
generator: (nb, opts) => getDistinctQuestions(() => getUseFormulaQuestion(opts), nb),
|
|
197
|
+
qcmTimer: 60,
|
|
198
|
+
freeTimer: 60,
|
|
199
|
+
getPropositions,
|
|
200
|
+
isAnswerValid,
|
|
201
|
+
subject: "Mathématiques",
|
|
202
|
+
getInstruction,
|
|
203
|
+
getHint,
|
|
204
|
+
getCorrection,
|
|
205
|
+
getAnswer,
|
|
206
|
+
getQuestionFromIdentifiers,
|
|
207
|
+
hasHintAndCorrection: true,
|
|
208
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|