How can I keep the results of all the iterations for all the quantities I want to compute as an array (row vector) at the end. this is my code.
#import numpy library import numpy as np #define the function to compute SHM main quantities for sevral masses def SHM(k,x,m,v): for i in range(0,len(m)): Fx = -k*x ax = -(k/m[i])*x w = np.sqrt(k/m[i]) f = w/2*(np.pi) T = 1/f Ek = (1/2)*m[i]*v**2 Ep = (1/2)*k*x**2 Et = Ek + Ep return Fx, ax, w, f, T, Ek, Ep, Et #Define the values you want to use for calculation m = [0.2, 0.3, 0.4, 0.5] k = 200 x = 0.015 v = 0.40 #Call the function out = SHM(k,x,m,v) #disaply the results display(out) Any help would be appreicted. Thanks.