math-exercises 2.2.4 → 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 (224) 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/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/scaleUsage.js +1 -1
  20. package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
  21. package/lib/exercises/math/calcul/rounding/rounding.js +18 -0
  22. package/lib/exercises/math/calculLitteral/distributivity/allIdentities.d.ts.map +1 -1
  23. package/lib/exercises/math/calculLitteral/distributivity/allIdentities.js +1 -0
  24. package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts.map +1 -1
  25. package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.js +1 -0
  26. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivity.d.ts.map +1 -1
  27. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivity.js +31 -1
  28. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -1
  29. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +11 -2
  30. package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
  31. package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.js +21 -2
  32. package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
  33. package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.js +23 -2
  34. package/lib/exercises/math/calculLitteral/distributivity/simpleDistributivity.d.ts.map +1 -1
  35. package/lib/exercises/math/calculLitteral/distributivity/simpleDistributivity.js +17 -2
  36. package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
  37. package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.js +21 -2
  38. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
  39. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +26 -1
  40. package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
  41. package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +18 -2
  42. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
  43. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +19 -2
  44. package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
  45. package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.js +15 -2
  46. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
  47. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +20 -5
  48. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
  49. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.js +24 -1
  50. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.d.ts.map +1 -1
  51. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.js +20 -1
  52. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.d.ts.map +1 -1
  53. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.js +19 -3
  54. package/lib/exercises/math/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
  55. package/lib/exercises/math/calculLitteral/equation/fractionEquation.js +24 -8
  56. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  57. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +21 -2
  58. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
  59. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.js +24 -4
  60. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
  61. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.js +25 -5
  62. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
  63. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.js +19 -0
  64. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  65. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +1 -0
  66. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.d.ts +8 -0
  67. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.d.ts.map +1 -0
  68. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalForm.js +77 -0
  69. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts +8 -0
  70. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts.map +1 -0
  71. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.js +80 -0
  72. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +2 -0
  73. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  74. package/lib/exercises/math/calculLitteral/factorisation/index.js +2 -0
  75. package/lib/exercises/math/equaDiff/equaDiffGeneralForme.d.ts.map +1 -1
  76. package/lib/exercises/math/equaDiff/equaDiffGeneralForme.js +1 -0
  77. package/lib/exercises/math/functions/logarithm/log10PowerSimplifying.d.ts.map +1 -1
  78. package/lib/exercises/math/functions/logarithm/log10PowerSimplifying.js +12 -2
  79. package/lib/exercises/math/functions/trinoms/index.d.ts +2 -0
  80. package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
  81. package/lib/exercises/math/functions/trinoms/index.js +2 -0
  82. package/lib/exercises/math/functions/trinoms/solveEquationByFactorisation.d.ts +5 -0
  83. package/lib/exercises/math/functions/trinoms/solveEquationByFactorisation.d.ts.map +1 -0
  84. package/lib/exercises/math/functions/trinoms/solveEquationByFactorisation.js +44 -0
  85. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.d.ts +9 -0
  86. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -0
  87. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.js +134 -0
  88. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.d.ts +7 -0
  89. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.d.ts.map +1 -0
  90. package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.js +59 -0
  91. package/lib/exercises/math/geometry/vectors/scalarProductViaCoords.d.ts.map +1 -1
  92. package/lib/exercises/math/geometry/vectors/scalarProductViaCoords.js +1 -0
  93. package/lib/exercises/math/index.d.ts +1 -0
  94. package/lib/exercises/math/index.d.ts.map +1 -1
  95. package/lib/exercises/math/index.js +1 -0
  96. package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
  97. package/lib/exercises/math/percent/applyPercent.js +20 -2
  98. package/lib/exercises/math/sequences/arithmetic/arithmeticFindRandomTermFromTwoTerms.d.ts +11 -0
  99. package/lib/exercises/math/sequences/arithmetic/arithmeticFindRandomTermFromTwoTerms.d.ts.map +1 -0
  100. package/lib/exercises/math/sequences/arithmetic/arithmeticFindRandomTermFromTwoTerms.js +49 -0
  101. package/lib/exercises/math/sequences/arithmetic/index.d.ts +1 -0
  102. package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
  103. package/lib/exercises/math/sequences/arithmetic/index.js +1 -0
  104. package/lib/exercises/math/spaceGeometry/index.d.ts +2 -0
  105. package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -0
  106. package/lib/exercises/math/spaceGeometry/index.js +17 -0
  107. package/lib/exercises/math/spaceGeometry/vectors/index.d.ts +4 -0
  108. package/lib/exercises/math/spaceGeometry/vectors/index.d.ts.map +1 -0
  109. package/lib/exercises/math/spaceGeometry/vectors/index.js +19 -0
  110. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.d.ts +5 -0
  111. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.d.ts.map +1 -0
  112. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.js +52 -0
  113. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts +5 -0
  114. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts.map +1 -0
  115. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.js +62 -0
  116. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts +9 -0
  117. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -0
  118. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +54 -0
  119. package/lib/exercises/math/squareRoots/squareRootIdentities.js +3 -3
  120. package/lib/exercises/math/suites/sequencePlot.d.ts.map +1 -1
  121. package/lib/exercises/math/suites/sequencePlot.js +1 -2
  122. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
  123. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +1 -0
  124. package/lib/exercises/pc/calibrationCurveOfSolution.d.ts.map +1 -1
  125. package/lib/exercises/pc/calibrationCurveOfSolution.js +1 -0
  126. package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.d.ts.map +1 -1
  127. package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.js +1 -0
  128. package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.d.ts.map +1 -1
  129. package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.js +1 -0
  130. package/lib/exercises/pc/chemicalReactions/calculateSynthesisEfficiency.d.ts.map +1 -1
  131. package/lib/exercises/pc/chemicalReactions/calculateSynthesisEfficiency.js +1 -0
  132. package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.d.ts.map +1 -1
  133. package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.js +1 -0
  134. package/lib/exercises/pc/dosage/beerLambertRandomValue.d.ts.map +1 -1
  135. package/lib/exercises/pc/dosage/beerLambertRandomValue.js +1 -0
  136. package/lib/exercises/pc/dosage/concentrationCalculation.d.ts.map +1 -1
  137. package/lib/exercises/pc/dosage/concentrationCalculation.js +1 -0
  138. package/lib/exercises/pc/dosage/concentrationFromMassCalculation.d.ts.map +1 -1
  139. package/lib/exercises/pc/dosage/concentrationFromMassCalculation.js +1 -0
  140. package/lib/exercises/pc/electricity/calculateIntensity.js +1 -1
  141. package/lib/exercises/pc/electricity/calculateVoltage.d.ts.map +1 -1
  142. package/lib/exercises/pc/electricity/calculateVoltage.js +1 -0
  143. package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.d.ts.map +1 -1
  144. package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.js +1 -0
  145. package/lib/exercises/pc/electricity/ohmLaw.d.ts.map +1 -1
  146. package/lib/exercises/pc/electricity/ohmLaw.js +1 -0
  147. package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts.map +1 -1
  148. package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.js +1 -0
  149. package/lib/exercises/pc/energy/calorificValue.d.ts.map +1 -1
  150. package/lib/exercises/pc/energy/calorificValue.js +1 -0
  151. package/lib/exercises/pc/energy/combustionTransferEnergy.d.ts.map +1 -1
  152. package/lib/exercises/pc/energy/combustionTransferEnergy.js +1 -0
  153. package/lib/exercises/pc/energy/combustionTransferEnergy2.d.ts.map +1 -1
  154. package/lib/exercises/pc/energy/combustionTransferEnergy2.js +1 -0
  155. package/lib/exercises/pc/energy/efficencyOfConverter.d.ts.map +1 -1
  156. package/lib/exercises/pc/energy/efficencyOfConverter.js +1 -0
  157. package/lib/exercises/pc/energy/efficiencyCalculation.d.ts.map +1 -1
  158. package/lib/exercises/pc/energy/efficiencyCalculation.js +1 -0
  159. package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.d.ts.map +1 -1
  160. package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.js +1 -0
  161. package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.d.ts.map +1 -1
  162. package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.js +1 -0
  163. package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.d.ts.map +1 -1
  164. package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.js +1 -0
  165. package/lib/exercises/pc/forces/electroStaticForce.d.ts.map +1 -1
  166. package/lib/exercises/pc/forces/electroStaticForce.js +1 -0
  167. package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.d.ts.map +1 -1
  168. package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.js +1 -0
  169. package/lib/exercises/pc/forces/gravitationalForcePlanets.d.ts.map +1 -1
  170. package/lib/exercises/pc/forces/gravitationalForcePlanets.js +1 -0
  171. package/lib/exercises/pc/forces/massWeight.d.ts.map +1 -1
  172. package/lib/exercises/pc/forces/massWeight.js +1 -0
  173. package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
  174. package/lib/exercises/pc/motion/averageSpeed.js +1 -0
  175. package/lib/exercises/pc/motion/averageSpeedCalculation.d.ts.map +1 -1
  176. package/lib/exercises/pc/motion/averageSpeedCalculation.js +1 -0
  177. package/lib/exercises/pc/motion/motionReference.d.ts.map +1 -1
  178. package/lib/exercises/pc/motion/motionReference.js +1 -0
  179. package/lib/exercises/pc/pH.d.ts.map +1 -1
  180. package/lib/exercises/pc/pH.js +1 -0
  181. package/lib/exercises/pc/power/calculatePowerOfLight.d.ts.map +1 -1
  182. package/lib/exercises/pc/power/calculatePowerOfLight.js +1 -0
  183. package/lib/exercises/pc/spectral/spectralEnergy.d.ts.map +1 -1
  184. package/lib/exercises/pc/spectral/spectralEnergy.js +1 -0
  185. package/lib/exercises/pc/waves/lightDistanceConversion.d.ts.map +1 -1
  186. package/lib/exercises/pc/waves/lightDistanceConversion.js +1 -0
  187. package/lib/exercises/pc/waves/periodicWaveCelerity.d.ts.map +1 -1
  188. package/lib/exercises/pc/waves/periodicWaveCelerity.js +1 -0
  189. package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
  190. package/lib/exercises/pc/weight/calculateWeight.js +1 -0
  191. package/lib/exercises/pc/weight/weightOnTheMoon.d.ts.map +1 -1
  192. package/lib/exercises/pc/weight/weightOnTheMoon.js +1 -0
  193. package/lib/index.d.ts +28 -64
  194. package/lib/index.d.ts.map +1 -1
  195. package/lib/index.js +4 -0
  196. package/lib/math/geometry/spacePoint.d.ts +27 -0
  197. package/lib/math/geometry/spacePoint.d.ts.map +1 -0
  198. package/lib/math/geometry/spacePoint.js +80 -0
  199. package/lib/math/geometry/spaceVector.d.ts +28 -0
  200. package/lib/math/geometry/spaceVector.d.ts.map +1 -0
  201. package/lib/math/geometry/spaceVector.js +83 -0
  202. package/lib/math/numbers/decimals/decimal.d.ts +1 -0
  203. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  204. package/lib/math/numbers/decimals/decimal.js +8 -0
  205. package/lib/math/numbers/rationals/rational.d.ts +1 -0
  206. package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
  207. package/lib/math/numbers/rationals/rational.js +4 -0
  208. package/lib/playground.d.ts +2 -0
  209. package/lib/playground.d.ts.map +1 -0
  210. package/lib/playground.js +19 -0
  211. package/lib/server.d.ts +3 -0
  212. package/lib/server.d.ts.map +1 -1
  213. package/lib/server.js +6 -0
  214. package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
  215. package/lib/tree/nodes/equations/equationSolutionNode.js +8 -0
  216. package/lib/tree/nodes/node.d.ts +1 -0
  217. package/lib/tree/nodes/node.d.ts.map +1 -1
  218. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  219. package/lib/tree/nodes/operators/multiplyNode.js +8 -2
  220. package/lib/tree/nodes/operators/powerNode.js +1 -1
  221. package/lib/utils/alignTex.d.ts +2 -0
  222. package/lib/utils/alignTex.d.ts.map +1 -0
  223. package/lib/utils/alignTex.js +18 -0
  224. package/package.json +1 -1
package/lib/index.d.ts CHANGED
@@ -5,6 +5,9 @@ declare global {
5
5
  frenchify: () => string;
6
6
  toScientific: (decimals?: number) => AlgebraicNode;
7
7
  }
8
+ interface String {
9
+ toTree: () => AlgebraicNode;
10
+ }
8
11
  }
9
12
  /**
10
13
  * TODO
@@ -142,6 +145,9 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
142
145
  }> | import("./exercises/exercise").Exercise<{
143
146
  nb: string;
144
147
  rankAsked: number;
148
+ }> | import("./exercises/exercise").Exercise<{
149
+ nb: number;
150
+ rankAsked: number;
145
151
  }> | import("./exercises/exercise").Exercise<{
146
152
  a: number;
147
153
  b: number;
@@ -235,6 +241,12 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
235
241
  }> | import("./exercises/exercise").Exercise<{
236
242
  affinesCoeffs: number[][];
237
243
  operation: string;
244
+ }> | import("./exercises/exercise").Exercise<{
245
+ a: number;
246
+ b: number;
247
+ }> | import("./exercises/exercise").Exercise<{
248
+ a: number;
249
+ bOperand: number;
238
250
  }> | import("./exercises/exercise").Exercise<{
239
251
  b: number;
240
252
  c: number;
@@ -254,38 +266,6 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
254
266
  a: number;
255
267
  b: number;
256
268
  c: number;
257
- /**
258
- * TODO
259
- * Décimal : permettre facilement -0.xxx
260
- * Tree shaking export
261
- *
262
- * VEA:
263
- * -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
264
- * ->> faire le meme delire que pour les power mais pour les opposite ?
265
- * c'est à dire créer toutes les permuts en déplacant le moins qquepart
266
- * -> faire des nodes pour les Ensembles de nombre
267
- *
268
- * !-> choses pour lesquelles la v1 ne marchera pas :
269
- * !-- fractions non réduites
270
- * !-- nbs décimaux avec des 0
271
- * !-- nb quelconque de moins, genre -3*-4 ou -x/-y
272
- * !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
273
- *
274
- * Passer les sqrtNode en tree-iable
275
- *
276
- *
277
- *
278
- * !!!à fix :
279
- * ! fraction réductible
280
- * ! 0,20 au lieu de 0,2
281
- * ! moins partout dans fraction
282
- * !puissances négatives vers inverse fraction
283
- * ! simplification du ln
284
- * ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
285
- * !aussi en tapant [ puis diviser, le crochet passe en numérateur
286
- * ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
287
-
288
- */
289
269
  d: number;
290
270
  }> | import("./exercises/exercise").Exercise<{
291
271
  k: number;
@@ -692,6 +672,12 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
692
672
  quadrinomial: number[];
693
673
  leftbound: number;
694
674
  rightbound: number;
675
+ }> | import("./exercises/exercise").Exercise<{
676
+ a: number;
677
+ b: number;
678
+ type: number;
679
+ }> | import("./exercises/exercise").Exercise<{
680
+ coeffs: number[];
695
681
  }> | import("./exercises/exercise").Exercise<{
696
682
  a: number;
697
683
  k: number;
@@ -1209,6 +1195,12 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
1209
1195
  rank2: number;
1210
1196
  reason: number;
1211
1197
  value1: number;
1198
+ }> | import("./exercises/exercise").Exercise<{
1199
+ rank1: number;
1200
+ value1: number;
1201
+ rank2: number;
1202
+ value2: number;
1203
+ rankAsked: number;
1212
1204
  }> | import("./exercises/exercise").Exercise<{
1213
1205
  firstValue: number;
1214
1206
  reason: number;
@@ -1267,43 +1259,15 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
1267
1259
  type: number;
1268
1260
  nb: string;
1269
1261
  }> | import("./exercises/exercise").Exercise<{
1262
+ x: number;
1263
+ y: number;
1264
+ z: number;
1265
+ }> | import("./exercises/exercise").Exercise<{}> | import("./exercises/exercise").Exercise<{}> | import("./exercises/exercise").Exercise<{
1270
1266
  sqrtOperand: number;
1271
1267
  }> | import("./exercises/exercise").Exercise<{
1272
1268
  k: number;
1273
1269
  }> | import("./exercises/exercise").Exercise<{
1274
1270
  type: number;
1275
- /**
1276
- * TODO
1277
- * Décimal : permettre facilement -0.xxx
1278
- * Tree shaking export
1279
- *
1280
- * VEA:
1281
- * -> -3x est bien transofmré en -3*x, x*(-3) mais pas en -x*3
1282
- * ->> faire le meme delire que pour les power mais pour les opposite ?
1283
- * c'est à dire créer toutes les permuts en déplacant le moins qquepart
1284
- * -> faire des nodes pour les Ensembles de nombre
1285
- *
1286
- * !-> choses pour lesquelles la v1 ne marchera pas :
1287
- * !-- fractions non réduites
1288
- * !-- nbs décimaux avec des 0
1289
- * !-- nb quelconque de moins, genre -3*-4 ou -x/-y
1290
- * !-> pour ces choses là il faut obligatoirement parser la rpéonse élève ?
1291
- *
1292
- * Passer les sqrtNode en tree-iable
1293
- *
1294
- *
1295
- *
1296
- * !!!à fix :
1297
- * ! fraction réductible
1298
- * ! 0,20 au lieu de 0,2
1299
- * ! moins partout dans fraction
1300
- * !puissances négatives vers inverse fraction
1301
- * ! simplification du ln
1302
- * ! meileure gestion des [] : le clavier devriat pouvoir produire des left/right ;
1303
- * !aussi en tapant [ puis diviser, le crochet passe en numérateur
1304
- * ! espace tous les 3 chiffres dans un nb (le clavier doit le fournir aussi!)
1305
-
1306
- */
1307
1271
  a: number;
1308
1272
  x: number;
1309
1273
  b: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;CACF;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BE;AAEF,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAjCnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;KAA+B,CAAC;AACnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
package/lib/index.js CHANGED
@@ -30,6 +30,10 @@ const MathExercises = __importStar(require("./exercises/math"));
30
30
  const PCExercises = __importStar(require("./exercises/pc"));
31
31
  const infiniteNode_1 = require("./tree/nodes/numbers/infiniteNode");
32
32
  const toScientific_1 = require("./utils/numberPrototype/toScientific");
33
+ const variableNode_1 = require("./tree/nodes/variables/variableNode");
34
+ String.prototype.toTree = function () {
35
+ return new variableNode_1.VariableNode(this.valueOf());
36
+ };
33
37
  Number.prototype.toTree = function () {
34
38
  const value = this.valueOf();
35
39
  if (value === Infinity)
@@ -0,0 +1,27 @@
1
+ import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
2
+ type AleaBound = {
3
+ min?: number;
4
+ max?: number;
5
+ excludes?: number[];
6
+ };
7
+ export declare abstract class SpacePointConstructor {
8
+ static random(name: string, xOpts?: AleaBound, yOpts?: AleaBound, zOpts?: AleaBound): SpacePoint;
9
+ static randomDifferent(names: string[]): SpacePoint[];
10
+ }
11
+ export declare class SpacePoint {
12
+ name: string;
13
+ x: AlgebraicNode;
14
+ y: AlgebraicNode;
15
+ z: AlgebraicNode;
16
+ constructor(name: string, x: AlgebraicNode, y: AlgebraicNode, z: AlgebraicNode);
17
+ toTex(): string;
18
+ toTexWithCoords(): string;
19
+ toCoords(): string;
20
+ midpoint(B: SpacePoint, name?: string): SpacePoint;
21
+ distanceTo(B: SpacePoint): number;
22
+ equals(B: SpacePoint): boolean;
23
+ isAligned(B: SpacePoint, C: SpacePoint): void;
24
+ toGGBCommand(): string;
25
+ }
26
+ export {};
27
+ //# sourceMappingURL=spacePoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spacePoint.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/spacePoint.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAI/D,KAAK,SAAS,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AACrE,8BAAsB,qBAAqB;IACzC,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,SAAS,EACjB,KAAK,CAAC,EAAE,SAAS,EACjB,KAAK,CAAC,EAAE,SAAS,GAChB,UAAU;IAyBb,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE;CA4BvC;AAED,qBAAa,UAAU;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;gBAEf,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa;IAQlB,KAAK,IAAI,MAAM;IAIf,eAAe,IAAI,MAAM;IAKzB,QAAQ,IAAI,MAAM;IAIlB,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,SAAM,GAAG,UAAU;IAkB/C,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM;IAIjC,MAAM,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO;IAG9B,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU;IAOtC,YAAY;CAKb"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SpacePoint = exports.SpacePointConstructor = void 0;
4
+ const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
5
+ const randint_1 = require("../utils/random/randint");
6
+ class SpacePointConstructor {
7
+ static random(name, xOpts, yOpts, zOpts) {
8
+ const x = (0, randint_1.randint)(xOpts?.min ?? -9, xOpts?.max ?? 10, xOpts?.excludes ?? []);
9
+ const y = (0, randint_1.randint)(yOpts?.min ?? -9, yOpts?.max ?? 10, yOpts?.excludes ?? []);
10
+ const z = (0, randint_1.randint)(zOpts?.min ?? -9, zOpts?.max ?? 10, zOpts?.excludes ?? []);
11
+ return new SpacePoint(name, new numberNode_1.NumberNode(x), new numberNode_1.NumberNode(y), new numberNode_1.NumberNode(z));
12
+ }
13
+ static randomDifferent(names) {
14
+ const res = [];
15
+ const points = [];
16
+ for (let i = 0; i < names.length; i++) {
17
+ let x;
18
+ let y;
19
+ let z;
20
+ do {
21
+ x = (0, randint_1.randint)(-10, 11);
22
+ y = (0, randint_1.randint)(-10, 11);
23
+ z = (0, randint_1.randint)(-10, 11);
24
+ } while (points.some((point) => point[0] === x && point[1] === y && point[2] === z));
25
+ points.push([x, y, z]);
26
+ res.push(new SpacePoint(names[i], new numberNode_1.NumberNode(x), new numberNode_1.NumberNode(y), new numberNode_1.NumberNode(z)));
27
+ }
28
+ return res;
29
+ }
30
+ }
31
+ exports.SpacePointConstructor = SpacePointConstructor;
32
+ class SpacePoint {
33
+ constructor(name, x, y, z) {
34
+ this.name = name;
35
+ this.x = x;
36
+ this.y = y;
37
+ this.z = z;
38
+ }
39
+ toTex() {
40
+ return `${this.name}`;
41
+ }
42
+ toTexWithCoords() {
43
+ return `${this.name}\\left(${this.x.toTex()};${this.y.toTex()};${this.z.toTex()}\\right)`;
44
+ }
45
+ toCoords() {
46
+ return `\\left(${this.x.toTex()};${this.y.toTex()};${this.z.toTex()}\\right)`;
47
+ }
48
+ midpoint(B, name = "I") {
49
+ // const types = [this.x.type, this.y.type, B.x.type, B.y.type];
50
+ // if (types.some((type) => type !== NodeType.number)) {
51
+ // throw Error("general midpoint not implemented yet");
52
+ // }
53
+ // return new Point(
54
+ // name,
55
+ // new Rational((this.x as NumberNode).value + (B.x as NumberNode).value, 2)
56
+ // .simplify()
57
+ // .toTree(),
58
+ // new Rational((this.y as NumberNode).value + (B.y as NumberNode).value, 2)
59
+ // .simplify()
60
+ // .toTree(),
61
+ // );
62
+ throw Error("unimplemented");
63
+ }
64
+ distanceTo(B) {
65
+ throw Error("unimplemented");
66
+ }
67
+ equals(B) {
68
+ return this.x.equals(B.x) && this.y.equals(B.y) && this.z.equals(B.z);
69
+ }
70
+ isAligned(B, C) {
71
+ // const AB = VectorConstructor.fromPoints(this, B);
72
+ // const AC = VectorConstructor.fromPoints(this, C);
73
+ // return AB.isColinear(AC);
74
+ throw Error("unimplemented");
75
+ }
76
+ toGGBCommand() {
77
+ return `${this.name} = (${this.x.toMathString()}, ${this.y.toMathString()}, ${this.z.toMathString()}})`;
78
+ }
79
+ }
80
+ exports.SpacePoint = SpacePoint;
@@ -0,0 +1,28 @@
1
+ import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
2
+ import { Node } from "../../tree/nodes/node";
3
+ import { SpacePoint } from "./spacePoint";
4
+ export declare abstract class SpaceVectorConstructor {
5
+ static fromPoints(origin: SpacePoint, end: SpacePoint): SpaceVector;
6
+ static random(name: string, allowNull?: boolean): SpaceVector;
7
+ static randomDifferents(names: string[], allowNull?: boolean): SpaceVector[];
8
+ }
9
+ export declare class SpaceVector {
10
+ name: string;
11
+ tex: string;
12
+ x: AlgebraicNode;
13
+ y: AlgebraicNode;
14
+ z: AlgebraicNode;
15
+ constructor(name: string, x: AlgebraicNode, y: AlgebraicNode, z: AlgebraicNode);
16
+ toTex(): string;
17
+ toInlineCoordsTex(): string;
18
+ toTexWithCoords(): string;
19
+ isColinear(v: SpaceVector): boolean;
20
+ determinant(v: SpaceVector): AlgebraicNode;
21
+ times(k: AlgebraicNode, name?: string): SpaceVector;
22
+ scalarProduct(v: SpaceVector): Node;
23
+ add(v: SpaceVector): SpaceVector;
24
+ getNorm(): AlgebraicNode;
25
+ getEndPoint(startPoint: SpacePoint, name?: string): SpacePoint;
26
+ equals(v: SpaceVector): boolean;
27
+ }
28
+ //# sourceMappingURL=spaceVector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaceVector.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/spaceVector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAY,MAAM,uBAAuB,CAAC;AAQvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,8BAAsB,sBAAsB;IAC1C,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,WAAW;IAQnE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,WAAW;IAY1D,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,UAAO,GAAG,WAAW,EAAE;CAW1E;AAED,qBAAa,WAAW;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;gBAEf,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa;IASlB,KAAK,IAAI,MAAM;IAIf,iBAAiB,IAAI,MAAM;IAK3B,eAAe,IAAI,MAAM;IAMzB,UAAU,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO;IAGnC,WAAW,CAAC,CAAC,EAAE,WAAW,GAAG,aAAa;IAI1C,KAAK,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM;IAQrC,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI;IAInC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,WAAW;IAShC,OAAO,IAAI,aAAa;IAYxB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM;IAQjD,MAAM,CAAC,CAAC,EAAE,WAAW;CAGtB"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SpaceVector = exports.SpaceVectorConstructor = void 0;
4
+ const sqrtNode_1 = require("../../tree/nodes/functions/sqrtNode");
5
+ const addNode_1 = require("../../tree/nodes/operators/addNode");
6
+ const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
7
+ const powerNode_1 = require("../../tree/nodes/operators/powerNode");
8
+ const substractNode_1 = require("../../tree/nodes/operators/substractNode");
9
+ const randint_1 = require("../utils/random/randint");
10
+ const spacePoint_1 = require("./spacePoint");
11
+ class SpaceVectorConstructor {
12
+ static fromPoints(origin, end) {
13
+ return new SpaceVector(`${origin.name}${end.name}`, new substractNode_1.SubstractNode(end.x, origin.x).simplify(), new substractNode_1.SubstractNode(end.y, origin.y).simplify(), new substractNode_1.SubstractNode(end.z, origin.z).simplify());
14
+ }
15
+ static random(name, allowNull = true) {
16
+ let x;
17
+ let y;
18
+ let z;
19
+ do {
20
+ x = (0, randint_1.randint)(-10, 11);
21
+ y = (0, randint_1.randint)(-10, 11);
22
+ z = (0, randint_1.randint)(-10, 11);
23
+ } while (!allowNull && x === 0 && y === 0 && z === 0);
24
+ return new SpaceVector(name, x.toTree(), y.toTree(), z.toTree());
25
+ }
26
+ static randomDifferents(names, allowNull = true) {
27
+ const res = [];
28
+ for (let i = 0; i < names.length; i++) {
29
+ let vec;
30
+ do {
31
+ vec = SpaceVectorConstructor.random(names[i], allowNull);
32
+ } while (res.some((v) => v.equals(vec)));
33
+ res.push(vec);
34
+ }
35
+ return res;
36
+ }
37
+ }
38
+ exports.SpaceVectorConstructor = SpaceVectorConstructor;
39
+ class SpaceVector {
40
+ constructor(name, x, y, z) {
41
+ this.name = name;
42
+ this.tex = `\\overrightarrow{${name}}`;
43
+ this.x = x;
44
+ this.y = y;
45
+ this.z = z;
46
+ }
47
+ toTex() {
48
+ return `\\overrightarrow{${this.name}}`;
49
+ }
50
+ toInlineCoordsTex() {
51
+ return `\\left(${this.x.simplify().toTex()};${this.y
52
+ .simplify()
53
+ .toTex()};${this.z.simplify().toTex()}\\right)`;
54
+ }
55
+ toTexWithCoords() {
56
+ return `\\overrightarrow{${this.name}}\\begin{pmatrix}${this.x.toTex()} \\\\ ${this.y.toTex()} \\\\ ${this.z.toTex()} \\end{pmatrix}`;
57
+ }
58
+ isColinear(v) {
59
+ throw Error("unimplemented");
60
+ }
61
+ determinant(v) {
62
+ throw Error("unimplemented");
63
+ }
64
+ times(k, name) {
65
+ return new SpaceVector(name ?? "v", new multiplyNode_1.MultiplyNode(this.x, k).simplify(), new multiplyNode_1.MultiplyNode(this.y, k).simplify(), new multiplyNode_1.MultiplyNode(this.z, k).simplify());
66
+ }
67
+ scalarProduct(v) {
68
+ throw Error("unimplemented");
69
+ }
70
+ add(v) {
71
+ return new SpaceVector(`${this.name}+${v.name}`, new addNode_1.AddNode(this.x, v.x).simplify(), new addNode_1.AddNode(this.y, v.y).simplify(), new addNode_1.AddNode(this.z, v.z).simplify());
72
+ }
73
+ getNorm() {
74
+ return new sqrtNode_1.SqrtNode(new addNode_1.AddNode(new powerNode_1.SquareNode(this.x), new addNode_1.AddNode(new powerNode_1.SquareNode(this.y), new powerNode_1.SquareNode(this.z)))).simplify();
75
+ }
76
+ getEndPoint(startPoint, name) {
77
+ return new spacePoint_1.SpacePoint(name ?? "B", new addNode_1.AddNode(startPoint.x, this.x).simplify(), new addNode_1.AddNode(startPoint.y, this.y).simplify(), new addNode_1.AddNode(startPoint.z, this.z).simplify());
78
+ }
79
+ equals(v) {
80
+ return this.x.equals(v.x) && this.y.equals(v.y) && this.z.equals(v.z);
81
+ }
82
+ }
83
+ exports.SpaceVector = SpaceVector;
@@ -28,6 +28,7 @@ export declare class Decimal implements Nombre {
28
28
  multiplyByPowerOfTen(power: number): Decimal;
29
29
  toScientificPart(): number;
30
30
  toScientificNotation(decimals?: number): NumberNode | MultiplyNode;
31
+ getDigitAtRank(rank: number): number;
31
32
  toRational(): Rational | import("../integer/integer").Integer;
32
33
  toTree(): NumberNode;
33
34
  toPercentNode(): PercentNode;
@@ -1 +1 @@
1
- {"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/decimals/decimal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,UAAyC,CAAC;AACxE,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,GAAE,MAAU,GAAG,MAAM;IAY1E,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OA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SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;IAMpE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAK/D,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;CAMrD;AAED,qBAAa,OAAQ,YAAW,MAAM;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,aAAsB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;gBACR,KAAK,EAAE,MAAM,GAAG,MAAM;IASlC,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIhC,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAkClC,gBAAgB;IA6BhB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM;IAwCtC,cAAc,CAAC,IAAI,EAAE,MAAM;IAS3B,UAAU;IAMV,MAAM;IAIN,aAAa;CAGd"}
@@ -154,6 +154,14 @@ class Decimal {
154
154
  return new multiplyNode_1.MultiplyNode(decNode, new numberNode_1.NumberNode(10));
155
155
  return new multiplyNode_1.MultiplyNode(decNode, new powerNode_1.PowerNode(new numberNode_1.NumberNode(10), new numberNode_1.NumberNode(power)));
156
156
  }
157
+ getDigitAtRank(rank) {
158
+ if (rank >= 0) {
159
+ return Number(this.intPart.toString()[this.intPart.toString().length - 1 - rank]);
160
+ }
161
+ else {
162
+ return Number(this.decimalPart[-rank - 1]);
163
+ }
164
+ }
157
165
  toRational() {
158
166
  return new rational_1.Rational(this.multiplyByPowerOfTen(this.precision).value, 10 ** this.precision).simplify();
159
167
  }
@@ -23,6 +23,7 @@ export declare class Rational implements Nombre {
23
23
  toTex(): string;
24
24
  add(nb: Nombre): Nombre;
25
25
  multiply(nb: Nombre): Rational | Integer;
26
+ reverse(shouldSimplify: boolean): Nombre;
26
27
  divide(nb: Nombre): Nombre;
27
28
  opposite(): Rational;
28
29
  toTree(opts?: NodeOptions): FractionNode | OppositeNode;
@@ -1 +1 @@
1
- {"version":3,"file":"rational.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/rationals/rational.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAQ,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAIvE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,8BAAsB,mBAAmB;IACvC;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAM,GAAE,MAAW;IAW7C,MAAM,CAAC,kBAAkB,CAAC,GAAG,GAAE,MAAW;IAO1C,MAAM,CAAC,0BAA0B,CAAC,GAAG,GAAE,MAAW;CAQnD;AAED,qBAAa,QAAS,YAAW,MAAM;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;gBAEL,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAYlD,MAAM,CAAC,CAAC,EAAE,MAAM;IAGhB,KAAK;IAML,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAkBvB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO;IAgBxC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAgB1B,QAAQ,IAAI,QAAQ;IAIpB,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW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I,OAAO,GAAG,QAAQ;CAS/B"}
@@ -96,6 +96,10 @@ class Rational {
96
96
  }
97
97
  throw Error("not implemented yet");
98
98
  }
99
+ reverse(shouldSimplify) {
100
+ const frac = new Rational(this.denum, this.num);
101
+ return shouldSimplify ? frac.simplify() : frac;
102
+ }
99
103
  divide(nb) {
100
104
  switch (nb.type) {
101
105
  case nombre_1.NumberType.Integer: {
@@ -0,0 +1,2 @@
1
+ export declare const playground: () => void;
2
+ //# sourceMappingURL=playground.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU,YAgBtB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.playground = void 0;
4
+ const affine_1 = require("./math/polynomials/affine");
5
+ const addNode_1 = require("./tree/nodes/operators/addNode");
6
+ const multiplyNode_1 = require("./tree/nodes/operators/multiplyNode");
7
+ const random_1 = require("./utils/random");
8
+ const shuffle_1 = require("./utils/shuffle");
9
+ const playground = () => {
10
+ const affines = affine_1.AffineConstructor.differentRandoms(3);
11
+ const permut = [
12
+ (0, shuffle_1.shuffle)([affines[0], affines[1]]),
13
+ (0, shuffle_1.shuffle)([affines[0], affines[2]]),
14
+ ];
15
+ const operation = (0, random_1.random)(["add", "substract"]);
16
+ const statementTree = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(permut[0][0].toTree(), permut[0][1].toTree()), new multiplyNode_1.MultiplyNode(permut[1][0].toTree(), permut[1][1].toTree()));
17
+ console.log(statementTree.simplify().toTex());
18
+ };
19
+ exports.playground = playground;
package/lib/server.d.ts CHANGED
@@ -5,5 +5,8 @@ declare global {
5
5
  frenchify: () => string;
6
6
  toScientific: (decimals?: number) => AlgebraicNode;
7
7
  }
8
+ interface String {
9
+ toTree: () => AlgebraicNode;
10
+ }
8
11
  }
9
12
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAkC3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;CACF"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAuC3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;IACD,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;KAC7B;CACF"}
package/lib/server.js CHANGED
@@ -36,10 +36,14 @@ const cors_1 = __importDefault(require("cors"));
36
36
  const numberNode_1 = require("./tree/nodes/numbers/numberNode");
37
37
  const infiniteNode_1 = require("./tree/nodes/numbers/infiniteNode");
38
38
  const toScientific_1 = require("./utils/numberPrototype/toScientific");
39
+ const variableNode_1 = require("./tree/nodes/variables/variableNode");
39
40
  const jsonParser = body_parser_1.default.json();
40
41
  const mathExercises = Object.values(MathExercises);
41
42
  const pcExercises = Object.values(PCExercises);
42
43
  const allExercises = [...mathExercises, ...pcExercises];
44
+ String.prototype.toTree = function () {
45
+ return new variableNode_1.VariableNode(this.valueOf());
46
+ };
43
47
  Number.prototype.toTree = function () {
44
48
  const value = this.valueOf();
45
49
  if (value === Infinity)
@@ -59,7 +63,9 @@ const runServer = () => {
59
63
  const app = (0, express_1.default)();
60
64
  app.use((0, cors_1.default)());
61
65
  console.log("math exos", mathExercises.length);
66
+ console.log("math hints", mathExercises.filter((exo) => exo.hasHintAndCorrection).length);
62
67
  console.log("pc exos", pcExercises.length);
68
+ // playground();
63
69
  app.get("/", (req, res) => {
64
70
  res.json(allExercises);
65
71
  });
@@ -1 +1 @@
1
- {"version":3,"file":"equationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/equations/equationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,KAAK,2BAA2B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC7E,qBAAa,oBAAqB,YAAW,IAAI;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,YAAY,EAAE,eAAe,EAC7B,MAAM,CAAC,EAAE,2BAA2B;IActC,cAAc;IAId,SAAS;IAUT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAQpC,YAAY;IAGZ,QAAQ;IAGR,KAAK;CAGN"}
1
+ {"version":3,"file":"equationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/equations/equationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,KAAK,2BAA2B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC7E,qBAAa,oBAAqB,YAAW,IAAI;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,YAAY,EAAE,eAAe,EAC7B,MAAM,CAAC,EAAE,2BAA2B;IActC,cAAc;IAId,SAAS;IAiBT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAQpC,YAAY;IAGZ,QAAQ;IAGR,KAAK;CAGN"}
@@ -25,6 +25,14 @@ class EquationSolutionNode {
25
25
  if (this.opts?.allowRawRightChildAsSolution)
26
26
  res.push(solTex);
27
27
  }
28
+ else {
29
+ const solTex = this.solutionsSet.elements.map((e) => e.toTex());
30
+ res.push(solTex.map((e) => `${this.variable}=${e}`).join("\\text{ ou }"));
31
+ if (this.opts?.allowRawRightChildAsSolution) {
32
+ res.push(solTex.join(";"));
33
+ res.push(solTex.join("\\text{ ou }"));
34
+ }
35
+ }
28
36
  return res;
29
37
  }
30
38
  toEquivalentNodes(opts) {
@@ -29,6 +29,7 @@ export type ToTexOptions = {
29
29
  scientific?: number;
30
30
  hideUnit?: boolean;
31
31
  notScientific?: boolean;
32
+ forceNoSimplification?: boolean;
32
33
  };
33
34
  export interface Node {
34
35
  type: NodeType;
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/node.ts"],"names":[],"mappings":"AAIA,oBAAY,QAAQ;IAClB,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,GAAG,IAAA;IACH,UAAU,IAAA;IACV,KAAK,IAAA;IACL,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,OAAO,KAAA;IACP,MAAM,KAAA;CACP;AACD,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC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O,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,iBAAiB,QAAS,aAAa,EAAE,SAWrD,CAAC;AACF,qBAAa,YAAa,YAAW,uBAAuB;IAC1D,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB,OAAO,aAGL;IAEF,YAAY,IAAI,MAAM;IAItB,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM;IA4DlC,SAAS;IAkDT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,YAAY,EAAE;IAwFrD,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAQ5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIrC,IAAI;IAGJ,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IA0H/C,MAAM,CAAC,IAAI,EAAE,aAAa;CAU3B"}
@@ -52,7 +52,8 @@ class MultiplyNode {
52
52
  toTex(opts) {
53
53
  let leftTex = this.leftChild.toTex(opts);
54
54
  let rightTex = this.rightChild.toTex(opts);
55
- if ((0, numberNode_1.isNumberNode)(this.leftChild) &&
55
+ if (!opts?.forceNoSimplification &&
56
+ (0, numberNode_1.isNumberNode)(this.leftChild) &&
56
57
  this.leftChild.value === 1 &&
57
58
  opts?.scientific === undefined) {
58
59
  return rightTex;
@@ -68,7 +69,7 @@ class MultiplyNode {
68
69
  }
69
70
  if (needBrackets)
70
71
  rightTex = `\\left(${rightTex}\\right)`;
71
- if (leftTex === "-1") {
72
+ if (leftTex === "-1" && !opts?.forceNoSimplification) {
72
73
  // if (!isNumberNode(this.rightChild)) {
73
74
  return "-" + rightTex;
74
75
  // }
@@ -271,6 +272,11 @@ class MultiplyNode {
271
272
  return new fractionNode_1.FractionNode(numNode, denumNode).simplify(opts);
272
273
  }
273
274
  const simplifyExternalNodes = (a, b) => {
275
+ if ((0, variableNode_1.isVariableNode)(a) && (0, variableNode_1.isVariableNode)(b)) {
276
+ if (a.name === b.name) {
277
+ return new powerNode_1.SquareNode(a);
278
+ }
279
+ }
274
280
  if ((0, numberNode_1.isNumberNode)(a) && (0, numberNode_1.isNumberNode)(b)) {
275
281
  return new numberNode_1.NumberNode((0, round_1.round)(a.value * b.value, 12));
276
282
  }
@@ -171,7 +171,7 @@ class PowerNode {
171
171
  return new PowerNode(leftSimplified.leftChild, new multiplyNode_1.MultiplyNode(rightSimplified, leftSimplified.rightChild).simplify(opts)).simplify(opts);
172
172
  }
173
173
  if ((0, multiplyNode_1.isMultiplyNode)(leftSimplified)) {
174
- return new multiplyNode_1.MultiplyNode(new PowerNode(leftSimplified.leftChild, rightSimplified), new PowerNode(leftSimplified.rightChild, rightSimplified));
174
+ return new multiplyNode_1.MultiplyNode(new PowerNode(leftSimplified.leftChild, rightSimplified), new PowerNode(leftSimplified.rightChild, rightSimplified)).simplify(opts);
175
175
  }
176
176
  if (!opts?.keepPowers &&
177
177
  (0, numberNode_1.isNumberNode)(copy.rightChild) &&
@@ -0,0 +1,2 @@
1
+ export declare function alignTex(arr: string[][] | string): string;
2
+ //# sourceMappingURL=alignTex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alignTex.d.ts","sourceRoot":"","sources":["../../src/utils/alignTex.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,UAehD"}