Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: So what exactly is a complex number? (http://www.velocityreviews.com/forums/t534680-re-so-what-exactly-is-a-complex-number.html)

Boris Borcic 09-03-2007 05:30 PM

Re: So what exactly is a complex number?
 
Lamonte Harris wrote:
> Like in math where you put letters that represent numbers for place
> holders to try to find the answer type complex numbers?
>


Not quite. Relating them to (plane) trigonometry is much closer to the mark.
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.



Roy Smith 09-04-2007 02:04 AM

Re: So what exactly is a complex number?
 
Boris Borcic <bborcic@gmail.com> wrote:
> Complex numbers are like a subclass of real numbers


I wouldn't use the term "subclass". 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_...ion_principle). 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.

Don't confuse "subset" with "subclass". The set of real numbers *is* a
subset of the set of complex numbers. It is *not* true that either reals
or complex numbers are a subclass of the other.

Steve Holden 09-04-2007 05:10 AM

Re: So what exactly is a complex number?
 
Roy Smith wrote:
> Boris Borcic <bborcic@gmail.com> wrote:
>> Complex numbers are like a subclass of real numbers

>
> I wouldn't use the term "subclass". 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_...ion_principle). 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.
>

That's not true. I suspect what you are attempting to say is that the
complex numbers are closed with respect to the square root operation,
but the reals aren't. Clearly you *can* take the square root of all real
numbers, since a real number *is* also a complex number with a zero
imaginary component. They are mathematically equal and equivalent.

> Don't confuse "subset" with "subclass". The set of real numbers *is* a
> subset of the set of complex numbers. It is *not* true that either reals
> or complex numbers are a subclass of the other.


I don't think "subclass" has a generally defined meaning in mathematics
(though such an assertion from me is usually a precursor to someone
presenting evidence of my ignorance, so I should know better than to
make them).

obpython: I have always thought that the "key widening" performed in
dictionary lookup is a little quirk of the language:

>>> d = {2: "indeedy"}
>>> d[2.0]

'indeedy'
>>> d[2.0+0j]

'indeedy'
>>>


but it does reflect the fact that the integers are a subset of the
reals, which are (as you correctly point out) a subset of the complexes.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------


Paul Rubin 09-04-2007 05:39 AM

Re: So what exactly is a complex number?
 
Steve Holden <steve@holdenweb.com> writes:
> but the reals aren't. Clearly you *can* take the square root of all
> real numbers, since a real number *is* also a complex number with a
> zero imaginary component. They are mathematically equal and equivalent.


Ehhh, I let it slide before but since the above has been said a few
times I thought I better mention that it's mathematically a bit bogus.
We could say there is an embedding of the real numbers in the complex
numbers (i.e. the set of complex numbers with Im z = 0). But the
usual mathematical definition of the reals (as a set in set theory) is
a different set from the complex numbers, not a subset. Also, for
example, the derivative of a complex valued function means something
considerably stronger than the derivative of a real valued function.
The real valued function

f(x) = { exp(-1/x**2, if x != 0,
{ 0, if x = 0

for real x is infinitely differentiable at x=0 and all the derivatives
are 0, which makes it sound like there's a Taylor series that
converges to 0 everywhere in some neighborhood of x=0, which is
obviously wrong since the function itself is nonzero when x!=0. The
discrepancy is because viewed as a complex valued function f(z), f is
not differentiable at z=0 even once.

It's pretty normal for a real function f to have a first derivative at
x, but no second derivative at x. That can't happen with complex
functions. If f'(z) exists for some z, then f is analytic at z which
means that all of f's derivatives exist at z and there is some
neighborhood of z in which the Taylor series centered at z converges.

Steve Holden 09-04-2007 05:56 AM

Re: So what exactly is a complex number?
 
Paul Rubin wrote:
> Steve Holden <steve@holdenweb.com> writes:
>> but the reals aren't. Clearly you *can* take the square root of all
>> real numbers, since a real number *is* also a complex number with a
>> zero imaginary component. They are mathematically equal and equivalent.

>
> Ehhh, I let it slide before but since the above has been said a few
> times I thought I better mention that it's mathematically a bit bogus.
> We could say there is an embedding of the real numbers in the complex
> numbers (i.e. the set of complex numbers with Im z = 0). But the
> usual mathematical definition of the reals (as a set in set theory) is
> a different set from the complex numbers, not a subset. Also, for
> example, the derivative of a complex valued function means something
> considerably stronger than the derivative of a real valued function.
> The real valued function
>
> f(x) = { exp(-1/x**2, if x != 0,
> { 0, if x = 0
>
> for real x is infinitely differentiable at x=0 and all the derivatives
> are 0, which makes it sound like there's a Taylor series that
> converges to 0 everywhere in some neighborhood of x=0, which is
> obviously wrong since the function itself is nonzero when x!=0. The
> discrepancy is because viewed as a complex valued function f(z), f is
> not differentiable at z=0 even once.
>
> It's pretty normal for a real function f to have a first derivative at
> x, but no second derivative at x. That can't happen with complex
> functions. If f'(z) exists for some z, then f is analytic at z which
> means that all of f's derivatives exist at z and there is some
> neighborhood of z in which the Taylor series centered at z converges.


Much as I'd like to argue with that I can't, dammit :-)

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------


Roy Smith 09-04-2007 12:28 PM

Re: So what exactly is a complex number?
 
In article <mailman.8.1188882659.2658.python-list@python.org>,
Steve Holden <steve@holdenweb.com> wrote:

> Roy Smith wrote:
> > Boris Borcic <bborcic@gmail.com> wrote:
> >> Complex numbers are like a subclass of real numbers

> >
> > I wouldn't use the term "subclass". 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_...ion_principle). 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.
> >

> That's not true. I suspect what you are attempting to say is that the
> complex numbers are closed with respect to the square root operation,
> but the reals aren't.


Yes, that's what I was trying to say.

> I don't think "subclass" has a generally defined meaning in mathematics


That may be true, but this is a programming newsgroup, so I was using a
programming sort of definition.

Boris Borcic 09-05-2007 11:57 AM

Re: So what exactly is a complex number?
 
Roy Smith wrote:
> Boris Borcic <bborcic@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_...ion_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



Boris Borcic 09-05-2007 12:17 PM

Re: So what exactly is a complex number?
 
Paul Rubin wrote:
> Also, for
> example, the derivative of a complex valued function means something
> considerably stronger than the derivative of a real valued function.


I vaguely remember (it has been decades) an amazingly beautiful russian doll
system of four of five theorems, the first hypothesizing a function of a complex
variable with a property that IIRC appeared somewhat weaker than
differentiability, and the latter theorems not hypothesizing anything more, but
pushing the consequence further to ever stronger properties.


All times are GMT. The time now is 04:10 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.