i did this code :
from scitools.std import *
npoints=10
vectorpoint=array(random.uniform(-1,1,[1,2]))
experiment=array(random.uniform(-1,1,[npoints,2]))
print("vectorpoint=",vectorpoint)
print("experiment=",experiment)
print(vectorpoint.shape)
print(experiment.shape)
which works fine.
I wanted to ask if the “experiment” array can be written in another way ,such as for example “experiment=[vectorpoint,npoints]”.I want to use the vectorpoint array.
(I don’t want to write all over again the “random.uniform(-1,1,[npoints,2])”.
If you want
experimentto be an array withnpointslines which are all equal tovectorpoint, you can useIf you want
experimentto havenpointslines independently generated byrandom.uniform(), you have to call the latter function again, sincevectorpointonly contains the numerical values returned byrandom.uniform()and no information on how it was generated. If the repetition bothers you, you can move it to a function:(Note that your use of
arrayis redundant — the return value ofrandom.uniform()already is an array.)