Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from multiprocessing.dummy import Pool
- import numpy as np
- SAMPLES = 10**6
- RANGE = 200
- points = np.linspace(-RANGE, RANGE, RANGE + 1) * 2 * np.pi
- print( sum( Pool().imap_unordered(
- lambda r: (np.sin(np.linspace(r[0], r[1], SAMPLES))/SAMPLES).sum(),
- zip(points, points[1:])
- )))
Advertisement
Add Comment
Please, Sign In to add comment