pimath 0.0.123 → 0.0.125

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 (132) hide show
  1. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  2. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30_[Default_Changelist]/shelved.patch +192 -0
  3. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30_[Default_Changelist]1/shelved.patch +0 -0
  4. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30__Default_Changelist_.xml +4 -0
  5. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_10_43_[Default_Changelist]/shelved.patch +2404 -0
  6. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_10_43__Default_Changelist_.xml +4 -0
  7. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_11_01_[Default_Changelist]/shelved.patch +1362 -0
  8. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_11_01__Default_Changelist_.xml +4 -0
  9. package/dist/pimath.js +53 -14
  10. package/dist/pimath.js.map +1 -1
  11. package/dist/pimath.min.js +1 -1
  12. package/dist/pimath.min.js.map +1 -1
  13. package/esm/maths/algebra/rational.d.ts +1 -0
  14. package/esm/maths/algebra/rational.js +12 -1
  15. package/esm/maths/algebra/rational.js.map +1 -1
  16. package/esm/maths/geometry/triangle.d.ts +6 -0
  17. package/esm/maths/geometry/triangle.js +14 -7
  18. package/esm/maths/geometry/triangle.js.map +1 -1
  19. package/esm/maths/randomization/random.d.ts +1 -1
  20. package/esm/maths/randomization/random.js +2 -2
  21. package/esm/maths/randomization/random.js.map +1 -1
  22. package/esm/maths/randomization/rndHelpers.d.ts +1 -1
  23. package/esm/maths/randomization/rndHelpers.js +25 -4
  24. package/esm/maths/randomization/rndHelpers.js.map +1 -1
  25. package/package.json +8 -8
  26. package/src/maths/algebra/rational.ts +13 -1
  27. package/src/maths/geometry/triangle.ts +24 -8
  28. package/src/maths/randomization/random.ts +2 -2
  29. package/src/maths/randomization/rndHelpers.ts +49 -18
  30. package/tests/algebra/rationnal.test.ts +5 -0
  31. package/tests/geometry/circle.test.ts +125 -10
  32. package/tests/numexp.test.ts +15 -2
  33. package/dev/pimath.js +0 -7935
  34. package/dev/pimath.js.map +0 -1
  35. package/docs/.nojekyll +0 -1
  36. package/docs/assets/highlight.css +0 -78
  37. package/docs/assets/main.js +0 -58
  38. package/docs/assets/search.js +0 -1
  39. package/docs/assets/style.css +0 -1367
  40. package/docs/classes/Logicalset.Logicalset.html +0 -221
  41. package/docs/classes/Polynom.Rational.html +0 -391
  42. package/docs/classes/Vector-1.Vector.html +0 -494
  43. package/docs/classes/Vector.Point.html +0 -341
  44. package/docs/classes/algebra_equation.Equation.html +0 -796
  45. package/docs/classes/algebra_linearSystem.LinearSystem.html +0 -408
  46. package/docs/classes/algebra_monom.Monom.html +0 -967
  47. package/docs/classes/algebra_polynom.Polynom.html +0 -1281
  48. package/docs/classes/coefficients_fraction.Fraction.html +0 -939
  49. package/docs/classes/geometry_circle.Circle.html +0 -476
  50. package/docs/classes/geometry_line.Line.html +0 -779
  51. package/docs/classes/geometry_triangle.Triangle.html +0 -429
  52. package/docs/classes/numeric.Numeric.html +0 -269
  53. package/docs/classes/shutingyard.Shutingyard.html +0 -259
  54. package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +0 -89
  55. package/docs/enums/geometry_line.LinePropriety.html +0 -102
  56. package/docs/enums/shutingyard.ShutingyardMode.html +0 -106
  57. package/docs/enums/shutingyard.ShutingyardType.html +0 -120
  58. package/docs/index.html +0 -63
  59. package/docs/interfaces/algebra_equation.ISolution.html +0 -111
  60. package/docs/interfaces/algebra_polynom.IEuclidian.html +0 -93
  61. package/docs/interfaces/geometry_triangle.remarquableLines.html +0 -150
  62. package/docs/modules/Logicalset.html +0 -69
  63. package/docs/modules/Polynom.html +0 -69
  64. package/docs/modules/Vector-1.html +0 -69
  65. package/docs/modules/Vector.html +0 -69
  66. package/docs/modules/algebra_equation.html +0 -75
  67. package/docs/modules/algebra_linearSystem.html +0 -65
  68. package/docs/modules/algebra_monom.html +0 -70
  69. package/docs/modules/algebra_polynom.html +0 -75
  70. package/docs/modules/coefficients_fraction.html +0 -70
  71. package/docs/modules/geometry_circle.html +0 -65
  72. package/docs/modules/geometry_line.html +0 -70
  73. package/docs/modules/geometry_triangle.html +0 -70
  74. package/docs/modules/numeric.html +0 -65
  75. package/docs/modules/shutingyard.html +0 -84
  76. package/docs/types/algebra_monom.literalType.html +0 -66
  77. package/docs/types/algebra_polynom.PolynomParsingType.html +0 -62
  78. package/docs/types/coefficients_fraction.FractionParsingType.html +0 -61
  79. package/docs/types/shutingyard.Token.html +0 -72
  80. package/docs/types/shutingyard.tokenType.html +0 -77
  81. package/docs/variables/shutingyard.tokenConstant.html +0 -70
  82. package/esm/maths/expressions/ExpressionTree.d.ts +0 -17
  83. package/esm/maths/expressions/ExpressionTree.js +0 -150
  84. package/esm/maths/expressions/ExpressionTree.js.map +0 -1
  85. package/esm/maths/expressions/expression.d.ts +0 -27
  86. package/esm/maths/expressions/expression.js +0 -239
  87. package/esm/maths/expressions/expression.js.map +0 -1
  88. package/esm/maths/expressions/expressionFactor.d.ts +0 -36
  89. package/esm/maths/expressions/expressionFactor.js +0 -156
  90. package/esm/maths/expressions/expressionFactor.js.map +0 -1
  91. package/esm/maths/expressions/expressionMember.d.ts +0 -27
  92. package/esm/maths/expressions/expressionMember.js +0 -199
  93. package/esm/maths/expressions/expressionMember.js.map +0 -1
  94. package/esm/maths/expressions/expressionOperators.d.ts +0 -8
  95. package/esm/maths/expressions/expressionOperators.js +0 -42
  96. package/esm/maths/expressions/expressionOperators.js.map +0 -1
  97. package/esm/maths/expressions/expressionParser.d.ts +0 -14
  98. package/esm/maths/expressions/expressionParser.js +0 -259
  99. package/esm/maths/expressions/expressionParser.js.map +0 -1
  100. package/esm/maths/expressions/factors/ExpFactor.d.ts +0 -7
  101. package/esm/maths/expressions/factors/ExpFactor.js +0 -34
  102. package/esm/maths/expressions/factors/ExpFactor.js.map +0 -1
  103. package/esm/maths/expressions/factors/ExpFactorConstant.d.ts +0 -14
  104. package/esm/maths/expressions/factors/ExpFactorConstant.js +0 -52
  105. package/esm/maths/expressions/factors/ExpFactorConstant.js.map +0 -1
  106. package/esm/maths/expressions/factors/ExpFactorExponential.d.ts +0 -8
  107. package/esm/maths/expressions/factors/ExpFactorExponential.js +0 -22
  108. package/esm/maths/expressions/factors/ExpFactorExponential.js.map +0 -1
  109. package/esm/maths/expressions/factors/ExpFactorNumber.d.ts +0 -14
  110. package/esm/maths/expressions/factors/ExpFactorNumber.js +0 -59
  111. package/esm/maths/expressions/factors/ExpFactorNumber.js.map +0 -1
  112. package/esm/maths/expressions/factors/ExpFactorPower.d.ts +0 -13
  113. package/esm/maths/expressions/factors/ExpFactorPower.js +0 -35
  114. package/esm/maths/expressions/factors/ExpFactorPower.js.map +0 -1
  115. package/esm/maths/expressions/factors/ExpFactorTrigo.d.ts +0 -20
  116. package/esm/maths/expressions/factors/ExpFactorTrigo.js +0 -48
  117. package/esm/maths/expressions/factors/ExpFactorTrigo.js.map +0 -1
  118. package/esm/maths/expressions/factors/ExpFactorVariable.d.ts +0 -13
  119. package/esm/maths/expressions/factors/ExpFactorVariable.js +0 -36
  120. package/esm/maths/expressions/factors/ExpFactorVariable.js.map +0 -1
  121. package/esm/maths/expressions/internals.d.ts +0 -12
  122. package/esm/maths/expressions/internals.js +0 -29
  123. package/esm/maths/expressions/internals.js.map +0 -1
  124. package/esm/maths/expressions/numexp.d.ts +0 -19
  125. package/esm/maths/expressions/numexp.js +0 -186
  126. package/esm/maths/expressions/numexp.js.map +0 -1
  127. package/esm/maths/expressions/polynomexp.bkp.d.ts +0 -33
  128. package/esm/maths/expressions/polynomexp.bkp.js +0 -184
  129. package/esm/maths/expressions/polynomexp.bkp.js.map +0 -1
  130. package/esm/maths/expressions/polynomexp.d.ts +0 -52
  131. package/esm/maths/expressions/polynomexp.js +0 -246
  132. package/esm/maths/expressions/polynomexp.js.map +0 -1
@@ -0,0 +1,4 @@
1
+ <changelist name="Uncommitted_changes_before_Checkout_at_09_11_2023_11_01_[Default_Changelist]" date="1699524101881" recycled="false" toDelete="true">
2
+ <option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_11_01_[Default_Changelist]/shelved.patch" />
3
+ <option name="DESCRIPTION" value="Uncommitted changes before Checkout at 09.11.2023 11:01 [Default Changelist]" />
4
+ </changelist>
package/dist/pimath.js CHANGED
@@ -3581,7 +3581,15 @@ class Rational {
3581
3581
  this.reduce = () => {
3582
3582
  this._numerator.factorize();
3583
3583
  for (let f of this._numerator.factors) {
3584
- this.simplify(f);
3584
+ if (f.degree().isZero()) {
3585
+ // Do the simplify only if the factor can divide the denominator
3586
+ if (this._denominator.commonMonom().coefficient.clone().divide(f.monomByDegree().coefficient).isNatural()) {
3587
+ this.simplify(f);
3588
+ }
3589
+ }
3590
+ else {
3591
+ this.simplify(f);
3592
+ }
3585
3593
  }
3586
3594
  return this;
3587
3595
  };
@@ -3687,6 +3695,9 @@ class Rational {
3687
3695
  get tex() {
3688
3696
  return `\\frac{ ${this._numerator.tex} }{ ${this._denominator.tex} }`;
3689
3697
  }
3698
+ get display() {
3699
+ return `(${this._numerator.display})/(${this._denominator.display})`;
3700
+ }
3690
3701
  get texFactors() {
3691
3702
  return `\\frac{ ${this._numerator.texFactors} }{ ${this._denominator.texFactors} }`;
3692
3703
  }
@@ -6140,6 +6151,7 @@ class Triangle {
6140
6151
  return new vector_1.Vector(this.getPointByName(ptName1), this.getPointByName(ptName2));
6141
6152
  };
6142
6153
  this._calculateRemarquableLines = () => {
6154
+ const bA = this._calculateBisectors('A'), bB = this._calculateBisectors('B'), bC = this._calculateBisectors('C');
6143
6155
  let remarquables = {
6144
6156
  'medians': {
6145
6157
  'A': new line_1.Line(this._A, this._middles.BC),
@@ -6160,9 +6172,15 @@ class Triangle {
6160
6172
  'intersection': null
6161
6173
  },
6162
6174
  'bisectors': {
6163
- 'A': this._calculateBisectors('A'),
6164
- 'B': this._calculateBisectors('B'),
6165
- 'C': this._calculateBisectors('C'),
6175
+ 'A': bA.internal,
6176
+ 'B': bB.internal,
6177
+ 'C': bB.internal,
6178
+ 'intersection': null
6179
+ },
6180
+ externalBisectors: {
6181
+ 'A': bA.external,
6182
+ 'B': bB.external,
6183
+ 'C': bC.external,
6166
6184
  'intersection': null
6167
6185
  }
6168
6186
  };
@@ -6191,16 +6209,16 @@ class Triangle {
6191
6209
  let b1 = new line_1.Line(new equation_1.Equation(d1.equation.left.clone().multiply(d2.n.simplify().norm), d2.equation.left.clone().multiply(d1.n.simplify().norm)).reorder(true).simplify()), b2 = new line_1.Line(new equation_1.Equation(d1.equation.left.clone().multiply(d2.n.simplify().norm), d2.equation.left.clone().multiply(d1.n.simplify().norm).opposed()).reorder(true).simplify());
6192
6210
  // Must determine which bisectors is in the triangle
6193
6211
  if (pt === 'A') {
6194
- return b1.hitSegment(this.B, this.C) ? b1 : b2;
6212
+ return b1.hitSegment(this.B, this.C) ? { internal: b1, external: b2 } : { internal: b2, external: b1 };
6195
6213
  }
6196
6214
  if (pt === 'B') {
6197
- return b1.hitSegment(this.A, this.C) ? b1 : b2;
6215
+ return b1.hitSegment(this.A, this.C) ? { internal: b1, external: b2 } : { internal: b2, external: b1 };
6198
6216
  }
6199
6217
  if (pt === 'C') {
6200
- return b1.hitSegment(this.B, this.A) ? b1 : b2;
6218
+ return b1.hitSegment(this.B, this.A) ? { internal: b1, external: b2 } : { internal: b2, external: b1 };
6201
6219
  }
6202
6220
  // Default returns the first bisector
6203
- return b1;
6221
+ return { internal: b1, external: b2 };
6204
6222
  };
6205
6223
  if (values.length > 0) {
6206
6224
  this.parse(...values);
@@ -6894,8 +6912,8 @@ var Random;
6894
6912
  return (new rndFraction_1.rndFraction(config)).generate();
6895
6913
  }
6896
6914
  Random.fraction = fraction;
6897
- function number(from, to) {
6898
- return rndHelpers_1.rndHelpers.randomInt(from, to);
6915
+ function number(from, to, exclude) {
6916
+ return rndHelpers_1.rndHelpers.randomInt(from, to, exclude);
6899
6917
  }
6900
6918
  Random.number = number;
6901
6919
  function numberSym(max, allowZero) {
@@ -7158,11 +7176,32 @@ class rndHelpers {
7158
7176
  * @param a (number) : From this value to the second value. If the second is ommited, this value is the max value.
7159
7177
  * @param b (number) : To this value. If this is ommited.
7160
7178
  */
7161
- static randomInt(a, b) {
7179
+ static randomInt(a, b, exclude) {
7162
7180
  if (b === undefined) {
7163
- return this.randomInt(0, a);
7181
+ if (a >= 0) {
7182
+ return this.randomInt(0, a);
7183
+ }
7184
+ else {
7185
+ return this.randomInt(a, 0);
7186
+ }
7187
+ }
7188
+ // Same start and end values
7189
+ if (a === b) {
7190
+ return a;
7191
+ }
7192
+ // No exclusion
7193
+ if (exclude === undefined) {
7194
+ return Math.floor(Math.random() * (b - a + 1) + a);
7195
+ }
7196
+ // With exclusion
7197
+ if (Math.abs(b - a) <= exclude.length) {
7198
+ throw new Error('The number of excluded values is too high.');
7199
+ }
7200
+ let r = this.randomInt(a, b);
7201
+ while (exclude.includes(r)) {
7202
+ r = this.randomInt(a, b);
7164
7203
  }
7165
- return Math.floor(Math.random() * (b - a + 1) + a);
7204
+ return r;
7166
7205
  }
7167
7206
  /**
7168
7207
  * Random integer between -max and max value.
@@ -7199,7 +7238,7 @@ class rndHelpers {
7199
7238
  if (arr.length === 0) {
7200
7239
  return '';
7201
7240
  }
7202
- return this.randomArray(arr, 1)[0];
7241
+ return arr[this.randomInt(0, arr.length - 1)];
7203
7242
  }
7204
7243
  static shuffleArray(arr) {
7205
7244
  // The Fisher-Yates algorithm