You can use this :

a,b,c = symbols('a b c')
expr = 49*cos(x)**2+49*sin(x)**2 + 5
expr.replace(a*sin(b)**2+a*cos(b)**2, a, exact=True)
# output 49*sin(x)**2 + 49*cos(x)**2 + 5



On Thursday, 18 February 2016 15:14:00 UTC+5:30, Paul Royik wrote:
>
> I'm trying to simplify a*cos(b)**2+a*sin(b)**2 to a
>
> So, I write
>
> a = sympy.Wild('a')
> b = sympy.Wild('b')
> expr = 49*cos(x)**2+49*sin(x)**2 + 5
> expr.replace(a*sympy.sin(b)**2+a*sympy.cos(b)**2, a, exact=True)
>
>
> But this doesn't work. expr is unchanged.
>

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/43a41034-e47d-48b6-b131-2ecc0e6a7c88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to