sequence multiplied by -1

Mel mwilson at the-wire.com
Sat Sep 25 12:28:38 EDT 2010


Stefan Schwarzer wrote:
> On 2010-09-25 15:54, Yingjie Lan wrote:
>> The first one is simpler (4 chars v.s. 9 chars).

>> I thought it was also intuitive because if you multiply
>> a vector by -1, you should get a vector
>> in the reversed direction. But, intuitiveness depends
>> on who you are, what you do, etc....
> 
> Sure ... in math, multiplying a vector by -1 gives a vector
> with all its elements negated:
> 
>     -1 * [1, 2, 3] -> [-1, -2, -3]
> 
> :-)

And math applies associativity

v * (3 - 1) == v * 3 + v * -1


	Mel.



More information about the Python-list mailing list