]> www.ginac.de Git - ginac.git/blobdiff - check/series_expansion.cpp
- updated for class series->class pseries
[ginac.git] / check / series_expansion.cpp
index b8e80204606a52620e8b000f331583ed3f49f9df..00998fd519b17259696d24e56dd9f9590f14942e 100644 (file)
@@ -3,7 +3,7 @@
  *  Series expansion test (Laurent and Taylor series). */
 
 /*
- *  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
@@ -31,7 +31,7 @@ static symbol x("x");
 static unsigned check_series(const ex &e, const ex &point, const ex &d, int order = 8)
 {
     ex es = e.series(x, point, order);
-    ex ep = static_cast<series *>(es.bp)->convert_to_poly();
+    ex ep = static_cast<const pseries &>(*es.bp).convert_to_poly();
     if (!(ep - d).is_zero()) {
         clog << "series expansion of " << e << " at " << point
              << " erroneously returned " << ep << " (instead of " << d
@@ -131,12 +131,33 @@ static unsigned series3(void)
     return result;
 }
 
-// Series of special functions
+// Order term handling
 static unsigned series4(void)
+{
+    unsigned result = 0;
+    ex e, d;
+
+    e = 1 + x + pow(x, 2) + pow(x, 3);
+    d = Order(1);
+    result += check_series(e, 0, d, 0);
+    d = 1 + Order(x);
+    result += check_series(e, 0, d, 1);
+    d = 1 + x + Order(pow(x, 2));
+    result += check_series(e, 0, d, 2);
+    d = 1 + x + pow(x, 2) + Order(pow(x, 3));
+    result += check_series(e, 0, d, 3);
+    d = 1 + x + pow(x, 2) + pow(x, 3);
+    result += check_series(e, 0, d, 4);
+    return result;
+}
+
+// Series of special functions
+static unsigned series5(void)
 {
     unsigned result = 0;
     ex e, d;
     
+    // gamma(-1):
     e = gamma(2*x);
     d = pow(x+1,-1)*numeric(1,4) +
         pow(x+1,0)*(numeric(3,4) -
@@ -165,6 +186,7 @@ static unsigned series4(void)
         Order(pow(x+1,4));
     result += check_series(e, -1, d, 4);
     
+    // tan(Pi/2)
     e = tan(x*Pi/2);
     d = pow(x-1,-1)/Pi*(-2) +
         pow(x-1,1)*Pi/6 +
@@ -188,6 +210,7 @@ unsigned series_expansion(void)
     result += series2();
     result += series3();
     result += series4();
+    result += series5();
     
     if (!result) {
         cout << " passed ";