Questions on attributes of functions.

learn more… | top users | synonyms

0
votes
0answers
37 views

SetAttributes to Cases creates problem in Suggestions Bar

I have encountered this issue when trying to set attributes to Cases (MMA V10.0.1). Any idea why? When I try to Open Wolfram Documentation in help menu (after this error) I got another problem.
4
votes
1answer
65 views

How Unevaluated works Through its Attributes?

Check this example: ...
4
votes
1answer
82 views

Slowdown of Flat attributed function

I was trying to write an associative function f using the attribute Flat. ...
0
votes
1answer
20 views

Numeric-type attributes for symbols (analog of NumericFunction)

Is there an attribute for symbols that makes NumericQ give True? For example Pi and ...
11
votes
2answers
153 views

Listable functions thread over Associations; is this documented?

Thanks to a somewhat misapplied use of MapThread I learned of this behavior: ...
10
votes
2answers
183 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 ...
3
votes
0answers
65 views

Listable on first level

I have some function which take List as input. f[l_List]:=someActions[l] I need apply this function to a list of lists. Now I ...
2
votes
1answer
191 views

Why is either Listable or HoldFirst not working?

Starting with a fresh kernel, I evaluate the following: ...
2
votes
1answer
185 views

Plotting attributes of vertices in WattsStrogatzGraphDistribution[n, p, k]

I have a graph WS = RandomGraph[WattsStrogatzGraphDistribution[n, p, k]]. I need to plot several characteristics of each v: the ...
8
votes
3answers
350 views

How to protect functions in a Mathematica Package?

I'm writing a Mathematica Package with many functions, but only two can be seen/public. I have: ...
9
votes
1answer
97 views

Why does $Failed have attribute HoldAll?

Why does $Failed have attribute HoldAll? Are there typical situations where $Failed is ...
9
votes
2answers
206 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 ...
5
votes
2answers
153 views

Strange Behavior when making Equal Listable in Pick

While trying to make this problem more efficient I tried different methods and dabbled with making Greater and Equal ...
12
votes
2answers
177 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
1answer
101 views

Apply N only outside a certain function

1 + f[1] // N gives 1. + f[1.] I don't want the argument of f evaluated by N; I ...
7
votes
1answer
162 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 ...
9
votes
1answer
237 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 ...
2
votes
1answer
91 views

Map and Scan ignore HoldFirst

I am trying to write a simple function that takes a list of data and outputs it to a file. I'd like the name of the file to be the same as the variable that holds the list. It seems that giving a ...
5
votes
1answer
80 views

Why is NHoldFirst not propagated to symbolic derivatives?

I encountered a nasty problem that N cannot evaluate expressions containing a symbolic Derivative of a multi-parameter function ...
5
votes
2answers
179 views

Why rule does not work if Flat attribute?

The following works: ...
7
votes
1answer
157 views

Custom attributes?

Is it possible to assign custom attributes to symbols and check them later? SetAttributes[a, b] says ...
5
votes
3answers
638 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 ...
11
votes
1answer
199 views

Why are the attributes of Plot changing?

In version 9, with a newly started Mathematica session, try the following code: ...
29
votes
1answer
341 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 ...
14
votes
4answers
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. ...
6
votes
2answers
264 views

Force integration to be linear over sum?

Is there an obvious way to force Mathematica to separately integrate the terms in a sum? According to the docs, When part of a sum cannot be integrated explicitly, the whole sum will stay ...
5
votes
1answer
208 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 ...
9
votes
1answer
104 views

Package automated way of ReadProtecting all symbols

My template for building packages has, at the end, the following expression that automatically ReadProtects all symbols defined in my ...
23
votes
2answers
774 views

Block attributes of Equal

I answered “Equating matrices (or higher order tensors) element-wise” with: ...
7
votes
1answer
203 views

DiracDelta attributes

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

How do you set attributes on SubValues?

SubValues, as discussed in a previous question, are declared as follows ...
13
votes
2answers
387 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: ...