X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Fseries_expansion.cpp;h=4cd169706d0dd4ca418f5ccdd6c70cd5e68ff9f7;hp=bd7cbbb348e9da37928f6ef194fef6046d927f38;hb=ff50f412bb89eed2c78adffa0f390341753e8792;hpb=84806997c064f7429cbec8b446b91445430fb1fb diff --git a/check/series_expansion.cpp b/check/series_expansion.cpp index bd7cbbb3..4cd16970 100644 --- a/check/series_expansion.cpp +++ b/check/series_expansion.cpp @@ -20,18 +20,18 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#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"); 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(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 @@ -131,8 +131,28 @@ 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; @@ -190,6 +210,7 @@ unsigned series_expansion(void) result += series2(); result += series3(); result += series4(); + result += series5(); if (!result) { cout << " passed ";