I have to create a list within a cycle which includes a Gauss function for z range(0,200)
def GetDepth():
return float(a * 2.7 - (z - mu)**2 / (2 * sig**2))
for z in range(-1,200):
k =[]
z=z 1;
for i in range(1):
k.append(z);
Gauss_list.append([z]);
Gauss_list.append([GetDepth()]);
print(Gauss_list)
It returns something like:
[[0], [-1.0535849715692442], [1], [-0.8792864705363532], [2], [-0.7109879179039058], [3], [-0.5486893136719024], [4], [-0.39239065784034244]....
But what I need is:
[[0, -1.0535849715692442], [1,-0.8792864705363532], [2,-0.7109879179039058], [3,-0.5486893136719024]....
That is for a Gauss plot. Maybe there is another option to make a plot without making 2-binary list?
CodePudding user response:
Instead of:
Gauss_list.append([z]);
Gauss_list.append([GetDepth()]);
Use append
at once:
Gauss_list.append([z, GetDepth()])