Dear Vladimir V. Kisil, Thanks very much for suggestion to use expand() method on e3 first. And I have given a look at the source code at power::to_polynomial https://www.ginac.de/reference/normal_8cpp_source.html#l02688 2688 ex power::to_polynomial(exmap & repl) const 2689 { 2690 if (exponent.info(info_flags::posint)) 2691 return pow(basis.to_rational(repl), exponent); 2692 else if (exponent.info(info_flags::negint)) 2693 { 2694 ex basis_pref = collect_common_factors(basis); 2695 if (is_exactly_a<mul>(basis_pref) || is_exactly_a<power>(basis_pref)) { 2696 // (A*B)^n will be automagically transformed to A^n*B^n 2697 ex t = pow(basis_pref, exponent); 2698 return t.to_polynomial(repl); 2699 } 2700 else 2701 return pow(replace_with_symbol(pow(basis, _ex_1), repl), -exponent); 2702 } 2703 else 2704 return replace_with_symbol(*this, repl); 2705 } and I wonfer if there is a typo on line 2691, the basis.to_rational can be replaced with basis.to_polynomial? Best regards! Feng