Re: [Sports Biomechanics] Re: [sympy] Question on Interfaces

2011-08-12 Thread Aaron Meurer
On Thu, Aug 11, 2011 at 3:31 PM, Jim Jewett jimjjew...@gmail.com wrote: On Thu, Aug 11, 2011 at 5:22 PM, Jason Moore moorepa...@gmail.com wrote: Couple more thoughts on operator overloading. ... The outer product doesn't really have a symbol on the keyboard. It often uses an x with a circle

[sympy] Question on Interfaces

2011-08-11 Thread Gilbert Gede
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

Re: [sympy] Question on Interfaces

2011-08-11 Thread Matthew Rocklin
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

Re: [sympy] Question on Interfaces

2011-08-11 Thread Luke
I ran this same question by my girlfriend who teaches undergraduate physics classes. She isn't an experienced programmer, so concepts of operator overloading and object oriented vs functional programming styles are not on here mind, but she has taught a lot of the core required physics classes to

Re: [Sports Biomechanics] Re: [sympy] Question on Interfaces

2011-08-11 Thread Jason Moore
I'm for the functional names as it is how all the programming languages that I know of implement dot products and cross products. It is clear what they mean and the symbols we use in math for the dot product and cross product (a dot and a cross) do not exist explicitly on the key board. Secondly,

Re: [Sports Biomechanics] Re: [sympy] Question on Interfaces

2011-08-11 Thread Jason Moore
FYI: there is a lot of stuff on the subject we've already typed here: https://github.com/sympy/sympy/pull/450#issuecomment-1782199 For the sake of retyping. On Thu, Aug 11, 2011 at 1:15 PM, Jason Moore moorepa...@gmail.com wrote: I'm for the functional names as it is how all the programming

Re: [Sports Biomechanics] Re: [sympy] Question on Interfaces

2011-08-11 Thread Luke
One comment below. On Thu, Aug 11, 2011 at 1:15 PM, Jason Moore moorepa...@gmail.com wrote: I'm for the functional names as it is how all the programming languages that I know of implement dot products and cross products. It is clear what they mean and the symbols we use in math for the dot

Re: [Sports Biomechanics] Re: [sympy] Question on Interfaces

2011-08-11 Thread Matthew Rocklin
Thanks for the link Jason, there is some good discussion there which it would be optimal to not have to repeat. My opinion after reading through that is as follows. I like operators. If the language supports it and you can find a good set they really do make writing code feel more like writing

Re: [Sports Biomechanics] Re: [sympy] Question on Interfaces

2011-08-11 Thread Jason Moore
Couple more thoughts on operator overloading. Let's assume the '+' symbol means 'to add' in the language of choice. It is very clear that what adding two numbers should do, but what about other objects: object = matrix '+' should add the matrix. we could write a function called 'add_matrix',

Re: [Sports Biomechanics] Re: [sympy] Question on Interfaces

2011-08-11 Thread Jim Jewett
On Thu, Aug 11, 2011 at 5:22 PM, Jason Moore moorepa...@gmail.com wrote: Couple more thoughts on operator overloading. ... The outer product doesn't really have a symbol on the keyboard. It often uses an x with a circle around it. Same with cross...the 'x' would be the best choice, but our

Re: [Sports Biomechanics] Re: [sympy] Question on Interfaces

2011-08-11 Thread Matthew Rocklin
I agree with Jason that coercing operators to perform unfamiliar tasks is probably a poor choice. I disagree however that operators have only a single meaning or that they should be avoided when their meaning might be ambiguous. Example of the first (operators have only a single meaning) also

Re: [sympy] Question on Interfaces

2011-08-11 Thread Gilbert gede
I chose the to represent dot product specifically because of its meaning of and/interection in Python; that is how I view the dot product of two vectors, as the common component between two vectors. I decided to only use * for scalar multiplication, to further reinforce that operations between

Re: [sympy] Question on Interfaces

2011-08-11 Thread Chris Smith
On Fri, Aug 12, 2011 at 4:29 AM, Gilbert gede gilbertg...@gmail.com wrote: I chose the to represent dot product specifically because of its meaning of and/interection in Python; that is how I view the dot product of two vectors, as the common component between two vectors. I decided to only