pimath 0.0.70 → 0.0.73
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 +0 -5
- package/dist/pi.js +33 -2
- package/dist/pi.js.map +1 -1
- package/dist/pi.min.js +1 -1
- package/dist/pi.min.js.map +1 -1
- package/esm/maths/coefficients/fraction.d.ts +2 -0
- package/esm/maths/coefficients/fraction.js +14 -0
- package/esm/maths/coefficients/fraction.js.map +1 -1
- package/esm/maths/geometry/circle.js +19 -2
- package/esm/maths/geometry/circle.js.map +1 -1
- package/package.json +1 -1
- package/src/maths/coefficients/fraction.ts +17 -0
- package/src/maths/geometry/circle.ts +16 -3
- package/tests/coefficients/fraction.test.ts +11 -0
- package/tests/geometry/circle.test.ts +15 -0
package/.idea/misc.xml
CHANGED
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) {
|
|
@@ -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) {
|
|
@@ -5185,9 +5199,26 @@ class Circle {
|
|
|
5185
5199
|
get developed() {
|
|
5186
5200
|
return this._cartesian.tex;
|
|
5187
5201
|
}
|
|
5188
|
-
// TODO: reformat code for better display.
|
|
5189
5202
|
get display() {
|
|
5190
|
-
|
|
5203
|
+
if (this._exists) {
|
|
5204
|
+
let cx, cy;
|
|
5205
|
+
if (this._center.x.isZero()) {
|
|
5206
|
+
cx = 'x^2';
|
|
5207
|
+
}
|
|
5208
|
+
else {
|
|
5209
|
+
cx = `(x${this._center.x.isNegative() ? '+' : '-'}${this._center.x.clone().abs().tex})^2`;
|
|
5210
|
+
}
|
|
5211
|
+
if (this._center.y.isZero()) {
|
|
5212
|
+
cy = 'y^2';
|
|
5213
|
+
}
|
|
5214
|
+
else {
|
|
5215
|
+
cy = `(y${this._center.y.isNegative() ? '+' : '-'}${this._center.y.clone().abs().tex})^2`;
|
|
5216
|
+
}
|
|
5217
|
+
return `${cx}+${cy}=${this._squareRadius.display}`;
|
|
5218
|
+
}
|
|
5219
|
+
else {
|
|
5220
|
+
return `\\text{le cercle n'existe pas.}`;
|
|
5221
|
+
}
|
|
5191
5222
|
}
|
|
5192
5223
|
clone() {
|
|
5193
5224
|
this._center = this._center.clone();
|