I was trying to solve a Fourier transform integration in python.The code should do this:
--I already have all the n coordinates of a function acceleration over time in a list, the number is the Acc value and the position in the list is its correspondent time.
--integration is done by adding all the acceleration values one time
--The process of integration has to be repeated nf times
--Each time the whole loop is complete, the result should be another list (Frequency) of coordinates, composed by "The integration of the acceleration" and "the frequency value" you did the integration for
So in resume, for every value in range nf I need the program to evaluate another function that iterates for n values and then repeat the process until the first range is exhausted of course.
Let me show you how that looks like in Fortran:
do k=1, nf # this is equivalent to "in range"
w = 2.d0 * pai * (k-1) * df # "pai" is pi (3.14...)
ctemp = 0.d0 # like when we do ctemp = []
do i=1,n # the other range
tt = (i - 1) * dt
ctemp = ctemp + Acc(i) * exp(-ai * w * tt) * dt # here there's something similar to append
end do
F(k) = ctemp
end do
Can you help me translate it to python?
question from:
https://stackoverflow.com/questions/65948930/translating-from-fortran-to-python-a-fourier-transform 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…