## Mathematic query

SimonAllen
Posts: 6
Joined: Sat Nov 29, 2014 3:57 pm

### Mathematic query

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?

DougieLawson
Posts: 35369
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK

### Re: Mathematic query

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.
Last edited by DougieLawson on Mon Dec 22, 2014 7:33 pm, edited 2 times in total.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

This is a doctor free zone.

jardino
Posts: 128
Joined: Wed Aug 08, 2012 9:03 am
Location: Aberdeenshire, Scotland

### Re: Mathematic query

Try with a capital "I" on "Infinity" and let me know the result.

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

Regards.
IT Background: Honeywell H2000 ... CA Naked Mini ... Sinclair QL ... WinTel ... Linux ... Raspberry Pi.

DougieLawson
Posts: 35369
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK

### Re: Mathematic query

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]:=``````
Note: Having anything remotely humorous in your signature is completely banned on this forum.

This is a doctor free zone.

SimonAllen
Posts: 6
Joined: Sat Nov 29, 2014 3:57 pm

### Re: Mathematic query

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.

szhorvat
Posts: 28
Joined: Wed Jun 04, 2014 2:07 am

### Re: Mathematic query

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.