Skip to content

Instantly share code, notes, and snippets.

@idrissrasheed
Last active August 13, 2017 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idrissrasheed/d51d056a2dd6120e989837d63cd2acb8 to your computer and use it in GitHub Desktop.
Save idrissrasheed/d51d056a2dd6120e989837d63cd2acb8 to your computer and use it in GitHub Desktop.
Short Monte Carlo Approximation in Python
#Import libraries
import numpy as np
import math as math
n = 10000
def Monte_Carlo(n):
return np.mean(np.exp(np.random.uniform(0,1,n)))
print Monte_Carlo(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment