Skip to content

Commit 29adaa9

Browse files
committed
computer algebra fix
1 parent 038c6c1 commit 29adaa9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

math/computerAlgebra/dataTypes/polynomials.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,14 @@ export const loadPolynomialsOperations = function () {
289289
coeff(firstTerm(gcd1)),
290290
1 + maxOrder - order(firstTerm(gcd1))
291291
);
292-
const numerator = divideTerms(multiplyRealByTermsArray(x, ta1), gcd1);
293-
const denominator = divideTerms(multiplyRealByTermsArray(x, ta2), gcd1);
292+
const numerator = divideTerms(
293+
!isZeroWithinTolerance(x) ? multiplyRealByTermsArray(x, ta1) : ta1,
294+
gcd1
295+
);
296+
const denominator = divideTerms(
297+
!isZeroWithinTolerance(x) ? multiplyRealByTermsArray(x, ta2) : ta2,
298+
gcd1
299+
);
294300
// console.log("numerator: ", numerator, "denominator: ", denominator);
295301

296302
// division with gcd1 returns no remainder, so:

0 commit comments

Comments
 (0)