Well, this week was the start of Google Summer of Code 2011. Unfortunately, the quarter is still not over for me, so I didn’t make as much progress as I would like. But, it looks like some of the questions about rewriting the Vector class have been answered.
When doing dynamics problems by hand, basis vectors are typically written as:
Where e is the reference frame within which the basis vectors are “standard”. One thing that is immediately obvious is that the numbering starts from 1, unlike most programming languages, which start indices at 0. PyDy is going to be printing out equations to LaTeX, for use in publication; this would most certainly use 1 indexing. This leads to some conflicting things, where e in the code is in LaTeX. This is something I definitely did not want to happen. So e.x, e.y, and e.z will be how the basis vectors are accessed, removing the indexing question. There will be a LaTeX printing option to determine 123, xyz, or ijk indices. But, there will never be 0 as an index (that the end-user will see).
My decision to keep the basis vectors in the ReferenceFrame class, versus generating them upon some function call, ultimately came down to the same issue. If you named a set of basis vectors b1,b2,b3 , but they were in frame “Foo”, printing them would give foo1>, foo2>, foo3>. This again, would be unacceptable. This situation is also fairly likely to come up, as one usually wants to take shortcuts (I know I have when using Autolev). It also ties into what I guess is my last point for this topic: readability for non-python programmers.
The professor who will teach the graduate multibody dynamics course next year said that he would consider teaching the students PyDy next winter quarter. This is going to mean that the code should be readable by people who aren’t familiar with Python. Here, by code, I mean the scripts that people will write to generate their equations of motion. Anyways, readability for non-Python users, while still trying to be Pythonic, will be an important consideration this summer.
Next is finishing up the Vector and ReferenceFrame classes. I’m trying to reuse as much code as possible, and definitely not lose any functionality. It seems to be going OK so far and hopefully it will stay that way.