Linked Questions
79 questions linked to/from What is the distinction between DownValues, UpValues, SubValues, and OwnValues?
563
votes
19answers
142k views
Where can I find examples of good Mathematica programming practice?
I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
482
votes
37answers
110k views
What are the most common pitfalls awaiting new users?
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 ...
133
votes
8answers
8k views
Can one identify the design patterns of Mathematica?
... or are they unnecessary in such a high-level language?
I've been thinking about programming style, coding standards and the like quite a bit lately, the result of my current work on a mixed .Net/...
71
votes
4answers
17k views
How do I save a variable or function definition to a file?
Is it possible to save a function which was created via Interpolation of some data in such a way that I can use this function in a new Mathematica session without ...
49
votes
2answers
2k views
How do you set attributes on SubValues?
SubValues, as discussed in a previous question, are declared as follows
...
40
votes
5answers
8k views
Clear complains that a subscripted variable is not a symbol or a string?
Here's a small listing where I've used EscqEsc to typeset θ in the notebook:
...
40
votes
4answers
3k views
Do people actually use UpValues?
I know what they are and how to define them. They have to serve some purpose - else why include them? But I never used them and all examples on this site and the docs never show a practical use of <...
25
votes
2answers
648 views
How to implement FittedModel like objects
In the course of making some RLink wrappers I want to have some richer containers like Mathematica does with its FittedModel ...
23
votes
8answers
2k views
Selectively Mapping over elements in a List
I am using the following code to easily generate a row of images of all eight planets of our Solar System:
...
23
votes
2answers
674 views
SetAttributes[f,Flat]: Why the order dependence?
I'm experiencing a strange phenomenon. Here's a (quite artificial) test case:
The following definition work just fine:
...
21
votes
1answer
684 views
Why does the documentation call functions “pure”?
Clearly, functions in mathematica are not pure functions according to the definition on Wikipedia (no side effects - basically implementabe with table lookups):
...
19
votes
3answers
901 views
Generating assignments and transforming code inside held forms when generating code
I have been playing with slightly above trivial code manipulations in Mathematica. I thought Mathematica would be great for this kind of work because of rule replacement and expression manipulation, ...
16
votes
3answers
362 views
Why is the first argument of the SetDelayed evaluated?
In[1]: f=g;
In[2]: SetDelayed[f[x_],x^2];
In[3]: ?f
Global`f
f=g
In[4]: ?g
Global`g
g[x_]:=x^2
However, SetDelayed has the ...
11
votes
2answers
343 views
Why is `D[a[b][c],a[b]]` equal to `1[c]`?
Background: I had the same issue as described here, and I went to extend Mr.Wizard’s code such that a[b][c] would be shown as $a_b^c$.
Issue: To my surprise, ...
11
votes
2answers
2k views
Solve a nonlinear PDE equation with a Neumann boundary condition
I am trying to use Mathematica 10 to solve a PDE
$$u_t=u_{xx}+u_{yy}+u(1-u),$$
in the unit disk $(x,y) \in D=\{(x,y):x^2+y^2<1\}$, with the Neumann boundary condtion
$$\frac{\partial u}{\partial n}...