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 >
This is how to do it with numpy:
import numpy as np x = np.array([ 1, 2, 3, 4, 5, 6, 7, 8 ,9, 10 ]) y = np.array([ 50 ]) for i in np.arange(len(x)): y = np.append( y, ( y[-1] * 2 + x[i] ) ) y = y[1:] print(y)