Questions tagged [downvalues]
Questions about DownValues which specify function definitions for symbols.
73 questions
12 votes
2 answers
284 views
Why is 2-dimensional array access slow (compared to memoized downvalues)?
The fabricated example below demonstrates a bizarre case I ran into. (If it matters, this is with Mma 14.1 on Apple ARM, but I see the same behavior with Mma 12.3.1 on Intel x86.) On a whim, I tried ...
0 votes
0 answers
46 views
How to define custom derivative rules for multiple symbolic fields in a loop without copy‐pasting?
Consider this code defining the "fields" field and their "derivatives" dfield for some list ...
1 vote
2 answers
158 views
How to pass arguments of outer function into inner function implicitly?
Consider the following setup: ...
0 votes
0 answers
49 views
Is this behaviour of pattern ordering of OptionsPattern stable and documented? [duplicate]
My version is 13.2. This behaviour of OptionsPattern together with `` is extracted from some complicated functions. Motivation <...
4 votes
1 answer
168 views
Can UpValues (as well as other "*Values") always be converted to DownValues?
As this post has discussed, UpValues are certainly useful, and as this post has discussed, g /: f[g[x_]] := h[x] is not ...
1 vote
2 answers
168 views
How to organise definitions that contain named parameters?
I have lots of definitions of (usually numeric) quantities that depend on parameters; they're mostly matrices (in the actual code, there are many more definitions): ...
4 votes
1 answer
159 views
Search speed of downvalues when indexing with strings
I'm writing a lot of print functions for different parts in a package and at the moment am using something like myprint[ identifierString_String ][ data_ ] := ... ...
4 votes
2 answers
187 views
Assignment with Span to Indexed Variable
If I use span to assign a value to every element in a "column", it miraculously works: ...