math-exercises 2.2.3 → 2.2.5

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 (500) hide show
  1. package/lib/exercises/exercise.d.ts +2 -1
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/digitDecimalRank.js +4 -4
  4. package/lib/exercises/math/calcul/digitRank.js +4 -4
  5. package/lib/exercises/math/calcul/digitRankNumber.d.ts +8 -0
  6. package/lib/exercises/math/calcul/digitRankNumber.d.ts.map +1 -0
  7. package/lib/exercises/math/calcul/digitRankNumber.js +57 -0
  8. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.js +34 -0
  10. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.js +17 -0
  12. package/lib/exercises/math/calcul/fractions/fractionsDivision.d.ts.map +1 -1
  13. package/lib/exercises/math/calcul/fractions/fractionsDivision.js +23 -0
  14. package/lib/exercises/math/calcul/fractions/fractionsProduct.d.ts.map +1 -1
  15. package/lib/exercises/math/calcul/fractions/fractionsProduct.js +15 -0
  16. package/lib/exercises/math/calcul/index.d.ts +1 -0
  17. package/lib/exercises/math/calcul/index.d.ts.map +1 -1
  18. package/lib/exercises/math/calcul/index.js +1 -0
  19. package/lib/exercises/math/calcul/proportionality/index.d.ts +2 -0
  20. package/lib/exercises/math/calcul/proportionality/index.d.ts.map +1 -1
  21. package/lib/exercises/math/calcul/proportionality/index.js +2 -0
  22. package/lib/exercises/math/calcul/proportionality/scaleCalculation.d.ts +9 -0
  23. package/lib/exercises/math/calcul/proportionality/scaleCalculation.d.ts.map +1 -0
  24. package/lib/exercises/math/calcul/proportionality/scaleCalculation.js +90 -0
  25. package/lib/exercises/math/calcul/proportionality/scaleUsage.d.ts +9 -0
  26. package/lib/exercises/math/calcul/proportionality/scaleUsage.d.ts.map +1 -0
  27. package/lib/exercises/math/calcul/proportionality/scaleUsage.js +95 -0
  28. package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
  29. package/lib/exercises/math/calcul/rounding/rounding.js +18 -0
  30. package/lib/exercises/math/calculLitteral/distributivity/allIdentities.d.ts.map +1 -1
  31. package/lib/exercises/math/calculLitteral/distributivity/allIdentities.js +1 -0
  32. package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts +7 -0
  33. package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts.map +1 -0
  34. package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.js +60 -0
  35. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivity.d.ts.map +1 -1
  36. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivity.js +31 -1
  37. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts +9 -0
  38. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -0
  39. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +86 -0
  40. package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
  41. package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.js +21 -2
  42. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +2 -0
  43. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
  44. package/lib/exercises/math/calculLitteral/distributivity/index.js +2 -0
  45. package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
  46. package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.js +23 -2
  47. package/lib/exercises/math/calculLitteral/distributivity/simpleDistributivity.d.ts.map +1 -1
  48. package/lib/exercises/math/calculLitteral/distributivity/simpleDistributivity.js +17 -2
  49. package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
  50. package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.js +21 -2
  51. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
  52. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +26 -1
  53. package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
  54. package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +18 -2
  55. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
  56. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +19 -2
  57. package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
  58. package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.js +15 -2
  59. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
  60. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +20 -5
  61. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
  62. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.js +24 -1
  63. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.d.ts.map +1 -1
  64. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.js +20 -1
  65. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.d.ts.map +1 -1
  66. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.js +19 -3
  67. package/lib/exercises/math/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
  68. package/lib/exercises/math/calculLitteral/equation/fractionEquation.js +24 -8
  69. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  70. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +21 -2
  71. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
  72. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.js +24 -4
  73. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
  74. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.js +25 -5
  75. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
  76. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.js +19 -0
  77. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  78. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +1 -0
  79. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.d.ts +8 -0
  80. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.d.ts.map +1 -0
  81. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.js +77 -0
  82. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts +8 -0
  83. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts.map +1 -0
  84. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.js +80 -0
  85. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +2 -0
  86. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  87. package/lib/exercises/math/calculLitteral/factorisation/index.js +2 -0
  88. package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
  89. package/lib/exercises/math/conversion/lengthConversion.js +18 -4
  90. package/lib/exercises/math/equaDiff/equaDiffGeneralForme.d.ts.map +1 -1
  91. package/lib/exercises/math/equaDiff/equaDiffGeneralForme.js +1 -0
  92. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts +10 -0
  93. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -0
  94. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +81 -0
  95. package/lib/exercises/math/functions/affines/index.d.ts +1 -0
  96. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  97. package/lib/exercises/math/functions/affines/index.js +1 -0
  98. package/lib/exercises/math/functions/logarithm/log10PowerSimplifying.d.ts.map +1 -1
  99. package/lib/exercises/math/functions/logarithm/log10PowerSimplifying.js +12 -2
  100. package/lib/exercises/math/functions/trinoms/index.d.ts +2 -0
  101. package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
  102. package/lib/exercises/math/functions/trinoms/index.js +2 -0
  103. package/lib/exercises/math/functions/trinoms/solveEquationByFactorisation.d.ts +5 -0
  104. package/lib/exercises/math/functions/trinoms/solveEquationByFactorisation.d.ts.map +1 -0
  105. package/lib/exercises/math/functions/trinoms/solveEquationByFactorisation.js +44 -0
  106. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.d.ts +9 -0
  107. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -0
  108. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.js +134 -0
  109. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.d.ts +7 -0
  110. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.d.ts.map +1 -0
  111. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.js +59 -0
  112. package/lib/exercises/math/geometry/vectors/scalarProductViaCoords.d.ts.map +1 -1
  113. package/lib/exercises/math/geometry/vectors/scalarProductViaCoords.js +1 -0
  114. package/lib/exercises/math/index.d.ts +1 -0
  115. package/lib/exercises/math/index.d.ts.map +1 -1
  116. package/lib/exercises/math/index.js +1 -0
  117. package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
  118. package/lib/exercises/math/percent/applyPercent.js +20 -2
  119. package/lib/exercises/math/sequences/arithmetic/arithmeticFindRandomTermFromTwoTerms.d.ts +11 -0
  120. package/lib/exercises/math/sequences/arithmetic/arithmeticFindRandomTermFromTwoTerms.d.ts.map +1 -0
  121. package/lib/exercises/math/sequences/arithmetic/arithmeticFindRandomTermFromTwoTerms.js +49 -0
  122. package/lib/exercises/math/sequences/arithmetic/index.d.ts +1 -0
  123. package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
  124. package/lib/exercises/math/sequences/arithmetic/index.js +1 -0
  125. package/lib/exercises/math/spaceGeometry/index.d.ts +2 -0
  126. package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -0
  127. package/lib/exercises/math/spaceGeometry/index.js +17 -0
  128. package/lib/exercises/math/spaceGeometry/vectors/index.d.ts +4 -0
  129. package/lib/exercises/math/spaceGeometry/vectors/index.d.ts.map +1 -0
  130. package/lib/exercises/math/spaceGeometry/vectors/index.js +19 -0
  131. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.d.ts +5 -0
  132. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.d.ts.map +1 -0
  133. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.js +52 -0
  134. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts +5 -0
  135. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts.map +1 -0
  136. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.js +62 -0
  137. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts +9 -0
  138. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -0
  139. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +54 -0
  140. package/lib/exercises/math/squareRoots/squareRootIdentities.js +3 -3
  141. package/lib/exercises/math/suites/sequencePlot.d.ts.map +1 -1
  142. package/lib/exercises/math/suites/sequencePlot.js +1 -2
  143. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
  144. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +1 -0
  145. package/lib/exercises/pc/calibrationCurveOfSolution.d.ts.map +1 -1
  146. package/lib/exercises/pc/calibrationCurveOfSolution.js +2 -1
  147. package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.d.ts +1 -1
  148. package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.d.ts.map +1 -1
  149. package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.js +1 -1
  150. package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.d.ts +1 -1
  151. package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.d.ts.map +1 -1
  152. package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.js +3 -3
  153. package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.d.ts.map +1 -1
  154. package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.js +29 -4
  155. package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.d.ts +1 -1
  156. package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.d.ts.map +1 -1
  157. package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.js +6 -6
  158. package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.d.ts +1 -1
  159. package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.d.ts.map +1 -1
  160. package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.js +2 -1
  161. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.d.ts +1 -1
  162. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.d.ts.map +1 -1
  163. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.js +1 -1
  164. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.d.ts +1 -1
  165. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.d.ts.map +1 -1
  166. package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.js +1 -1
  167. package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.d.ts +1 -1
  168. package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.d.ts.map +1 -1
  169. package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.js +1 -1
  170. package/lib/exercises/pc/chemicalElements/index.d.ts +1 -0
  171. package/lib/exercises/pc/chemicalElements/index.d.ts.map +1 -1
  172. package/lib/exercises/pc/chemicalElements/index.js +1 -0
  173. package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.d.ts +11 -0
  174. package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.d.ts.map +1 -0
  175. package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.js +100 -0
  176. package/lib/exercises/pc/chemicalEquations.d.ts +1 -1
  177. package/lib/exercises/pc/chemicalEquations.d.ts.map +1 -1
  178. package/lib/exercises/pc/chemicalEquations.js +1 -1
  179. package/lib/exercises/pc/chemicalReactions/calculateSynthesisEfficiency.d.ts.map +1 -1
  180. package/lib/exercises/pc/chemicalReactions/calculateSynthesisEfficiency.js +1 -0
  181. package/lib/exercises/pc/chemicalReactions/index.d.ts +2 -0
  182. package/lib/exercises/pc/chemicalReactions/index.d.ts.map +1 -1
  183. package/lib/exercises/pc/chemicalReactions/index.js +2 -0
  184. package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.d.ts +5 -0
  185. package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.d.ts.map +1 -0
  186. package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.js +69 -0
  187. package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.d.ts +11 -0
  188. package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.d.ts.map +1 -0
  189. package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.js +181 -0
  190. package/lib/exercises/pc/chemicalReactionsProduct.d.ts +1 -1
  191. package/lib/exercises/pc/chemicalReactionsProduct.d.ts.map +1 -1
  192. package/lib/exercises/pc/chemicalReactionsProduct.js +1 -1
  193. package/lib/exercises/pc/dosage/beerLambertRandomValue.d.ts.map +1 -1
  194. package/lib/exercises/pc/dosage/beerLambertRandomValue.js +2 -1
  195. package/lib/exercises/pc/dosage/concentrationCalculation.d.ts +10 -0
  196. package/lib/exercises/pc/dosage/concentrationCalculation.d.ts.map +1 -0
  197. package/lib/exercises/pc/dosage/concentrationCalculation.js +119 -0
  198. package/lib/exercises/pc/dosage/concentrationFromMassCalculation.d.ts +10 -0
  199. package/lib/exercises/pc/dosage/concentrationFromMassCalculation.d.ts.map +1 -0
  200. package/lib/exercises/pc/dosage/concentrationFromMassCalculation.js +117 -0
  201. package/lib/exercises/pc/dosage/index.d.ts +2 -0
  202. package/lib/exercises/pc/dosage/index.d.ts.map +1 -1
  203. package/lib/exercises/pc/dosage/index.js +2 -0
  204. package/lib/exercises/pc/electricity/calculateIntensity.d.ts +8 -0
  205. package/lib/exercises/pc/electricity/calculateIntensity.d.ts.map +1 -0
  206. package/lib/exercises/pc/electricity/calculateIntensity.js +60 -0
  207. package/lib/exercises/pc/electricity/calculateIntensityInSerieOrParallel.d.ts +10 -0
  208. package/lib/exercises/pc/electricity/calculateIntensityInSerieOrParallel.d.ts.map +1 -0
  209. package/lib/exercises/pc/electricity/calculateIntensityInSerieOrParallel.js +105 -0
  210. package/lib/exercises/pc/electricity/calculateVoltage.d.ts +11 -0
  211. package/lib/exercises/pc/electricity/calculateVoltage.d.ts.map +1 -0
  212. package/lib/exercises/pc/electricity/calculateVoltage.js +144 -0
  213. package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.d.ts +9 -0
  214. package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.d.ts.map +1 -0
  215. package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.js +81 -0
  216. package/lib/exercises/pc/electricity/index.d.ts +7 -0
  217. package/lib/exercises/pc/electricity/index.d.ts.map +1 -1
  218. package/lib/exercises/pc/electricity/index.js +7 -0
  219. package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.d.ts +10 -0
  220. package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.d.ts.map +1 -0
  221. package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.js +110 -0
  222. package/lib/exercises/pc/electricity/ohmLaw.d.ts +11 -0
  223. package/lib/exercises/pc/electricity/ohmLaw.d.ts.map +1 -0
  224. package/lib/exercises/pc/electricity/ohmLaw.js +123 -0
  225. package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts +5 -0
  226. package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts.map +1 -0
  227. package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.js +95 -0
  228. package/lib/exercises/pc/energy/calorificValue.d.ts +8 -0
  229. package/lib/exercises/pc/energy/calorificValue.d.ts.map +1 -0
  230. package/lib/exercises/pc/energy/calorificValue.js +78 -0
  231. package/lib/exercises/pc/energy/combustionTransferEnergy.d.ts +8 -0
  232. package/lib/exercises/pc/energy/combustionTransferEnergy.d.ts.map +1 -0
  233. package/lib/exercises/pc/energy/combustionTransferEnergy.js +78 -0
  234. package/lib/exercises/pc/energy/combustionTransferEnergy2.d.ts +11 -0
  235. package/lib/exercises/pc/energy/combustionTransferEnergy2.d.ts.map +1 -0
  236. package/lib/exercises/pc/energy/combustionTransferEnergy2.js +141 -0
  237. package/lib/exercises/pc/energy/efficencyOfConverter.d.ts +8 -0
  238. package/lib/exercises/pc/energy/efficencyOfConverter.d.ts.map +1 -0
  239. package/lib/exercises/pc/energy/efficencyOfConverter.js +84 -0
  240. package/lib/exercises/pc/energy/efficiencyCalculation.d.ts +10 -0
  241. package/lib/exercises/pc/energy/efficiencyCalculation.d.ts.map +1 -0
  242. package/lib/exercises/pc/energy/efficiencyCalculation.js +122 -0
  243. package/lib/exercises/pc/energy/energyTransfer.d.ts +10 -0
  244. package/lib/exercises/pc/energy/energyTransfer.d.ts.map +1 -0
  245. package/lib/exercises/pc/energy/energyTransfer.js +67 -0
  246. package/lib/exercises/pc/energy/index.d.ts +9 -0
  247. package/lib/exercises/pc/energy/index.d.ts.map +1 -0
  248. package/lib/exercises/pc/energy/index.js +24 -0
  249. package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.d.ts +10 -0
  250. package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.d.ts.map +1 -0
  251. package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.js +168 -0
  252. package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.d.ts +11 -0
  253. package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.d.ts.map +1 -0
  254. package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.js +143 -0
  255. package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.d.ts +8 -0
  256. package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.d.ts.map +1 -0
  257. package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.js +102 -0
  258. package/lib/exercises/pc/forces/electroStaticForce.d.ts +13 -0
  259. package/lib/exercises/pc/forces/electroStaticForce.d.ts.map +1 -0
  260. package/lib/exercises/pc/forces/electroStaticForce.js +117 -0
  261. package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.d.ts +9 -0
  262. package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.d.ts.map +1 -0
  263. package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.js +132 -0
  264. package/lib/exercises/pc/forces/gravitationalAttractionValue.d.ts +1 -0
  265. package/lib/exercises/pc/forces/gravitationalAttractionValue.d.ts.map +1 -1
  266. package/lib/exercises/pc/forces/gravitationalAttractionValue.js +31 -27
  267. package/lib/exercises/pc/forces/gravitationalForcePlanets.d.ts +10 -0
  268. package/lib/exercises/pc/forces/gravitationalForcePlanets.d.ts.map +1 -0
  269. package/lib/exercises/pc/forces/gravitationalForcePlanets.js +118 -0
  270. package/lib/exercises/pc/forces/index.d.ts +5 -0
  271. package/lib/exercises/pc/forces/index.d.ts.map +1 -1
  272. package/lib/exercises/pc/forces/index.js +6 -0
  273. package/lib/exercises/pc/forces/massWeight.d.ts +9 -0
  274. package/lib/exercises/pc/forces/massWeight.d.ts.map +1 -0
  275. package/lib/exercises/pc/forces/massWeight.js +68 -0
  276. package/lib/exercises/pc/forces/pressureDifferenceCalculation.d.ts +1 -0
  277. package/lib/exercises/pc/forces/pressureDifferenceCalculation.d.ts.map +1 -0
  278. package/lib/exercises/pc/forces/pressureDifferenceCalculation.js +106 -0
  279. package/lib/exercises/pc/formulaFromComposition.js +2 -2
  280. package/lib/exercises/pc/identifyAtomicMassOrAtomicNb.d.ts +8 -0
  281. package/lib/exercises/pc/identifyAtomicMassOrAtomicNb.d.ts.map +1 -0
  282. package/lib/exercises/pc/identifyAtomicMassOrAtomicNb.js +72 -0
  283. package/lib/exercises/pc/index.d.ts +6 -0
  284. package/lib/exercises/pc/index.d.ts.map +1 -1
  285. package/lib/exercises/pc/index.js +6 -0
  286. package/lib/exercises/pc/molarQuantity.js +2 -2
  287. package/lib/exercises/pc/mole/index.d.ts +2 -0
  288. package/lib/exercises/pc/mole/index.d.ts.map +1 -1
  289. package/lib/exercises/pc/mole/index.js +2 -0
  290. package/lib/exercises/pc/mole/molarMass.js +1 -1
  291. package/lib/exercises/pc/mole/moleculeCountFromMassAndAvogadro.d.ts +9 -0
  292. package/lib/exercises/pc/mole/moleculeCountFromMassAndAvogadro.d.ts.map +1 -0
  293. package/lib/exercises/pc/mole/moleculeCountFromMassAndAvogadro.js +75 -0
  294. package/lib/exercises/pc/mole/moleculeCountFromMol.d.ts +7 -0
  295. package/lib/exercises/pc/mole/moleculeCountFromMol.d.ts.map +1 -0
  296. package/lib/exercises/pc/mole/moleculeCountFromMol.js +66 -0
  297. package/lib/exercises/pc/moleculeFormula.js +1 -1
  298. package/lib/exercises/pc/moleculeNomenclature.js +1 -1
  299. package/lib/exercises/pc/motion/averageSpeed.d.ts +12 -0
  300. package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -0
  301. package/lib/exercises/pc/motion/averageSpeed.js +122 -0
  302. package/lib/exercises/pc/motion/averageSpeedCalculation.d.ts +10 -0
  303. package/lib/exercises/pc/motion/averageSpeedCalculation.d.ts.map +1 -0
  304. package/lib/exercises/pc/motion/averageSpeedCalculation.js +146 -0
  305. package/lib/exercises/pc/motion/characteristicsOfVelocityVector.d.ts +7 -0
  306. package/lib/exercises/pc/motion/characteristicsOfVelocityVector.d.ts.map +1 -0
  307. package/lib/exercises/pc/motion/characteristicsOfVelocityVector.js +86 -0
  308. package/lib/exercises/pc/motion/index.d.ts +7 -0
  309. package/lib/exercises/pc/motion/index.d.ts.map +1 -0
  310. package/lib/exercises/pc/motion/index.js +22 -0
  311. package/lib/exercises/pc/motion/motionReference.d.ts +9 -0
  312. package/lib/exercises/pc/motion/motionReference.d.ts.map +1 -0
  313. package/lib/exercises/pc/motion/motionReference.js +168 -0
  314. package/lib/exercises/pc/motion/typeOfAcceleration.d.ts +5 -0
  315. package/lib/exercises/pc/motion/typeOfAcceleration.d.ts.map +1 -0
  316. package/lib/exercises/pc/motion/typeOfAcceleration.js +97 -0
  317. package/lib/exercises/pc/motion/typeOfMovement.d.ts +5 -0
  318. package/lib/exercises/pc/motion/typeOfMovement.d.ts.map +1 -0
  319. package/lib/exercises/pc/motion/typeOfMovement.js +111 -0
  320. package/lib/exercises/pc/orderOfMagnitude.d.ts +8 -0
  321. package/lib/exercises/pc/orderOfMagnitude.d.ts.map +1 -0
  322. package/lib/exercises/pc/orderOfMagnitude.js +68 -0
  323. package/lib/exercises/pc/pH.d.ts.map +1 -1
  324. package/lib/exercises/pc/pH.js +1 -0
  325. package/lib/exercises/pc/potentialEnergy.d.ts.map +1 -1
  326. package/lib/exercises/pc/potentialEnergy.js +17 -5
  327. package/lib/exercises/pc/power/calculatePowerOfLight.d.ts +8 -0
  328. package/lib/exercises/pc/power/calculatePowerOfLight.d.ts.map +1 -0
  329. package/lib/exercises/pc/power/calculatePowerOfLight.js +86 -0
  330. package/lib/exercises/pc/power/index.d.ts +2 -0
  331. package/lib/exercises/pc/power/index.d.ts.map +1 -0
  332. package/lib/exercises/pc/power/index.js +17 -0
  333. package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.d.ts +5 -0
  334. package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.d.ts.map +1 -0
  335. package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.js +117 -0
  336. package/lib/exercises/pc/sound/findPeriodOrFrequencyFromGraph.d.ts +9 -0
  337. package/lib/exercises/pc/sound/findPeriodOrFrequencyFromGraph.d.ts.map +1 -0
  338. package/lib/exercises/pc/sound/findPeriodOrFrequencyFromGraph.js +95 -0
  339. package/lib/exercises/pc/sound/index.d.ts +1 -0
  340. package/lib/exercises/pc/sound/index.d.ts.map +1 -1
  341. package/lib/exercises/pc/sound/index.js +1 -0
  342. package/lib/exercises/pc/spectral/spectralEnergy.d.ts.map +1 -1
  343. package/lib/exercises/pc/spectral/spectralEnergy.js +1 -0
  344. package/lib/exercises/pc/waves/index.d.ts +1 -0
  345. package/lib/exercises/pc/waves/index.d.ts.map +1 -1
  346. package/lib/exercises/pc/waves/index.js +1 -0
  347. package/lib/exercises/pc/waves/lightDistanceConversion.d.ts +10 -0
  348. package/lib/exercises/pc/waves/lightDistanceConversion.d.ts.map +1 -0
  349. package/lib/exercises/pc/waves/lightDistanceConversion.js +161 -0
  350. package/lib/exercises/pc/waves/periodicWaveCelerity.d.ts.map +1 -1
  351. package/lib/exercises/pc/waves/periodicWaveCelerity.js +1 -0
  352. package/lib/exercises/pc/weight/calculateWeight.d.ts +7 -0
  353. package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -0
  354. package/lib/exercises/pc/weight/calculateWeight.js +73 -0
  355. package/lib/exercises/pc/weight/index.d.ts +1 -0
  356. package/lib/exercises/pc/weight/index.d.ts.map +1 -1
  357. package/lib/exercises/pc/weight/index.js +1 -0
  358. package/lib/exercises/pc/weight/weightOnTheMoon.d.ts.map +1 -1
  359. package/lib/exercises/pc/weight/weightOnTheMoon.js +7 -6
  360. package/lib/exercises/utils/getAtoms.d.ts +1 -1
  361. package/lib/exercises/utils/getAtoms.d.ts.map +1 -1
  362. package/lib/exercises/utils/getAtoms.js +1 -1
  363. package/lib/index.d.ts +216 -75
  364. package/lib/index.d.ts.map +1 -1
  365. package/lib/index.js +4 -0
  366. package/lib/math/geometry/spacePoint.d.ts +27 -0
  367. package/lib/math/geometry/spacePoint.d.ts.map +1 -0
  368. package/lib/math/geometry/spacePoint.js +80 -0
  369. package/lib/math/geometry/spaceVector.d.ts +28 -0
  370. package/lib/math/geometry/spaceVector.d.ts.map +1 -0
  371. package/lib/math/geometry/spaceVector.js +83 -0
  372. package/lib/math/numbers/decimals/decimal.d.ts +1 -0
  373. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  374. package/lib/math/numbers/decimals/decimal.js +8 -0
  375. package/lib/math/numbers/rationals/rational.d.ts +1 -0
  376. package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
  377. package/lib/math/numbers/rationals/rational.js +4 -0
  378. package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -2
  379. package/lib/math/numbers/reals/extendedRingElement.d.ts.map +1 -1
  380. package/lib/math/polynomials/affine.d.ts +4 -0
  381. package/lib/math/polynomials/affine.d.ts.map +1 -1
  382. package/lib/math/polynomials/affine.js +10 -0
  383. package/lib/math/polynomials/trinom.d.ts +2 -1
  384. package/lib/math/polynomials/trinom.d.ts.map +1 -1
  385. package/lib/math/polynomials/trinom.js +3 -0
  386. package/lib/pc/constants/atoms.d.ts +0 -1
  387. package/lib/pc/constants/atoms.d.ts.map +1 -1
  388. package/lib/pc/constants/atoms.js +2 -2
  389. package/lib/pc/constants/coulomb.d.ts +3 -0
  390. package/lib/pc/constants/coulomb.d.ts.map +1 -0
  391. package/lib/pc/constants/coulomb.js +13 -0
  392. package/lib/pc/constants/earth.d.ts +0 -1
  393. package/lib/pc/constants/earth.d.ts.map +1 -1
  394. package/lib/pc/constants/earth.js +4 -4
  395. package/lib/pc/constants/gravity.d.ts +1 -1
  396. package/lib/pc/constants/gravity.d.ts.map +1 -1
  397. package/lib/pc/constants/gravity.js +16 -7
  398. package/lib/pc/constants/mechanics/gravitational.d.ts +14 -0
  399. package/lib/pc/constants/mechanics/gravitational.d.ts.map +1 -0
  400. package/lib/pc/constants/mechanics/gravitational.js +37 -0
  401. package/lib/pc/constants/mechanics/planets.d.ts +15 -0
  402. package/lib/pc/constants/mechanics/planets.d.ts.map +1 -0
  403. package/lib/pc/constants/mechanics/planets.js +35 -0
  404. package/lib/pc/constants/mechanics/waves.d.ts +8 -0
  405. package/lib/pc/constants/mechanics/waves.d.ts.map +1 -0
  406. package/lib/pc/constants/mechanics/waves.js +8 -0
  407. package/lib/pc/constants/molecularChemistry/atomSymbols.d.ts +2 -0
  408. package/lib/pc/constants/molecularChemistry/atomSymbols.d.ts.map +1 -0
  409. package/lib/pc/constants/molecularChemistry/atomSymbols.js +2 -0
  410. package/lib/pc/constants/molecularChemistry/atome.d.ts +18 -0
  411. package/lib/pc/constants/molecularChemistry/atome.d.ts.map +1 -0
  412. package/lib/pc/constants/molecularChemistry/atome.js +174 -0
  413. package/lib/pc/constants/molecularChemistry/atoms.d.ts +9 -0
  414. package/lib/pc/constants/molecularChemistry/atoms.d.ts.map +1 -0
  415. package/lib/pc/constants/molecularChemistry/atoms.js +15 -0
  416. package/lib/pc/constants/molecularChemistry/molecule.d.ts +25 -0
  417. package/lib/pc/constants/molecularChemistry/molecule.d.ts.map +1 -0
  418. package/lib/pc/constants/molecularChemistry/molecule.js +579 -0
  419. package/lib/pc/constants/molecularChemistry/reaction.d.ts +27 -0
  420. package/lib/pc/constants/molecularChemistry/reaction.d.ts.map +1 -0
  421. package/lib/pc/constants/molecularChemistry/reaction.js +471 -0
  422. package/lib/pc/measure/measure.d.ts +16 -6
  423. package/lib/pc/measure/measure.d.ts.map +1 -1
  424. package/lib/pc/measure/measure.js +112 -16
  425. package/lib/pc/units/AmountOfSubstance.d.ts +17 -0
  426. package/lib/pc/units/AmountOfSubstance.d.ts.map +1 -0
  427. package/lib/pc/units/AmountOfSubstance.js +40 -0
  428. package/lib/pc/units/PressionUnit.d.ts +17 -0
  429. package/lib/pc/units/PressionUnit.d.ts.map +1 -0
  430. package/lib/pc/units/PressionUnit.js +32 -0
  431. package/lib/pc/units/distanceUnits.d.ts +16 -0
  432. package/lib/pc/units/distanceUnits.d.ts.map +1 -0
  433. package/lib/pc/units/distanceUnits.js +32 -0
  434. package/lib/pc/units/divideUnit.d.ts +13 -0
  435. package/lib/pc/units/divideUnit.d.ts.map +1 -0
  436. package/lib/pc/units/divideUnit.js +32 -0
  437. package/lib/pc/units/electricalChargeUnit.d.ts +17 -0
  438. package/lib/pc/units/electricalChargeUnit.d.ts.map +1 -0
  439. package/lib/pc/units/electricalChargeUnit.js +40 -0
  440. package/lib/pc/units/electricalResistanceUnit.d.ts +18 -0
  441. package/lib/pc/units/electricalResistanceUnit.d.ts.map +1 -0
  442. package/lib/pc/units/electricalResistanceUnit.js +32 -0
  443. package/lib/pc/units/electricalUnit.d.ts +18 -0
  444. package/lib/pc/units/electricalUnit.d.ts.map +1 -0
  445. package/lib/pc/units/electricalUnit.js +32 -0
  446. package/lib/pc/units/energyUnit.d.ts +16 -0
  447. package/lib/pc/units/energyUnit.d.ts.map +1 -0
  448. package/lib/pc/units/energyUnit.js +32 -0
  449. package/lib/pc/units/forceUnits.d.ts +16 -0
  450. package/lib/pc/units/forceUnits.d.ts.map +1 -0
  451. package/lib/pc/units/forceUnits.js +32 -0
  452. package/lib/pc/units/frequenceUnit.d.ts +17 -0
  453. package/lib/pc/units/frequenceUnit.d.ts.map +1 -0
  454. package/lib/pc/units/frequenceUnit.js +40 -0
  455. package/lib/pc/units/interfaces/baseTenUnit.d.ts +10 -0
  456. package/lib/pc/units/interfaces/baseTenUnit.d.ts.map +1 -0
  457. package/lib/pc/units/interfaces/baseTenUnit.js +16 -0
  458. package/lib/pc/units/interfaces/basicUnit.d.ts +13 -0
  459. package/lib/pc/units/interfaces/basicUnit.d.ts.map +1 -0
  460. package/lib/pc/units/interfaces/basicUnit.js +19 -0
  461. package/lib/pc/units/interfaces/unit.d.ts +13 -0
  462. package/lib/pc/units/interfaces/unit.d.ts.map +1 -0
  463. package/lib/pc/units/interfaces/unit.js +2 -0
  464. package/lib/pc/units/massUnits.d.ts +17 -0
  465. package/lib/pc/units/massUnits.d.ts.map +1 -0
  466. package/lib/pc/units/massUnits.js +32 -0
  467. package/lib/pc/units/mulitplyUnits.d.ts +13 -0
  468. package/lib/pc/units/mulitplyUnits.d.ts.map +1 -0
  469. package/lib/pc/units/mulitplyUnits.js +26 -0
  470. package/lib/pc/units/powerUnits.d.ts +14 -0
  471. package/lib/pc/units/powerUnits.d.ts.map +1 -0
  472. package/lib/pc/units/powerUnits.js +26 -0
  473. package/lib/pc/units/timeUnits.d.ts +13 -0
  474. package/lib/pc/units/timeUnits.d.ts.map +1 -0
  475. package/lib/pc/units/timeUnits.js +42 -0
  476. package/lib/pc/units/volumeUnit.d.ts +17 -0
  477. package/lib/pc/units/volumeUnit.d.ts.map +1 -0
  478. package/lib/pc/units/volumeUnit.js +32 -0
  479. package/lib/pc/units/wattUnit.d.ts +17 -0
  480. package/lib/pc/units/wattUnit.d.ts.map +1 -0
  481. package/lib/pc/units/wattUnit.js +32 -0
  482. package/lib/playground.d.ts +2 -0
  483. package/lib/playground.d.ts.map +1 -0
  484. package/lib/playground.js +19 -0
  485. package/lib/server.d.ts +3 -0
  486. package/lib/server.d.ts.map +1 -1
  487. package/lib/server.js +11 -5
  488. package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
  489. package/lib/tree/nodes/equations/equationSolutionNode.js +8 -0
  490. package/lib/tree/nodes/node.d.ts +4 -0
  491. package/lib/tree/nodes/node.d.ts.map +1 -1
  492. package/lib/tree/nodes/operators/addNode.js +2 -2
  493. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  494. package/lib/tree/nodes/operators/multiplyNode.js +40 -12
  495. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  496. package/lib/tree/nodes/operators/powerNode.js +12 -0
  497. package/lib/utils/alignTex.d.ts +2 -0
  498. package/lib/utils/alignTex.d.ts.map +1 -0
  499. package/lib/utils/alignTex.js +18 -0
  500. package/package.json +1 -1
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateIntensity = 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 getCalculateIntensityQuestion = () => {
8
+ const exo = generateExercise();
9
+ const question = {
10
+ answer: exo.answer + "",
11
+ instruction: exo.instruction +
12
+ `![](https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/xpliveV2/activities/quizzes/generator/electricCircuit2.png)`,
13
+ keys: [],
14
+ // correction: `1 - Calculer l'instensité au bord de la lampe à l'aide de la loi des noeuds : $L_1+L_2=L$ $\\Rightarrow$ $${exo.l1}+${exo.l2}=${exo.answer}$ $mA$`,
15
+ answerFormat: "tex",
16
+ identifiers: { l1: exo.l1, l2: exo.l2 },
17
+ };
18
+ return question;
19
+ };
20
+ const getPropositions = (n, { answer, l1, l2 }) => {
21
+ const propositions = [];
22
+ (0, exercise_1.addValidProp)(propositions, answer);
23
+ generatePropositions(l1, l2).forEach((value) => (0, exercise_1.tryToAddWrongProp)(propositions, value + ""));
24
+ while (propositions.length < n) {
25
+ let random = (0, randint_1.randint)(+answer - Math.min(5, +answer - 1), +answer + 6, [+answer]) + "";
26
+ (0, exercise_1.tryToAddWrongProp)(propositions, random);
27
+ }
28
+ return (0, exercise_1.shuffleProps)(propositions, n);
29
+ };
30
+ const isAnswerValid = (ans, { answer }) => {
31
+ return ans === answer;
32
+ };
33
+ const generateExercise = () => {
34
+ const l1 = (0, randint_1.randint)(10, 60);
35
+ const l2 = (0, randint_1.randint)(10, 60);
36
+ const instruction = `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}$ $mA$, celle traversant la lampe $L_2$ est de $${l2}$ $mA$. \n \\
37
+ Calculer l'intensité du courant qui traverse la pile.`;
38
+ return {
39
+ instruction,
40
+ answer: l1 + l2,
41
+ l1,
42
+ l2,
43
+ };
44
+ };
45
+ const generatePropositions = (l1, l2) => {
46
+ return [l1 - l2, l1, l2];
47
+ };
48
+ exports.calculateIntensity = {
49
+ id: "calculateIntensity",
50
+ label: "Calcul d'intnsité dans un circuit électrique en parallèle",
51
+ levels: ["2nde"],
52
+ isSingleStep: true,
53
+ sections: ["Électricité"],
54
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getCalculateIntensityQuestion, nb),
55
+ qcmTimer: 60,
56
+ freeTimer: 60,
57
+ getPropositions,
58
+ isAnswerValid,
59
+ subject: "Physique",
60
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ l1: number;
4
+ l2: number;
5
+ isAsking: string;
6
+ circuit: string;
7
+ };
8
+ export declare const calculateIntensityInSerieOrParallel: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=calculateIntensityInSerieOrParallel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateIntensityInSerieOrParallel.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/calculateIntensityInSerieOrParallel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkHF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAarE,CAAC"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateIntensityInSerieOrParallel = 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
+ const getCalculateIntensityInSerieOrParallelQuestion = () => {
9
+ const exo = generateExercise();
10
+ const schemaIllu = exo.circuit === "Série"
11
+ ? " https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/xpliveV2/activities/quizzes/generator/electricCircuit3.png"
12
+ : "https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/xpliveV2/activities/quizzes/generator/electricCircuit2.png";
13
+ const question = {
14
+ answer: exo.answer + "",
15
+ instruction: exo.instruction + `![](${schemaIllu})`,
16
+ keys: [],
17
+ answerFormat: "tex",
18
+ identifiers: {
19
+ l1: exo.l1,
20
+ l2: exo.l2,
21
+ isAsking: exo.isAsking,
22
+ circuit: exo.circuit,
23
+ },
24
+ };
25
+ return question;
26
+ };
27
+ const getPropositions = (n, { answer, isAsking, circuit, l1, l2 }) => {
28
+ const propositions = [];
29
+ (0, exercise_1.addValidProp)(propositions, answer);
30
+ generatePropositions(l1, l2, isAsking, circuit).forEach((value) => (0, exercise_1.tryToAddWrongProp)(propositions, value + ""));
31
+ while (propositions.length < n) {
32
+ let random = (0, randint_1.randint)(+answer - Math.min(5, +answer - 1), +answer + 6, [+answer]) + "";
33
+ (0, exercise_1.tryToAddWrongProp)(propositions, random);
34
+ }
35
+ return (0, exercise_1.shuffleProps)(propositions, n);
36
+ };
37
+ const isAnswerValid = (ans, { answer }) => {
38
+ return ans === answer;
39
+ };
40
+ const generateExercise = () => {
41
+ const l1 = (0, randint_1.randint)(10, 60);
42
+ const isAsking = (0, random_1.random)(["L", "L1", "L2"]);
43
+ const circuit = (0, random_1.random)(["Série", "Parallèle", "Parallèle"]);
44
+ const l2 = circuit === "Série" ? l1 : (0, randint_1.randint)(10, 60);
45
+ const l = circuit === "Série" ? l1 : l1 + l2;
46
+ const values = [l, l1, l2];
47
+ const instruction = getInstruction(isAsking, circuit, l1, l2, l);
48
+ const answer = circuit === "Série"
49
+ ? l1
50
+ : values[["L", "L1", "L2"].findIndex((value) => value === isAsking)];
51
+ return {
52
+ instruction,
53
+ answer,
54
+ l1,
55
+ l2,
56
+ l,
57
+ isAsking,
58
+ circuit,
59
+ };
60
+ };
61
+ const getInstruction = (isAsking, circuit, l1, l2, l) => {
62
+ if (circuit === "Série")
63
+ return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}$ $mA$, celle traversant la lampe $L_2$ est de $${l2}$ $mA$. \n \\
64
+ Calculer l'intensité du courant qui traverse la pile en $mA$.`;
65
+ switch (isAsking) {
66
+ case "L":
67
+ return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}$ $mA$, celle traversant la lampe $L_2$ est de $${l2}$ $mA$. \n \\
68
+ Calculer l'intensité du courant qui traverse la pile en $mA$.`;
69
+ case "L1":
70
+ return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_2$ est de $${l2}$ $mA$, celle traversant la pile est de $${l}$ $mA$. \n \\
71
+ Calculer l'intensité du courant qui traverse la lampe $L_1$ en $mA$.`;
72
+ case "L2":
73
+ return `Pour ce circuit schématisé, l'intensité du courant qui traverse la lampe $L_1$ est de $${l1}$ $mA$, celle traversant la pile est de $${l}$ $mA$. \n \\
74
+ Calculer l'intensité du courant qui traverse la lampe $L_2$ en $mA$.`;
75
+ default:
76
+ return "";
77
+ }
78
+ };
79
+ const generatePropositions = (l1, l2, isAsking, circuit) => {
80
+ if (circuit === "Série")
81
+ return [l1 + l2, Math.floor(l1 / 2)];
82
+ switch (isAsking) {
83
+ case "L":
84
+ return [l1, l2, Math.abs(l1 - l2)];
85
+ case "L1":
86
+ return [l2, l1 + l2, l1 + l2 + l2];
87
+ case "L2":
88
+ return [l1, l1 + l2, l2 + l1 + l1];
89
+ default:
90
+ return [];
91
+ }
92
+ };
93
+ exports.calculateIntensityInSerieOrParallel = {
94
+ id: "calculateIntensityInSerieOrParallel",
95
+ label: "Calcul d'intnsité dans un circuit électrique en série/parallèle",
96
+ levels: ["1reSpé"],
97
+ isSingleStep: true,
98
+ sections: ["Électricité"],
99
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getCalculateIntensityInSerieOrParallelQuestion, nb),
100
+ qcmTimer: 60,
101
+ freeTimer: 60,
102
+ getPropositions,
103
+ isAnswerValid,
104
+ subject: "Physique",
105
+ };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ E: number;
4
+ I: number;
5
+ r: number;
6
+ R: number;
7
+ isAsking: string;
8
+ };
9
+ export declare const calculateVoltage: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=calculateVoltage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateVoltage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/calculateVoltage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAiKF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateVoltage = 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 random_1 = require("../../../utils/random");
9
+ const getCalculateVoltageQuestion = () => {
10
+ const exo = generateExercise();
11
+ const question = {
12
+ answer: exo.answer,
13
+ instruction: exo.instruction,
14
+ keys: [],
15
+ correction: exo.correction,
16
+ hint: exo.hint,
17
+ answerFormat: "tex",
18
+ identifiers: {
19
+ E: exo.E,
20
+ I: exo.I,
21
+ r: exo.r,
22
+ R: exo.R,
23
+ isAsking: exo.isAsking,
24
+ },
25
+ };
26
+ return question;
27
+ };
28
+ const getPropositions = (n, { answer, E, I, R, r, isAsking }) => {
29
+ const propositions = [];
30
+ const correctAns = +getCorrectAnswer(isAsking, E, I, r, R).toFixed(0);
31
+ (0, exercise_1.addValidProp)(propositions, answer);
32
+ generatePropositions(E, I, r, R, isAsking).forEach((value) => (0, exercise_1.tryToAddWrongProp)(propositions, value));
33
+ while (propositions.length < n) {
34
+ let random = (0, randint_1.randint)(correctAns - 10, correctAns + 11, [correctAns]);
35
+ (0, exercise_1.tryToAddWrongProp)(propositions, random.frenchify());
36
+ }
37
+ return (0, exercise_1.shuffleProps)(propositions, n);
38
+ };
39
+ const isAnswerValid = (ans, { answer, isAsking, E, I, r, R }) => {
40
+ const scientificAns = getCorrectAnswer(isAsking, E, I, r, R).toScientific(0);
41
+ return [answer, scientificAns].includes(ans);
42
+ };
43
+ const generatePropositions = (E, I, r, R, isAsking) => {
44
+ const first = E.frenchify();
45
+ let second = (0).frenchify();
46
+ switch (isAsking) {
47
+ case "du générateur":
48
+ second = (+getCorrectAnswer("de la résistance", E, I, r, R).toFixed(0)).frenchify();
49
+ break;
50
+ case "de la résistance":
51
+ second = (+getCorrectAnswer("du générateur", E, I, r, R).toFixed(0)).frenchify();
52
+ break;
53
+ case "de la diode":
54
+ second = (+(getCorrectAnswer("de la résistance", E, I, r, R) +
55
+ getCorrectAnswer("du générateur", E, I, r, R)).toFixed(0)).frenchify();
56
+ break;
57
+ }
58
+ return [first, second];
59
+ };
60
+ const generateExercise = () => {
61
+ const R = (0, randint_1.randint)(1, 21);
62
+ const I = (0, randfloat_1.randfloat)(0.1, 4, 1);
63
+ const r = (0, randint_1.randint)(1, 6);
64
+ const EMin = Math.floor(r * I + R * I);
65
+ const E = (0, randint_1.randint)(EMin + 5, EMin + 51);
66
+ const isAsking = (0, random_1.random)(["du générateur", "de la résistance", "de la diode"]);
67
+ const instruction = `Dans un circuit électrique, on trouve :
68
+
69
+ - Une source de tension $E=${E}$ volts, avec une résistance interne $r=${r}\\ \\Omega$.
70
+
71
+ - Un conducteur ohmique de résistance $R=${R}\\ \\Omega$.
72
+
73
+ - Un courant $I=${I.frenchify()}\\ A$ circule à travers la résistance.
74
+
75
+ Calculez la tension U aux bornes ${isAsking} en $V$, arrondie à l'unité
76
+ ![](https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/xpliveV2/activities/quizzes/generator/electricCircuit1NoLetters.png)`;
77
+ const answer = getCorrectAnswer(isAsking, E, I, r, R).toFixed(0);
78
+ const correction = getCorrection(isAsking, answer);
79
+ const hint = getHint(isAsking);
80
+ return {
81
+ instruction,
82
+ answer: answer,
83
+ correction,
84
+ hint,
85
+ isAsking,
86
+ E,
87
+ I,
88
+ r,
89
+ R,
90
+ };
91
+ };
92
+ const getCorrectAnswer = (isAsking, E, I, r, R) => {
93
+ switch (isAsking) {
94
+ case "du générateur":
95
+ return E - r * I;
96
+ case "de la résistance":
97
+ return R * I;
98
+ case "de la diode":
99
+ const U1 = E - r * I;
100
+ const U2 = R * I;
101
+ return U1 - U2;
102
+ default:
103
+ return 0;
104
+ }
105
+ };
106
+ const getHint = (isAsking) => {
107
+ switch (isAsking) {
108
+ case "de la diode":
109
+ return `Calculer d'abord la tension aux bornes du conducteur ohmique et du générateur, puis appliquer la loi des mailles.`;
110
+ case "du générateur":
111
+ return `Appliquer la formule qui met en relation la tension $U$ aux bornes du générateur, la résistance interne du générateur $r$ et l'intensité $I$.`;
112
+ case "de la résistance":
113
+ return `Appliquer la loi d'ohm.`;
114
+ default:
115
+ return "";
116
+ }
117
+ };
118
+ const getCorrection = (isAsking, answer) => {
119
+ switch (isAsking) {
120
+ case "du générateur":
121
+ return `Appliquer la formule qui met en relation la tension $U$ aux bornes du générateur, la résistance interne du générateur $r$ et l'intensité $I$.\n
122
+ $U=E-r \\cdot I\\ \\Rightarrow\\ U=${answer}\\ V$`;
123
+ case "de la résistance":
124
+ return `Appliquer la loi d'ohm : $U=R \\cdot I\\ \\Rightarrow\\ U=${answer}\\ V$`;
125
+ case "de la diode":
126
+ return `1 - Calculer la tension aux bornes du générateur $U=E-r \\cdot I$.\n
127
+ 2 - Calculer la tension aux bornes du conducteur ohmique $U_1=R \\cdot I$.\n
128
+ 3 - Appliquer la loi des mailles $U=U_1+U_2\\ \\Rightarrow\\ U_2=U-U_1\\ \\Rightarrow\\ U_2=${answer}\\ V$`;
129
+ }
130
+ };
131
+ exports.calculateVoltage = {
132
+ id: "calculateVoltage",
133
+ label: "Calcul de tension au borne d'une résistance",
134
+ levels: ["2nde"],
135
+ isSingleStep: true,
136
+ sections: ["Électricité"],
137
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getCalculateVoltageQuestion, nb),
138
+ qcmTimer: 60,
139
+ freeTimer: 60,
140
+ getPropositions,
141
+ isAnswerValid,
142
+ subject: "Physique",
143
+ hasHintAndCorrection: true,
144
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ power: number;
4
+ seconds: number;
5
+ energy: number;
6
+ };
7
+ export declare const electricPowerOrEnergyCalculation: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=electricPowerOrEnergyCalculation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electricPowerOrEnergyCalculation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/electricPowerOrEnergyCalculation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAwFtE,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAclE,CAAC"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.electricPowerOrEnergyCalculation = void 0;
4
+ const frenchify_1 = require("../../../math/utils/latex/frenchify");
5
+ const exercise_1 = require("../../../exercises/exercise");
6
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
7
+ const round_1 = require("../../../math/utils/round");
8
+ const random_1 = require("../../../utils/random");
9
+ const randfloat_1 = require("../../../math/utils/random/randfloat");
10
+ const coinFlip_1 = require("../../../utils/coinFlip");
11
+ const powers = [15, 18, 50, 25, 65, 66, 7.5, 10]; // Puissances en watts
12
+ const durations = [60, 3600, 86400, 604800]; // Durées en secondes (1 min, 1 h, 1 jour, 1 semaine)
13
+ const getElectricPowerOrEnergyQuestion = () => {
14
+ const power = (0, random_1.random)(powers);
15
+ const seconds = (0, random_1.random)(durations);
16
+ const energy = power * seconds;
17
+ const isCalculatingEnergy = (0, coinFlip_1.coinFlip)();
18
+ const questionText = isCalculatingEnergy
19
+ ? `Un appareil a une puissance de $P = ${(0, frenchify_1.frenchify)(power)}\\ \\text{W}$ et fonctionne pendant $t = ${(0, frenchify_1.frenchify)(seconds)}\\ \\text{s}$. Calculez l'énergie électrique $E$ en $\\text{J}$ fournie par cet appareil.`
20
+ : `Un appareil consomme une énergie $E = ${(0, frenchify_1.frenchify)(energy)}\\ \\text{J}$ en $t = ${(0, frenchify_1.frenchify)(seconds)}\\ \\text{s}$. Calculez la puissance $P$ en $\\text{W}$ de cet appareil.`;
21
+ const answer = isCalculatingEnergy ? energy : (0, round_1.round)(energy / seconds, 2);
22
+ const hint = `La relation entre l'énergie électrique, la puissance et le temps est donnée par la formule :
23
+ $$
24
+ E = P \\times t
25
+ $$
26
+ Réarrangez cette formule pour isoler la variable à trouver.`;
27
+ const correction = `La relation entre l'énergie électrique, la puissance et le temps est :
28
+ $$
29
+ E = P \\times t
30
+ $$
31
+
32
+ Pour résoudre ce problème, nous devons réorganiser la formule pour isoler la variable inconnue.
33
+
34
+ ${isCalculatingEnergy
35
+ ? `$$E = P \\times t = ${(0, frenchify_1.frenchify)(power)} \\times ${(0, frenchify_1.frenchify)(seconds)} = ${(0, frenchify_1.frenchify)(answer)}\\ \\text{J}$$`
36
+ : `$$P = \\frac{E}{t} = \\frac{${(0, frenchify_1.frenchify)(energy)}}{${(0, frenchify_1.frenchify)(seconds)}} = ${(0, frenchify_1.frenchify)(answer)}\\ \\text{W}$$`}`;
37
+ const question = {
38
+ answer: answer.toTree().toTex(),
39
+ instruction: questionText,
40
+ hint,
41
+ correction,
42
+ keys: ["P", "E", "t"],
43
+ answerFormat: "tex",
44
+ identifiers: { power, seconds, energy },
45
+ };
46
+ return question;
47
+ };
48
+ const getPropositions = (n, { answer, power, seconds, energy }) => {
49
+ const propositions = [];
50
+ (0, exercise_1.addValidProp)(propositions, answer);
51
+ const wrongAnswers = [
52
+ (0, round_1.roundSignificant)(power * seconds * 0.5, 2),
53
+ (0, round_1.roundSignificant)(energy * 0.1, 2),
54
+ (0, round_1.roundSignificant)(seconds / power, 2),
55
+ (0, round_1.roundSignificant)(power / seconds, 2),
56
+ ];
57
+ wrongAnswers.forEach((wrongAnswer) => {
58
+ (0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer);
59
+ });
60
+ while (propositions.length < n) {
61
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randfloat_1.randfloat)(0.1, 5, 2).toTree().toTex());
62
+ }
63
+ return (0, exercise_1.shuffleProps)(propositions, n);
64
+ };
65
+ const isAnswerValid = (ans, { answer }) => {
66
+ return ans === answer;
67
+ };
68
+ exports.electricPowerOrEnergyCalculation = {
69
+ id: "electricPowerOrEnergyCalculation",
70
+ label: "Calculer la puissance ou l'énergie électrique",
71
+ levels: ["1reSpé"],
72
+ isSingleStep: true,
73
+ sections: ["Électricité"],
74
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getElectricPowerOrEnergyQuestion, nb),
75
+ qcmTimer: 60,
76
+ freeTimer: 60,
77
+ getPropositions,
78
+ isAnswerValid,
79
+ subject: "Physique",
80
+ hasHintAndCorrection: true,
81
+ };
@@ -1,3 +1,10 @@
1
1
  export * from "./electricChargeFromIntensity";
2
2
  export * from "./electricEnergyFromPower";
3
+ export * from "./calculateVoltage";
4
+ export * from "./ohmicConductorOrGenerator";
5
+ export * from "./kirchhoffVoltageLaw";
6
+ export * from "./calculateIntensityInSerieOrParallel";
7
+ export * from "./calculateIntensity";
8
+ export * from "./ohmLaw";
9
+ export * from "./electricPowerOrEnergyCalculation";
3
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,oCAAoC,CAAC"}
@@ -16,3 +16,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./electricChargeFromIntensity"), exports);
18
18
  __exportStar(require("./electricEnergyFromPower"), exports);
19
+ __exportStar(require("./calculateVoltage"), exports);
20
+ __exportStar(require("./ohmicConductorOrGenerator"), exports);
21
+ __exportStar(require("./kirchhoffVoltageLaw"), exports);
22
+ __exportStar(require("./calculateIntensityInSerieOrParallel"), exports);
23
+ __exportStar(require("./calculateIntensity"), exports);
24
+ __exportStar(require("./ohmLaw"), exports);
25
+ __exportStar(require("./electricPowerOrEnergyCalculation"), exports);
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ isAsking: string;
4
+ uAB: number;
5
+ uED: number;
6
+ uDC: number;
7
+ };
8
+ export declare const kirchhoffVoltageLaw: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=kirchhoffVoltageLaw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kirchhoffVoltageLaw.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/kirchhoffVoltageLaw.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAoHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAarD,CAAC"}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.kirchhoffVoltageLaw = 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
+ const getKirchhoffVoltageLawQuestion = () => {
9
+ const exo = generateExercise();
10
+ const question = {
11
+ answer: exo.answer + "",
12
+ instruction: exo.instruction +
13
+ `![](https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/xpliveV2/activities/quizzes/generator/electricCircuit1.png)`,
14
+ keys: [],
15
+ answerFormat: "tex",
16
+ identifiers: {
17
+ isAsking: exo.isAsking,
18
+ uAB: exo.uAB,
19
+ uED: exo.uED,
20
+ uDC: exo.uDC,
21
+ },
22
+ };
23
+ return question;
24
+ };
25
+ const getPropositions = (n, { answer, isAsking, uAB, uDC, uED }) => {
26
+ const propositions = [];
27
+ (0, exercise_1.addValidProp)(propositions, answer);
28
+ generateProposition(isAsking, uAB, uED, uDC).forEach((value) => (0, exercise_1.tryToAddWrongProp)(propositions, value + ""));
29
+ while (propositions.length < n) {
30
+ let random = (0, randint_1.randint)(+answer - Math.min(5, +answer), +answer + 6, [
31
+ +answer,
32
+ ]);
33
+ (0, exercise_1.tryToAddWrongProp)(propositions, random + "");
34
+ }
35
+ return (0, exercise_1.shuffleProps)(propositions, n);
36
+ };
37
+ const isAnswerValid = (ans, { answer }) => {
38
+ return ans === answer;
39
+ };
40
+ const generateProposition = (isAsking, uAB, uED, uDC) => {
41
+ switch (isAsking) {
42
+ case "UAB":
43
+ return [uDC + uED, Math.abs(uDC - uED)];
44
+ case "UED":
45
+ return [uAB + uDC, uAB, uDC];
46
+ case "UDC":
47
+ return [uAB + uED, uAB, uED];
48
+ }
49
+ return [uAB - uED, uAB - uDC, uED + uDC];
50
+ };
51
+ const generateExercise = () => {
52
+ const uED = (0, randint_1.randint)(1, 60);
53
+ const uDC = (0, randint_1.randint)(1, 60);
54
+ const uAB = uED + uDC;
55
+ const isAsking = (0, random_1.random)(["UAB", "UDC", "UED"]);
56
+ const instruction = getInstruction(isAsking, uAB, uDC, uED);
57
+ const answer = getAnswer(isAsking, uAB, uDC, uED);
58
+ return {
59
+ instruction,
60
+ answer,
61
+ isAsking,
62
+ uAB,
63
+ uED,
64
+ uDC,
65
+ };
66
+ };
67
+ const getInstruction = (isAsking, uAB, uDC, uED) => {
68
+ switch (isAsking) {
69
+ case "UAB":
70
+ return `Un circuit est alimenté par une pile. \n \\
71
+ La tension $U_{DC}$ aux bornes de la diode est $${uDC}$ $V$. \n \\
72
+ La tension $U_{ED}$ aux bornes du conducteur ohmique est $${uED}$ $V$. \n \\
73
+ Cacluler la tension de la pile $U_{AB}$.`;
74
+ case "UED":
75
+ return `Un circuit est alimenté par une pile de $${uAB}$ $V$. \n \\
76
+ La tension $U_{DC}$ aux bornes de la diode est $${uDC}$ $V$. \n \\
77
+ Calculer la tension $U_{ED}$ aux bornes du conducteur ohmique.`;
78
+ case "UDC":
79
+ return `Un circuit est alimenté par une pile de $${uAB}$ $V$. \n \\
80
+ La tension $U_{ED}$ aux bornes du conducteur ohmique est $${uED}$ $V$. \n \\
81
+ Calculer la tension $U_{DC}$ aux bornes de la diode.`;
82
+ default:
83
+ return "";
84
+ }
85
+ };
86
+ const getAnswer = (isAsking, uAB, uDC, uED) => {
87
+ switch (isAsking) {
88
+ case "UAB":
89
+ return uDC + uED;
90
+ case "UED":
91
+ return uAB - uDC;
92
+ case "UDC":
93
+ return uAB - uED;
94
+ default:
95
+ return 0;
96
+ }
97
+ };
98
+ exports.kirchhoffVoltageLaw = {
99
+ id: "kirchhoffVoltageLaw",
100
+ label: "Application de la loi de maille",
101
+ levels: ["2nde"],
102
+ isSingleStep: true,
103
+ sections: ["Électricité"],
104
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getKirchhoffVoltageLawQuestion, nb),
105
+ qcmTimer: 60,
106
+ freeTimer: 60,
107
+ getPropositions,
108
+ isAnswerValid,
109
+ subject: "Physique",
110
+ };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ voltage: number;
4
+ current: number;
5
+ resistance: number;
6
+ target: string;
7
+ targetValue: number;
8
+ };
9
+ export declare const OhmLawExercise: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=ohmLaw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ohmLaw.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/ohmLaw.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAsJF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}