So what exactly is a complex number?
Roy Smith
roy at panix.com
Tue Sep 4 04:04:36 CEST 2007
Boris Borcic <bborcic at 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_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.
More information about the Python-list
mailing list