Linked Questions

13 votes
2 answers
6k views

I haven't seen this question specifically addressed before in this site, although some hints and traces have been given, for instance, here: Pass by reference for an option argument Does pass-by-value ...
Vicent's user avatar
  • 1,131
11 votes
1 answer
2k views

An example will be most specific: func[list_, column_] := list[[All, column]] = Map[#*2 &, list[[All, column]]]; This throws errors. I want to avoid doing ...
phil's user avatar
  • 113
0 votes
1 answer
2k views

Sometimes I'd like to make a function, which would take an argument "by reference" instead of usual "by value". This is semantically similar to what e.g. AppendTo ...
Ruslan's user avatar
  • 7,272
3 votes
1 answer
2k views

For example, I defined a user function with a module and what this function does is take the values of two global variables ga and ...
nanjun's user avatar
  • 1,347
1 vote
1 answer
1k views

I'd like to write a function, that would take a matrix as an input parameter and would change it by multiplying one of its rows by a factor. I try to do it in the following way: ...
user1541776's user avatar
2 votes
2 answers
245 views

I have a custom function like this stringLength[string_] := StringLength[ ToExpression[StringJoin[ToString /@ {del, string}]] = StringDelete[string, " "]] ...
yode's user avatar
  • 27.8k
0 votes
1 answer
431 views

read some related posts and found no solution. For a list defined like this m = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9, 1.0, 1.5, 1.6}; when I define this function ...
Ruth Lazkoz's user avatar
1 vote
1 answer
145 views

I can't transform a simple code into a function. The function should take an integer and return a list of digits in a factorial number system: ...
Alex Rad's user avatar
1 vote
1 answer
159 views

I'm currently trying very hard to assign a variable inside a function. Therefore I'm using a function like this, which should reassign a predefined variable. ...
cxkoda's user avatar
  • 305
0 votes
1 answer
135 views

Can someone explain the principles underlying the following behavior. I define the list testD, and then use a Do loop to change values in the list (I realize there are smarter ways but they don't fit ...
Robert's user avatar
  • 505
0 votes
0 answers
138 views

I want to create a function that when it is called clears the value of a parameter. For example I want to keep the value of a parameter and then clear its valueby calling a function: ...
Nitra's user avatar
  • 347
2 votes
0 answers
103 views

Assuming variable x is a long list, which needs 1GB memory to store. I want to modify x in a function, such as let x[[10]]=1, using ...
cmc's user avatar
  • 751
0 votes
0 answers
26 views

I have written a function to assign values to a matrix putConj[arr_, i_, j_, val_] := Block[{}, arr[[i, j]] = val; arr[[j, i]] = val\[Conjugate]; ] This ...
Galilean's user avatar
  • 569
559 votes
37 answers
139k views

As you may already know, Mathematica is a wonderful piece of software. However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...
25 votes
5 answers
6k views

Given a function with the attribute HoldFirst, HoldAll or similar, and a variable, list, how ...
István Zachar's user avatar

15 30 50 per page