[SciPy-user] scipy-user list

Alan G Isaac aisaac@american....
Wed Sep 19 09:02:24 CDT 2007


On Wed, 19 Sep 2007, (SAST) Zakaria Ali apparently wrote:
> Im having a probleme to generalete someting like that.  
> e1=(1,0.0)
> e2=(0,1,0)
> e3=(0,0,1)

You want all of them?
Use the identity.
(See below.)

Cheers,
Alan Isaac

>>> import numpy as N
>>> dim = 5
>>> e = N.eye(dim)
>>> for j in range(dim):
...  print e[j]
...
[ 1.  0.  0.  0.  0.]
[ 0.  1.  0.  0.  0.]
[ 0.  0.  1.  0.  0.]
[ 0.  0.  0.  1.  0.]
[ 0.  0.  0.  0.  1.]




More information about the SciPy-user mailing list