]> www.ginac.de Git - ginac.git/blobdiff - check/exam_factor.cpp
Fixed bug in multivariate factorization. Fractional numerical content was not
[ginac.git] / check / exam_factor.cpp
index e3552bfcdd8e0aaa1cd7f8ccb4f5f065e4269582..71a63f24ba68dce756efd210005b93d5b2b6a4c1 100644 (file)
@@ -41,7 +41,7 @@ static unsigned check_factor(const ex& e)
 static unsigned exam_factor1()
 {
        unsigned result = 0;
-       ex e, d;
+       ex e;
        symbol x("x");
        lst syms;
        syms.append(x);
@@ -110,7 +110,7 @@ static unsigned exam_factor1()
 static unsigned exam_factor2()
 {
        unsigned result = 0;
-       ex e, d;
+       ex e;
        symbol x("x"), y("y"), z("z");
        lst syms;
        syms = x, y, z;
@@ -118,12 +118,68 @@ static unsigned exam_factor2()
        e = ex("x+y", syms);
        result += check_factor(e);
 
-       e = ex("x+y", syms);
+       e = ex("(x^2-y+1)*(x+y)", syms);
        result += check_factor(e);
 
        e = ex("-2*(x+y)*(x-y)", syms);
        result += check_factor(e);
 
+       e = ex("(16+x^2*z^3)*(-17+3*x-5*z)*(2*x+3*z)*(x-y^2-z^3)", syms);
+       result += check_factor(e);
+
+       e = ex("(x-y*z)*(x-y^2-z^3)*(x+y+z)", syms);
+       result += check_factor(e);
+       
+       e = ex("-(y^2-x+z^3)*x*(x+y+z)", syms);
+       result += check_factor(e);
+       
+       e = ex("-316*(3*x-4*z)*(2*x+3*z)*(x+y)*(-1+x)", syms);
+       result += check_factor(e);
+       
+       e = ex("(x+x^3+z^2)*(3*x-4*z)", syms);
+       result += check_factor(e);
+       
+       e = ex("250*(-3+x)*(4*z-3*x)*(x^3+z^2+x)*x", syms);
+       result += check_factor(e);
+       
+       e = ex("327*(x+z^2+x^3)*(3*x-4*z)*(-7+5*x-x^3)*(1+x+x^2)", syms);
+       result += check_factor(e);
+       
+       e = ex("x-y^2-z^3", syms);
+       result += check_factor(e);
+       
+       e = ex("-390*(7+3*x^4)*(2+x^2)*(x-z^3-y^2)", syms);
+       result += check_factor(e);
+       
+       e = ex("55*(1+x)^2*(3*x-4*z)*(1+x+x^2)*(x+x^3+z^2)", syms);
+       result += check_factor(e);
+       
+       e = ex("x+y*x-1", syms);
+       result += check_factor(e);
+       
+       e = ex("390*(-1+x^6-x)*(7+3*x^4)*(2+x^2)*(y+x)*(-1+y-x^2)*(1+x^2+x)^2", syms);
+       result += check_factor(e);
+       
+       e = ex("310*(y+x)*(-1+y-x^2)", syms);
+       result += check_factor(e);
+
+       return result;
+}
+
+static unsigned exam_factor3()
+{
+       unsigned result = 0;
+       ex e;
+       symbol k("k"), n("n");
+       lst syms;
+       syms = k, n;
+       
+       e = ex("1/2*(-3+3*k-n)*(-2+3*k-n)*(-1+3*k-n)", syms);
+       result += check_factor(e);
+
+       e = ex("1/4*(2*k-n)*(-1+2*k-n)", syms);
+       result += check_factor(e);
+
        return result;
 }
 
@@ -135,6 +191,7 @@ unsigned exam_factor()
 
        result += exam_factor1(); cout << '.' << flush;
        result += exam_factor2(); cout << '.' << flush;
+       result += exam_factor3(); cout << '.' << flush;
 
        return result;
 }