]> www.ginac.de Git - ginac.git/blobdiff - check/exam_pseries.cpp
Finalize 1.7.6 release.
[ginac.git] / check / exam_pseries.cpp
index 5d3c8d7d8341240e19ccbf6ad0814f395ce048c8..e59026c494384a0124d203962c19d1310c77c308 100644 (file)
@@ -3,7 +3,7 @@
  *  Series expansion test (Laurent and Taylor series). */
 
 /*
- *  GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2019 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
@@ -141,6 +141,10 @@ static unsigned exam_series1()
        d = pow(a, b) + (pow(a, b)*b/a)*x + (pow(a, b)*b*b/a/a/2 - pow(a, b)*b/a/a/2)*pow(x, 2) + Order(pow(x, 3));
        result += check_series(e, 0, d, 3);
 
+       e = a * (1 / (x * sin(x)) - sin(x) / x);
+       d = a * pow(x, -2) + Order(pow(x, -1));
+       result += check_series(e, 0, d, -1);
+
        return result;
 }
 
@@ -173,6 +177,7 @@ static unsigned exam_series3()
 // Series exponentiation
 static unsigned exam_series4()
 {
+       using GiNaC::tgamma;
        unsigned result = 0;
        ex e, d;
        
@@ -211,6 +216,7 @@ static unsigned exam_series5()
 // Series expansion of tgamma(-1)
 static unsigned exam_series6()
 {
+       using GiNaC::tgamma;
        ex e = tgamma(2*x);
        ex d = pow(x+1,-1)*numeric(1,4) +
               pow(x+1,0)*(numeric(3,4) -
@@ -328,6 +334,7 @@ static unsigned exam_series11()
 static unsigned exam_series12()
 {
        using GiNaC::log;
+       using GiNaC::atanh;
 
        unsigned result = 0;
        ex e, d;
@@ -366,6 +373,23 @@ static unsigned exam_series13()
        return result;
 }
 
+// Test if (1+x)^(1/x) can be expanded.
+static unsigned exam_series14()
+{
+       unsigned result = 0;
+
+       ex e = pow(1+x, sin(x)/x);
+       ex d = 1 + x - pow(x,3)/6 + Order(pow(x,4));
+       try {
+               result += check_series(e,0,d,4);
+       } catch (const pole_error& err) {
+               clog << "series expansion of " << e << " at 0 raised an exception." << endl;
+               ++result;
+       }
+
+       return result;
+}
+
 unsigned exam_pseries()
 {
        unsigned result = 0;
@@ -385,6 +409,7 @@ unsigned exam_pseries()
        result += exam_series11();  cout << '.' << flush;
        result += exam_series12();  cout << '.' << flush;
        result += exam_series13();  cout << '.' << flush;
+       result += exam_series14();  cout << '.' << flush;
        
        return result;
 }