Re: So what exactly is a complex number?

Discussion in 'Python' started by Boris Borcic, Sep 3, 2007.

  1. Boris Borcic

    Boris Borcic Guest

    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.
     
    Boris Borcic, Sep 3, 2007
    #1
    1. Advertising

  2. Boris Borcic

    Roy Smith Guest

    Boris Borcic <> 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_substitution_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.
     
    Roy Smith, Sep 4, 2007
    #2
    1. Advertising

  3. Boris Borcic

    Steve Holden Guest

    Roy Smith wrote:
    > Boris Borcic <> 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_substitution_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 -------------
     
    Steve Holden, Sep 4, 2007
    #3
  4. Boris Borcic

    Paul Rubin Guest

    Steve Holden <> 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.
     
    Paul Rubin, Sep 4, 2007
    #4
  5. Boris Borcic

    Steve Holden Guest

    Paul Rubin wrote:
    > Steve Holden <> 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 -------------
     
    Steve Holden, Sep 4, 2007
    #5
  6. Boris Borcic

    Roy Smith Guest

    In article <>,
    Steve Holden <> wrote:

    > Roy Smith wrote:
    > > Boris Borcic <> 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_substitution_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.
     
    Roy Smith, Sep 4, 2007
    #6
  7. Boris Borcic

    Boris Borcic Guest

    Roy Smith wrote:
    > Boris Borcic <> 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
     
    Boris Borcic, Sep 5, 2007
    #7
  8. Boris Borcic

    Boris Borcic Guest

    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.
     
    Boris Borcic, Sep 5, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carsten Haese

    Re: So what exactly is a complex number?

    Carsten Haese, Aug 31, 2007, in forum: Python
    Replies:
    31
    Views:
    862
    =?UTF-8?B?R3J6ZWdvcnogU8WCb2Rrb3dpY3o=?=
    Sep 9, 2007
  2. Chris Mellon

    Re: So what exactly is a complex number?

    Chris Mellon, Aug 31, 2007, in forum: Python
    Replies:
    4
    Views:
    295
    Steve Holden
    Aug 31, 2007
  3. harijay
    Replies:
    6
    Views:
    679
    harijay
    Nov 21, 2008
  4. Tambaa Hapa

    Replace exactly match of a number

    Tambaa Hapa, Jul 13, 2005, in forum: Perl Misc
    Replies:
    6
    Views:
    123
    Eric Bohlman
    Jul 14, 2005
  5. FAQ server
    Replies:
    1
    Views:
    160
    Bart Van der Donck
    Aug 19, 2006
Loading...

Share This Page