Multiplication turning array into scalar -- who wants to try? [message #53261] |
Sat, 31 March 2007 20:40 |
swingnut
Messages: 30 Registered: September 2005
|
Member |
|
|
JOURNALING AT IDL PROMPT:
temp=[0.0,-1.0,0.0]
print,size(temp)
; 1 3 4 3
temp2=-25.0
print,size(temp2)
; 0 4 1
print,temp2/ABS(temp2)
; -1.00000
temp2=temp2/ABS(temp2)
print,SIZE(temp2)
; 0 4 1
print,temp2*temp
; 0.000000 1.00000 0.000000
temp=temp2*temp
print,temp
; 0.000000 1.00000 0.000000
print,SIZE(temp)
; 1 3 4 3
OUTPUT OF SEQUENCE OF PRINT STATEMENTS IN MY CODE:
;----------
;Adjusting density power law in increments of [0.000000 , -1.00000 ,
0.000000 ]
;adjustmentIncrement =
; 0.000000 -1.00000 0.000000
;SIZE of adjustmentIncrement =
; 1 3 4 3
;-----
;deltaVirtHeight =
; -0.0678234
;SIZE of deltaVirtHeight =
; 1 1 4 1
;-----
;signOfDifference = deltaVirtHeight/ABS(deltaVirtHeight) =
; -1.00000
;SIZE of signOfDifference =
; 1 1 4 1
;-----
;Multiply signOfDifference with each element of adjustmentIncrement,
i.e.,
;adjustmentIncrement[i]=adjustmentIncrement[i]*signOfDiffere nce,
i=0,1,2:
;adjustmentIncrement =
; 0.000000 1.00000 0.000000
;SIZE of adjustmentIncrement =
; 1 3 4 3
;-----
;But if we do
adjustmentIncrement=adjustmentIncrement*signOfDifference, it becomes a
scalar?
;adjustmentIncrement =
; 0.000000
;SIZE of adjustmentIncrement =
; 1 1 4 1
; % Attempt to subscript LOCDENSPL with <INT ( 1)> is out
of range.
|
|
|