Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2015-05-05 19:35:19

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Sigma evaluation in Mathematica

Hi;

I tried the following three expressions in M for n=10 and expected all of them to give the same answer, that being the sum of the first ten triangular numbers:

Sum[k(k+1)/2,{k,n}]

n(n+1)(n+2)/6

The output for the first two is 220 (as expected), but the third one gave this output:

1[2]/2 + 2[3]/2 + 3[4]/2 + 4[5]/2 + 5[6]/2 + 6[7]/2 + 7[8]/2 + 8[9]/2 + 9[10]/2 + 10[11]/2

That one also totals 220, but I'd like to know how to get M to output the total instead of the ten elements.

Thanks.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#2 2015-05-05 19:44:54

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Sigma evaluation in Mathematica

Hi;

Can I see your exact code that you used for the third one?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#3 2015-05-05 20:11:22

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: Sigma evaluation in Mathematica

I worked it out just now thanks, Bobby.

I hadn't entered Ctrl+Space to move the insertion point to the right of the Sigma.

Edit 1: I've been unable to repeat the error since! hmm
Edit 2: Tried some more, and apparently I had a 'TraditionalForm expression' in a 'StandardForm cell' (whatever that means). So...nothing to do with the CTRL+Space insertion point move.

Last edited by phrontister (2015-05-06 04:30:54)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#4 2015-05-05 20:14:09

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Sigma evaluation in Mathematica

Hi;

Okay, glad you are studying some M.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#5 2015-05-05 20:19:07

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: Sigma evaluation in Mathematica

Slowly, slowly.

My code was entered like this:
Esc sum Esc Ctrl+$ k=1 Ctrl+% n Ctrl+Space 1 Ctrl+/ 2 Ctrl+Space k(k+1)

This, in M-language code, converted to the following: 

\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(k = 1\), \(n\)]\(
\*FractionBox[\(1\), \(2\)] k \((k + 1)\)\)\)

If you paste that converted code into M it will display in the Latex style.

Last edited by phrontister (2015-05-06 03:59:12)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#6 2015-05-05 20:23:05

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Sigma evaluation in Mathematica

Slowly, slowly.

There is an old Chinese saying:

The oxen are slow but the earth is patient.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#7 2015-05-05 21:07:02

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: Sigma evaluation in Mathematica

Yes, good one. I can't find its origin, but there's some thought it originated in the 1983 Tom Selleck film, High Road to China.

I like this one too:

“It does not matter how slowly you go as long as you do not stop.” ― Confucius

Last edited by phrontister (2015-05-05 21:44:49)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#8 2015-05-06 05:38:56

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Sigma evaluation in Mathematica

I am pretty sure they are right. That is the movie I heard it in.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#9 2015-05-06 14:17:28

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: Sigma evaluation in Mathematica

Re the quote from the movie:

The aphorism said by Struts (Jack Weston) was "The ox is slow but the earth is patient". Apparently, this saying is an ancient Buddhist proverb. Its meaning (according to a blog on Yahoo Answers) is :

The ox is universally a symbol of slow, plodding, working in the fields or rice paddies, dragging the plow. But it gets the job done. "The earth is patient" expresses the meaning that time does not matter to nature. On a symbolic level, the phrase refers to man, plowing the field with the ox. The earth (a symbolic representation of all nature) is not in a hurry. Seasons come and seasons go. All in its time...persistence and patience are virtues to be admired.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#10 2015-05-06 14:21:07

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Sigma evaluation in Mathematica

Persistence, the highest attribute anyone can have.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#11 2015-05-07 00:46:36

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: Sigma evaluation in Mathematica

Nothing in this world can take the place of persistence.
  - Talent will not; nothing is more common than unsuccessful people with talent.
  - Genius will not; unrewarded genius is almost a proverb.
  - Education will not; the world is full of educated derelicts.
Persistence and determination alone are omnipotent.
Calvin Coolidge


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#12 2015-05-07 08:51:30

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Sigma evaluation in Mathematica

Here, here! Wunderbar!


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

Board footer

Powered by FluxBB