In [1]: var('x y', positive=True) Out[1]: (x, y) In [2]: ex = x**2 * y**4
In [3]: w = Wild('w') In [4]: mt = ex.match(w**2) In [5]: mt Out[5]: ⎧ 2⎫ ⎨w: x⋅y ⎬ ⎩ ⎭ In [6]: Pow(mt[w], 2, evaluate=False) Out[6]: 2 ⎛ 2⎞ ⎝x⋅y ⎠ On Tuesday, March 31, 2015 at 4:50:59 PM UTC+2, Paul Royik wrote: > > Is there any way I can rewrite > x^2y^4 to (xy^2)^2 or x^3(x+y)^6 to (x(x+y)^2)^3 > > > , i.e. combine base? > > > Exponents are guaranteed to be integers. > > > Thank you. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/4f837d86-2c54-416e-92a1-53687b484b6c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.