Questions tagged [assignment]

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

Filter by
Sorted by
Tagged with
6
votes
3answers
816 views

Understanding Function and Variable in Mathematica for beginner [closed]

I'm reading the book of Leonid Shifrin, and I love the way the book explains the core in Mathematica. As everything is an expression, now I understand that, there ...
4
votes
2answers
218 views

Unset while running recursion

I am trying to run a recursive definition while at the same time clearing previously found values, so my memory is not completely consumed. I found this: How to clear parts of a memoized function? ...
2
votes
1answer
78 views

Reassign a value to an array element

I have a very complex code in which I assign a value to an element of an array and then I reassign to it another one. A minimal example: ...
1
vote
2answers
221 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: ...
1
vote
2answers
198 views

Evaluating ReplaceAll inside SetDelayed, first

Consider the following (simplified for the purpose of example) definitions: f[x_] := y /. y -> x g[x_] := x Where for example, the definition of ...
8
votes
1answer
3k views

Clear and Unset doesn't free memory

Example: Try this example only if you have > 4G ram d = 2000; f[x_, y_, d_] = Sum[Subscript[a, i, j]*x^i*y^j, {i, 0, d - 1}, {j, 0, d - i}]; Then ...
7
votes
2answers
243 views

Apply ToString to a list of variables [duplicate]

I have data1 = {1, 1}; data2 = {2, 2}; datalist = {data1, data2}; I want to create a string list based on the variable names inside ...
7
votes
3answers
501 views

Implementing key-value associations in Mathematica 9 with inexact numbers for keys

I'm not sure of what type of problem my issue falls into, so I haven't been able to search forums with any success. If this has already been solved then my apologies! Essentially I'm trying to set a ...
5
votes
1answer
69 views

Set on symbol with OwnValues skips UpValues

Can anyone provide insight on what's going on here? First I define a new Set behavior for a symbol: ...
4
votes
2answers
2k 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 ...
3
votes
1answer
80 views

Why does syntax highlighting in `Set` and `Rule` not color pattern names on the RHS?

The mathematica front-end colors x on the right hand side of x_ :> x and f[x_] := x but ...
3
votes
2answers
255 views

Bare symbol invocation fails but not if used with an argument

How to achieve the following behavior on a symbol f? Background: The main goal is to use the symbol to tag an abstract data structure where downvalues are used to store information. Only defined ...
1
vote
1answer
401 views

Tag Times in Null is Protected [closed]

I've some problems with the error mentioned in the title. Unfortunately, my code is full of subscripts so I'll show it in a photo. In this code the central aspect is to assign a scalar value to an ...
1
vote
2answers
111 views

Assigning to the “local” version of a symbol

Compare Manipulate[c[1] = 1; c[1], {c[1], 0, 1}] with Manipulate[Do[c[i] = 1, {i, 1}]; c[1], {c[1], 0, 1}] The first case ...