From: Christian Bauer Date: Sun, 6 Feb 2005 16:22:19 +0000 (+0000) Subject: don't produce zero coefficients in a pseries object [Chris Dams] X-Git-Tag: release_1-4-0~195 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=d2df5be8fc866c55ea2d893620883ee070064e33 don't produce zero coefficients in a pseries object [Chris Dams] --- diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index bc04b186..67725d9f 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -1100,12 +1100,12 @@ ex integral::series(const relational & r, int order, unsigned options) const fexpansion.reserve(fseries.nops()); for (size_t i=0; i(fseries).coeffop(i); - fexpansion.push_back(expair( - currcoeff == Order(_ex1) - ? currcoeff - : integral(x, a.subs(r), b.subs(r), currcoeff), - ex_to(fseries).exponop(i) - )); + currcoeff = (currcoeff == Order(_ex1)) + ? currcoeff + : integral(x, a.subs(r), b.subs(r), currcoeff); + if (currcoeff != 0) + fexpansion.push_back( + expair(currcoeff, ex_to(fseries).exponop(i))); } // Expanding lower boundary @@ -1118,7 +1118,7 @@ ex integral::series(const relational & r, int order, unsigned options) const break; ex currexpon = ex_to(fseries).exponop(i); int orderforf = order-ex_to(currexpon).to_int()-1; - currcoeff=currcoeff.series(r, orderforf); + currcoeff = currcoeff.series(r, orderforf); ex term = ex_to(aseries).power_const(ex_to(currexpon+1),order); term = ex_to(term).mul_const(ex_to(-1/(currexpon+1))); term = ex_to(term).mul_series(ex_to(currcoeff)); @@ -1134,7 +1134,7 @@ ex integral::series(const relational & r, int order, unsigned options) const break; ex currexpon = ex_to(fseries).exponop(i); int orderforf = order-ex_to(currexpon).to_int()-1; - currcoeff=currcoeff.series(r, orderforf); + currcoeff = currcoeff.series(r, orderforf); ex term = ex_to(bseries).power_const(ex_to(currexpon+1),order); term = ex_to(term).mul_const(ex_to(1/(currexpon+1))); term = ex_to(term).mul_series(ex_to(currcoeff));