I do not know enough about Mathematica to understand why the following statement won't save the variable for me for later use:

x_fake = Table[i, {i, 1, 100}]

It generates a list of fake x values from 1 to 100 with increments of 1. I want to use this list later to plot:


But it doesn't work and throws the errors

"Rule: Pattern x_fake appears on the right-hand side of rule..." and "ListPlot: x_fake is not a list of numbers or pairs of numbers"

Although the reason must be very simple, I can't seem to find a straightforward answer. The Wolfram docs indicate that in Mathematica there is a difference between immediate and delayed execution, so I tried the delayed execution syntax

x_fake := Table[i, {i, 1, 100}]

But it throws the same errors.

How can I save x_fake and reuse it like I can with R or any other normal programming language?


closed as off-topic by Michael E2, MarcoB, Coolwater, m_goldberg, rhermans Jul 1 '18 at 8:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, MarcoB, Coolwater, m_goldberg, rhermans
If this question can be reworded to fit the rules in the help center, please edit the question.


The underscore is a reserved character. Effectively, you are writing

Pattern[x, Blank[fake]]

you can see this by looking at FullForm[x_fake]. You then get the message whenever you try to use it because x_fake, a Pattern, appears on the right hand side of a rule, like Set or SetDelayed. Variable names must start with a character, but otherwise can contain a mix of characters and numbers. Note, this includes the full character table, such as \[Alpha].

As an example found in ref/ImplicitRegion, this uses \[ScriptCapitalR]

enter image description here

  • 1
    $\begingroup$ Ha. Simple. Thank you. $\endgroup$ – briennakh Jun 30 '18 at 23:50
  • 1
    $\begingroup$ This should probably be in the pitfalls post since some form of it has come up fairly often. Would you consider writing that? $\endgroup$ – Mr.Wizard Jul 1 '18 at 6:46
  • 1
    $\begingroup$ @Mr.Wizard it already is, although it likely could be improved. $\endgroup$ – rcollyer Jul 1 '18 at 13:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.