Message Boards Message Boards

GROUPS:

Working with indexing?

Posted 8 days ago
240 Views
|
4 Replies
|
2 Total Likes
|

Hello everybody, please have a look at the following:

In[1]:= Subscript[\[Sigma], Subscript[K, Euler]] = 10

Out[1]= 10

In[2]:= \[Sigma] = 5

Out[2]= 5

In[3]:= Subscript[\[Sigma], Subscript[K, Euler]]/\[Sigma]

Out[3]= Subscript[5, Subscript[K, Euler]]/5

As a photo too, because i think it is better visible then:

code visible

Does sombody have an idea on how to stop this problem and why it occurs. For me it is kind of mandatory to use those index.

Greetings Christoph

4 Replies
Posted 8 days ago

As you've noticed there are odd things that can happen using subscripts (and superscripts) in calculations. The solution: Don't use subscript and superscripts in calculations.

But you can have the desired effect (which was posted recently either in this forum or Mathematica.StackExchange - I can't find it at the moment) using the Format statement.

Format[\[Sigma]KEuler, Subscript[\[Sigma], Subscript[K, Euler]]];
\[Sigma]KEuler = 10;
\[Sigma] = 5;
\[Sigma]KEuler/\[Sigma]
(* 2 *)

This support article addresses the issue of variables with subscripts and superscripts: https://support.wolfram.com/43606

Posted 7 days ago

The issue can also be fixed when naming Sigma into Sigma_Something

Posted 7 days ago

But an underscore isn't a legitimate part of a variable name.

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