I personally like the functions, dot(a,b), etc... and would be sad to see
them left out. If you had to kick one I would get rid of the object oriented
syntax a.dot(b). This is just a personal preference though.

It seems to me though that Python is all about having several overlapping
syntaxes (for better or for worse). Even if I used dot(a,b) exclusively I
don't think that a.dot(b) would ever get in my way. I don't think it's a
terrible idea to keep them all around.

While I'm stating personal preferences how about ** for dot? To me this says
"I'm multiplication, but different".

Also, in some areas of mathematics the wedge operator ∧ is used to represent
the outer product. Your use of ^ might be mistaken for this.

On Thu, Aug 11, 2011 at 2:14 PM, Gilbert Gede <[email protected]> wrote:

> 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.
>

-- 
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.

Reply via email to