Page 1 of 1

Mathematic query

Posted: Mon Dec 22, 2014 6:56 pm
by SimonAllen
I have been testing out Mathematica in Raspbian and typed this

Sum[1/n^2,{n,infinity}]

In English this should sum the reciprocals of the squares i.e. 1 + 1/4 + 1/9 + 1/16 + 1/25 + 1/36 etc The surprising result should be pi^2/6 However Mathematica returns

HarmonicNumber[infinity, 2]

Why does it not produce the expected result?

Re: Mathematic query

Posted: Mon Dec 22, 2014 7:29 pm
by DougieLawson
Are you running the latest version? There was a 500MB update for Wolfram on 6th August.

When I feed your intermediate result into the online W|A at http://www.wolframalpha.com/input/?i=+H ... nity%2C+2] I get your expected result.

Re: Mathematic query

Posted: Mon Dec 22, 2014 7:31 pm
by jardino
Try with a capital "I" on "Infinity" and let me know the result.

Perhaps this query should be in the "Mathematica" topic?

Regards.

Re: Mathematic query

Posted: Mon Dec 22, 2014 7:37 pm
by DougieLawson
jardino wrote:Try with a capital "I" on "Infinity" and let me know the result.

Perhaps this query should be in the "Mathematica" topic?

Regards.
That worked on my version.

Code: Select all

In[4]:= Sum[1/n^2,{n,Infinity}]

          2
        Pi
Out[4]= ---
         6

In[5]:=
The intermediate result also works with a capital I.

Code: Select all

In[5]:= HarmonicNumber[Infinity, 2]

          2
        Pi
Out[5]= ---
         6

In[6]:=

Re: Mathematic query

Posted: Mon Dec 22, 2014 11:20 pm
by SimonAllen
Grateful thanks to you all. Yes the problem was the 'I' in 'infinity' I should have typed 'Infinity' I think Mathematica treats the lower case as a variable where with the initial capital letter it recognises Infinity as, I was going to say a value, for what it is. Correcting that produced the expected result. I am quite astonished that Mathematica came bundled in Raspbian, a most generous gift by Stephen Wolfram.

Re: Mathematic query

Posted: Sat Feb 07, 2015 3:31 am
by szhorvat
All built-in symbols in Mathematica have names starting with a capital letter, no exception.

Infinity, Pi, I, E, all of them are capitalized.

This makes it easy to avoid conflicts with builtins when you create your own symbols: just use lowercase names for your own ones.

Also, all of these names are symbols in Mathematica. There's no distinction between variables, functions, keywords, etc. as in other languages. Everything is just a symbol. Some symbols, such as Infinity, have builtin definitions or interpretations.