Comment #8 on issue 1181 by [email protected]: Advanced trigonometric
simplification
http://code.google.com/p/sympy/issues/detail?id=1181
I am new to SymPy, so I may have missed a more straight forward method:
I have found the following quite useful in simplifying trigonometric
expressions:
trigsimp_via_exp = lambda expr:
expr.rewrite((sin,cos),exp).expand().rewrite(exp,sin).expand()
## example ##
var('theta')
R = Matrix([[cos(theta),-sin(theta)],[sin(theta),cos(theta)]])
s_rr = cos(theta/2)*(1+sin(theta/2)**2)
s_tt = cos(theta/2)**3
s_rt = cos(theta/2)**2*sin(theta/2)
sigma_polar = Matrix([[s_rr,s_rt],[s_rt,s_tt]])
sigma_cart = R*sigma_polar*R.T
s_xx,s_xy,s_yx,s_yy = flatten(sigma_cart)
trigsimp_via_exp = lambda expr:
expr.rewrite((sin,cos),exp).expand().rewrite(exp,sin).expand()
# compare the output of
s_xx
# and
trigsimp_via_exp(s_xx)
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.