title: Summation Evaluation in python
body: <p>Given
  <code>z = np.linspace(1,10,100)</code> </p>
  
  <p>Calculate Summation over all values of z in <code>z^k * exp((-z^2)/ 2)</code></p>
  
  <pre><code>import numpy as np
  import math
  
  def calc_Summation1(z, k):
      ans = 0.0
      for i in range(0, len(z)):`
          ans += math.pow(z[i], k) * math.exp(math.pow(-z[i], 2) / 2)
      return ans
  
  def calc_Summation2(z,k):
       part1 = z**k
       part2 = math.exp(-z**2 / 2)
       return np.dot(part1, part2.transpose())
  </code></pre>
  
  <p>Can someone tell me what is wrong with both <code>calc_Summation1</code> and <code>calc_Summation2</code>?</p>