23
votes
Accepted
Is there a comprehensive list of functions with operator forms?
From version 10.3 you can use WolframLanguageData.
WolframLanguageData[EntityClass["WolframLanguageSymbol", "Curryable"]]
As ...
- 40.7k
22
votes
Accepted
What is the definition of Curl in Mathematica?
The definition used (motivated by exterior calculus) is as follows:
Given a rectangular array $a$ of depth $n$, with dimensions $\{d, ..., d\}$ (so there are $n$ $d$'s) and a list $x = \{x_1, ..., ...
- 6,053
20
votes
20
votes
Accepted
Element-wise test on List elements
To my knowledge, there aren't built-in versions for comparison operators that would be automatically threaded over lists. One reason for that is that Mathematica is a symbolic system, and every auto-...
- 113k
18
votes
V10's Operator Forms - what are they good for?
Intermingling Operator Forms & Linguistic Connections
This answer attempts to draw out linguistic connections in understanding why operator forms seem so useful, a process that can perhaps point ...
- 5,991
18
votes
Accepted
How I can define this operator in Mathematica?
g[f_][x_?NumericQ] := If[EvenQ@Floor[x], f@FractionalPart[x], 1/f@FractionalPart[x]]
The ?NumericQ part is important because <...
- 231k
17
votes
Accepted
Question about Rules and Pattern (The operator patt/;test)
When using Set rather than SetDelayed you will need to hang the Condition on the left-hand-...
- 267k
17
votes
Element-wise test on List elements
The BoolEval` package does exactly this. For example:
BoolEval[{0.6, 1.2} > 1]
(* Out: {0, 1} *)
and
...
- 69.3k
14
votes
Accepted
Defining quantum-mechanical Bra and Ket operations
The definition of the scalar product in your question assumes that all your kets are orthogonal unit vectors. In that case, the most natural approach would be to use the built-in ...
- 96.2k
13
votes
Accepted
Why `Drop` and `Take` do not support a operator form
If they changed it, I'm pretty sure it would break some code somewhere, possibly in an obscure and hard to debug way. So it's a good thing that they didn't change it.
Why does the one argument ...
- 231k
13
votes
Accepted
13
votes
Defining an operator in Mathematica?
It should be this:
lap = D[#, {r, 2}] + 1/r D[#, r] &;
lapsquared = lap @* lap;
lapsquared[f[r]] // Simplify
Or using ...
- 9,503
12
votes
Accepted
Operator currying: how to convert f[a,b][c,d] to {a+c,b+d}?
Both Operate and Curry don't have access to the full expression, acting mostly on the head. This is why both of them take the ...
- 113k
12
votes
Accepted
Why does OperatorApplied by default reverse the arguments?
It comes down to being consistent with the convention/idiom/pattern of WL functions typically having as a first argument an object to be operated on with typically the second argument doing the ...
- 5,991
11
votes
Accepted
Redefining a built-in operator
Use upvalues. You don't want || to change its behavior except when it's operating on impedances. So, use a wrapper (z[ ], say) around the quantities that represent impedances, and associate upvalues ...
- 13.6k
11
votes
How can I define operators that implement the algebra of sets?
Here is one idea. Convert the set expression into an equivalent boolean expression, use BooleanMinimize to simplify the boolean expression, and then convert back to ...
- 127k
11
votes
Accepted
What is the best way to define Wirtinger derivatives
Here is one idea for supporting derivatives with respect to $z$ and $z^*$. First, we need to use SetSystemOptions to avoid ...
- 127k
11
votes
How to make a function with two patterns listable?
A few comments:
Values of the form f[][] are called SubValues.
For example, if one defines ...
- 11.6k
10
votes
Creating the Nabla operator (also known as Del operator) as an operator
Well, over-pursuing similarity of Mathematica code and traditional math notation does more harm than good, still, it's possible to create a nabla operator in Mathematica, here's my approach:
...
- 59.6k
10
votes
Accepted
How to make a binary function associative? (Or define an n-ary function?)
You can tell it by making a definition what it should do if you have more then 2 arguments:
ClearAll[f];
f[a_, b_, c__] := f[f[a, b], c];
CirclePlus = f
Then you ...
- 112k
10
votes
Redefining a built-in operator
I don't like the idea of redefining Or (||). Rather, I would suggest defining a function with the name ...
- 107k
10
votes
10
votes
Accepted
Define multilinear operator
Orderless
Orderlessness is easy just set Orderless attribute on your operator (I'll call it opA instead of ...
- 14.9k
10
votes
Accepted
Change Operator Precedence of --> operator
How about overloading the LongRightArrow with a special rule for Part[...] as the second argument?
...
- 11.3k
10
votes
Accepted
Associativity of upvalue
f[a x + b y] + c f[z]
is not the same as
1 * f[a x + b y] + c f[z]
so the pattern
...
- 11.3k
10
votes
What is the definition of Curl in Mathematica?
I fail to find a reference for the definition used by Curl, but manage to figure out how the Curl is defined.
I'll use Einstein ...
- 59.6k
10
votes
Accepted
10
votes
What operator is this?
It's StandardForm of UndirectedEdge. It's also mentioned in e.g. document of Graph.
- 59.6k
9
votes
Accepted
What is the operator **?
Since this was missing from What are the most common pitfalls awaiting new users? I'll answer. ** is shorthand for ...
- 267k
9
votes
Append a function of an expression as operator form using Curry?
Here are two methods that work:
opAppend1 = Curry[Append[#1, #2[#1]] &];
opAppend2[f_] := Function[Append[#, f[#]]];
Test:
...
- 20.2k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
operators × 259calculus-and-analysis × 35
functions × 31
function-construction × 31
matrix × 27
symbolic × 22
syntax × 16
differential-equations × 15
list-manipulation × 12
physics × 12
vector × 12
linear-algebra × 11
algebraic-manipulation × 10
custom-notation × 10
differentials × 9
simplifying-expressions × 8
pattern-matching × 8
vector-calculus × 8
replacement × 7
functional-style × 7
pure-function × 7
algebra × 7
evaluation × 6
tensors × 6
symbols × 6