Ondrej Certik wrote: > Hi Alan! > > On Wed, Dec 2, 2009 at 3:48 PM, Alan Bromborsky<abro...@verizon.net> wrote: > >> Alan Bromborsky wrote: >> >>> Vinzent Steinberg wrote: >>> >>> >>>> On 1 déc, 21:28, Scott<scotta_2...@yahoo.com> wrote: >>>> >>>> >>>> >>>>> Is there a sympy function for making symbolic tensors? >>>>> Basically I want to treat 3x3 rotation tensor symbol that is constant >>>>> inside of an integral while preserving the tensor algebra (A*B .ne. >>>>> B*A). The 3x3 rotain tensor is multiplied by a 3x1 position tenosr >>>>> which is integrated. >>>>> >>>>> Is there a built in function for converting a 3*1 tensor to a skew >>>>> antisymetric cross product matrix then back again? >>>>> V/R >>>>> >>>>> Scott >>>>> >>>>> >>>>> >>>> This is one of our oldest issues: >>>> http://code.google.com/p/sympy/issues/detail?id=16 >>>> >>>> You may have a look at the geometric algebra module, but there are no >>>> tensors in sympy yet. >>>> >>>> Vinzent >>>> >>>> -- >>>> >>>> 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. >>>> >>>> >>>> >>>> >>>> >>>> >>> In geometric algebra rotations are done via rotors (spinors) as follows: >>> >>> For a the rotation of a vector x around an axis u (|u| = 1) through >>> an angle theta, the rotor is: >>> >>> R = cos(theta)-I*u*sin(theta) >>> >>> where I is the pseudo scalar (I=i*j*k if i, j, and k are orthogonal >>> basis vectors and * the geometric product). >>> The components of I*u form a rank 2 antisymmetric tensor. The >>> reverse of R, rev(R) is: >>> >>> rev(R) = cos(theta)+I*u*sin(theta) >>> >>> The rotated x, x' is then: >>> >>> x' = R*x*rev(R) >>> >>> where again * is the geometric product. >>> >>> What domain (path, area, or volume) do you want to integrate >>> R*x*rev(R) over? >>> >>> -- >>> >>> 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. >>> >>> >>> >>> >>> >> Here is your example: >> >> First the code - >> >> #!/usr/bin/python >> >> import sys >> import os,sympy,time >> from sympy.galgebra.GA import * >> from sympy import cos,sin >> set_main(sys.modules[__name__]) >> >> if __name__ == '__main__': >> >> make_symbols('a x y z') >> MV.setup('e',metric='[1,1,1]',coords=[x,y,z]) >> MV.set_str_format(1) >> u = MV('u','vector') >> x = MV('x','vector') >> print u >> print x >> print MV.I*u >> R = cos(a)-MV.I*u*sin(a/2) >> Rrev = R.rev() >> print R >> print Rrev >> MV.set_str_format(2) >> rot_x = R*x*Rrev >> rot_x.simplify() >> print rot_x >> >> Second the result - >> >> u__x*e_x+u__y*e_y+u__z*e_z >> >> x__x*e_x+x__y*e_y+x__z*e_z >> >> u__z*e_xe_y-u__y*e_xe_z+u__x*e_ye_z >> >> cos(a/2)-u__z*sin(a/2)*e_x^e_y+u__y*sin(a/2)*e_x^e_z-u__x*sin(a/2)*e_y^e_z >> >> cos(a/2)+u__z*sin(a/2)*e_x^e_y-u__y*sin(a/2)*e_x^e_z+u__x*sin(a/2)*e_y^e_z >> >> (-2*u__z*x__y*cos(a/2)*sin(a/2)+2*u__y*x__z*cos(a/2)*sin(a/2)+x__x*cos(a/2)**2+x__x*u__x**2*sin(a/2)**2-x__x*u__y**2*sin(a/2)**2-x__x*u__z**2*sin(a/2)**2+2*u__x*u__y*x__y*sin(a/2)**2+2*u__x*u__z*x__z*sin(a/2)**2)*e_x >> +(-2*u__x*x__z*cos(a/2)*sin(a/2)+2*u__z*x__x*cos(a/2)*sin(a/2)+x__y*cos(a/2)**2+x__y*u__y**2*sin(a/2)**2-x__y*u__x**2*sin(a/2)**2-x__y*u__z**2*sin(a/2)**2+2*u__x*u__y*x__x*sin(a/2)**2+2*u__y*u__z*x__z*sin(a/2)**2)*e_y >> +(-2*u__y*x__x*cos(a/2)*sin(a/2)+2*u__x*x__y*cos(a/2)*sin(a/2)+x__z*cos(a/2)**2+x__z*u__z**2*sin(a/2)**2-x__z*u__x**2*sin(a/2)**2-x__z*u__y**2*sin(a/2)**2+2*u__x*u__z*x__x*sin(a/2)**2+2*u__y*u__z*x__y*sin(a/2)**2)*e_z >> >> In the previous post I forgot you had to use the half-angle! >> > > thanks for this, I am always intrigued how well you handle the > geometric algebra and that you are able to handle all problems that > people (including myself) raise with tensors. It's really cool, I am > glad we have it in sympy. > > 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. > > > > What would be the best way to handle the double angle reduction to simplify the output?
-- 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.