math-exercises 3.0.55 → 3.0.57

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 (147) hide show
  1. package/lib/exercises/math/calcul/arithmetics/index.d.ts +1 -0
  2. package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
  4. package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts +8 -0
  5. package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts.map +1 -0
  6. package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.js +87 -0
  7. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +2 -2
  9. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +7 -1
  11. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts.map +1 -1
  12. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.js +65 -13
  13. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  14. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +43 -0
  15. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts.map +1 -1
  16. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.js +23 -0
  17. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts.map +1 -1
  18. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.js +23 -0
  19. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts.map +1 -1
  20. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +49 -0
  21. package/lib/exercises/math/conversion/capacityConversion.d.ts.map +1 -1
  22. package/lib/exercises/math/conversion/capacityConversion.js +68 -12
  23. package/lib/exercises/math/conversion/hoursToDecimal.d.ts.map +1 -1
  24. package/lib/exercises/math/conversion/hoursToDecimal.js +73 -15
  25. package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
  26. package/lib/exercises/math/conversion/lengthConversion.js +55 -6
  27. package/lib/exercises/math/conversion/massConversion.d.ts.map +1 -1
  28. package/lib/exercises/math/conversion/massConversion.js +72 -16
  29. package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
  30. package/lib/exercises/math/conversion/volumeConversion.js +72 -12
  31. package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/affines/signFunction.js +23 -11
  33. package/lib/exercises/math/functions/basics/imageFunctionGeogebra.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/basics/imageFunctionGeogebra.js +16 -0
  35. package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
  36. package/lib/exercises/math/geometry/areas/triangleArea.js +34 -2
  37. package/lib/exercises/math/geometry/areas/triangleAreaV2.d.ts.map +1 -1
  38. package/lib/exercises/math/geometry/areas/triangleAreaV2.js +54 -8
  39. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
  40. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +12 -5
  41. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.d.ts.map +1 -1
  42. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.js +29 -1
  43. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.d.ts.map +1 -1
  44. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.js +25 -1
  45. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -1
  46. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +68 -29
  47. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts.map +1 -1
  48. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.js +56 -4
  49. package/lib/exercises/math/geometry/lines/directorVectorFromAnother.d.ts.map +1 -1
  50. package/lib/exercises/math/geometry/lines/directorVectorFromAnother.js +1 -0
  51. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts.map +1 -1
  52. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.js +71 -25
  53. package/lib/exercises/math/geometry/lines/index.d.ts +1 -0
  54. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  55. package/lib/exercises/math/geometry/lines/index.js +1 -0
  56. package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts +6 -0
  57. package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts.map +1 -1
  58. package/lib/exercises/math/geometry/vectors/findCoordForAligment.js +161 -92
  59. package/lib/exercises/math/geometry/vectors/index.d.ts +1 -0
  60. package/lib/exercises/math/geometry/vectors/index.d.ts.map +1 -1
  61. package/lib/exercises/math/geometry/vectors/index.js +1 -0
  62. package/lib/exercises/math/geometry/volumes/coneVolume.d.ts.map +1 -1
  63. package/lib/exercises/math/geometry/volumes/coneVolume.js +68 -6
  64. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
  65. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +55 -11
  66. package/lib/exercises/math/geometry/volumes/sphereVolume.d.ts.map +1 -1
  67. package/lib/exercises/math/geometry/volumes/sphereVolume.js +31 -3
  68. package/lib/exercises/math/geometry/volumes/volumeOfCube.d.ts.map +1 -1
  69. package/lib/exercises/math/geometry/volumes/volumeOfCube.js +46 -18
  70. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithSquareOrRectBase.d.ts.map +1 -1
  71. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithSquareOrRectBase.js +114 -63
  72. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.d.ts.map +1 -1
  73. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.js +102 -64
  74. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.d.ts.map +1 -1
  75. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.js +99 -53
  76. package/lib/exercises/math/limits/polynomLimit.d.ts +1 -1
  77. package/lib/exercises/math/limits/polynomLimit.d.ts.map +1 -1
  78. package/lib/exercises/math/limits/polynomLimit.js +28 -9
  79. package/lib/exercises/math/limits/polynomLimitNoFI.d.ts +1 -1
  80. package/lib/exercises/math/limits/polynomLimitNoFI.d.ts.map +1 -1
  81. package/lib/exercises/math/limits/polynomLimitNoFI.js +29 -10
  82. package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
  83. package/lib/exercises/math/powers/calculateNegativePower.js +59 -16
  84. package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
  85. package/lib/exercises/math/powers/decimalToScientific.js +55 -11
  86. package/lib/exercises/math/powers/index.d.ts +1 -0
  87. package/lib/exercises/math/powers/index.d.ts.map +1 -1
  88. package/lib/exercises/math/powers/index.js +1 -0
  89. package/lib/exercises/math/powers/powersDivision.d.ts +5 -2
  90. package/lib/exercises/math/powers/powersDivision.d.ts.map +1 -1
  91. package/lib/exercises/math/powers/powersDivision.js +68 -53
  92. package/lib/exercises/math/powers/powersMixOperations.d.ts +1 -0
  93. package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
  94. package/lib/exercises/math/powers/powersMixOperations.js +88 -17
  95. package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts +10 -0
  96. package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts.map +1 -0
  97. package/lib/exercises/math/powers/powersOfTenMixOperations.js +129 -0
  98. package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
  99. package/lib/exercises/math/powers/powersOfTenToDecimal.js +32 -3
  100. package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
  101. package/lib/exercises/math/powers/powersProduct.js +1 -0
  102. package/lib/exercises/math/powers/scientificToDecimal.d.ts.map +1 -1
  103. package/lib/exercises/math/powers/scientificToDecimal.js +50 -10
  104. package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
  105. package/lib/exercises/math/primitive/polynomialPrimitive.js +1 -0
  106. package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts.map +1 -1
  107. package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.js +50 -3
  108. package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.d.ts.map +1 -1
  109. package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.js +32 -0
  110. package/lib/exercises/math/trigonometry/remarkableValues.d.ts.map +1 -1
  111. package/lib/exercises/math/trigonometry/remarkableValues.js +8 -0
  112. package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
  113. package/lib/exercises/math/trigonometry/trigonometry.js +67 -1
  114. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
  115. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +89 -0
  116. package/lib/index.d.ts +22 -4
  117. package/lib/index.d.ts.map +1 -1
  118. package/lib/math/geometry/angle.d.ts.map +1 -1
  119. package/lib/math/geometry/angle.js +0 -5
  120. package/lib/math/geometry/vector.d.ts +3 -0
  121. package/lib/math/geometry/vector.d.ts.map +1 -1
  122. package/lib/math/geometry/vector.js +25 -0
  123. package/lib/math/numbers/decimals/decimal.d.ts +1 -0
  124. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  125. package/lib/math/numbers/decimals/decimal.js +2 -0
  126. package/lib/math/systems/generalSystem.d.ts +6 -1
  127. package/lib/math/systems/generalSystem.d.ts.map +1 -1
  128. package/lib/math/systems/generalSystem.js +137 -0
  129. package/lib/math/utils/arithmetic/lcm.d.ts +2 -0
  130. package/lib/math/utils/arithmetic/lcm.d.ts.map +1 -0
  131. package/lib/math/utils/arithmetic/lcm.js +5 -0
  132. package/lib/playground.d.ts.map +1 -1
  133. package/lib/playground.js +1 -3
  134. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  135. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  136. package/lib/tree/nodes/equations/equalNode.d.ts +7 -1
  137. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  138. package/lib/tree/nodes/equations/equalNode.js +17 -9
  139. package/lib/tree/nodes/operators/addNode.js +1 -1
  140. package/lib/tree/nodes/operators/fractionNode.d.ts +2 -2
  141. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  142. package/lib/tree/nodes/operators/fractionNode.js +37 -17
  143. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  144. package/lib/tree/nodes/operators/powerNode.js +5 -0
  145. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  146. package/lib/tree/nodes/sets/intervalNode.js +3 -1
  147. package/package.json +1 -1
@@ -9,7 +9,7 @@ import { Rational } from "../../../math/numbers/rationals/rational.js";
9
9
  import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
10
10
  import { AddNode, isAddNode } from "./addNode.js";
11
11
  import { PowerNode, isPowerNode } from "./powerNode.js";
12
- import { SubstractNode, isSubstractNode } from "./substractNode.js";
12
+ import { SubstractNode, isSubstractNode, substract } from "./substractNode.js";
13
13
  import { parseToMonomNode } from "../polynomials/monomNode.js";
14
14
  export function isFractionNode(a) {
15
15
  return isOperatorNode(a) && a.id === OperatorIds.fraction;
@@ -100,7 +100,7 @@ export class FractionNode {
100
100
  denum = denum / 5;
101
101
  return denum === 1;
102
102
  }
103
- toTex() {
103
+ toTex(texOpts) {
104
104
  //! this stinks
105
105
  //! to tex shouldn't be doing all of this
106
106
  //! we need a "canonicalToTex" or a "purifyTex" in order to print correct latex without simplifying mathematically
@@ -110,17 +110,17 @@ export class FractionNode {
110
110
  this.leftChild.child.value > 0) ||
111
111
  (isNumberNode(this.leftChild) && this.leftChild.value < 0))) {
112
112
  return `-\\frac{${this.leftChild
113
- .toTex()
114
- .slice(1)}}{${this.rightChild.toTex()}}`;
113
+ .toTex(texOpts)
114
+ .slice(1)}}{${this.rightChild.toTex(texOpts)}}`;
115
115
  }
116
116
  if (!this.opts?.allowMinusAnywhereInFraction &&
117
117
  (isOppositeNode(this.rightChild) ||
118
118
  (isNumberNode(this.rightChild) && this.rightChild.value < 0))) {
119
- return `-\\frac{${this.leftChild.toTex()}}{${this.rightChild
120
- .toTex()
119
+ return `-\\frac{${this.leftChild.toTex(texOpts)}}{${this.rightChild
120
+ .toTex(texOpts)
121
121
  .slice(1)}}`;
122
122
  }
123
- return `\\frac{${this.leftChild.toTex()}}{${this.rightChild.toTex()}}`;
123
+ return `\\frac{${this.leftChild.toTex(texOpts)}}{${this.rightChild.toTex(texOpts)}}`;
124
124
  }
125
125
  evaluate(vars) {
126
126
  return this.leftChild.evaluate(vars) / this.rightChild.evaluate(vars);
@@ -225,20 +225,14 @@ export class FractionNode {
225
225
  if (opts?.forceDistributeFractions &&
226
226
  isNumberNode(denum) &&
227
227
  parsedMonom) {
228
- return new MultiplyNode(new FractionNode(parsedMonom.a, denum), parsedMonom.variable.toTree()).simplify(opts);
228
+ return new MultiplyNode(new FractionNode(parsedMonom.a, denum), parsedMonom.toTree()).simplify(opts);
229
229
  }
230
230
  if (isFractionNode(denum) && isFractionNode(num)) {
231
231
  return new MultiplyNode(num, new FractionNode(denum.rightChild, denum.leftChild)).simplify(opts);
232
232
  }
233
- //!ya mieux à faire pour gérer tous les cas d'un coup
234
- //!s'insiprer de multiply
235
- if (isPowerNode(num) &&
236
- isPowerNode(denum) &&
237
- num.rightChild.isNumeric &&
238
- denum.rightChild.isNumeric &&
239
- num.rightChild.evaluate() === denum.rightChild.evaluate()) {
240
- return new PowerNode(new FractionNode(num.leftChild, denum.leftChild), num.rightChild).simplify(opts);
241
- }
233
+ const powerSimp = powerSimplify(num, denum, opts);
234
+ if (powerSimp)
235
+ return powerSimp;
242
236
  if (num.equals(denum))
243
237
  return new NumberNode(1);
244
238
  return null;
@@ -312,3 +306,29 @@ export class FractionNode {
312
306
  throw new Error("unimplemented derivative");
313
307
  }
314
308
  }
309
+ const powerSimplify = (num, denum, opts) => {
310
+ //!ya mieux à faire pour gérer tous les cas d'un coup
311
+ //!s'insiprer de multiply
312
+ if (isPowerNode(num) &&
313
+ isPowerNode(denum) &&
314
+ num.leftChild.evaluate() === denum.leftChild.evaluate()) {
315
+ return new PowerNode(num.leftChild, substract(num.rightChild, denum.rightChild)).simplify(opts);
316
+ }
317
+ if (isPowerNode(num) &&
318
+ isNumberNode(denum) &&
319
+ num.leftChild.evaluate() === denum.evaluate()) {
320
+ return new PowerNode(num.leftChild, substract(num.rightChild, 1)).simplify(opts);
321
+ }
322
+ if (isPowerNode(denum) &&
323
+ isNumberNode(num) &&
324
+ num.evaluate() === denum.leftChild.evaluate()) {
325
+ return new PowerNode(num, substract(1, denum.rightChild)).simplify(opts);
326
+ }
327
+ if (isPowerNode(num) &&
328
+ isPowerNode(denum) &&
329
+ num.rightChild.isNumeric &&
330
+ denum.rightChild.isNumeric &&
331
+ num.rightChild.evaluate() === denum.rightChild.evaluate()) {
332
+ return new PowerNode(new FractionNode(num.leftChild, denum.leftChild), num.rightChild).simplify(opts);
333
+ }
334
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"powerNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/powerNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGrE,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,UAAU,CAErD;AACD,eAAO,MAA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G,SAAS,GAAG,aAAa;CAcxD;AAED,qBAAa,UAAW,SAAQ,SAAS;gBAC3B,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,WAAW;CAIrD"}
@@ -112,6 +112,11 @@ export class PowerNode {
112
112
  if (isNumberNode(rightSimplified) && rightSimplified.value === 1) {
113
113
  return leftSimplified;
114
114
  }
115
+ if (opts?.calculatePowers &&
116
+ isNumberNode(leftSimplified) &&
117
+ isNumberNode(rightSimplified)) {
118
+ return new NumberNode(leftSimplified.value ** rightSimplified.value);
119
+ }
115
120
  if (isPowerNode(leftSimplified)) {
116
121
  return new PowerNode(leftSimplified.leftChild, new MultiplyNode(rightSimplified, leftSimplified.rightChild).simplify(opts)).simplify(opts);
117
122
  }
@@ -1 +1 @@
1
- {"version":3,"file":"intervalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/intervalNode.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,eAAe,EAAkB,MAAM,uBAAuB,CAAC;AAOxE,OAAO,EAAW,WAAW,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,eAAe,EAAY,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAa,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,8BAAsB,uBAAuB;IAC3C,MAAM,CAAC,MAAM;IA2Cb,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,MAAM;IAYlC,MAAM,C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GZ,aAAa;IAGb,QAAQ,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO;IAanC,UAAU,CAAC,QAAQ,EAAE,YAAY;IAEjC,YAAY,CAAC,QAAQ,EAAE,YAAY;IA0DnC,YAAY;IAIZ,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,GAAG,iBAAiB;CAkDhE"}
@@ -252,7 +252,9 @@ export class IntervalNode {
252
252
  if (ordered[0].includes(ordered[1].a) ||
253
253
  Math.abs(thisA - otherA) < 0.0000000001) {
254
254
  if (Math.abs(orderedEv[0][1] - orderedEv[1][0]) < 0.0000000001) {
255
- return new DiscreteSetNode([ordered[1].a]);
255
+ if (ordered[0].isRightClosed() && ordered[1].isLeftClosed())
256
+ return new DiscreteSetNode([ordered[1].a]);
257
+ return EmptySet;
256
258
  }
257
259
  let leftBracket = "[";
258
260
  if (Math.abs(thisA - otherA) < 0.0000000001) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.55",
4
+ "version": "3.0.57",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [