]> www.ginac.de Git - ginac.git/blobdiff - check/normalization.cpp
new #define CINT_CONVERSION_WORKAROUND for ginaccint, needed
[ginac.git] / check / normalization.cpp
index 7ce1e5dce8e2d7d7c7cff3ac4be4ca6c4de63292..814c45be9cdfc80fa00d50be60a7932701d0288c 100644 (file)
@@ -3,7 +3,7 @@
  *  Rational function normalization test suite. */
 
 /*
- *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2000 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <ginac/ginac.h>
+#include "ginac.h"
 
-#ifndef NO_GINAC_NAMESPACE
+#ifndef NO_NAMESPACE_GINAC
 using namespace GiNaC;
-#endif // ndef NO_GINAC_NAMESPACE
+#endif // ndef NO_NAMESPACE_GINAC
 
-static symbol x("x"), y("y"), z("z");
+static symbol w("w"), x("x"), y("y"), z("z");
 
 static unsigned check_normal(const ex &e, const ex &d)
 {
@@ -46,7 +46,7 @@ static unsigned normal1(void)
     
     // Expansion
     e = pow(x, 2) - (x+1)*(x-1) - 1;
-    d = exZERO();
+    d = ex(0);
     result += check_normal(e, d);
     
     // Expansion inside functions
@@ -55,24 +55,44 @@ static unsigned normal1(void)
     result += check_normal(e, d);
     
     // Fraction addition
-    e = numeric(2)/x + y/3;
-    d = (x*y/3 + 2) / x;
+    e = 2/x + y/3;
+    d = (x*y + 6) / (x*3);
     result += check_normal(e, d);
     
-    // Fraction addition
     e = pow(x, -1) + x/(x+1);
     d = (pow(x, 2)+x+1)/(x*(x+1));
     result += check_normal(e, d);
     
     // Fraction cancellation
+       e = numeric(1)/2 * z * (2*x + 2*y);
+       d = z * (x + y);
+       result += check_normal(e, d);
+
+       e = numeric(1)/6 * z * (3*x + 3*y) * (2*x + 2*w);
+       d = z * (x + y) * (x + w);
+       result += check_normal(e, d);
+
+       e = (3*x + 3*y) * (w/3 + z/3);
+       d = (x + y) * (w + z);
+       result += check_normal(e, d);
+
     e = (pow(x, 2) - pow(y, 2)) / pow(x-y, 3);
     d = (x + y) / (pow(x, 2) + pow(y, 2) - x * y * 2);
     result += check_normal(e, d);
     
-    // Fraction cancellation
     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);