I am using numpy arrays in my codes very frequently. Its speed and convenient indexing rules are very useful. Now, I am searching how to avoid 'for' loops in order to make execution time faster. For the simplicity, let's assume that, we have two vectors(named a and b), each has 10 elements. First value of second vector(b) is equal to 1, then each nth value is equal to '(b[n-1]*13+a[n])/14'. With the help of 'for' loop, I can write that like below:
import numpy as np
a = np.random.random(10)
b = np.ones(10)
for i in range(1, b.shape[0]):
b[i] = (b[i-1]*13 + a[i]) / 14
So, my question is how can I do same thing without for loop and faster? How can I use numpy vectorization to do that operation? Thanks in advance!