Infinite sums in python
<p>I have heard that python can do infinite sums. For instance if I want to evaluate the infinite sum </p>

<p>1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + ...</p>

<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 "Summation (-1)^(n-1)/(2*n-1) from n=1 to infinity" it gives the answer as 0.785395. 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="http://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>

<p>"NameError: name 'Infinity' is not defined"</p>

<p>"NameError: name 'Inf' is not defined"</p>

<p>Thanks,
Adhvaitha</p>
