Dear all, I am using the function to_polynomial to produce a polynomial from a expression, it seems that to_polynomial does not return a polynomial in some cases, as illustrated in the following example, note that it works well on expression e2, while it does nothing on e3 (e3=e2^2), and does not return a polynomial. #include "ginac/GiNaC.h" using namespace GiNaC; using namespace std; int main() { symbol x("x"), y("y"); auto e1 = x+y; auto e2 = e1+1/e1+pow(e1,4); auto e3 = pow(e2, 2); exmap mp2; ex p2 = e2.to_polynomial(mp2); cout << " = " << p2 << "\n with " << mp2 << endl; //= y+symbol4+x+(y+x)^4 // with {symbol4==(y+x)^(-1)} exmap mp3; ex p3 = e3.to_polynomial(mp3); cout << " = " << p3 << "\n with " << mp3 << endl; //= (y+(y+x)^(-1)+x+(y+x)^4)^2 //with {} return 0; } Best regards! Feng