]> www.ginac.de Git - ginac.git/commitdiff
Fix bug in inifcns_nstdsums.cpp...
authorStefan Weinzierl <weinzierl@uni-mainz.de>
Fri, 22 Mar 2019 09:01:30 +0000 (10:01 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Fri, 22 Mar 2019 09:01:30 +0000 (10:01 +0100)
...related to trailing zeros in combination with user-specified signs for small
imaginary parts.

When the trailing zeros are shuffled away, the information on the signs of the
small imaginary parts has to be kept.

This bug was reported by Dmitry Chicherin.

ginac/inifcns_nstdsums.cpp

index e2e48bc1eeeba031f67490d1ef6383110bf8e295..482afcd9fb61c963f6811fe4d158377ee1befa37 100644 (file)
@@ -605,6 +605,27 @@ ex G_eval(const Gparameter& a, int scale, const exvector& gsyms)
        return pow(-1, x.nops()) * Li(m, x);
 }
 
+// convert back to standard G-function, keep information on small imaginary parts
+ex G_eval_to_G(const Gparameter& a, int scale, const exvector& gsyms)
+{
+       lst z;
+       lst s;
+       for (const auto & it : a) {
+               if (it != 0) {
+                        z.append(gsyms[std::abs(it)]);
+                       if ( it<0 ) {
+                         s.append(-1);
+                       } else {
+                         s.append(1);
+                       }
+               } else {
+                       z.append(0);
+                       s.append(1);
+               }
+       }
+       return G(z,s,gsyms[std::abs(scale)]);
+}
+
 
 // converts data for G: pending_integrals -> a
 Gparameter convert_pending_integrals_G(const Gparameter& pending_integrals)
@@ -844,8 +865,12 @@ ex G_transform(const Gparameter& pendint, const Gparameter& a, int scale,
                return result / trailing_zeros;
        }
 
-       // convergence case or flag_trailing_zeros_only
-       if (convergent || flag_trailing_zeros_only) {
+       // flag_trailing_zeros_only: in this case we don't have pending integrals
+       if (flag_trailing_zeros_only)
+               return G_eval_to_G(a, scale, gsyms);
+
+       // convergence case
+       if (convergent) {
                if (pendint.size() > 0) {
                        return G_eval(convert_pending_integrals_G(pendint),
                                      pendint.front(), gsyms) *