[GiNaC-list] issue about series involving positive symbol

Feng Feng f.feng at outlook.com
Sun Jul 26 12:36:10 CEST 2020


Hi all,

I come across an issue about the series on an expression involving positive symbol, i.e., possymbol in GiNaC.
the problem can be reproduced by the following program (test.cpp), for example, we compile the test.cpp to test,
and then run the test program several times, we will see different outputs.

for example, we can run the bash script in the terminal:
for n in {1..20}; do ./test; done

PS: if we change the possymbol to symbol in the test.cpp, we will always get correct result.

Best regards!
Feng

---
#include "ginac/ginac.h"

using namespace std;
using namespace GiNaC;

int main() {
    possymbol t("t");
    symbol m("m"), ep("ep");
    symtab table;
    table["ep"] = ep;
    table["t"] = t;
    table["m"] = m;
    parser reader(table);

    ex in1 = reader("(-3/2*t^2*(2*t*m^2-3*m^2*(-1+t))^(-1)*(-1+t)^(-1))");
    ex in2 = reader("((3*pow(m,-2)*pow(-3+t,-1)*pow(-1+t,-1)*pow(t,2))/2)");

    cout << "in1-in2 = " << normal(in1-in2) << endl;

    in1 = pow(in1,-1+ep)*tgamma(ep);
    in2 = pow(in2,-1+ep)*tgamma(ep);

    ex diff = series_to_poly(series(in1-in2,ep,1));
    lst repl = lst{ep==2,m==1,t==1/ex(3)};
    cout << "diff = " << normal(diff.subs(repl)) << endl;
    return 0;
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ginac.de/pipermail/ginac-list/attachments/20200726/6318bff7/attachment.htm>


More information about the GiNaC-list mailing list