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

Mathematic query

Mon Dec 22, 2014 6:56 pm

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?

User avatar
DougieLawson
Posts: 30448
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Mathematic query

Mon Dec 22, 2014 7:29 pm

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.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

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

Re: Mathematic query

Mon Dec 22, 2014 7:31 pm

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.

User avatar
DougieLawson
Posts: 30448
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Mathematic query

Mon Dec 22, 2014 7:37 pm

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]:=
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

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

Re: Mathematic query

Mon Dec 22, 2014 11:20 pm

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: 24
Joined: Wed Jun 04, 2014 2:07 am

Re: Mathematic query

Sat Feb 07, 2015 3:31 am

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.

Return to “Wolfram Language”

Who is online

Users browsing this forum: No registered users and 1 guest