vector elementwise division 1./[1 2 3 4]

bagvian bagvian at gmail.com
Tue Sep 2 10:30:32 CEST 2008


Hi,

Old Matlab user, I wanted to create a simple row vector (say V1) and
inverse each of its components with the values to be set in another
row vector (say V2). I typed in Scilab prompt:

V1=[1 2 3 4] ;

V2=1./V1

I obtained :

V2 =

0.0333333

0.0666667

0.1

0.1333333

Amazing, isn't?

In order to get the result I expected, I had to type :

V2=(1)./V1

To obtain:

V2 =

1. 0.5 0.3333333 0.25

Don't you find this behaviour rather inappropriate?

Thanks for your comments, Bagvian



More information about the users mailing list