Linked Questions

528
votes
19answers
132k 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 ...
454
votes
37answers
99k 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 ...
129
votes
8answers
7k 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/...
68
votes
4answers
16k 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 ...
47
votes
2answers
2k views

How do you set attributes on SubValues?

SubValues, as discussed in a previous question, are declared as follows ...
37
votes
5answers
7k 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: ...
36
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 <...
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
602 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 ...
20
votes
2answers
630 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: ...
19
votes
3answers
857 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
318 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
1answer
552 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): ...
11
votes
2answers
315 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
1k 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}...

15 30 50 per page