38 questions linked to/from Elegant manipulation of the variables list
93 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, ...
95 views

### HoldFirst being overridden by Activate [duplicate]

So here's the problem a=1;a=2 works because of the HoldFirst attribute of Set, so that it ...
49 views

### How to assign a value to an already existing element of a list? [closed]

I want to do the following. Say I have a list: test = List[a,b,c] and I now want to assign some value to elements of that list, so that say if I assign 4 to a, ...
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 ...
141k 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 ...
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 ...
644 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 ...
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 ...
141 views

### HoldFirst and Hold expression as argument

I store a reference to the association in a held expression in a variable: a=<||>; b=Hold[a]; And in the code, I want to do manipulations with the original ...
90 views

### Set does not work

I tried following code, but it does not work as expected: Do[Set[a[[1]],a[[2]]],{a,{x->2,y->5,z->x+y}}] {x,y,z} I ...
1k views

### Reassign values to symbols

I've got a situation where I have, say 4 symbols, a, b, c and ...
148 views

### Can a Dynamic be attached to the single elements of a list?

Consider the following example: ...
157 views

### How to apply Set to held symbols listed in a variable?

I have a variable states that contains a list of held symbols: ...
116 views

### Get the name of a time series while using Table

I saw a number of related questions to the one I'm about to post; they helped, but none of them solved my problem entirely. Get the name of a symbol passed to a function Obtaining the name of a ...
290 views

### How to return the unevaluated variable names from a list of variables which have been declared

I feel like this should have a simple answer but I haven't found anything that works. The toy example of what I want is as follows: ...
735 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 ...
265 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 ...
874 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 ...
68 views

### How to use Set correctly

My codes are shown in the picture attached. I'm writing codes for numerical calculations frequently, and I think it looks neat and clear to organize input parameters in the form of table. For example,...
43 views

### How to transfer the list of parameters values into With [duplicate]

In the following case: With[{x=1,y=2},Print[x+y]] the values of x and y are declared in ...
2k views

I have been working on picking expressions apart using Head and Part and encountered a little mystery. Consider the canonical ...
437 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 ...
187 views

### How to extract a variable names (not values) from a list of transformation rules?

I am trying to extract variable names from a list of transformation rules mapping = {var1 -> 'val1', var2 -> 'val2' }. Variables ...
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 ...
399 views

### Printing names of indexed variables instead of values

I'd like to display only the variable (indexed variable) name (in symbol form, not in string form) instead of its value in Mathematica. Say I have a variable foo[i] ...
29 views

### Assign to variables inside Array, rather than changing array entries [duplicate]

I am generating an Array with symbolic coefficients: coefficients = Array[c, 3] > {c[1], c[2], c[3]} I would like to assign a value to each of these generated ...
702 views

### How to assign the values for the Table list?

Now, I want to assign some values for a Table list and I find that If {mat[1], mat[2], mat[3], mat[4], mat[5]}={4,23,3,12,1}; it is no problem. But, if we use ...
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 ...
119 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 ...
1k views

### Pass the list of variables into function to change their values

I'm new to Mathematica, so I don't really know, how do what I want, and I don't even know how to google it. Doing one Mathematica task for my supervisor, I faced the following problem. I need to ...
425 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 ...
219 views

### A problem with set values

The following code is just an example to clearly explain my problem. Assume that : ...
230 views

### How do I use a passed-in symbol as a tag to define UpValues?

ClearAll@foo; foo[tag_] := ( tag /: tag[i_] := tag[[i]] ); a = {7, 8, 9}; foo[a]; a[2] I wanted the above to output 8, ...
155 views

### Using a variable to tell Mathematica which existing variable to manipulate

I have an estimation routine I have coded up, I want now to do some tests on it where I pick a particular parameter and run the estimation for differing values of that parameter. What I want is to be ...
229 views

### I am missing a function like HoldPattern

Temporary message: I am planning to edit this question, making the examples less confusing and by moving the things that are confusing to a separate question For any confusion about expressions that ...
252 views

### direct assignment to the element in a Table

I have already asked a related question here why set values in this way doesn't work? But I think I have to write the question which I encountered explicitly? ...