Questions on attributes of functions.

learn more… | top users | synonyms

27
votes
5answers
2k views

how to differentiate formally?

I have been wrapping my head around this for a while now and I have not found a solution so far. I want to work with an arbitrary number of variables in mathematica and use some built in functions. ...
31
votes
1answer
974 views

How do you set attributes on SubValues?

SubValues, as discussed in a previous question, are declared as follows ...
27
votes
2answers
868 views

Block attributes of Equal

I answered “Equating matrices (or higher order tensors) element-wise” with: ...
18
votes
2answers
496 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: ...
5
votes
2answers
233 views

Why rule does not work if Flat attribute?

The following works: ...
12
votes
1answer
303 views

Orderless pattern matching

The MMA docs state that "In matching patterns with Orderless functions, all possible orders of arguments are tried". Why then does the following not work? ...
19
votes
2answers
308 views

Pattern does not match with Orderless head

Why does the following pattern matching not succeed? ...
14
votes
1answer
355 views

Pure function with attributes of arbitrary number of arguments: Is it possible?

Mathematica allows to define pure function, like Function[{a, b},Length[Unevaluated@a]{b}][1+2,2+3] (* ==> {0} *) Pure functions in Mathematica can take an ...
13
votes
2answers
209 views

Listable functions thread over Associations; is this documented?

Thanks to a somewhat misapplied use of MapThread I learned of this behavior: ...
12
votes
2answers
318 views

How to restore function attributes to default

Adding an attribute to a function is easy and clearing attribute is easy also. But I don't know really how to restore the attributes of a function to its defaults. All I do is quit the kernel or close ...
5
votes
3answers
1k views

Define an 'inner product' with AngleBracket

I want to define my own little 'Inner Product' function satisfying properties of linearity and commutativity, and I'd like to use the "$\langle$" and "$\rangle$" symbols to output my results. For ...
7
votes
2answers
229 views

Given the OneIdentity attribute why is GCD[a] evaluated to GCD[a]?

GCD has attribute OneIdentity so I expected GCD[a] being evaluated to a?
32
votes
1answer
404 views

Quickly look-up usages, options and attributes of symbols

When I'm writing code in the front-end, I find myself very often looking up the list of options of a symbol over and over again in the documentation center. In most cases you find there a list of ...
4
votes
2answers
76 views

MatchQ failing in some cases with Hold [duplicate]

Could someone clarify why the first of these MatchQ finds a match whereas the second does not? (I'm using version 10.0, in case that matters.) ...
12
votes
4answers
200 views

How to define a function that is Listable for some but not all arguments?

I want to define a function f[x,y] that is Listable for only the first argument, not the second. If we use ...
15
votes
1answer
249 views

Why are the attributes of Plot changing?

In version 9, with a newly started Mathematica session, try the following code: ...
12
votes
2answers
196 views

How can one write a robust ListableQ function?

I would like to have a test that determines if a particular function is Listable. In the case of Symbols this is merely a matter of checking Attributes. ...
9
votes
2answers
401 views

Mathematica: How to create a function that returns a property similar to how LinearModelFit works?

I'm trying to write a custom function in Mathematica, myFunc[x]. I want to be able to define properties of the function so that the user can call ...
8
votes
1answer
188 views

The Flat Attribute, Unevaluated and the Evaluation Process

To make this question easy to follow let's give some symbols a couple attributes. Attributes[f] = {Flat}; Attributes[s] = {Orderless}; Now consider the ...
8
votes
1answer
242 views

DiracDelta attributes

Is there any reason why DiracDelta isn't a NumericFunction but DiracComb is? I just ate a ...
5
votes
1answer
258 views

Why can't I remove Orderless from Plus?

I am making some random algebra equations, and I want to have the ordering be random too, such that if my random equation generator makes x+1, the output stays ...