def sum(f,a,b):
res = f[a]
for n in range(a,b):
res = res + f[n]
n = n+1
print(res)
N = 6
k = np.linspace(-1*N/2,N/2,2*N+1)
x = np.linspace(0,N)
input = np.array(np.sin(x))
for i in range(0,2*N+1):
function = [np.exp(np.complex(0,1)*2*np.pi*n*k[i]/N)*input[n] for n in range(0,N)]
a = sum(function,0,6)
i make this code in python and the result is
(-0.34308675549375994-1.2298564233140399e-15j)
(0.27793666495274316-0.09017303827683287j)
(-0.3457355570883548+0.19448708931217606j)
(0.22798848052009088-0.3377086144947856j)
(-0.36716758327446863+0.5893747211133995j)
(-0.505925145472833-1.32495749826065j)....
but i want the list datatype in the result.
what i do to add the code? for the result transform to list?
i want the result -> list -> array -> graph
question from:
https://stackoverflow.com/questions/65870625/i-want-to-transform-this-result-to-type-list-in-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…