Say that I have array x and y:
x
y
x = numpy.array([1,2,3,4,5,6,7,8,9,10]) # actual content is the a result of another calculation step >
Here is how you do it with Python:
x = [1, 2, 3, 4, 5, 6, 7, 8 ,9, 10] y = [50] for i in range(len(x)): y.append(y[-1] * 2 + x[i]) y = y[1:]
You might want to calculate it from the last element to prevent using the new values for the next i.
i