title: Infinite sums in python
body: <p>I have heard that python can do infinite sums. For instance if I want to evaluate the infinite sum:</p>
  
  <pre><code>1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + ...
  </code></pre>
  
  <p>How should I go about? I am a newbie to python. So I would appreciate if someone could write out the entire code and if I need to include/import something.</p>
  
  <p>For instance, in wolfram alpha if I input <code>Summation (-1)^(n-1)/(2*n-1) from n=1 to infinity</code> it gives the answer as <code>0.785395</code>. I want the answer computed to a desired accuracy say, as in the case of wolfram alpha upto 6 digits.</p>
  
  <p>Further, I was looking at this post <a href="https://stackoverflow.com/questions/2552213/which-programming-language-or-a-library-can-process-infinite-series">here</a> and tried to mimic that but it gives me the following errors:</p>
  
  <pre><code>`NameError: name 'Infinity' is not defined`
  `NameError: name 'Inf' is not defined`
  </code></pre>
  
  <p>Thanks,
  Adhvaitha</p>