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

learn more… | top users | synonyms

57
votes
2answers
2k views

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

When reading through the documentation, you often encounter the phrases DownValues, UpValues, ...
8
votes
3answers
2k 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?
5
votes
3answers
537 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 ...
11
votes
5answers
620 views

How to pass a symbolname to a function with any of the Hold attributes?

Given a function with the attribute HoldFirst, HoldAll or similar, and a variable, list, how ...
8
votes
3answers
217 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 ...
16
votes
1answer
340 views

How do you set attributes on SubValues?

SubValues, as discussed in a previous question, are declared as follows ...
9
votes
2answers
240 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 ...
11
votes
2answers
172 views

Nested definition: How can I define a function with a passed-in expression?

Here's a simplified version of what I'm trying to do: ...
10
votes
1answer
157 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 (...
12
votes
1answer
195 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? ...
4
votes
2answers
140 views

why set values in this way doesn't work?

question is as follows define a list ttt={1,2}; and if I set values in this way {ttt[[1]],ttt[[2]]}={3,4} then the value ...
22
votes
1answer
404 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" ...
15
votes
2answers
166 views

Clearing a specific definition

Consider the case where a symbol has multiple definitions attached to it, a /: Subscript[a,2] := 1 a[b_] := 2 a[b_, c_] := 3 How does one clear (/unset/remove) ...
14
votes
5answers
275 views

Reassign values to symbols

I've got a situation where I have, say 4 symbols, a, b, c and ...
16
votes
4answers
476 views

How can I randomly generate a unique, unused symbol?

In a previous question on collecting terms for a multivariable polynomial, I answered with a solution that required a unused symbol to be used for a temporary substitution and back substitution. It ...
11
votes
3answers
167 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 ...
1
vote
1answer
98 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? ...