Linked Questions
38 questions linked to/from Elegant manipulation of the variables list
2
votes
3answers
267 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 ...
1
vote
2answers
664 views
How to assign values to symbolic arrays [duplicate]
My main question is how to assign values to symbolic arrays, in an efficient way. The code below is a simplified version of what I am trying to do and the output I get. Note that because I am using ...
3
votes
3answers
99 views
Assign Values from Array to Array [duplicate]
I am trying to simply do the following
cVec = {a,b,c,d}
From another expression, I obtain another vector, say,
...
2
votes
1answer
125 views
Table of references [duplicate]
I have a list of variables (say a, b, c, d, e) that I want to assign in a single command.
{a,b,c,d,e} = {1,2,3,4,5}
would ...
562
votes
19answers
142k views
Where can I find examples of good Mathematica programming practice?
I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
44
votes
5answers
3k views
How to create symbols from strings and set values for them?
I am trying to convert a list of string names into symbols, which will then be used to store data. I have 24 files (where the name of each file is a member of the list mentioned above) that I need to ...
22
votes
5answers
1k views
53
votes
2answers
2k views
Head and everything except Head?
I have been working on picking expressions apart using Head and Part and encountered a little mystery. Consider the canonical ...
15
votes
3answers
8k views
Assigning values to a list of variable names
As part of a calculation I need to do something like this
Evaluate[{aaa, bbb, ccc}[[ index]]] = {1, 2, 3, 4, 5}
so if index is ...
10
votes
6answers
1k views
Generate list of strings from a list of assigned variables
How do I generate a list of strings from a list of assigned variables?
E.g. convert
...
8
votes
2answers
745 views
How to Clear variables represented as a list of strings?
Say I have a string list called fullpara
fullpara={"width", "long", "line", "distance"}
And there are corresponding variables ...
2
votes
2answers
1k views
Why this list has a length of 1?
Here is the code :
bb = HoldForm[{aa[1], bbb[2], cc[3], dd[4]}]
it returns :
{aa[1], bbb[2], cc[3], dd[4]}
Which is what I ...
4
votes
3answers
442 views
Using Block with a list of variables
I have a list of variables
var={v1,v2};
which I want to protect/localize during a particular operation. I have decided that I want to use ...
9
votes
2answers
881 views
How to name a variable with the value of another variable?
A simple but very important (at least for me) question.
In some languages for defining a variable, for example, we can do:
i=10
"d"&i=30
So I have defined the variable d10, and...
d10=30
...
2
votes
3answers
427 views
How to create a writable and clearable symbol? [duplicate]
I'm trying to create several symbols and assign values to them. Here's what currently appears to work:
Evaluate[Symbol["fdds" <> ToString[10]]] = 1
But ...