On Sun, May 15, 2011 at 1:40 AM, Luke <hazelnu...@gmail.com> wrote: > Gilbert, > I prefer this notation: > >>>> B = ReferenceFrame('B') > > and then to access the basic vectors of that frame, to use one of the > following approaches: > > B.x, B.y, B.z or, B.i, B.j, B.k > > You could view the ReferenceFrame class as a container object for the > basis vectors and implement the __iter__() method to iterate over the > basis vectors in the following way: > > v = a*B.i + b*B.j + B.k > for basisvector in B: > dot(v, basisvector) > > Since we are restricting ourself to basis vectors in R^3, we probably > don't need all the other methods typical of a container object, I > think __iter__() would be enough. > > My vote is to go with the ijk or xyz syntax and not use the > __getitem__() method that allows for B[1]. This will mean some work > to change things from how they are currently implemented in PyDy, but > I think the syntax is cleaner and more concise. What do other people > think about this?
My preference is the ijk syntax so v = a*B.i + b*B.j + B.k works fine for me. Being able to convert v to a 1x3 matrix would be nice too. In the event you want to work with it as a linear algebra vector or as a tensor would be useful. So, if you could say lv = Vector(v) to convert v to a 1x3 vector. I'd prefer not to use xyz since that's typically used solely for Cartesian coordinates. > > Another thing to think about though is how you will print the basis > vectors, both to the screen and to LaTeX. Currently, PyDy prints > UnitVectors as b1>, b2>, b3>, and it uses unicode to make the color > bright so you can distinguish UnitVectors from the scalar multiplier. > For LaTeX printing, this I think should be \boldsymbol{b}_{1}, > \boldsymbol{b}_x or \boldsymbol_{i}. If you go with the ijk syntax, > bi>, bj>, bk> might work but in most physics/math books I have seen > they typically only use \hat{\boldsymbol{i}}, etc, and typically this > is in settings where you don't have many different reference frames to > distinguish between, so the syntax isn't ambiguous. On the other > hand, I have seen \boldsymbol{b}_x, etc, so perhaps this might be more > common and familiar to some users? It is a pretty minor difference, > so I say you pick one you think is most likely to appeal to the widest > audience and stick with it. This might also be something that could > have a default value, but could be customized -- I have seen > subscripts of ijk, xyz, 012, or 123 in various classical mechanics > literature. what about \vec{i} which is quite common. I use a variant with the vector on the bottom instead of the top, but I created a command to get the style I wanted. The advantage of using \vec{i} is that it's simple to use regular expressions to switch to another command and easy to switch by hand if necessary. I don't use I think you'd want \mathbf{b} instead of \boldsymbol, though. \boldsymbol seems to be used for symbols, while \mathbf is a math bold font for characters. > > Do any of the physics people out there have thoughts on what syntax > would be nicest for physics students? We definitely want to keep the > syntax familiar to that potential user base, but we also need to make > sure we can accommodate many different reference frames which is > common in multibody dynamics. > \vec with i,j,k as the basis vectors is what's taught in all the engineering physics courses I know of at my university. I've been a TA for all physics courses but the EM course in my department (and been friends with various people in other departments). We've tended to use \mathbf{v} for the vector of magnitudes that multiply the basis vectors. So, you could have \vec{v} = [\vec{i} \vec{j} \vec{k}] [v_1 v_2 v_3]^T where the last vector is \mathbf{v} (and all are assumed to be a column vector). I just wrote them as row vectors for e-mail convenience. Cheers, Tim. -- Tim Lahey PhD Candidate, Systems Design Engineering University of Waterloo http://about.me/tjlahey -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@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.