Guest User

Numpy

a guest
May 16th, 2015
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. import math
  2. import time
  3. import random
  4. import numpy as np
  5.    
  6. random.seed(time.time())
  7. t1 = time.time()
  8.  
  9. v = np.vectorize(lambda b: math.pow(b, 1.546) if b > 0.5 else math.pow(b, 0.434232))
  10. a = np.arctan(np.cos(v(np.random.random((4999999))) + np.arange(4999999)))
  11.  
  12. t2 = time.time()
  13. print t2 - t1
Advertisement
Add Comment
Please, Sign In to add comment