My Summer of Code project is writing a submodule of SymPy for creation of symbolic equations of motion for multibody systems. As part of this, I've implemented classes to represent vectors and dyadics. I have currently implemented three ways to do mathematical operations on vectors: an operator, a function, and a method interface. I think three interfaces for these operations is too many, and am looking for some input on which ones people prefer. The implemented interfaces look like:
Cross product: >>> (vec1 ^ vec2) >>> cross(vec1, vec2) >>> vec1.cross(vec2) Dot product: >>> (vec1 & vec2) >>> dot(vec1, vec2) >>> vec1.dot(vec2) Outer product: >>> (vec1 | vec2) >>> outer(vec1, vec2) >>> vec1.outer(vec2) Here is one example where vector and dyadic quantities are used in the code. I is a dyadic, and omega and alpha are vectors. >>> -(I & alpha) - (omega ^ (I & omega)) >>> -dot(I, alpha) - cross(omega, dot(I, omega)) >>> -I.dot(alpha) - omega.cross(I.dot(omega)) I'd appreciate people's opinions on: 1) Which is clearest? 2) Which would be easiest to teach? 3) Which is least error prone? I personally prefer the operator interface (&, ^, |), as I think once you learn what the three operators represent, it is clearer to read and write. I would especially value the input of anyone who would be interested in using this as part of teaching students. I've also made a poll here: http://www.surveymonkey.com/s/CK8HDMD Thanks, Gilbert -- 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.
