Guest User

Untitled

a guest
Aug 10th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. gamma = 0.9
  2. dim = 4
  3.  
  4. M = np.zeros((dim,dim))
  5. for i in range(dim)[::-1]:
  6. M += np.diagflat([gamma**(dim-i-1)]*(i+1),dim-i-1)
  7.  
  8. print(M)
  9.  
  10. array([[ 1. , 0.9 , 0.81 , 0.729],
  11. [ 0. , 1. , 0.9 , 0.81 ],
  12. [ 0. , 0. , 1. , 0.9 ],
  13. [ 0. , 0. , 0. , 1. ]])
Add Comment
Please, Sign In to add comment