title: Python - Integrating entire list with the Gaussian distribution
body: <p>I'm trying to plot the integral of this normal distribution for values greater than x defined as</p>
  
  <p><a href="https://i.stack.imgur.com/LRsHj.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LRsHj.gif" alt="enter image description here"></a></p>
  
  <p>where </p>
  
  <p><a href="https://i.stack.imgur.com/l9vnM.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l9vnM.gif" alt="enter image description here"></a></p>
  
  <p>defining both functions in python</p>
  
  <pre><code>import scipy.integrate as integrate
  import numpy as np
  
  def gaussian(x, mu, sig):
      norm = 1/np.sqrt(2*np.pi*sig*sig)
      return norm * np.exp(-np.power(x - mu, 2.) / (2. * sig*sig))
  
  def gaussianGreater(x, mu, sig):
      Integrand = lambda x: gaussian(x, mu, sig)
      return integrate.quad(Integrand,-np.Inf, x)[0]
  </code></pre>
  
  <p>My problem now lies in the integration bounds of my <code>gaussianGreater</code> function while it is being evaluated through the distribution function. When evaluating, this occurs.</p>
  
  <pre><code>y = gaussianGreater(subdist_1, mu_1, sig_1 )
  xd = np.argsort(subdist_1)
  
  fig = plt.figure(figsize=(8,6))
  ax = fig.add_subplot(111)
  ax.plot(subdist_1[xd] ,y[xd] )
  
  ValueError: The truth value of an array with more than one element
  is ambiguous. Use a.any() or a.all()
  </code></pre>
  
  <p>I tried changing the upper bounds to what the error gave me, but that would return the error <code>'float' object has no attribute '__getitem__'
  </code> </p>
  
  <p>Applying a for loop does not work either</p>
  
  <pre><code>[gaussianGreater(x, mu_1, sig_1 ) for x in subdist_1]
  
  TypeError: only integer arrays with one element can be converted to an index
  </code></pre>
  
  <p>How do I fix this problem?</p>