Questions about DownValues which specify function definitions for symbols.

learn more… | top users | synonyms

16
votes
5answers
2k views

The difference between 0. and 0

I have a function for which 0 is a special case: f[A___, 0, B___] := 0 But since I am doing numerics, sometimes in the course ...
8
votes
2answers
393 views

How to get the list of defined values for an indexed variable?

I would like a table with rational indexes - thus it would be practical to use a dictionary, which, in Mathematica are implemented with the indexed variables. I would like to be able to do: ...
31
votes
0answers
565 views

How is pattern specificity decided?

Mathematica has a notion of pattern specificity, which is a partial ordering on patterns. The rules (e.g. DownValues, ...
9
votes
1answer
306 views

Selectively clear DownValues

How can I clear a subset of a symbol's DownValues ? For example, suppose I have created some DownValues for $f$ like this: ...
3
votes
2answers
137 views

Get DownValues that do not involve patterns?

Say I have a function with a few definitions that also implements memoization: f[x_] := f[x] = x^2 f[x_, y_] := f[x, y] = x^2 + y^2 I then apply the function to ...
4
votes
1answer
110 views

Multiple down-values with exactly the same lefthand side

I was working on an answer to this question, when I was sidetracked by what I bring up here. I wanted a function, which when given a string representing a binary number, would convert the string to a ...
2
votes
1answer
92 views

How do I constrain movement for lists of Locators using 2nd argument of Dynamic?

I need to display edge labels of a graph in a way that allows the edge labels to be moved. Locator seems the simplest and most obvious function to use. My ...