help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

imaginary unit


From: Przemek Klosowski
Subject: imaginary unit
Date: Wed, 26 Apr 2006 14:33:18 -0400 (EDT)

e^(i*pi) is the natural way of calculating vectors in complex
plane. It failed for me, though, and I realized that I used the
variable 'i' as a loop index, overwriting its original value of an
imaginary unit vector, which octave assigns on startup to i,I, j,J.

octave:1> i,j,I,J
i = 0 + 1i
j = 0 + 1i
I = 0 + 1i
J = 0 + 1i

All of those variables can be overwritten:

octave:2> i=j=I=J=1;i,j,I,J
i = 1
j = 1
I = 1
J = 1

so the safe way to use them is to use 1i etc.

octave:3> 1i,1j,1I,1J
ans = 0 + 1i
ans = 0 + 1i
ans = 0 + 1i
ans = 0 + 1i

Perhaps the use of predefined 'i' should elicit a warning?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]