# Tagged Questions

For questions relating to assignments to symbols, patterns, or expressions.

1k views

### How to store value in a For loop

I am using two For loops. When the inner loop finishes, I don't want to print but I want to store the result from the inner loop in some variable so that I can call ...
201 views

My code: ...
28k views

### Assign the results from a Solve to variable(s)

I understand Mathematica can't assign the results of a Solve to the unknowns because there may be more than 1 solution. How can I assign the 4 values of following result to variables?
1k views

### Scoping in assigning a derivative

While answering another question, I stumbled upon a problem I cannot easily resolve. To assign the derivative of a function to another function, typically one can do this with a ...
174 views

### Set promotes Rule to RuleDelayed?

In mentally building a model of how Mathematica works, I naively expected Set to create a Rule in a symbol's ...
642 views

### Does Set vs. SetDelayed have any effect after the definition was done?

I was always assuming that the only difference between Set (=) and SetDelayed (...
743 views

### How to augment the realm of functions Mathematica thinks it knows how to integrate symbolically

My question involves extending the functionality of Integrate over specific integrals in the most generic manner. Specifically, is it possible to "hack into" <...
98 views

### Syntax Coloring for “Possible Unwanted Assignment” Issue

Apparently Mathematica's syntax coloring engine believes that the second assignment in the following code excerpt (concocted for illustration purposes only) is a "Possible Unwanted Assignment" since ...
353 views

### Assignment rule to distribute matrix-multiplication over custom notation

I'm trying to write some code to do basic algebraic manipulations in BraKet notation. Thus far I have a function KetToVec which will convert any expression of the form a1 Ket[s1]+ b Ket[s2] +... to a ...
4k 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 ...
688 views

### Delayed evaluation of assignment

I have a set of PDE's that depend on parameters. They depend on many parameters, but for simplicity we can here assume that they depend only on one, say a. I want ...
322 views

### Setting parts of a list

Suppose I have list a = Range[10] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} in which I want to set some elements to be a list <...
451 views

### MapThread gives different results from ToExpression when trying to assign variables from a list

I have the following data set: data = {{"Jakarta","Surabaya","Bandung"},{1,2,3}} and I'd actually like to assign the numerical values to the categorical data so ...
2k views

### How to pass a symbol name to a function with any of the Hold attributes?

Given a function with the attribute HoldFirst, HoldAll or similar, and a variable, list, how ...
353 views

### Why does ++++x return an increment of 2 when the value of x is only incremented by 1?

This line returns 3: x = 1; ++++x However, the value of x after the increment is only 2....
369 views

### How to write a function-defining function which stores the function arguments in a stack?

I have a function-defining function SetAttributes[DefFn, HoldAll]; DefFn[f_[args___], body_] := f[args] := body; I am trying to modify this function to record ...
323 views

### How to make a function like Set, but with a Block construct for the pattern names

How can we define a function that works like f[x_]=ComputeSomething[x] and treats x as a variable that does not have a value? ...
160 views

### Differentiation w/o assiging concrete values

v = Subscript[v, 0]*Sin[(Pi*S)/Subscript[S, 0]]; a = dv/ds v; a = D[v, s] returns ...
1k views

### How do you set attributes on SubValues?

SubValues, as discussed in a previous question, are declared as follows ...
663 views

### Reassign values to symbols

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

### What is the distinction between DownValues, UpValues, SubValues, and OwnValues?

When reading through the documentation, you often encounter the phrases DownValues, UpValues, ...