pimath 0.0.71 → 0.0.74

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.
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
@@ -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) {
@@ -4733,6 +4744,16 @@ class NumExp {
4733
4744
  else if (element.token === 'sqrt') {
4734
4745
  this._addToStack(stack, Math.sqrt(a));
4735
4746
  }
4747
+ else if (element.token === 'nthrt') {
4748
+ // TODO: support nthrt in num. exp.
4749
+ // this._addToStack(stack, Math.pow(a, 1/b))
4750
+ }
4751
+ else if (element.token === 'ln') {
4752
+ this._addToStack(stack, Math.log(a));
4753
+ }
4754
+ else if (element.token === 'log') {
4755
+ this._addToStack(stack, Math.log10(a));
4756
+ }
4736
4757
  }
4737
4758
  }
4738
4759
  if (stack.length === 1) {
@@ -5188,9 +5209,26 @@ class Circle {
5188
5209
  get developed() {
5189
5210
  return this._cartesian.tex;
5190
5211
  }
5191
- // TODO: reformat code for better display.
5192
5212
  get display() {
5193
- return this._cartesian.display;
5213
+ if (this._exists) {
5214
+ let cx, cy;
5215
+ if (this._center.x.isZero()) {
5216
+ cx = 'x^2';
5217
+ }
5218
+ else {
5219
+ cx = `(x${this._center.x.isNegative() ? '+' : '-'}${this._center.x.clone().abs().tex})^2`;
5220
+ }
5221
+ if (this._center.y.isZero()) {
5222
+ cy = 'y^2';
5223
+ }
5224
+ else {
5225
+ cy = `(y${this._center.y.isNegative() ? '+' : '-'}${this._center.y.clone().abs().tex})^2`;
5226
+ }
5227
+ return `${cx}+${cy}=${this._squareRadius.display}`;
5228
+ }
5229
+ else {
5230
+ return `\\text{le cercle n'existe pas.}`;
5231
+ }
5194
5232
  }
5195
5233
  clone() {
5196
5234
  this._center = this._center.clone();
@@ -6909,6 +6947,9 @@ class Shutingyard {
6909
6947
  'cos': { precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION },
6910
6948
  'tan': { precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION },
6911
6949
  'sqrt': { precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION },
6950
+ 'nthrt': { precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION },
6951
+ 'ln': { precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION },
6952
+ 'log': { precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION },
6912
6953
  };
6913
6954
  this._uniformize = false;
6914
6955
  }