]> www.ginac.de Git - ginac.git/blobdiff - check/exam_factor.cpp
Fixed a bug in is_polynomial() that caused expressions like
[ginac.git] / check / exam_factor.cpp
index 8851b7cc2f2c9fedd59d52f91838866f14cf48fe..2006a325f4537c5d4dd4da50245d1077e88e80ab 100644 (file)
@@ -3,7 +3,7 @@
  *  Factorization test suite. */
 
 /*
- *  GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <iostream>
 #include "ginac.h"
-using namespace std;
 using namespace GiNaC;
 
+#include <iostream>
+using namespace std;
+
 static symbol w("w"), x("x"), y("y"), z("z");
 
 static unsigned check_factor(const ex& e)
@@ -41,7 +42,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 +111,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;
@@ -166,6 +167,23 @@ static unsigned exam_factor2()
        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;
+}
+
 unsigned exam_factor()
 {
        unsigned result = 0;
@@ -174,6 +192,7 @@ unsigned exam_factor()
 
        result += exam_factor1(); cout << '.' << flush;
        result += exam_factor2(); cout << '.' << flush;
+       result += exam_factor3(); cout << '.' << flush;
 
        return result;
 }