I have created a list containing 10 arrays that consist of 20 random numbers between 0 and 1 each.
Now, I wish to multiply each array in the list with the numbers 0.05, 0.1, ..., to 1.0 so that none of the elements in each array is larger than the number it is multiplied with.
For example, all the 20 elements in the first array should lie between 0 and 0.05, all the elements in the second array between 0 and 0.10 and so on.
I create a list of 10 random arrays and a range of numbers between 0 and 1 with:
range1 = np.arange(0.005, 0.105, 0.005)
noise1 = [abs(np.random.uniform(0,1,20)) for i in range(10)]
I then try to multiply the elements with:
noise2 = [noise1 * range1 for i in noise1]
But this doesn't work and just causes all the arrays in the list to have the same values.
I would really appreciate some help with how to do this.
linspaceinstead ofarangefor floating-point values.i?