pimath 0.0.69 → 0.0.72

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 (69) hide show
  1. package/.idea/misc.xml +0 -5
  2. package/dist/pi.js +18 -1
  3. package/dist/pi.js.map +1 -1
  4. package/dist/pi.min.js +1 -1
  5. package/dist/pi.min.js.map +1 -1
  6. package/esm/maths/algebra/polynom.js +1 -1
  7. package/esm/maths/algebra/polynom.js.map +1 -1
  8. package/esm/maths/coefficients/fraction.d.ts +2 -0
  9. package/esm/maths/coefficients/fraction.js +14 -0
  10. package/esm/maths/coefficients/fraction.js.map +1 -1
  11. package/esm/maths/expressions/expression.d.ts +6 -0
  12. package/esm/maths/expressions/expression.js +79 -1
  13. package/esm/maths/expressions/expression.js.map +1 -1
  14. package/esm/maths/expressions/expressionFactor.d.ts +8 -1
  15. package/esm/maths/expressions/expressionFactor.js +51 -4
  16. package/esm/maths/expressions/expressionFactor.js.map +1 -1
  17. package/esm/maths/expressions/expressionMember.d.ts +12 -1
  18. package/esm/maths/expressions/expressionMember.js +128 -19
  19. package/esm/maths/expressions/expressionMember.js.map +1 -1
  20. package/esm/maths/expressions/expressionParser.d.ts +2 -0
  21. package/esm/maths/expressions/expressionParser.js +74 -34
  22. package/esm/maths/expressions/expressionParser.js.map +1 -1
  23. package/esm/maths/expressions/factors/ExpFactor.d.ts +2 -2
  24. package/esm/maths/expressions/factors/ExpFactor.js +15 -3
  25. package/esm/maths/expressions/factors/ExpFactor.js.map +1 -1
  26. package/esm/maths/expressions/factors/ExpFactorConstant.d.ts +1 -0
  27. package/esm/maths/expressions/factors/ExpFactorConstant.js +3 -0
  28. package/esm/maths/expressions/factors/ExpFactorConstant.js.map +1 -1
  29. package/esm/maths/expressions/factors/ExpFactorExponential.d.ts +1 -0
  30. package/esm/maths/expressions/factors/ExpFactorExponential.js +4 -0
  31. package/esm/maths/expressions/factors/ExpFactorExponential.js.map +1 -1
  32. package/esm/maths/expressions/factors/ExpFactorNumber.d.ts +3 -2
  33. package/esm/maths/expressions/factors/ExpFactorNumber.js +23 -0
  34. package/esm/maths/expressions/factors/ExpFactorNumber.js.map +1 -1
  35. package/esm/maths/expressions/factors/ExpFactorPower.d.ts +5 -1
  36. package/esm/maths/expressions/factors/ExpFactorPower.js +15 -2
  37. package/esm/maths/expressions/factors/ExpFactorPower.js.map +1 -1
  38. package/esm/maths/expressions/factors/ExpFactorTrigo.d.ts +1 -0
  39. package/esm/maths/expressions/factors/ExpFactorTrigo.js +8 -0
  40. package/esm/maths/expressions/factors/ExpFactorTrigo.js.map +1 -1
  41. package/esm/maths/expressions/factors/ExpFactorVariable.d.ts +1 -0
  42. package/esm/maths/expressions/factors/ExpFactorVariable.js +3 -0
  43. package/esm/maths/expressions/factors/ExpFactorVariable.js.map +1 -1
  44. package/esm/maths/expressions/polynomexp.bkp.js +0 -1
  45. package/esm/maths/expressions/polynomexp.bkp.js.map +1 -1
  46. package/esm/maths/shutingyard.js +3 -0
  47. package/esm/maths/shutingyard.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/maths/algebra/polynom.ts +1 -1
  50. package/src/maths/coefficients/fraction.ts +17 -0
  51. package/src/maths/expressions/expression.ts +115 -20
  52. package/src/maths/expressions/expressionFactor.ts +59 -7
  53. package/src/maths/expressions/expressionMember.ts +141 -22
  54. package/src/maths/expressions/expressionParser.ts +79 -33
  55. package/src/maths/expressions/factors/ExpFactor.ts +19 -6
  56. package/src/maths/expressions/factors/ExpFactorConstant.ts +4 -0
  57. package/src/maths/expressions/factors/ExpFactorExponential.ts +7 -0
  58. package/src/maths/expressions/factors/ExpFactorNumber.ts +32 -4
  59. package/src/maths/expressions/factors/ExpFactorPower.ts +21 -3
  60. package/src/maths/expressions/factors/ExpFactorTrigo.ts +10 -1
  61. package/src/maths/expressions/factors/ExpFactorVariable.ts +5 -0
  62. package/src/maths/expressions/polynomexp.bkp.ts +0 -1
  63. package/src/maths/shutingyard.ts +4 -1
  64. package/tests/coefficients/fraction.test.ts +11 -0
  65. package/tests/expressions/expressions.test.ts +24 -3
  66. package/tests/geometry/circle.test.ts +6 -0
  67. package/esm/maths/expressions/factors/ExpFactorSin.d.ts +0 -7
  68. package/esm/maths/expressions/factors/ExpFactorSin.js +0 -22
  69. package/esm/maths/expressions/factors/ExpFactorSin.js.map +0 -1
package/.idea/misc.xml CHANGED
@@ -3,9 +3,4 @@
3
3
  <component name="JavaScriptSettings">
4
4
  <option name="languageLevel" value="ES6" />
5
5
  </component>
6
- <component name="SwUserDefinedSpecifications">
7
- <option name="specTypeByUrl">
8
- <map />
9
- </option>
10
- </component>
11
6
  </project>
package/dist/pi.js CHANGED
@@ -2191,7 +2191,7 @@ class Polynom {
2191
2191
  }
2192
2192
  else if (element.token === '^') {
2193
2193
  if (b.degree().isStrictlyPositive()) {
2194
- console.error('Cannot elevate a polynom with another polynom !');
2194
+ console.error('Cannot elevate a polynom with another polynom !', a.tex, b.tex);
2195
2195
  }
2196
2196
  else {
2197
2197
  if (b.monoms[0].coefficient.isRelative()) {
@@ -4120,6 +4120,17 @@ class Fraction {
4120
4120
  this._denominator = this._denominator * Q.denominator;
4121
4121
  return this.reduce();
4122
4122
  };
4123
+ this.xMultiply = (...values) => {
4124
+ // Parse the value.
4125
+ // If it's a fraction, return a clone of it
4126
+ // If it's an integer, return the fraction F/1
4127
+ for (let value of values) {
4128
+ let F = new Fraction(value);
4129
+ this._numerator = this._numerator * F.numerator;
4130
+ this._denominator = this._denominator * F.denominator;
4131
+ }
4132
+ return this;
4133
+ };
4123
4134
  this.divide = (F) => {
4124
4135
  let Q = new Fraction(F);
4125
4136
  if (Q.numerator === 0) {
@@ -4381,6 +4392,9 @@ class Fraction {
4381
4392
  return this.value.toFixed(3);
4382
4393
  }
4383
4394
  }
4395
+ get texWithSign() {
4396
+ return this.isPositive() ? `+${this.tex}` : this.tex;
4397
+ }
4384
4398
  get display() {
4385
4399
  if (this.isExact()) {
4386
4400
  if (this._denominator === 1) {
@@ -7002,6 +7016,9 @@ class Shutingyard {
7002
7016
  return [token, start + token.length, tokenType];
7003
7017
  }
7004
7018
  normalize(expr) {
7019
+ if (expr.length === 1) {
7020
+ return expr;
7021
+ }
7005
7022
  // Get the list of function token.
7006
7023
  let fnToken = [], kToken = [];
7007
7024
  for (let token in this._tokenConfig) {