Luke wrote: > I'm trying to figure out how I could implement in Sympy a way to take > dot and cross products of unit vectors in different reference frames. > For example, suppose I have a reference frame 'A', along with 3 > dextral orthonormal vectors: a1, a2, a3. I think I can figure out how > to code up something so that dot and cross products in the same > reference frame would give the following results: > In[1]: dot(a1,a2) > Out[1]: 0 > In[2]: dot(a1,a1) > Out[2]: 1 > In[3]: cross(a1,a2) > Out[3]: a3 > > I haven't done this yet, but I think it should be pretty > straightforward. What I would like to extend this to is to be able to > dot and cross multiply unit vectors from different reference frames. > For example, suppose I introduce a second reference frame 'B', along > with 3 dextral orthonormal vectors: b1, b2, b3, and I orient B by > aligning B with A then performing a simple rotation of B about the > a3=b3 axis by an angle q1. Then: > b1 = cos(q1)*a1 + sin(q1)*a2 > b2 = -sin(q1)*a1 + cos(q1)*a2 > b3 = a3 > > I would like to then be able to do: > In[4]: dot(a1,b1) > Out[4]: cos(q1) > > etc... > > I guess what I'm not sure about is how to structure all the objects so > that if a rotation matrix hasn't been defined between two reference > frames, an exception is raised and you can't take the dot or cross > product. It would be ideal to be able to handle long chains of simple > rotations so that every possible rotation matrix wouldn't need to be > defined explicitly, i.e., if I specify the orientation of B relative > to A (as above), and then the orientation of another reference frame C > relative to B, and then try to take a dot product between a1 and c1, > the two rotation matrices (C to B, B to A) get multplied and then used > to compute the dot product. > > I'm familiar with classes and python fairly well, and I know the > kinematics well, but I'm by no means an experience object oriented > programmer, so I'm not sure about how the best way to structure things > would be. > > Any suggestions on how I might start on something like this? > > Thanks, > ~Luke > > > > > Do you want to do this purely symbolically or are you going to put in specific values? That is do you want sympy only to generate symbolic formulas that you will later use in a program or do you want sympy to also do the numerical evaluation?
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" 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?hl=en -~----------~----~----~----~------~----~------~--~---
