I have a velocity distribution which has a complicated normalization factor. Without that factor it's integral is 0.95. I'm using Monte Carlo to generate the same velocity distribution. I wanted to check my generated array of velocity to see if it works fine. The shape of plotting it shows that it is but I wanted to know if there is any way to make python to make a histogram that is normalized to an arbitrary value? Thanks all in advance.
def VelocityDistribution (velocity):
v = velocity
v0 = 220
ve = v0*(1.05)
return 100/95.2032*np.sqrt(1/np.pi) * (v/(v0*ve)) * (np.exp((-(v-
v0)**2)/(v0**2)) - np.exp((-(v+v0)**2)/(v0**2)))
v = np.linspace(0,800,10000)
v0 = 220
ve = v0*(1.05)
VelocityDistribution1 = 100/95.2032*np.sqrt(1/np.pi) * (v/(v0*ve)) * (np.exp((-(v-v0)**2)/(v0**2)) - np.exp((-(v+v0)**2)/(v0**2)))
i=0
V = []
while i < 100000:
randPro = random.uniform(0.0, 0.003)
randv = random.uniform(0,800)
if VelocityDistribution(randv) >= randPro :
V.append(randv)
i+=1
plt.hist(V, bins = 80, normed = 0.80)
plt.title("Velocity Distribution of WIMP particles")
plt.xlabel('Velocity (km/s)')
plt.ylabel('Probability')
plt.plot(v, VelocityDistribution1, 'r')
plt.show()