вторник, 1 декабря 2015 г., 12:58:34 UTC+6 пользователь Andrey Grozin
написал:
>
> I need the action inverse to expand_trig (I think it is needed more often
> than expand_trig; suppose I want to multiply two truncated Fourier series,
> I do expand, what next?).
>
No easy way to do this? In Mathematica I could use substitutions like
Cos[x_]*Cos[y_]->(Cos[x+y]+Cos[x-y])/2
(similarly in Reduce, Maxima,...). But in sympy .replace(...) will not find
cos(x)*cos(y) in a larger product:
>>> a=Wild('a')
>>> b=Wild('b')
>>> (z*cos(x)*cos(y)).replace(cos(a)*cos(b),(cos(a+b)+cos(a-b))/2)
z*cos(x)*cos(y)
So, how to do this?
--
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 [email protected].
To post to this group, send email to [email protected].
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/18f946be-6a7c-487b-a603-1ff9e58eff84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.