So what exactly is a complex number?

Boris Borcic bborcic at gmail.com
Wed Sep 5 07:57:42 EDT 2007


Roy Smith wrote:
> Boris Borcic <bborcic at gmail.com> wrote:
>> Complex numbers are like a subclass of real numbers 
> 
> I wouldn't use the term "subclass". 

Really you should name yourself as the author when you butcher someone else's 
prose to such a degree. Suppose I had written "Complex numbers are like an 
afghan beauty that has little chance to seduce you unless you first get to see 
her eyes despite the burkha she is usually wearing". Would you find it 
reasonable to cut this down to "Complex numbers are like an afghan beauty" and 
then criticize the result as if the word "like" hadn't survived this treatment ?

 > It certainly doesn't apply in the same
 > sense it applies in OOPLs.  For example, you can't say, "All complex
 > numbers are real numbers".  In fact, just the opposite.
 > But, it's equally wrong to say, "real numbers are a subclass of complex
 > numbers", at least not if you believe in LSP
 > (http://en.wikipedia.org/wiki/Liskov_substitution_principle).

Well, some edulcorated-analogical version of that principle was precisely what I 
had in mind when I wrote what I wrote - not what you cite and much less "just 
the opposite" of the latter, that you here adress.

What makes complex numbers magical to use is precisely that you can port to them 
without change (most of) the algebraic procedures that you first learn on the 
real number field. And manipulate them technically while neglecting that they 
are not really real numbers, except when convenient because (a) things will work 
uniformly using complex numbers where real numbers would present exceptions and 
(b) they allow more powerful results. And that's what LSP is about, is it not ?

> For example,
> it is true that you can take the square root of all complex numbers.  It is 
> not, however, true that you can take square root of all real numbers.

(a) note that with the subclass relation put in the order I had chosen, this 
would not contradict LSP

(b) and nevertheless :

 >>> x = -1.0
 >>> type(x)
<type 'float'>
 >>> import cmath
 >>> cmath.sqrt(x)
1j
 >>>

> 
> Don't confuse "subset" with "subclass".

Don't confuse myself with yourself, thanks :) Or are you going to say that you 
would have launched into the same diatribe if I had proposed a subclassing 
relation that wasn't counter the grain viz the purported subset relation ?

> The set of real numbers *is* a 
> subset of the set of complex numbers.

It *is* unfortunate that learning mathematics using sets allows to neglect the 
fundamental difference between the identity of physical objects and the identity 
of mathematical objects. The latter we only ever reach "up to isomorphism". 
There is a natural embedding of real numbers into complex numbers, but there is 
also a natural embedding of real numbers into surreal numbers. The two 
embeddings aren't compatible. So which should be promoted to "*being*", and why ?

> It is *not* true that either reals 
> or complex numbers are a subclass of the other.

What I had written : "Complex numbers are like a subclass of real numbers that 
elegantly extends the usual arithmetic operations to provide access to 
trigonometric functions and related goodies. This then allows you to think of 
trigonometric problems as simple arithmetic problems."

Boris Borcic





More information about the Python-list mailing list