From: Christian Bauer Date: Tue, 25 Jan 2000 22:31:49 +0000 (+0000) Subject: - checks adapted to new GCD behavior for partly-factored input polynomials X-Git-Tag: release_0-5-0~35 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=1270ae7827fed80f7170de31d4c9e61e412906d9 - checks adapted to new GCD behavior for partly-factored input polynomials --- diff --git a/check/normalization.cpp b/check/normalization.cpp index fa14496a..1c3ac9c7 100644 --- a/check/normalization.cpp +++ b/check/normalization.cpp @@ -73,6 +73,16 @@ static unsigned normal1(void) e = (pow(x, -1) + x) / (pow(x , 2) * 2 + 2); d = pow(x * 2, -1); result += check_normal(e, d); + + // Fraction cancellation with rational coefficients + e = (pow(x, 2) - pow(y, 2)) / pow(x/2 - y/2, 3); + d = (8 * x + 8 * y) / (pow(x, 2) + pow(y, 2) - x * y * 2); + result += check_normal(e, d); + + // Fraction cancellation with rational coefficients + e = z/5 * (x/7 + y/10) / (x/14 + y/20); + d = 2*z/5; + result += check_normal(e, d); // Distribution of powers e = pow(x/y, 2); diff --git a/check/poly_gcd.cpp b/check/poly_gcd.cpp index 37a310fd..0d8327a3 100644 --- a/check/poly_gcd.cpp +++ b/check/poly_gcd.cpp @@ -68,7 +68,7 @@ static unsigned poly_gcd2(void) ex d = pow(e1 + 1, 2); ex f = d * pow(e2 - 2, 2); ex g = d * pow(e1 + 2, 2); - ex r = gcd(f, g); + ex r = gcd(f.expand(), g.expand()); if (!(r - d).expand().is_zero()) { clog << "case 2, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl; return 1; @@ -88,7 +88,7 @@ static unsigned poly_gcd3(void) ex d = e1 + 1; ex f = d * (e1 - 2); ex g = d * (e1 + 2); - ex r = gcd(f, g); + ex r = gcd(f.expand(), g.expand()); if (!(r - d).expand().is_zero()) { clog << "case 3, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl; return 1; @@ -111,7 +111,7 @@ static unsigned poly_gcd3p(void) ex d = e1 + 1; ex f = d * (e1 - 2); ex g = d * (e2 + 2); - ex r = gcd(f, g); + ex r = gcd(f.expand(), g.expand()); if (!(r - d).expand().is_zero()) { clog << "case 3p, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl; return 1; @@ -136,7 +136,7 @@ static unsigned poly_gcd4(void) ex d = e1 + 1; ex f = d * (e2 - 1); ex g = d * pow(e3 + 2, 2); - ex r = gcd(f, g); + ex r = gcd(f.expand(), g.expand()); if (!(r - d).expand().is_zero()) { clog << "case 4, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl; return 1; @@ -161,7 +161,7 @@ static unsigned poly_gcd5(void) ex d = e1 - 3; ex f = d * (e2 + 3); ex g = d * (e3 - 3); - ex r = gcd(f, g); + ex r = gcd(f.expand(), g.expand()); if (!(r - d).expand().is_zero()) { clog << "case 5, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl; return 1; @@ -181,7 +181,7 @@ static unsigned poly_gcd5p(void) ex d = e1 - 1; ex f = d * (e1 + 3); ex g = d * (e1 - 3); - ex r = gcd(f, g); + ex r = gcd(f.expand(), g.expand()); if (!(r - d).expand().is_zero()) { clog << "case 5p, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl; return 1; @@ -199,7 +199,7 @@ static unsigned poly_gcd6(void) ex d = pow(x, j) * y * (z - 1); ex f = d * (pow(x, j) + pow(y, j + 1) * pow(z, j) + 1); ex g = d * (pow(x, j + 1) + pow(y, j) * pow(z, j + 1) - 7); - ex r = gcd(f, g); + ex r = gcd(f.expand(), g.expand()); if (!(r - d).expand().is_zero()) { clog << "case 6, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl; return 1;