Hi Ondrej Thanks for the reply. I have appended below the code (which takes more time during trigsimp). My version of sympy is, 0.6.7
I have to check on the tips which Aaron has suggested. ############################################################### from sympy import * from sympy.printing import print_latex t = var('theta'); psi = var('psi') ; phi = var('phi') s_11 = var('s_11') ; s_22 = var('s_22'); s_33 = var('s_33') def rotmat2(psi,t,phi): """ Rotation about zxz - Euler matrix i.e. alpha, beta, gamma - angles in z x z order i.e. psi, theta, phi - angles in z x z order Molecular frame to lab frame of reference """ # rotn. about z axis r_psi = Matrix([\ [ cos(psi), sin(psi), 0.0],\ [-sin(psi), cos(psi), 0.0],\ [ 0.0 , 0.0 , 1.0]]) # rotn. about x axis r_t = Matrix([\ [1.0, 0.0, 0.0 ],\ [0.0, cos(t), sin(t)],\ [0.0, -sin(t), cos(t)]]) # rotn. about z axis r_phi = Matrix([\ [cos(phi) ,sin(phi), 0.0],\ [-sin(phi),cos(phi), 0.0],\ [0.0 , 0.0 , 1.0]]) R = r_psi*r_t*r_phi return R #2nd rank tensor def T(s_11, s_22, s_33): t = Matrix([\ [s_11, 0.0, 0.0],\ [0.0, s_22, 0.0],\ [0.0, 0.0, s_33]]) return t def transform_t(psi, t, phi, t_11, t_22, t_33): new_t = rotmat2(psi, t, phi)*T(s_11, s_22, s_33)*rotmat2(psi,t,phi).inv() return new_t new_t = transform_t(psi, t, phi, s_11, s_22, s_33) simp_new_t = new_t.applyfunc(lambda x: trigsimp(x, deep=True, recursive=True)) pretty_print(simp_new_t) #tex_head = "\documentclass[10pt,landscape]{article}" + '\n' + "\usepackage[left=0.5cm,right=0.5cm,top=0.5cm,bottom=0.5cm]{geometry}" + '\n' + "\usepackage{amsmath, amssymb, bm}" + '\n' + "\ \begin{document}" + '\n' + '\\tiny' #print '%s' %(tex_head) #print_latex(simp_new_t) #print "\n" + "\end{document}" ############################################################################ Thanks Viswanath. On Jun 25, 9:40 pm, Ondrej Certik <ond...@certik.cz> wrote: > Hi Viswanath, > > On Fri, Jun 25, 2010 at 3:07 AM, morovia morovia > > <jallika...@googlemail.com> wrote: > > Hi Bastian, > > > Thanks for your reply. > > > I would like to have the final function > > in a symbolic way and later do evalf. But, the > > trigsimp with deep and recursive options set > > to true, did not yield the simplified form. > > > I am not sure how the trigonometry relations > > are handled. > > > Earlier, I have tried with inverse_ADJ() which > > keeps it slow, but with only inv it is faster. > > Can you post here the script that generates the trig expressions that > you need to simplify? We started to write a better trig solver, but > it's not finished yet. I CCed Luke, who has been working on it. > > Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sy...@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.