Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-16 Thread Roy Smith
In article , John Nagle wrote: > Then upgrade to 3D. You can represent latitude and longitude > as a 3-element unit vector. (GPS systems do this; latitude and > longitude are only generated at the end, for output.) And annoyingly so. Somebody I know was building a tracking system based on a

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-15 Thread John Nagle
On 10/10/2013 6:27 PM, Steven D'Aprano wrote: > For what it's worth, there is no three-dimensional extension to complex > numbers, but there is a four-dimensional one, the quaternions or > hypercomplex numbers. They look like 1 + 2i + 3j + 4k, where i, j and k > are all distinct but i**2 == j**2

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Gene Heskett
On Friday 11 October 2013 12:49:40 Roy Smith did opine: > In article , > > Oscar Benjamin wrote: > > If someone tried to explain why their field couldn't use ً for the > > circumference of a unit circle I would suggest that they adjust the > > other parts of their notation not ً (there are othe

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Steven D'Aprano
On Fri, 11 Oct 2013 10:05:03 -0400, Roy Smith wrote: > In article , > Oscar Benjamin wrote: > >> If someone tried to explain why their field couldn't use ð for the >> circumference of a unit circle I would suggest that they adjust the >> other parts of their notation not ð (there are other uses

Re: I am never going to complain about Python again

2013-10-11 Thread Joshua Landau
On 11 October 2013 10:11, Steven D'Aprano wrote: > On Fri, 11 Oct 2013 09:17:37 +0100, Joshua Landau wrote: > >> On 11 October 2013 03:08, Steven D'Aprano >> wrote: >>> >>> Given: >>> >>> x ∈ ℝ, x = 2 (reals) >>> y ∈ ℕ, y = 2 (natural numbers) >>> >>> we have x = y, but since 1/y is undefined (

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Roy Smith
In article , Oscar Benjamin wrote: > If someone tried to explain why their field couldn't use ð for the > circumference of a unit circle I would suggest that they adjust the > other parts of their notation not ð (there are other uses of ð. Pi is wrong: http://www.youtube.com/watch?v=jG7vhMMX

Re: I am never going to complain about Python again

2013-10-11 Thread Neil Cerutti
On 2013-10-11, Steven D'Aprano wrote: > On Thu, 10 Oct 2013 17:48:16 +, Neil Cerutti wrote: > >> >>> 5.0 == abs(3 + 4j) >> False > > Did you maybe accidentally rebind abs? If not, what version of > Python are you using? Honestly, I think I got my Python term and my Vim term mixed up. I Shall

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Jussi Piitulainen
Oscar Benjamin writes: > tried to explain why their field couldn't use π for the > circumference of a unit circle I would suggest that they adjust the > other parts of their notation not π (there are other uses of π. There's τ for the full circle; π is used for half the circumference. -- https

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Oscar Benjamin
On 11 October 2013 10:35, David wrote: > On 11 October 2013 12:27, Steven D'Aprano > wrote: >> On Fri, 11 Oct 2013 00:25:27 +1100, Chris Angelico wrote: >> >>> On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: BTW, one of the earliest things that turned me on to Python was when I disc

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Nobody
On Thu, 10 Oct 2013 14:12:36 +, Grant Edwards wrote: > Nope. "i" is electical current (though it's more customary to use upper > case). "I" is steady-state current (either AC or DC), "i" is small-signal current. -- https://mail.python.org/mailman/listinfo/python-list

Re: I am never going to complain about Python again

2013-10-11 Thread Chris Angelico
On Fri, Oct 11, 2013 at 8:11 PM, Steven D'Aprano wrote: > If you implicitly decide to promote entities, then of course you can > promote y to a real then take the invoice. Either you're channelling Bugs Bunny or you're trying to sell me something... you mean "take the inverse", I assume, here :)

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread David
On 11 October 2013 12:27, Steven D'Aprano wrote: > On Fri, 11 Oct 2013 00:25:27 +1100, Chris Angelico wrote: > >> On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: >>> BTW, one of the earliest things that turned me on to Python was when I >>> discovered that it uses j as the imaginary unit, not

Re: I am never going to complain about Python again

2013-10-11 Thread Steven D'Aprano
On Fri, 11 Oct 2013 09:17:37 +0100, Joshua Landau wrote: > On 11 October 2013 03:08, Steven D'Aprano > wrote: >> Your mistake here seems to be that you're assuming that if two numbers >> are equal, they must be in the same domain, but that's not the case. >> (Perhaps you think that 0.0 == 0+0j sh

Re: I am never going to complain about Python again

2013-10-11 Thread Joshua Landau
On 11 October 2013 03:08, Steven D'Aprano wrote: > Your mistake here seems to be that you're assuming that if two numbers > are equal, they must be in the same domain, but that's not the case. > (Perhaps you think that 0.0 == 0+0j should return False?) It's certainly > not the case when it comes t

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Chris Angelico
On Fri, Oct 11, 2013 at 11:13 AM, Dennis Lee Bieber wrote: > On Fri, 11 Oct 2013 01:20:01 +1100, Chris Angelico > declaimed the following: > >> >>This belongs in the Izzet League, I think. >> > Was that an MtG reference? It most assuredly was. The Ravnican guild known as the Izzet League

Re: I am never going to complain about Python again

2013-10-10 Thread Steven D'Aprano
On Thu, 10 Oct 2013 17:48:16 +, Neil Cerutti wrote: > >>> 5.0 == abs(3 + 4j) > False Did you maybe accidentally rebind abs? If not, what version of Python are you using? [steve@ando ~]$ for a in 2.4 2.5 2.6 2.7 3.2 3.3 ; do > python$a -c "print( 5.0 == abs(3 + 4j) )" ; > done True True Tr

Re: I am never going to complain about Python again

2013-10-10 Thread Steven D'Aprano
On Thu, 10 Oct 2013 09:09:42 -0400, Roy Smith wrote: > BTW, here's a Python equality oddity: > r = 0.0 c = 0 + 0j r == c > True Mathematically, this is only to be expected. int(r) == int(c) > Traceback (most recent call last): > File "", line 1, in > TypeError: can't con

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Steven D'Aprano
On Fri, 11 Oct 2013 00:25:27 +1100, Chris Angelico wrote: > On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: >> BTW, one of the earliest things that turned me on to Python was when I >> discovered that it uses j as the imaginary unit, not i. All >> right-thinking people will agree with me on t

Re: I am never going to complain about Python again

2013-10-10 Thread Roy Smith
In article , Neil Cerutti wrote: > >>> 5.0 == abs(3 + 4j) > False I'd like an argument, please. -- https://mail.python.org/mailman/listinfo/python-list

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread David
On 11 October 2013 06:29, Oscar Benjamin wrote: > > I learned to use i for sqrt(-1) while studying theoretical physics. > When I later found myself teaching maths to engineers I asked why j > was used and was given this explanation. I'm still unconvinced by it > though. Please don't be. We need d

Re: I am never going to complain about Python again

2013-10-10 Thread Cameron Simpson
On 10Oct2013 17:48, Neil Cerutti wrote: > On 2013-10-10, MRAB wrote: > > If r is real (float) and c is complex: > > r == c means r == c.real and c.imag == 0.0 > > Woah. I thought I was going by what the docs say: > > Python fully supports mixed arithmetic: when a binary > arithmetic op

Re: I am never going to complain about Python again

2013-10-10 Thread Neil Cerutti
On 2013-10-10, Oscar Benjamin wrote: > On 10 October 2013 18:48, Neil Cerutti wrote: >> I guess the "if appropriate" part eluded my eye. When *is* it >> appropriate? Apparently not during an equal test. >> > 5.0 == abs(3 + 4j) >> False > > If the above is genuine output then it's most likely

Re: I am never going to complain about Python again

2013-10-10 Thread Oscar Benjamin
On 10 October 2013 18:48, Neil Cerutti wrote: > I guess the "if appropriate" part eluded my eye. When *is* it > appropriate? Apparently not during an equal test. > 5.0 == abs(3 + 4j) > False If the above is genuine output then it's most likely floating point error. I wouldn't expect any erro

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Oscar Benjamin
On 10 October 2013 15:34, David wrote: > On 11 October 2013 00:25, Chris Angelico wrote: >> On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: >> >> I've never been well-up on complex numbers; can you elaborate on this, >> please? All I know is that I was taught that the square root of -1 is >>

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Christian Gollwitzer
Am 10.10.13 18:54, schrieb Grant Edwards: On 2013-10-10, Chris Angelico wrote: On Fri, Oct 11, 2013 at 1:12 AM, Grant Edwards wrote: Nope. "i" is electical current (though it's more customary to use upper case). "j" is the square root of -1. and that hypercomplex numbers include i, j, k,

Re: I am never going to complain about Python again

2013-10-10 Thread Neil Cerutti
On 2013-10-10, Ian Kelly wrote: > On Thu, Oct 10, 2013 at 11:48 AM, Neil Cerutti wrote: >> Woah. I thought I was going by what the docs say: >> >> Python fully supports mixed arithmetic: when a binary >> arithmetic operator has operands of different numeric types, >> the operand with the ?n

Re: I am never going to complain about Python again

2013-10-10 Thread Ian Kelly
On Thu, Oct 10, 2013 at 11:48 AM, Neil Cerutti wrote: > On 2013-10-10, MRAB wrote: >> On 10/10/2013 16:57, Rotwang wrote: >>> On 10/10/2013 16:51, Neil Cerutti wrote: [...] Mixed arithmetic always promotes to the wider type (except in the case of complex numbers (Ha!)). >

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Ethan Furman
On 10/10/2013 07:20 AM, Chris Angelico wrote: On Fri, Oct 11, 2013 at 1:12 AM, Grant Edwards wrote: Nope. "i" is electical current (though it's more customary to use upper case). "j" is the square root of -1. and that hypercomplex numbers include i, j, k, and maybe even other terms, and I n

Re: I am never going to complain about Python again

2013-10-10 Thread Neil Cerutti
On 2013-10-10, MRAB wrote: > On 10/10/2013 16:57, Rotwang wrote: >> On 10/10/2013 16:51, Neil Cerutti wrote: >>> [...] >>> >>> Mixed arithmetic always promotes to the wider type (except in >>> the case of complex numbers (Ha!)). >>> >>> r == c is equivalent to r == abs(c), which returns the magint

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Grant Edwards
On 2013-10-10, Chris Angelico wrote: > On Fri, Oct 11, 2013 at 1:12 AM, Grant Edwards > wrote: >> Nope. "i" is electical current (though it's more customary to use >> upper case). "j" is the square root of -1. >> >>> and that hypercomplex numbers include i, j, k, and maybe even other >>> terms

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread William Ray Wing
On Oct 10, 2013, at 10:12 AM, Grant Edwards wrote: > On 2013-10-10, Chris Angelico wrote: >> On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: >>> BTW, one of the earliest things that turned me on to Python was when I >>> discovered that it uses j as the imaginary unit, not i. All >>> right-t

Re: I am never going to complain about Python again

2013-10-10 Thread MRAB
On 10/10/2013 16:57, Rotwang wrote: On 10/10/2013 16:51, Neil Cerutti wrote: [...] Mixed arithmetic always promotes to the wider type (except in the case of complex numbers (Ha!)). r == c is equivalent to r == abs(c), which returns the magintude of the complex number. What? >>> -1 == -1 +

Re: I am never going to complain about Python again

2013-10-10 Thread Rotwang
On 10/10/2013 16:51, Neil Cerutti wrote: [...] Mixed arithmetic always promotes to the wider type (except in the case of complex numbers (Ha!)). r == c is equivalent to r == abs(c), which returns the magintude of the complex number. What? >>> -1 == -1 + 0j True >>> -1 == abs(-1 + 0j) False >

Re: I am never going to complain about Python again

2013-10-10 Thread Neil Cerutti
;> => evaluates as true >> >> http://wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array >> >> I swear, I am never going to complain about Python again. > > I've just finished reading JavaScript: The Good Parts, by Douglas > Crockford (now I'm

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread rusi
On Thursday, October 10, 2013 8:04:00 PM UTC+5:30, David wrote: > I have never heard the term "hypercomplex" numbers. I guess you > are referring to vectors with more dimensions than two. A three A generalization of quaternions : http://en.wikipedia.org/wiki/Hypercomplex_number http://en.wikipedia

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread David
On 11 October 2013 00:25, Chris Angelico wrote: > On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: > > I've never been well-up on complex numbers; can you elaborate on this, > please? All I know is that I was taught that the square root of -1 is > called i, and that hypercomplex numbers include

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Chris Angelico
On Fri, Oct 11, 2013 at 1:12 AM, Grant Edwards wrote: > Nope. "i" is electical current (though it's more customary to use > upper case). "j" is the square root of -1. > >> and that hypercomplex numbers include i, j, k, and maybe even other >> terms, and I never understood where j comes from. Why

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Grant Edwards
On 2013-10-10, Chris Angelico wrote: > On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: >> BTW, one of the earliest things that turned me on to Python was when I >> discovered that it uses j as the imaginary unit, not i. All >> right-thinking people will agree with me on this. > > I've never b

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Robin Becker
On 10/10/2013 14:25, Chris Angelico wrote: On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: BTW, one of the earliest things that turned me on to Python was when I discovered that it uses j as the imaginary unit, not i. All right-thinking people will agree with me on this. I've never been w

Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Chris Angelico
On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: > BTW, one of the earliest things that turned me on to Python was when I > discovered that it uses j as the imaginary unit, not i. All > right-thinking people will agree with me on this. I've never been well-up on complex numbers; can you elabor

Re: I am never going to complain about Python again

2013-10-10 Thread Roy Smith
/11/all-your-commas-are-belong-to-Array > > I swear, I am never going to complain about Python again. I've just finished reading JavaScript: The Good Parts, by Douglas Crockford (now I'm working on the harder part of re-reading it slowly, to make sure I really understand it). Anyb

Re: I am never going to complain about Python again

2013-10-10 Thread Frank Millman
his little Javascript gem: >>> >>> ",,," == Array((null,'cool',false,NaN,4)); >>> >>> => evaluates as true >>> >>> http://wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array >>> >>> I swear, I am

Re: I am never going to complain about Python again

2013-10-10 Thread Tim Chase
On 2013-10-10 12:10, MRAB wrote: > Re "==", this page: > > http://php.net/manual/en/language.operators.comparison.php > > states: > > """If you compare a number with a string or the *comparison involves > numerical strings*, then each string is converted to a number and > the comparison per

Re: I am never going to complain about Python again

2013-10-10 Thread MRAB
//wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array I swear, I am never going to complain about Python again. I am sure you know this, but for the record, Javascript has two equality operators, '==' and '==='. The double form attempts to coerce the left and ri

Re: I am never going to complain about Python again

2013-10-10 Thread Frank Millman
11/02/11/all-your-commas-are-belong-to-Array > > I swear, I am never going to complain about Python again. > I am sure you know this, but for the record, Javascript has two equality operators, '==' and '==='. The double form attempts to coerce the left and right side

Re: I am never going to complain about Python again

2013-10-09 Thread Christian Gollwitzer
Am 10.10.13 06:36, schrieb Steven D'Aprano: Just came across this little Javascript gem: ",,," == Array((null,'cool',false,NaN,4)); => evaluates as true http://wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array I swear, I am never going to complain about

Re: I am never going to complain about Python again

2013-10-09 Thread Cameron Simpson
> > > http://wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array > > > > I swear, I am never going to complain about Python again. > > *blank look* > Wow. > > Now, is there a situation in which this problem can actually crop up > in production code? O

Re: I am never going to complain about Python again

2013-10-09 Thread Mark Lawrence
On 10/10/2013 05:36, Steven D'Aprano wrote: Just came across this little Javascript gem: ",,," == Array((null,'cool',false,NaN,4)); => evaluates as true http://wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array I swear, I am never going to complain about

Re: I am never going to complain about Python again

2013-10-09 Thread Chris Rebert
On Wed, Oct 9, 2013 at 9:36 PM, Steven D'Aprano wrote: > Just came across this little Javascript gem: > > ",,," == Array((null,'cool',false,NaN,4)); > > => evaluates as true > > http://wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array >

Re: I am never going to complain about Python again

2013-10-09 Thread Chris Angelico
On Thu, Oct 10, 2013 at 3:36 PM, Steven D'Aprano wrote: > Just came across this little Javascript gem: > > ",,," == Array((null,'cool',false,NaN,4)); > > => evaluates as true > > http://wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array >

I am never going to complain about Python again

2013-10-09 Thread Steven D'Aprano
Just came across this little Javascript gem: ",,," == Array((null,'cool',false,NaN,4)); => evaluates as true http://wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array I swear, I am never going to complain about Python again. -- Steven -- https://mail.pyth