[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: imaginary unit
From: |
Robert A. Macy |
Subject: |
Re: imaginary unit |
Date: |
Thu, 27 Apr 2006 16:14:13 -0700 |
Running the old binary 2.1.50a on Win98
>> for i=1:100;
>> x(i) = exp(1i*pi*( i/25 ));
>> endfor;
caused no problem
note mixing 1i and i through out.
- Robert -
On Wed, 26 Apr 2006 14:33:18 -0400 (EDT)
Przemek Klosowski <address@hidden> wrote:
> 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?
Re: imaginary unit, Marek Szczypinski, 2006/04/27
Re: imaginary unit, Javier Arantegui, 2006/04/27
Re: imaginary unit,
Robert A. Macy <=
Re: imaginary unit, Bill Denney, 2006/04/28