complex number woes (help please) [message #47667] |
Sun, 26 February 2006 19:07 |
Steve[3]
Messages: 7 Registered: January 2006
|
Junior Member |
|
|
I'm working on a GUI that has 2 text widgets that I use to get the real
and imaginary parts of a complex number. I then wish to mutliply this
number by every element in a 7x7 array, but my output is yielding only
a single complex number (and not the 7x7 complex array output that I'd
expect). Funny thing is, I can't seem to reproduce the problem if I
just generate a complex number (that is not from my widget),
Here's what I do to create the issue...
widget_control, event.top, get_uvalue=global_data
widget_control, global_data.w1_real_id, get_value=real1
widget_control, global_data.w1_imag_id, get_value=imag1
real1=float(real1)
imag1=float(imag1)
w1=complex(real1,imag1)
w2=real1+complex(0,1)*imag1
mat=fltarr(7,7)+1.0
a1=w1*mat
a2=w1*mat
Now, both w1, and w2 are showing up as "COMPLEX = Array[1]", and
products a1 and a2 have only a single comlplex quatity equal to w1 (but
I want 7x7)
---------------------------------------------------
Here's the weird part (to me)...
w3=complex(float(1),float(0)); try just defining a complex number
q1=float(1)
q2=float(0)
w4=complex(q1,q2); try defining a complex number using variables
sss='1'
sst='0'
w5=complex(float(sss),float(sst)); try defining complex number from
string values
a3=w3*mat
a4=w4*mat
a5=w5*mat
Now, w3, w4 and w5 are all "COMPLEX = ( 1.00000, 0.000000)",
and the products are all 7x7 complex arrays.
------------------------------------------------------------
Any idea what's going on, and why there's a difference?
Thanks in advance for any help...
v/r
-Steve
|
|
|