math-exercises 3.0.108 → 3.0.110

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.
Files changed (104) hide show
  1. package/lib/exercises/math/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/addAndSubWithoutRelatives.js +5 -1
  3. package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.d.ts +7 -0
  5. package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.d.ts.map +1 -0
  6. package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.js +197 -0
  7. package/lib/exercises/math/calcul/rounding/index.d.ts +1 -0
  8. package/lib/exercises/math/calcul/rounding/index.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/rounding/index.js +1 -0
  10. package/lib/exercises/math/calcul/writing/numberToFrenchWriting.js +0 -1
  11. package/lib/exercises/math/calculLitteral/factorisation/factoType2.d.ts.map +1 -1
  12. package/lib/exercises/math/calculLitteral/formulas/index.d.ts +2 -0
  13. package/lib/exercises/math/calculLitteral/formulas/index.d.ts.map +1 -0
  14. package/lib/exercises/math/calculLitteral/formulas/index.js +1 -0
  15. package/lib/exercises/math/calculLitteral/formulas/useFormula.d.ts +18 -0
  16. package/lib/exercises/math/calculLitteral/formulas/useFormula.d.ts.map +1 -0
  17. package/lib/exercises/math/calculLitteral/formulas/useFormula.js +208 -0
  18. package/lib/exercises/math/calculLitteral/index.d.ts +1 -0
  19. package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
  20. package/lib/exercises/math/calculLitteral/index.js +1 -0
  21. package/lib/exercises/math/calculLitteral/writing/index.d.ts +2 -0
  22. package/lib/exercises/math/calculLitteral/writing/index.d.ts.map +1 -0
  23. package/lib/exercises/math/calculLitteral/writing/index.js +1 -0
  24. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts +33 -0
  25. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -0
  26. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +348 -0
  27. package/lib/exercises/math/dataRepresentations/functionGraphReading.d.ts.map +1 -1
  28. package/lib/exercises/math/dataRepresentations/pieChartReading.d.ts.map +1 -1
  29. package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.js +1 -1
  30. package/lib/exercises/math/derivation/tangent/derivativeTangentEquationReading.d.ts.map +1 -1
  31. package/lib/exercises/math/derivation/variations/index.d.ts +1 -0
  32. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
  33. package/lib/exercises/math/derivation/variations/index.js +1 -0
  34. package/lib/exercises/math/derivation/variations/thirdDegreeDerivativeVariation.d.ts +10 -0
  35. package/lib/exercises/math/derivation/variations/thirdDegreeDerivativeVariation.d.ts.map +1 -0
  36. package/lib/exercises/math/derivation/variations/thirdDegreeDerivativeVariation.js +201 -0
  37. package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -1
  38. package/lib/exercises/math/functions/logarithm/index.d.ts +1 -0
  39. package/lib/exercises/math/functions/logarithm/index.d.ts.map +1 -1
  40. package/lib/exercises/math/functions/logarithm/index.js +1 -0
  41. package/lib/exercises/math/functions/logarithm/powerEquation.d.ts +11 -0
  42. package/lib/exercises/math/functions/logarithm/powerEquation.d.ts.map +1 -0
  43. package/lib/exercises/math/functions/logarithm/powerEquation.js +148 -0
  44. package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts.map +1 -1
  45. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
  46. package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +28 -5
  47. package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts.map +1 -1
  48. package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts.map +1 -1
  49. package/lib/exercises/math/geometry/cartesian/placeAPoint.d.ts.map +1 -1
  50. package/lib/exercises/math/geometry/cartesian/placeAPoint.js +14 -0
  51. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.d.ts.map +1 -1
  52. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.d.ts.map +1 -1
  53. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
  54. package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
  55. package/lib/exercises/math/geometry/quadrilaterals/parallelogramAngles.d.ts.map +1 -1
  56. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -1
  57. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
  58. package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -1
  59. package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.d.ts.map +1 -1
  60. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
  61. package/lib/exercises/math/limits/sequencePolynomLimit.js +2 -2
  62. package/lib/exercises/math/limits/sequencePolynomNoFILimit.js +2 -2
  63. package/lib/exercises/math/limits/sequencePolynomProductLimit.js +4 -4
  64. package/lib/exercises/math/limits/sequenceRationalFracLimit.js +4 -4
  65. package/lib/exercises/math/percent/evolutions/evolutionRateFromValues.d.ts.map +1 -1
  66. package/lib/exercises/math/percent/evolutions/findEndValueAfterEvolution.d.ts.map +1 -1
  67. package/lib/exercises/math/percent/evolutions/findStartValueAfterEvolution.d.ts.map +1 -1
  68. package/lib/exercises/math/percent/populationEffectifFromSubPopulation.d.ts.map +1 -1
  69. package/lib/exercises/math/percent/subPopulationEffectifFromPercent.d.ts.map +1 -1
  70. package/lib/exercises/math/python/conditionIfElifElse.d.ts +1 -0
  71. package/lib/exercises/math/python/conditionIfElifElse.d.ts.map +1 -1
  72. package/lib/exercises/math/python/conditionIfElifElse.js +24 -16
  73. package/lib/exercises/math/python/forLoop.js +1 -1
  74. package/lib/exercises/math/python/inOutCalcul.d.ts.map +1 -1
  75. package/lib/exercises/math/python/inOutCalcul.js +5 -1
  76. package/lib/exercises/math/python/pyWhileLoop1Exercise.js +1 -1
  77. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts.map +1 -1
  78. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.js +24 -15
  79. package/lib/exercises/math/python/pythonRangeCompletion.d.ts.map +1 -1
  80. package/lib/exercises/math/python/pythonRangeCompletion.js +7 -5
  81. package/lib/exercises/math/python/variableAffectation.js +7 -7
  82. package/lib/exercises/math/python/variableType.d.ts.map +1 -1
  83. package/lib/exercises/math/python/variableType.js +11 -10
  84. package/lib/exercises/math/python/whileLoopCount.js +1 -1
  85. package/lib/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.d.ts +9 -0
  86. package/lib/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.d.ts.map +1 -0
  87. package/lib/exercises/math/sequences/arithmetic/arithmeticFindAntecedent.js +110 -0
  88. package/lib/exercises/math/sequences/arithmetic/index.d.ts +1 -0
  89. package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
  90. package/lib/exercises/math/sequences/arithmetic/index.js +1 -0
  91. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.d.ts.map +1 -1
  92. package/lib/exercises/math/trigonometry/arcLength.d.ts.map +1 -1
  93. package/lib/exercises/math/trigonometry/basicEquationCos.d.ts.map +1 -1
  94. package/lib/exercises/math/trigonometry/basicEquationSin.d.ts.map +1 -1
  95. package/lib/exercises/math/trigonometry/basicTrigoSystemEquation.d.ts.map +1 -1
  96. package/lib/exercises/math/trigonometry/degreeToRadians.d.ts.map +1 -1
  97. package/lib/exercises/math/trigonometry/mainAngleMeasure.d.ts.map +1 -1
  98. package/lib/index.d.ts +26 -0
  99. package/lib/index.d.ts.map +1 -1
  100. package/lib/playground.d.ts.map +1 -1
  101. package/lib/tree/nodes/equations/equalNode.d.ts +1 -1
  102. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  103. package/lib/tree/nodes/equations/equalNode.js +5 -5
  104. package/package.json +1 -1
@@ -1 +1 @@
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
+ {"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;AAmFzC,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
@@ -8,7 +8,11 @@ import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
8
8
  import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
9
9
  const getInstruction = (identifiers) => {
10
10
  const { numbers } = identifiers;
11
- return `Calculer : $${getStartStatement(identifiers)}$`;
11
+ return `Calculer :
12
+
13
+ $$
14
+ ${getStartStatement(identifiers)}
15
+ $$`;
12
16
  };
13
17
  const getAnswer = (identifiers) => {
14
18
  const { numbers } = identifiers;
@@ -1 +1 @@
1
- {"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,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
+ {"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"}
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ factIndex: number;
4
+ };
5
+ export declare const getPhysicalOrderOfMagnitude: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=getPhysicalOrderOfMagnitude.d.ts.map
@@ -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,2 +1,3 @@
1
1
  export * from "./rounding.js";
2
+ export * from "./getPhysicalOrderOfMagnitude.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -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,2 @@
1
1
  export * from "./rounding.js";
2
+ export * from "./getPhysicalOrderOfMagnitude.js";
@@ -15,7 +15,6 @@
15
15
  // GetInstruction,
16
16
  // GetKeys,
17
17
  // GetGGBOptions,
18
- // GetStudentGGBOptions,
19
18
  // GetGGBAnswer,
20
19
  // } from "../../../../exercises/exercise.js";
21
20
  // import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
@@ -1 +1 @@
1
- {"version":3,"file":"factoType2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,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"}
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,2 @@
1
+ export * from "./useFormula.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -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
+ };
@@ -5,4 +5,5 @@ export * from "./inequations/index.js";
5
5
  export * from "./simplifying/index.js";
6
6
  export * from "./systems/index.js";
7
7
  export * from "./isolate/index.js";
8
+ export * from "./formulas/index.js";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -5,3 +5,4 @@ export * from "./inequations/index.js";
5
5
  export * from "./simplifying/index.js";
6
6
  export * from "./systems/index.js";
7
7
  export * from "./isolate/index.js";
8
+ export * from "./formulas/index.js";
@@ -0,0 +1,2 @@
1
+ export * from "./writeLitExpFromFrenchExp.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/writing/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./writeLitExpFromFrenchExp.js";
@@ -0,0 +1,33 @@
1
+ import { Exercise } from '../../../../exercises/exercise.js';
2
+ type UnaryOperator = {
3
+ outputName: "Opposite" | "Inverse";
4
+ arity: 1;
5
+ };
6
+ type BinaryOperator = {
7
+ outputName: "Sum" | "Difference" | "Product" | "Quotient";
8
+ arity: 2;
9
+ };
10
+ type UnaryOperation = {
11
+ operator: UnaryOperator;
12
+ operands: {
13
+ a: string;
14
+ };
15
+ };
16
+ type BinaryOperation = {
17
+ operator: BinaryOperator;
18
+ operands: {
19
+ a: number;
20
+ b: string;
21
+ } | {
22
+ a: string;
23
+ b: number;
24
+ };
25
+ };
26
+ type Operation = UnaryOperation | BinaryOperation;
27
+ type Identifiers = {
28
+ operation: Operation;
29
+ isUsingFrenchFactorNouns: boolean;
30
+ };
31
+ export declare const writeLitExprFromFrench: Exercise<Identifiers>;
32
+ export {};
33
+ //# sourceMappingURL=writeLitExpFromFrenchExp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writeLitExpFromFrenchExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AA6BrC,KAAK,aAAa,GAAI;IACpB,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,KAAK,EAAG,CAAC,CAAA;CACV,CAAC;AACF,KAAK,cAAc,GAAG;IACpB,UAAU,EAAE,KAAK,GAAG,YAAY,GAAG,SAAS,GAAG,UAAU,CAAC;IAC1D,KAAK,EAAG,CAAC,CAAA;CACV,CAAC;AAcF,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE;QAAE,CAAC,EAAG,MAAM,CAAA;KAAE,CAAC;CAC1B,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE;QAAE,CAAC,EAAG,MAAM,CAAC;QAAC,CAAC,EAAG,MAAM,CAAA;KAAE,GAAI;QAAC,CAAC,EAAG,MAAM,CAAC;QAAC,CAAC,EAAG,MAAM,CAAA;KAAE,CAAC;CACnE,CAAA;AAED,KAAK,SAAS,GAAG,cAAc,GAAG,eAAe,CAAC;AAIlD,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,wBAAwB,EAAE,OAAO,CAAC;CACnC,CAAC;AA8WF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAgBxD,CAAC"}