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

Oscar Benjamin oscar.j.benjamin at gmail.com
Thu Oct 10 15:29:45 EDT 2013


On 10 October 2013 15:34, David <bouncingcats at gmail.com> wrote:
> On 11 October 2013 00:25, Chris Angelico <rosuav at gmail.com> wrote:
>> On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith <roy at panix.com> 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 i, j, k, and maybe
>> even other terms, and I never understood where j comes from. Why is
>> Python better for using j?
>
> Pretty well covered here: http://en.wikipedia.org/wiki/Complex_number
>
> Plus, the simple overview is that they are useful because they are
> two-dimensional, and so can be used to simply calculations involving
> two-dimensional quantities. Very useful for electrical engineers who
> use them to represent the two dimensions of amplitude,phase in
> Fourier or Laplace circuit analysis. As others have pointed out, they
> use the symbol j for the square root of -1 to avoid confusion with the
> symbol i used for current.

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. Physicists also have to deal with electric currents but they
can happily distinguish these two with upper and lower case. Upper
case J is used in electrodynamics for the "free" current density.
Lower case j is used by both engineers and physicists to denote a unit
vector in the "y-direction" though it would usually be in non-italic
bold-face when used in that context.

> I have never heard the term "hypercomplex" numbers. I guess you
> are referring to vectors with more dimensions than two. A three
> dimensional vector is described as having components in i,j,k
> directions. Although this is very like an extension of complex numbers
> into higher dimensions, the symbols used (i,j,k) are not the same
> as the i or j used for complex numbers. Instead they represent
> orthogonal unit vectors; which are similar in concept (because
> real and imaginary components of complex numbers are orthogonal),
> but not the *same*. So don't think of the i *or* j of a complex number
> being related to the i *and* j etc components of a vector.
>
> These are useful for example to describe three dimensional space, and
> scalar or vector functions in that space.

I've never heard the term "hypercomplex" before either although I did
intuitively understand its meaning (quaternions, octonions etc). These
are also useful in a number of contexts. For example, quaternions are
often used to represent orientations in 3D physical simulations
(including computer games). A quaternion is usually represented with
the basis i, j, k and 1 where a complex number would just have 1 and i
(or 1 and j if you're an engineer).


Oscar



More information about the Python-list mailing list