title: Calculating the infinite approximation to infinite amount of given function as an argument with python
body: <p>I'm trying to calculate the approximation to infinite amount of given function as an argument with lambda function, for example i'm trying to calculate the approximation of amount:</p>
  <p><a href="https://i.stack.imgur.com/ObqTC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ObqTC.png" alt="enter image description here" /></a></p>
  <p>for now I have written this code:</p>
  <pre><code>def infinite_sum(form):
      i=1
      sum_of_sigma=0
      while i &lt; 100000:
          sum_of_sigma+=form(i)
          i+=1
      return sum_of_sigma
  </code></pre>
  <p>and I'm trying to use this function like this:</p>
  <pre><code>print(infinite_sum(lambda i : 1/(3^i)))
  </code></pre>
  <p>but unfortunately I'm getting this error when I try to run the code:</p>
  <p><a href="https://i.stack.imgur.com/TxxhV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TxxhV.png" alt="enter image description here" /></a></p>
  <p>someone have an idea how to solve this problem?</p>