daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.   ]])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top