I would like to be able to do something with a bunch of variables whose names are listed in an array, for example:
import numpy as np
Nsim=100
for vec in ['lgx1','lgx2','lgx3']: vec=np.random.uniform(low=0.0, high=1.0, size=Nsim)
This actually doesn't produce a compilation error, but it doesn't seem to do what I want either (i.e., doesn't set the three arrays named lgx1, lgx2 and lgx3 of random uniformly drawn variables). This would be more compact than having one such command for each of the arrays. Any suggestions? For those of us still speaking SuperMongo, I am looking for the python analog of
foreach vec {lgx1 lgx2 lgx3} {set $vec=random(100)}
Many thanks!