title: Sumproduct of a continuous function in python
body: <p>I need to compute an information value called entropy (invented by Claude Shannon).</p>
  <p>A picture of the outputrange, along with the equation i want to use can be found here:
  <a href="https://commons.wikimedia.org/wiki/File:Mplwp_shannon_entropy.svg" rel="nofollow noreferrer">https://commons.wikimedia.org/wiki/File:Mplwp_shannon_entropy.svg</a></p>
  <p>I use Z for the probability, (value in range 0 and 1)</p>
  <p>This is what i have so far:</p>
  <pre><code>Z=0.5    
  -Z * math.log(Z, 2)
  </code></pre>
  <p>The problem is that my code is not contiuous. It multiplies the z value with base 2 log. of the z value, while it should work like an integral, how can i fix this?</p>