math-exercises 2.1.0 → 2.1.2

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 (160) hide show
  1. package/lib/exercises/exercise.d.ts +1 -1
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  4. package/lib/exercises/math/functions/affines/affineExpressionReading.js +1 -0
  5. package/lib/exercises/math/functions/affines/interceptReading.d.ts.map +1 -1
  6. package/lib/exercises/math/functions/affines/interceptReading.js +1 -0
  7. package/lib/exercises/math/percent/findProportion.d.ts +8 -0
  8. package/lib/exercises/math/percent/findProportion.d.ts.map +1 -0
  9. package/lib/exercises/math/percent/findProportion.js +48 -0
  10. package/lib/exercises/math/percent/index.d.ts +1 -0
  11. package/lib/exercises/math/percent/index.d.ts.map +1 -1
  12. package/lib/exercises/math/percent/index.js +1 -0
  13. package/lib/exercises/math/powers/decimalToScientific.js +4 -4
  14. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts.map +1 -1
  15. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.js +4 -1
  16. package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.d.ts.map +1 -1
  17. package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.js +4 -1
  18. package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.d.ts +8 -0
  19. package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.d.ts.map +1 -0
  20. package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.js +58 -0
  21. package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.d.ts +8 -0
  22. package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.d.ts.map +1 -0
  23. package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.js +63 -0
  24. package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.d.ts +5 -0
  25. package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.d.ts.map +1 -0
  26. package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.js +76 -0
  27. package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.d.ts +10 -0
  28. package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.d.ts.map +1 -0
  29. package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.js +68 -0
  30. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.d.ts +8 -0
  31. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.d.ts.map +1 -0
  32. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.js +58 -0
  33. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.d.ts +8 -0
  34. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.d.ts.map +1 -0
  35. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.js +59 -0
  36. package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.d.ts +8 -0
  37. package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.d.ts.map +1 -0
  38. package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.js +101 -0
  39. package/lib/exercises/pc/chemicalElements/index.d.ts +9 -0
  40. package/lib/exercises/pc/chemicalElements/index.d.ts.map +1 -0
  41. package/lib/exercises/pc/chemicalElements/index.js +24 -0
  42. package/lib/exercises/pc/chemicalElements/weightPercent.d.ts +10 -0
  43. package/lib/exercises/pc/chemicalElements/weightPercent.d.ts.map +1 -0
  44. package/lib/exercises/pc/chemicalElements/weightPercent.js +107 -0
  45. package/lib/exercises/pc/chemicalEquations.js +1 -1
  46. package/lib/exercises/pc/forces/gravitationalAttractionValue.d.ts +7 -0
  47. package/lib/exercises/pc/forces/gravitationalAttractionValue.d.ts.map +1 -0
  48. package/lib/exercises/pc/forces/gravitationalAttractionValue.js +71 -0
  49. package/lib/exercises/pc/forces/index.d.ts +2 -0
  50. package/lib/exercises/pc/forces/index.d.ts.map +1 -0
  51. package/lib/exercises/pc/forces/index.js +17 -0
  52. package/lib/exercises/pc/index.d.ts +12 -0
  53. package/lib/exercises/pc/index.d.ts.map +1 -1
  54. package/lib/exercises/pc/index.js +14 -0
  55. package/lib/exercises/pc/math/index.d.ts +2 -0
  56. package/lib/exercises/pc/math/index.d.ts.map +1 -0
  57. package/lib/exercises/pc/math/index.js +18 -0
  58. package/lib/exercises/pc/math/isolateVariables.d.ts +8 -0
  59. package/lib/exercises/pc/math/isolateVariables.d.ts.map +1 -0
  60. package/lib/exercises/pc/math/isolateVariables.js +304 -0
  61. package/lib/exercises/pc/math/proportionnalityCoeffFromLine.d.ts +10 -0
  62. package/lib/exercises/pc/math/proportionnalityCoeffFromLine.d.ts.map +1 -0
  63. package/lib/exercises/pc/math/proportionnalityCoeffFromLine.js +81 -0
  64. package/lib/exercises/pc/motion/recognizeFreeFall.d.ts +1 -0
  65. package/lib/exercises/pc/motion/recognizeFreeFall.d.ts.map +1 -0
  66. package/lib/exercises/pc/motion/recognizeFreeFall.js +53 -0
  67. package/lib/exercises/pc/sound/findPeriodFromGraph.d.ts +8 -0
  68. package/lib/exercises/pc/sound/findPeriodFromGraph.d.ts.map +1 -0
  69. package/lib/exercises/pc/sound/findPeriodFromGraph.js +80 -0
  70. package/lib/exercises/pc/sound/findSoundFrequencyFromPeriod.d.ts +7 -0
  71. package/lib/exercises/pc/sound/findSoundFrequencyFromPeriod.d.ts.map +1 -0
  72. package/lib/exercises/pc/sound/findSoundFrequencyFromPeriod.js +51 -0
  73. package/lib/exercises/pc/sound/findSoundPeriodFromFrequency.d.ts +7 -0
  74. package/lib/exercises/pc/sound/findSoundPeriodFromFrequency.d.ts.map +1 -0
  75. package/lib/exercises/pc/sound/findSoundPeriodFromFrequency.js +58 -0
  76. package/lib/exercises/pc/sound/frequencyComparison.d.ts +9 -0
  77. package/lib/exercises/pc/sound/frequencyComparison.d.ts.map +1 -0
  78. package/lib/exercises/pc/sound/frequencyComparison.js +51 -0
  79. package/lib/exercises/pc/sound/index.d.ts +5 -0
  80. package/lib/exercises/pc/sound/index.d.ts.map +1 -0
  81. package/lib/exercises/pc/sound/index.js +20 -0
  82. package/lib/exercises/pc/waves/findDistanceFromEarth.d.ts +7 -0
  83. package/lib/exercises/pc/waves/findDistanceFromEarth.d.ts.map +1 -0
  84. package/lib/exercises/pc/waves/findDistanceFromEarth.js +66 -0
  85. package/lib/exercises/pc/waves/index.d.ts +2 -0
  86. package/lib/exercises/pc/waves/index.d.ts.map +1 -0
  87. package/lib/exercises/pc/waves/index.js +17 -0
  88. package/lib/exercises/pc/weight/index.d.ts +2 -0
  89. package/lib/exercises/pc/weight/index.d.ts.map +1 -0
  90. package/lib/exercises/pc/weight/index.js +17 -0
  91. package/lib/exercises/pc/weight/weightOnTheMoon.d.ts +8 -0
  92. package/lib/exercises/pc/weight/weightOnTheMoon.d.ts.map +1 -0
  93. package/lib/exercises/pc/weight/weightOnTheMoon.js +64 -0
  94. package/lib/exercises/utils/getAtoms.d.ts +2 -0
  95. package/lib/exercises/utils/getAtoms.d.ts.map +1 -0
  96. package/lib/exercises/utils/getAtoms.js +11 -0
  97. package/lib/exercises/utils/getElectronicConfigurationFromShells.d.ts +2 -0
  98. package/lib/exercises/utils/getElectronicConfigurationFromShells.d.ts.map +1 -0
  99. package/lib/exercises/utils/getElectronicConfigurationFromShells.js +19 -0
  100. package/lib/geogebra/geogebraConstructor.d.ts +2 -0
  101. package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
  102. package/lib/geogebra/geogebraConstructor.js +2 -0
  103. package/lib/index.d.ts +126 -0
  104. package/lib/index.d.ts.map +1 -1
  105. package/lib/index.js +4 -0
  106. package/lib/math/numbers/decimals/decimal.d.ts +3 -3
  107. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  108. package/lib/math/numbers/decimals/decimal.js +39 -19
  109. package/lib/math/utils/random/randfloat.d.ts +1 -1
  110. package/lib/math/utils/random/randfloat.d.ts.map +1 -1
  111. package/lib/math/utils/random/randfloat.js +4 -7
  112. package/lib/math/utils/round.d.ts +2 -1
  113. package/lib/math/utils/round.d.ts.map +1 -1
  114. package/lib/math/utils/round.js +10 -3
  115. package/lib/pc/constants/atoms.d.ts +8 -0
  116. package/lib/pc/constants/atoms.d.ts.map +1 -0
  117. package/lib/pc/constants/atoms.js +9 -0
  118. package/lib/pc/constants/earth.d.ts +9 -0
  119. package/lib/pc/constants/earth.d.ts.map +1 -0
  120. package/lib/pc/constants/earth.js +12 -0
  121. package/lib/pc/constants/gravity.d.ts +10 -0
  122. package/lib/pc/constants/gravity.d.ts.map +1 -0
  123. package/lib/pc/constants/gravity.js +16 -0
  124. package/lib/pc/measure/measure.d.ts +15 -0
  125. package/lib/pc/measure/measure.d.ts.map +1 -0
  126. package/lib/pc/measure/measure.js +97 -0
  127. package/lib/pc/molecularChemistry/atome.d.ts +3 -2
  128. package/lib/pc/molecularChemistry/atome.d.ts.map +1 -1
  129. package/lib/pc/molecularChemistry/atome.js +156 -120
  130. package/lib/pc/molecularChemistry/molecule.d.ts +3 -2
  131. package/lib/pc/molecularChemistry/molecule.d.ts.map +1 -1
  132. package/lib/pc/molecularChemistry/molecule.js +11 -0
  133. package/lib/pc/molecularChemistry/reaction.d.ts +2 -1
  134. package/lib/pc/molecularChemistry/reaction.d.ts.map +1 -1
  135. package/lib/pc/molecularChemistry/reaction.js +9 -0
  136. package/lib/server.d.ts +1 -0
  137. package/lib/server.d.ts.map +1 -1
  138. package/lib/server.js +5 -0
  139. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  140. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  141. package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
  142. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  143. package/lib/tree/nodes/equations/equalNode.js +0 -1
  144. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  145. package/lib/tree/nodes/node.d.ts +1 -0
  146. package/lib/tree/nodes/node.d.ts.map +1 -1
  147. package/lib/tree/nodes/numbers/numberNode.js +1 -1
  148. package/lib/tree/nodes/numbers/piNode.d.ts.map +1 -1
  149. package/lib/tree/nodes/operators/multiplyNode.d.ts +2 -2
  150. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  151. package/lib/tree/nodes/operators/multiplyNode.js +6 -5
  152. package/lib/types/keyIds.d.ts +4 -2
  153. package/lib/types/keyIds.d.ts.map +1 -1
  154. package/lib/utils/numberPrototype/toScientific.d.ts +3 -0
  155. package/lib/utils/numberPrototype/toScientific.d.ts.map +1 -0
  156. package/lib/utils/numberPrototype/toScientific.js +110 -0
  157. package/lib/utils/requiresApostropheBefore.d.ts +2 -0
  158. package/lib/utils/requiresApostropheBefore.d.ts.map +1 -0
  159. package/lib/utils/requiresApostropheBefore.js +7 -0
  160. package/package.json +1 -1
@@ -0,0 +1,304 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isolateVariables = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../../math/utils/random/randint");
7
+ const random_1 = require("../../../utils/random");
8
+ // m = t*v
9
+ // P = m*g
10
+ // v = d/t
11
+ // U = RI
12
+ // F = t_m / t_f
13
+ // F = V_f / V_m
14
+ // t_m/t_f = V_f/V_m
15
+ const formulas = [];
16
+ const getIsolateVariablesQuestion = () => {
17
+ let varAsked = "";
18
+ let answer = "";
19
+ const formulaType = (0, randint_1.randint)(1, 8);
20
+ let formulaAsked = "";
21
+ let vars = [];
22
+ let formulas = [];
23
+ switch (formulaType) {
24
+ case 1:
25
+ vars = ["m", "t", "v"];
26
+ formulas = ["m=tv", "t=\\frac{m}{v}", "v=\\frac{m}{t}"];
27
+ varAsked = (0, random_1.random)(vars);
28
+ answer = formulas.find((el) => el[0] === varAsked);
29
+ formulaAsked = (0, random_1.random)(formulas.filter((el) => el[0] !== varAsked));
30
+ break;
31
+ case 2:
32
+ vars = ["P", "m", "g"];
33
+ formulas = ["P=mg", "m=\\frac{P}{g}", "g=\\frac{P}{m}"];
34
+ varAsked = (0, random_1.random)(vars);
35
+ answer = formulas.find((el) => el[0] === varAsked);
36
+ formulaAsked = (0, random_1.random)(formulas.filter((el) => el[0] !== varAsked));
37
+ break;
38
+ case 3:
39
+ vars = ["U", "R", "I"];
40
+ formulas = ["U=RI", "R=\\frac{U}{I}", "I=\\frac{U}{R}"];
41
+ varAsked = (0, random_1.random)(vars);
42
+ answer = formulas.find((el) => el[0] === varAsked);
43
+ formulaAsked = (0, random_1.random)(formulas.filter((el) => el[0] !== varAsked));
44
+ break;
45
+ case 4:
46
+ vars = ["v", "d", "t"];
47
+ formulas = ["v=\\frac{d}{t}", "d=vt", "t=\\frac{d}{v}"];
48
+ varAsked = (0, random_1.random)(vars);
49
+ answer = formulas.find((el) => el[0] === varAsked);
50
+ formulaAsked = (0, random_1.random)(formulas.filter((el) => el[0] !== varAsked));
51
+ break;
52
+ case 5:
53
+ vars = ["F", "t_m", "t_f"];
54
+ formulas = ["F=\\frac{t_m}{t_f}", "t_m=Ft_f", "t_f=\\frac{t_m}{F}"];
55
+ varAsked = (0, random_1.random)(vars);
56
+ answer = formulas.find((el) => el.split("=")[0] === varAsked);
57
+ formulaAsked = (0, random_1.random)(formulas.filter((el) => el.split("=")[0] !== varAsked));
58
+ break;
59
+ case 6:
60
+ vars = ["F", "V_m", "V_f"];
61
+ formulas = ["F=\\frac{V_f}{V_m}", "V_m=\\frac{V_f}{F}", "V_f=FV_m"];
62
+ varAsked = (0, random_1.random)(vars);
63
+ answer = formulas.find((el) => el.split("=")[0] === varAsked);
64
+ formulaAsked = (0, random_1.random)(formulas.filter((el) => el.split("=")[0] !== varAsked));
65
+ break;
66
+ case 7:
67
+ vars = ["t_m", "t_f", "V_m", "V_f"];
68
+ formulas = ["\\frac{t_m}{t_f}=\\frac{V_f}{V_m}", "t_mV_m=t_fV_f"];
69
+ varAsked = (0, random_1.random)(vars);
70
+ answer =
71
+ varAsked === "t_m"
72
+ ? "t_m=\\frac{V_ft_f}{V_m}"
73
+ : varAsked === "t_f"
74
+ ? "t_f=\\frac{t_mV_m}{t_f}"
75
+ : varAsked === "V_m"
76
+ ? "V_m=\\frac{t_fV_f}{t_m}"
77
+ : "V_f=\\frac{t_mV_m}{t_f}";
78
+ formulaAsked = (0, random_1.random)(formulas);
79
+ break;
80
+ }
81
+ const keys = [
82
+ "equal",
83
+ ...vars.map((v) => v === "V_f"
84
+ ? "volumeFille"
85
+ : v === "V_m"
86
+ ? "volumeMere"
87
+ : v === "t_f"
88
+ ? "concentrationFille"
89
+ : v === "t_m"
90
+ ? "concentrationMere"
91
+ : v),
92
+ ];
93
+ const question = {
94
+ answer,
95
+ instruction: `Isoler la grandeur $${varAsked}$ dans l'expression suivante : $${formulaAsked}$`,
96
+ keys: keys,
97
+ answerFormat: "tex",
98
+ identifiers: { varAsked, formulaType },
99
+ };
100
+ return question;
101
+ };
102
+ const getPropositions = (n, { answer, formulaType, varAsked }) => {
103
+ const propositions = [];
104
+ (0, exercise_1.addValidProp)(propositions, answer);
105
+ switch (formulaType) {
106
+ case 1:
107
+ if (varAsked === "m") {
108
+ (0, exercise_1.tryToAddWrongProp)(propositions, "m=\\frac{t}{v}");
109
+ (0, exercise_1.tryToAddWrongProp)(propositions, "m=\\frac{v}{t}");
110
+ (0, exercise_1.tryToAddWrongProp)(propositions, "m=t+v");
111
+ }
112
+ if (varAsked === "t") {
113
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t=\\frac{v}{m}");
114
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t=mv");
115
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t=m-v");
116
+ }
117
+ if (varAsked === "v") {
118
+ (0, exercise_1.tryToAddWrongProp)(propositions, "v=\\frac{t}{m}");
119
+ (0, exercise_1.tryToAddWrongProp)(propositions, "v=mt");
120
+ (0, exercise_1.tryToAddWrongProp)(propositions, "v=m-t");
121
+ }
122
+ break;
123
+ case 2:
124
+ if (varAsked === "P") {
125
+ (0, exercise_1.tryToAddWrongProp)(propositions, "P=\\frac{m}{g}");
126
+ (0, exercise_1.tryToAddWrongProp)(propositions, "P=\\frac{g}{m}");
127
+ (0, exercise_1.tryToAddWrongProp)(propositions, "P=m+g");
128
+ }
129
+ if (varAsked === "m") {
130
+ (0, exercise_1.tryToAddWrongProp)(propositions, "m=\\frac{g}{P}");
131
+ (0, exercise_1.tryToAddWrongProp)(propositions, "m=Pg");
132
+ (0, exercise_1.tryToAddWrongProp)(propositions, "m=P-g");
133
+ }
134
+ if (varAsked === "g") {
135
+ (0, exercise_1.tryToAddWrongProp)(propositions, "g=\\frac{m}{P}");
136
+ (0, exercise_1.tryToAddWrongProp)(propositions, "g=Pm");
137
+ (0, exercise_1.tryToAddWrongProp)(propositions, "g=P-m");
138
+ }
139
+ break;
140
+ case 3:
141
+ if (varAsked === "U") {
142
+ (0, exercise_1.tryToAddWrongProp)(propositions, "U=\\frac{R}{I}");
143
+ (0, exercise_1.tryToAddWrongProp)(propositions, "U=\\frac{I}{R}");
144
+ (0, exercise_1.tryToAddWrongProp)(propositions, "U=R+I");
145
+ }
146
+ if (varAsked === "R") {
147
+ (0, exercise_1.tryToAddWrongProp)(propositions, "R=\\frac{I}{U}");
148
+ (0, exercise_1.tryToAddWrongProp)(propositions, "R=UI");
149
+ (0, exercise_1.tryToAddWrongProp)(propositions, "R=U-I");
150
+ }
151
+ if (varAsked === "I") {
152
+ (0, exercise_1.tryToAddWrongProp)(propositions, "I=\\frac{R}{U}");
153
+ (0, exercise_1.tryToAddWrongProp)(propositions, "I=RU");
154
+ (0, exercise_1.tryToAddWrongProp)(propositions, "I=U-R");
155
+ }
156
+ break;
157
+ case 4:
158
+ if (varAsked === "v") {
159
+ (0, exercise_1.tryToAddWrongProp)(propositions, "v=\\frac{t}{d}");
160
+ (0, exercise_1.tryToAddWrongProp)(propositions, "v=dt");
161
+ (0, exercise_1.tryToAddWrongProp)(propositions, "v=d+t");
162
+ }
163
+ if (varAsked === "d") {
164
+ (0, exercise_1.tryToAddWrongProp)(propositions, "d=\\frac{t}{v}");
165
+ (0, exercise_1.tryToAddWrongProp)(propositions, "d=\\frac{v}{t}");
166
+ (0, exercise_1.tryToAddWrongProp)(propositions, "d=v+t");
167
+ }
168
+ if (varAsked === "t") {
169
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t=\\frac{v}{d}");
170
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t=vd");
171
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t=v+d");
172
+ }
173
+ break;
174
+ case 5:
175
+ //F = t_m / t_f
176
+ if (varAsked === "F") {
177
+ (0, exercise_1.tryToAddWrongProp)(propositions, "F=\\frac{t_f}{t_m}");
178
+ (0, exercise_1.tryToAddWrongProp)(propositions, "F=t_mt_f");
179
+ (0, exercise_1.tryToAddWrongProp)(propositions, "F=t_f+t_m");
180
+ }
181
+ if (varAsked === "t_m") {
182
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_m=\\frac{F}{t_f}");
183
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_m=\\frac{t_f}{F}");
184
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_m=F+t_f");
185
+ }
186
+ if (varAsked === "t_f") {
187
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_f=\\frac{F}{t_m}");
188
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_f=Ft_m");
189
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_f=F+t_m");
190
+ }
191
+ break;
192
+ case 6:
193
+ //F = V_f / V_m
194
+ if (varAsked === "F") {
195
+ (0, exercise_1.tryToAddWrongProp)(propositions, "F=\\frac{V_m}{V_f}");
196
+ (0, exercise_1.tryToAddWrongProp)(propositions, "F=V_mV_f");
197
+ (0, exercise_1.tryToAddWrongProp)(propositions, "F=V_f+V_m");
198
+ }
199
+ if (varAsked === "V_f") {
200
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_f=\\frac{F}{V_m}");
201
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_f=\\frac{V_m}{F}");
202
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_f=F+V_m");
203
+ }
204
+ if (varAsked === "V_m") {
205
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_m=\\frac{F}{V_f}");
206
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_m=FV_f");
207
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_m=F+V_f");
208
+ }
209
+ break;
210
+ case 7:
211
+ //t_mV_m = V_f t_f
212
+ if (varAsked === "t_m") {
213
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_m=\\frac{V_f}{V_mt_f}");
214
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_m=\\frac{V_fV_m}{t_f}");
215
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_m=\\frac{V_mt_f}{V_f}");
216
+ }
217
+ if (varAsked === "V_f") {
218
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_f=\\frac{t_m}{t_fV_m}");
219
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_f=\\frac{t_mt_f}{V_m}");
220
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_f=\\frac{t_fV_m}{t_m}");
221
+ }
222
+ if (varAsked === "V_m") {
223
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_m=\\frac{t_m}{V_ft_f}");
224
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_m=\\frac{V_ft_m}{t_f}");
225
+ (0, exercise_1.tryToAddWrongProp)(propositions, "V_m=\\frac{V_f}{t_mt_f}");
226
+ }
227
+ if (varAsked === "t_f") {
228
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_f=\\frac{V_m}{V_ft_m}");
229
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_f=\\frac{V_fV_m}{t_m}");
230
+ (0, exercise_1.tryToAddWrongProp)(propositions, "t_f=\\frac{V_f}{V_mt_m}");
231
+ }
232
+ break;
233
+ }
234
+ return (0, exercise_1.shuffleProps)(propositions, n);
235
+ };
236
+ const isAnswerValid = (ans, { answer, formulaType, varAsked }) => {
237
+ const texs = [answer];
238
+ switch (formulaType) {
239
+ case 1:
240
+ // formulas = ["m=t\\times v", "t=\\frac{m}{v}", "v=\\frac{m}{t}"];
241
+ if (varAsked === "m")
242
+ texs.push("m=vt");
243
+ break;
244
+ case 2:
245
+ // formulas = ["P=m\\times g", "m=\\frac{P}{g}", "g=\\frac{P}{m}"];
246
+ if (varAsked === "P")
247
+ texs.push("P=gm");
248
+ break;
249
+ case 3:
250
+ // formulas = ["U=R\\times I", "R=\\frac{U}{I}", "I=\\frac{U}{R}"];
251
+ if (varAsked === "U")
252
+ texs.push("U=IR");
253
+ break;
254
+ case 4:
255
+ // formulas = ["v=\\frac{d}{t}", "d=v\\times t", "t=\\frac{d}{v}"];
256
+ if (varAsked === "d")
257
+ texs.push("d=tv");
258
+ break;
259
+ case 5:
260
+ // formulas = [
261
+ // "F=\\frac{t_m}{t_f}",
262
+ // "t_m=F\\times t_f",
263
+ // "t_f=\\frac{t_m}{F}",
264
+ // ];
265
+ if (varAsked === "t_m")
266
+ texs.push("t_m=t_fF");
267
+ break;
268
+ case 6:
269
+ // formulas = [
270
+ // "F=\\frac{V_f}{V_m}",
271
+ // "V_m=\\frac{V_f}{F}",
272
+ // "V_f=F\\times V_m",
273
+ // ];
274
+ if (varAsked === "V_f")
275
+ texs.push("V_f=V_mF");
276
+ break;
277
+ case 7:
278
+ // formulas = ["\\frac{t_m}{t_f}=\\frac{V_f}{V_m}", "t_mV_m = t_fV_f"];
279
+ if (varAsked === "t_m")
280
+ texs.push("t_m=\\frac{t_fV_f}{V_m}");
281
+ if (varAsked === "t_f")
282
+ texs.push("t_f=\\frac{V_mt_m}{t_f}");
283
+ if (varAsked === "V_m")
284
+ texs.push("V_m=\\frac{V_ft_f}{t_m}");
285
+ if (varAsked === "V_f")
286
+ texs.push("V_f=\\frac{V_mt_m}{t_f}");
287
+ break;
288
+ }
289
+ return texs.includes(ans) || texs.includes(ans.replace("\\times ", ""));
290
+ };
291
+ exports.isolateVariables = {
292
+ id: "isolateVariables",
293
+ connector: "=",
294
+ label: "Isoler une grandeur",
295
+ levels: ["2nde"],
296
+ isSingleStep: true,
297
+ sections: [],
298
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIsolateVariablesQuestion, nb),
299
+ qcmTimer: 60,
300
+ freeTimer: 60,
301
+ getPropositions,
302
+ isAnswerValid,
303
+ subject: "Physique",
304
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ xA: number;
4
+ yA: number;
5
+ xB: number;
6
+ yB: number;
7
+ };
8
+ export declare const proportionnalityCoeffFromLine: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=proportionnalityCoeffFromLine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proportionnalityCoeffFromLine.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/math/proportionnalityCoeffFromLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA0EF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAe/D,CAAC"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.proportionnalityCoeffFromLine = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
7
+ const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
8
+ const integer_1 = require("../../../math/numbers/integer/integer");
9
+ const rational_1 = require("../../../math/numbers/rationals/rational");
10
+ const randint_1 = require("../../../math/utils/random/randint");
11
+ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
12
+ const shuffle_1 = require("../../../utils/shuffle");
13
+ const getProportionnalityCoeffFromLineQuestion = () => {
14
+ let xA, yA, xB, yB;
15
+ [xA, yA] = [1, 2].map((el) => (0, randint_1.randint)(-5, 6));
16
+ xB = xA > 0 ? (0, randint_1.randint)(xA - 4, 6, [xA]) : (0, randint_1.randint)(-4, xA + 5, [xA]); // l'écart entre les deux points ne soit pas grand
17
+ yB = yA > 0 ? (0, randint_1.randint)(yA - 4, 6) : (0, randint_1.randint)(-4, yA + 5);
18
+ const a = new rational_1.Rational(yB - yA, xB - xA).simplify();
19
+ const b = a.opposite().multiply(new integer_1.Integer(xA)).add(new integer_1.Integer(yA));
20
+ const aTree = a.toTree();
21
+ const bTree = b.toTree();
22
+ const aString = aTree.toMathString();
23
+ const bString = bTree.toMathString();
24
+ const xMin = Math.min(xA, xB);
25
+ const xMax = Math.max(xA, xB);
26
+ const yMin = Math.min(yA, yB);
27
+ const yMax = Math.max(yA, yB);
28
+ const commands = [
29
+ `f(x) = (${aString}) * x + (${bString})`,
30
+ `SetColor(f, "${(0, colors_1.randomColor)()}")`,
31
+ ];
32
+ const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
33
+ isGridSimple: true,
34
+ axisLabels: ["$x$", "$y$"],
35
+ });
36
+ const answer = aTree.toTex();
37
+ const question = {
38
+ instruction: "Déterminer le coefficient de proportionnalité entre $y$ et $x$ : ",
39
+ answer,
40
+ keys: [],
41
+ commands: ggb.commands,
42
+ coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
43
+ options: ggb.getOptions(),
44
+ answerFormat: "tex",
45
+ identifiers: { xA, xB, yA, yB },
46
+ };
47
+ return question;
48
+ };
49
+ const getPropositions = (n, { answer, xA, xB, yA, yB }) => {
50
+ const propositions = [];
51
+ (0, exercise_1.addValidProp)(propositions, answer);
52
+ if (yB - yA !== 0)
53
+ (0, exercise_1.tryToAddWrongProp)(propositions, new rational_1.Rational(xB - xA, yB - yA).simplify().toTree().toTex());
54
+ while (propositions.length < n) {
55
+ const wrongAnswer = new numberNode_1.NumberNode((0, randint_1.randint)(-4, 5, [0]));
56
+ (0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer.toTex());
57
+ }
58
+ return (0, shuffle_1.shuffle)(propositions);
59
+ };
60
+ const isAnswerValid = (ans, { xA, xB, yA, yB }) => {
61
+ const leadingCoeff = new rational_1.Rational(yB - yA, xB - xA)
62
+ .simplify()
63
+ .toTree({ allowFractionToDecimal: true });
64
+ const texs = leadingCoeff.toAllValidTexs();
65
+ return texs.includes(ans);
66
+ };
67
+ exports.proportionnalityCoeffFromLine = {
68
+ id: "proportionnalityCoeffFromLine",
69
+ connector: "=",
70
+ label: "Déterminer le coefficient de proportionnalité à l'aide d'une droite",
71
+ levels: ["3ème", "2nde", "1reESM", "2ndPro", "1rePro", "1reTech"],
72
+ isSingleStep: false,
73
+ sections: ["Droites", "Fonctions affines"],
74
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getProportionnalityCoeffFromLineQuestion, nb),
75
+ qcmTimer: 60,
76
+ freeTimer: 60,
77
+ getPropositions,
78
+ isAnswerValid,
79
+ hasGeogebra: true,
80
+ subject: "Physique",
81
+ };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=recognizeFreeFall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recognizeFreeFall.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/motion/recognizeFreeFall.ts"],"names":[],"mappings":""}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ // import {
3
+ // Exercise,
4
+ // Proposition,
5
+ // QCMGenerator,
6
+ // Question,
7
+ // QuestionGenerator,
8
+ // VEA,
9
+ // addValidProp,
10
+ // shuffleProps,
11
+ // tryToAddWrongProp,
12
+ // } from "../../../exercises/exercise";
13
+ // import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions";
14
+ // type Identifiers = {};
15
+ // const getRecognizeFreeFallQuestion: QuestionGenerator<Identifiers> = () => {
16
+ // const yStart = 10;
17
+ // const freeFallPoints = [];
18
+ // const commands = [];
19
+ // const question: Question<Identifiers> = {
20
+ // answer,
21
+ // instruction: ``,
22
+ // keys: [],
23
+ // answerFormat: "tex",
24
+ // identifiers: {},
25
+ // };
26
+ // return question;
27
+ // };
28
+ // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
29
+ // const propositions: Proposition[] = [];
30
+ // addValidProp(propositions, answer);
31
+ // while (propositions.length < n) {
32
+ // throw Error("QCM not implemented");
33
+ // }
34
+ // return shuffleProps(propositions, n);
35
+ // };
36
+ // const isAnswerValid: VEA<Identifiers> = (ans, { answer }) => {
37
+ // throw Error("VEA not implemented");
38
+ // };
39
+ // export const recognizeFreeFall: Exercise<Identifiers> = {
40
+ // id: "recognizeFreeFall",
41
+ // connector: "",
42
+ // label: "",
43
+ // levels: [],
44
+ // isSingleStep: true,
45
+ // sections: [],
46
+ // generator: (nb: number) =>
47
+ // getDistinctQuestions(getRecognizeFreeFallQuestion, nb),
48
+ // qcmTimer: 60,
49
+ // freeTimer: 60,
50
+ // getPropositions,
51
+ // isAnswerValid,
52
+ // subject: "Mathématiques",
53
+ // };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ period: number;
4
+ splinePoints: number[][];
5
+ };
6
+ export declare const findPeriodFromGraph: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=findPeriodFromGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findPeriodFromGraph.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/sound/findPeriodFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;CAC1B,CAAC;AAkEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findPeriodFromGraph = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
7
+ const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
8
+ const randfloat_1 = require("../../../math/utils/random/randfloat");
9
+ const randint_1 = require("../../../math/utils/random/randint");
10
+ const coinFlip_1 = require("../../../utils/coinFlip");
11
+ const getFindPeriodFromGraphQuestion = () => {
12
+ const period = (0, randint_1.randint)(2, 5);
13
+ const yStart = (0, randint_1.randint)(0, 4);
14
+ const splinePoints = [[0, yStart]];
15
+ const isFirstNegative = (0, coinFlip_1.coinFlip)();
16
+ const quarter = period / 4;
17
+ splinePoints.push([
18
+ quarter,
19
+ yStart + (isFirstNegative ? (0, randfloat_1.randfloat)(-2, -5) : (0, randfloat_1.randfloat)(2, 5)),
20
+ ]);
21
+ const half = period / 2;
22
+ splinePoints.push([half, yStart]);
23
+ const threeQuarter = (3 * period) / 4;
24
+ splinePoints.push([
25
+ threeQuarter,
26
+ yStart + (isFirstNegative ? (0, randfloat_1.randfloat)(2, 5) : (0, randfloat_1.randfloat)(-2, -5)),
27
+ ]);
28
+ splinePoints.push([period, yStart]);
29
+ const color = (0, colors_1.randomColor)();
30
+ const commands = [
31
+ `S =Spline(${splinePoints
32
+ .map((point) => `(${point[0]},${point[1]})`)
33
+ .join(",")})`,
34
+ "SetFixed(S, true)",
35
+ `SetColor(S, "${color}")`,
36
+ ];
37
+ for (let i = 1; i < 10; i++) {
38
+ commands.push(`S_{${i}} = Translate(S, (${i * period}, 0))`, `SetFixed(S_{${i}}, true)`, `SetColor(S_{${i}}, "${color}")`);
39
+ }
40
+ const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
41
+ axisLabels: ["$\\tiny Temps (ms)$", "$\\tiny Tension (V)$"],
42
+ isGridSimple: true,
43
+ });
44
+ const question = {
45
+ answer: period + "",
46
+ instruction: `L'enregistrement d'un signal sonore est donnée ci-dessous. Déterminer la période de ce signal.`,
47
+ keys: [],
48
+ answerFormat: "tex",
49
+ identifiers: { period, splinePoints },
50
+ commands: ggb.commands,
51
+ options: ggb.getOptions(),
52
+ coords: [0, 20, -8, 8],
53
+ };
54
+ return question;
55
+ };
56
+ const getPropositions = (n, { answer, period }) => {
57
+ const propositions = [];
58
+ (0, exercise_1.addValidProp)(propositions, answer);
59
+ while (propositions.length < n) {
60
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-3, 6) + "");
61
+ }
62
+ return (0, exercise_1.shuffleProps)(propositions, n);
63
+ };
64
+ const isAnswerValid = (ans, { answer }) => {
65
+ return ans === answer;
66
+ };
67
+ exports.findPeriodFromGraph = {
68
+ id: "findPeriodFromGraph",
69
+ label: "Lire la période d'un signal sonore",
70
+ levels: ["2nde"],
71
+ isSingleStep: true,
72
+ sections: ["Son"],
73
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFindPeriodFromGraphQuestion, nb),
74
+ qcmTimer: 60,
75
+ freeTimer: 60,
76
+ getPropositions,
77
+ isAnswerValid,
78
+ subject: "Physique",
79
+ hasGeogebra: true,
80
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ period: number;
4
+ };
5
+ export declare const findSoundFrequencyFromPeriod: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=findSoundFrequencyFromPeriod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findSoundFrequencyFromPeriod.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/sound/findSoundFrequencyFromPeriod.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAwCF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAa9D,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findSoundFrequencyFromPeriod = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const randfloat_1 = require("../../../math/utils/random/randfloat");
7
+ const randint_1 = require("../../../math/utils/random/randint");
8
+ const round_1 = require("../../../math/utils/round");
9
+ const getFindSoundFrequencyFromPeriodQuestion = () => {
10
+ const period = (0, round_1.round)((0, randfloat_1.randfloat)(1, 50), 1);
11
+ const periodInSeconds = period / 1000;
12
+ const answer = `${(0, round_1.round)(1 / periodInSeconds, 0)}`;
13
+ const question = {
14
+ answer,
15
+ instruction: `Un signal sonore a une période de $${period}\\ \\text{ms}$. Calculer la fréquence de ce signal en $\\text{Hz}$ (arrondir à l'unité).`,
16
+ keys: [],
17
+ answerFormat: "tex",
18
+ identifiers: { period },
19
+ };
20
+ return question;
21
+ };
22
+ const getPropositions = (n, { answer, period }) => {
23
+ const propositions = [];
24
+ (0, exercise_1.addValidProp)(propositions, answer);
25
+ const answerFromPeriodInMs = `${(0, round_1.round)(1 / period, 0)}`;
26
+ const answerWithWrongConversion = `${(0, round_1.round)(1 / (period / 100), 0)}`;
27
+ const answerWithWrongConversion2 = `${(0, round_1.round)(1 / (period / 10000), 0)}`;
28
+ (0, exercise_1.tryToAddWrongProp)(propositions, answerFromPeriodInMs);
29
+ (0, exercise_1.tryToAddWrongProp)(propositions, answerWithWrongConversion);
30
+ (0, exercise_1.tryToAddWrongProp)(propositions, answerWithWrongConversion2);
31
+ while (propositions.length < n) {
32
+ (0, exercise_1.tryToAddWrongProp)(propositions, `${(0, randint_1.randint)(0, 1000)}`);
33
+ }
34
+ return (0, exercise_1.shuffleProps)(propositions, n);
35
+ };
36
+ const isAnswerValid = (ans, { answer }) => {
37
+ return ans === answer;
38
+ };
39
+ exports.findSoundFrequencyFromPeriod = {
40
+ id: "findSoundFrequencyFromPeriod",
41
+ label: "Calculer la fréquence d'un signal sonore en fonction de la période",
42
+ levels: ["2nde"],
43
+ isSingleStep: true,
44
+ sections: ["Son"],
45
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFindSoundFrequencyFromPeriodQuestion, nb),
46
+ qcmTimer: 60,
47
+ freeTimer: 60,
48
+ getPropositions,
49
+ isAnswerValid,
50
+ subject: "Physique",
51
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ frequency: number;
4
+ };
5
+ export declare const findSoundPeriodFromFrequency: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=findSoundPeriodFromFrequency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findSoundPeriodFromFrequency.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/sound/findSoundPeriodFromFrequency.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoDF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAa9D,CAAC"}