375 reputation
19
bio website munderwood.ca
location Calgary, Canada
age 35
visits member for 2 years, 3 months
seen Apr 11 at 5:43

I am working on my Ph.D. in physics at the University of Calgary, and have been using Mathematica since version 5 in the course of my studies.


Jan
18
awarded  Yearling
Sep
25
awarded  Caucus
Apr
16
awarded  Nice Question
Apr
12
accepted When should I, and when should I not, set the HoldAll attribute on a function I define?
Apr
11
comment When should I, and when should I not, set the HoldAll attribute on a function I define?
Aah, that definitely clears a few things up for me, thanks! Would it be correct to say then that if what you want from the arguments to your function is their values then you shouldn't use HoldAll, but if you explicitly want the symbols as entered then you should?
Apr
11
awarded  Editor
Apr
11
revised When should I, and when should I not, set the HoldAll attribute on a function I define?
Added further definition of the question.
Apr
11
comment When should I, and when should I not, set the HoldAll attribute on a function I define?
I just made this comment above, but will add to it here. I tried the syntax highlighting example with HoldAll omitted, and it behaved exactly the same. This isn't surprising to me, because if I set foo=bar and then type f[foo], Mathematica doesn't change my input to read f[bar]... So indeed it still displays as f[foo], with foo a different colour.
Apr
11
comment When should I, and when should I not, set the HoldAll attribute on a function I define?
@Szabolcs my question includes two examples on this site where I think HoldAll is unnecessary... @Albert, it does make sense that many examples here are exceptional! Perhaps an explanation of why HoldAll is needed would help to enlighten me. I took the first example I mentioned, syntax highlighting, and entered the code from the accepted answer except for the SetAttributes line. The result was exactly what was specified it would be in the answer; I see no different behaviour in the syntax highlighting. I'm not sure why I can't then conclude that the line of code I omitted is unnecessary.
Apr
11
asked When should I, and when should I not, set the HoldAll attribute on a function I define?
Mar
29
comment When using GraphPlot with an adjacency matrix, how can I make Mathematica draw exactly one self loop for any non-zero weight?
I posted two of the matrices in the examples in my question: {{1,2},{2,0}} and {{2,2},{2,0}}. So I guess they would both be given by WeightedAdjacencyMatrix[g] instead of AdjacencyMatrix[g] if I had started with some graph g, but I'm just working directly with real symmetric matrices that represent weighted undirected graphs. Can you point me to some of those other ways to visualise graphs? I'm only familiar with GraphPlot[]. Thanks!
Mar
29
asked When using GraphPlot with an adjacency matrix, how can I make Mathematica draw exactly one self loop for any non-zero weight?
Feb
4
awarded  Scholar
Feb
4
accepted Pattern to match a non-empty list of non-empty lists
Feb
4
awarded  Nice Question
Feb
3
comment Pattern to match a non-empty list of non-empty lists
Thanks, that appears to do the trick for all test cases I've come up with... Could you elaborate on this at all? Am I interpreting correctly that the outer braces simply hold the pattern, the inner ones represent a list, the two underscores say that list must have at least one element, and the two periods indicate that there must be at least one such non-empty list?
Feb
3
awarded  Student
Feb
3
asked Pattern to match a non-empty list of non-empty lists
Jan
18
awarded  Teacher
Jan
18
awarded  Supporter