Message Boards Message Boards

0
|
629 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Variable assignment using Subscript

Posted 2 months ago

POSTED BY: Sheng Dai
2 Replies

You may try TagSet or TagSetDelayed:

example /: Subscript[example, variable] = 10

This way example will change color to black, because the assignment will be tied to example, not to Subscript.

POSTED BY: Gianluca Gorni
Posted 2 months ago

An expression like

exampleVariable=10 

does not really set the value of a variable. It creates a replacement rule. That distinction can usually be ignored, but it becomes important when you do

Subscript[example, Variable]=10

What you're doing here is creating a replacement rule that is attached to the symbol Subsript.

I'm not really sure what your question is or what you're trying to accomplish, so I don't know what else to say.

POSTED BY: Eric Rimbey
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