pimath 0.0.56 → 0.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.
- package/dist/pi.js +25 -4
- 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/algebra/rational.d.ts +1 -1
- package/esm/maths/algebra/rational.js +25 -4
- package/esm/maths/algebra/rational.js.map +1 -1
- package/package.json +1 -1
- package/src/maths/algebra/rational.ts +26 -7
- package/tests/algebra/rationnal.test.ts +6 -0
package/dist/pi.js
CHANGED
|
@@ -3438,7 +3438,7 @@ class Rational {
|
|
|
3438
3438
|
// Factorize the numerator and the denominator
|
|
3439
3439
|
this._numerator.factorize();
|
|
3440
3440
|
this._denominator.factorize();
|
|
3441
|
-
let zeroes = equation_1.Equation.makeSolutionsUnique([...this._numerator.getZeroes(), ...this._denominator.getZeroes()], true), NFactors = this._numerator.factors, DFactors = this._denominator.factors;
|
|
3441
|
+
let zeroes = equation_1.Equation.makeSolutionsUnique([...this._numerator.getZeroes(), ...this._denominator.getZeroes()], true).filter(x => !isNaN(x.value)), NFactors = this._numerator.factors, DFactors = this._denominator.factors;
|
|
3442
3442
|
let tableOfSigns = [], result = [];
|
|
3443
3443
|
NFactors.forEach(factor => {
|
|
3444
3444
|
tableOfSigns.push(this._makeOneLineOfTableOfSigns(factor, zeroes, 'z'));
|
|
@@ -3506,7 +3506,12 @@ class Rational {
|
|
|
3506
3506
|
let oneLine = [], currentZero = factor.getZeroes().map(x => x.tex);
|
|
3507
3507
|
// First +/- sign, before the first zero
|
|
3508
3508
|
oneLine.push('');
|
|
3509
|
-
|
|
3509
|
+
if (factor.degree().isZero()) {
|
|
3510
|
+
oneLine.push(factor.monoms[0].coefficient.sign() === 1 ? '+' : '-');
|
|
3511
|
+
}
|
|
3512
|
+
else {
|
|
3513
|
+
oneLine.push(factor.evaluate(zeroes[0].value - 1).sign() === 1 ? '+' : '-');
|
|
3514
|
+
}
|
|
3510
3515
|
for (let i = 0; i < zeroes.length; i++) {
|
|
3511
3516
|
// Add the zero if it's the current one
|
|
3512
3517
|
oneLine.push(currentZero.includes(zeroes[i].tex) ? zeroSign : 't');
|
|
@@ -3521,8 +3526,24 @@ class Rational {
|
|
|
3521
3526
|
oneLine.push('');
|
|
3522
3527
|
return oneLine;
|
|
3523
3528
|
};
|
|
3524
|
-
|
|
3525
|
-
|
|
3529
|
+
if (numerator instanceof polynom_1.Polynom) {
|
|
3530
|
+
this._numerator = numerator.clone();
|
|
3531
|
+
}
|
|
3532
|
+
else if (typeof numerator === 'string') {
|
|
3533
|
+
this._numerator = new polynom_1.Polynom(numerator);
|
|
3534
|
+
}
|
|
3535
|
+
else {
|
|
3536
|
+
this._numerator = new polynom_1.Polynom();
|
|
3537
|
+
}
|
|
3538
|
+
if (denominator instanceof polynom_1.Polynom) {
|
|
3539
|
+
this._denominator = denominator.clone();
|
|
3540
|
+
}
|
|
3541
|
+
else if (typeof denominator === 'string') {
|
|
3542
|
+
this._denominator = new polynom_1.Polynom(denominator);
|
|
3543
|
+
}
|
|
3544
|
+
else {
|
|
3545
|
+
this._denominator = new polynom_1.Polynom();
|
|
3546
|
+
}
|
|
3526
3547
|
}
|
|
3527
3548
|
get numerator() {
|
|
3528
3549
|
return this._numerator;
|