]> www.ginac.de Git - ginac.git/blobdiff - check/series_expansion.cpp
- Made configure warn a lot when readline-stuff couldn't be found.
[ginac.git] / check / series_expansion.cpp
index 5660e708db3ad01eb38ba64a73502c49fb94ec1b..4cd169706d0dd4ca418f5ccdd6c70cd5e68ff9f7 100644 (file)
@@ -3,7 +3,7 @@
  *  Series expansion test (Laurent and Taylor series). */
 
 /*
  *  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
  *
  *  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
  */
 
  *  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;
 using namespace GiNaC;
-#endif // ndef NO_GINAC_NAMESPACE
+#endif // ndef NO_NAMESPACE_GINAC
 
 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);
 
 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 = ex_to_pseries(es).convert_to_poly();
     if (!(ep - d).is_zero()) {
         clog << "series expansion of " << e << " at " << point
              << " erroneously returned " << ep << " (instead of " << d
     if (!(ep - d).is_zero()) {
         clog << "series expansion of " << e << " at " << point
              << " erroneously returned " << ep << " (instead of " << d
@@ -131,8 +131,28 @@ static unsigned series3(void)
     return result;
 }
 
     return result;
 }
 
-// Series of special functions
+// Order term handling
 static unsigned series4(void)
 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;
 {
     unsigned result = 0;
     ex e, d;
@@ -190,6 +210,7 @@ unsigned series_expansion(void)
     result += series2();
     result += series3();
     result += series4();
     result += series2();
     result += series3();
     result += series4();
+    result += series5();
     
     if (!result) {
         cout << " passed ";
     
     if (!result) {
         cout << " passed ";