Message Boards Message Boards

0
|
9197 Views
|
9 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

What is the syntax error in this expression?

Posted 10 years ago

In[33] was copied and pasted from the Mathematica language syntax tutorial, which evaluates as expected from the tutorial. In[34] is my attempt to type this symbolically myself, which gives a syntax error/incomplete expression. The only visible difference to me is that the letters "n" are both gray in the correct expression, but they are blue in the incorrect one. I assume this means they are somehow linked in the former, but I don't know how to reproduce this. New to Mathematica language, thanks in advance for help!

Attachments:
POSTED BY: Rose Yntema
9 Replies

What happens if you enter the expression as

In[2]:= Sum[n^-s, {n, 1, \[Infinity]}]

Out[2]= Zeta[s]

?

POSTED BY: Frank Kampas
Posted 10 years ago

To get after what Frank recommended I copied and pasted each command (the bad and the good) into a text editor and found the following:

Bad one

\!\(\*UnderscriptBox[
OverscriptBox[\(\[Sum]\), \(\[Infinity]\)], \(n = 1\)]\)1/n^s




Good one

\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(\[Infinity]\)]
\*FractionBox[\(1\), 
SuperscriptBox[\(n\), \(s\)]]\)
POSTED BY: Jim Baldwin

Looks like the palette wasn't used to construct the expression.

POSTED BY: Frank Kampas
Posted 10 years ago

Ahh! As I said, I am extremely new to this and am just beginning with the built-in tutorials; I didn't actually know about the palette yet. I thought I had to enter fancy expressions using only keyboard shortcuts, silly me. When I use the palette it works fine, since it has explicitly delineated fields for the index and expression. I just couldn't figure out how to impart this information using only shortcuts but now I know I don't have to.

Thank you all very much!

POSTED BY: Rose Yntema
Posted 10 years ago

Thanks for your response, Frank! However, this unfortunately doesn't work for me, because the syntax error is preventing any output from being returned in order to show me the full form. It only shows me the full form if I use it on the correct expression.

There seems to be some problem in the keystrokes I am using to attempt to reproduce the form of the summation, whereas you were able to enter it correctly. What did you do to make the "n" variables show up correctly in gray while the s is in blue? I'm still new so I am not sure of the significance of these colors or how to get mathematica to interpret my variables correctly.

What I did was I entered the sum symbol, then used keyboard shortcuts to enter the infinity overscript and n=1 underscript, and then entered the expression with n and s next to the sum symbol. What am I missing with these "n"s? It's just a regular "n" on a keyboard right?

Edit: I am attaching a notebook with my expression as the last line.

Attachments:
POSTED BY: Rose Yntema

I suggest you look at FullForm of the expression that doesn't work to figure out what's going on. enter image description here

POSTED BY: Frank Kampas
Posted 10 years ago

Here is a screenshot of each expression in a new, clean notebook. I am trying to figure out why the sum I type will not evaluate, but the sum I copy-paste from a tutorial does evaluate to the correct Zeta[s] output.

Attachments:
POSTED BY: Rose Yntema
Posted 10 years ago

The Zeta was just the evaluation of the expression (output). It's not anything I typed. I had another notebook file where I typed my sum expression first and it didn't work then either.

POSTED BY: Rose Yntema

I'm no coder but....I think it's because you put: Zeta[s] instead of: s = Zeta[n]...I might be wrong, but it seems like that to me.

POSTED BY: Joshua Champion
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract