1k views

### Is it possible to set values for a list of variables using a for loop? [duplicate]

Let me preface this question by noting that this is a simple example meant to clarify what I am asking. The actual context in which I want to implement this involves associations containing hundreds ...
• 117
294 views

### How can I assign many values each to a different variable? [duplicate]

How can I assign many values each to a different variable? For example, I want to set $a = f(1),\,b = f(2),\,c = f(3),\,\dots,\,z = f(26)$ (generally more variables than these). How can I do this ...
• 161
101 views

### Convert Strings in Variables [duplicate]

I want to convert strings to variables. I want to create the term pionprodg1. I tried to do this: ...
1 vote
108 views

### How to set a value to the symbol denoted by a given string? [duplicate]

The code setString[name_String, value_]:= Evaluate[Symbol[name]] = value fails whenever Symbol[name] has already been assigned ...
• 872
164 views

### Assign a value to the protected string [duplicate]

How can I assign a value for a symbol composed of a string plus and another string converted from integer? n=3; Symbol["as"<>ToString[n]]=4; So I want to ...
68 views

### How to convert a list of names and values into a series of expressions [duplicate]

I had an Excel spreadsheet with a list of symbols names in the first column and a list of values in the second column. I imported it. Working with the resulting expression, I now have (in Mathematica) ...
• 327
146 views

### How to get Symbol["x"]=3 to work [duplicate]

This is probably a really simple one, but I'm stumped. I want Symbol["x"]=3 to work just like x=3. However I can't figure out ...
• 4,959
74 views

### Can you dynamically create variable names in Mathematica? [duplicate]

I was wondering if there is a way of Mathematica to read a string or number and create variable with that name. For instance imagine that I have a file with the word data1. I would want to create a ...
1 vote
51 views

### InputField with a symbol’s name [duplicate]

Suppose I have an InputField of type String wherein I want to enter a symbol name that I want a later Button to assign values to. That button would then do something like: ...
• 2,307
65 views

### Transform String to Expression [duplicate]

I have a variable postVector and another called CHKpostVector. Both are global variables. Only the variable ...
• 159
60 views

### Import names into notebook namespace [duplicate]

I have function that at some point has list of strings (e.g. {"apple","pear"}) and I want to declare (initialize) those variables in notebook namespace to default ...
47 views

### Symbol created in Module not seen outside of Module scope [duplicate]

I am using a function defined with a Module[]. In the Module I am creating a new variable name using a ...
28 views

### Performing operations on LHS of assignment [duplicate]

Is it possible to first perform an operation on LHS of the = symbol, evaluate that, and then assign the RHS to the new LHS as usual? The following shows the most ...
24 views

### Evaluating a String that is a Variable [duplicate]

I have a Variable assigned a value, say ImportantDocuments=1 How do I make N["ImportantDocuments"] evaluate to be 1 instead of ImportantDocuments I found that N[ToExpression["...
• 117