23
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, ..., ...
22
votes
17
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 <...
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 ...
12
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:
...
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 ...
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 ...
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 ...
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 ...
11
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 ...
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 ...
10
votes
Accepted
Change Operator Precedence of --> operator
How about overloading the LongRightArrow with a special rule for Part[...] as the second argument?
...
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
...
10
votes
Accepted
10
votes
Accepted
10
votes
What operator is this?
It's StandardForm of UndirectedEdge. It's also mentioned in e.g. document of Graph.
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 ...
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:
...
9
votes
Accepted
A possible issue in combination of the Infix operator ~ with Sequence
Look at:
Attributes[If]
(* {HoldRest, Protected} *)
Now consider:
If[#1, Sequence @@ {2, 3}] &
Because of the "...
9
votes
Can I use == to compare two list element wise?
You could create a listable version of Equal:
...
8
votes
Change Operator Precedence of --> operator
You could give LongRightArrow a HoldRest attribute and manipulate the right hand side.
Perhaps something like:
...
8
votes
Which operators are missing from the official precedence table?
Finding All Operators and Their Precedence, Arity, Affix, and Associativity
Sources of Information
There are a few different sources of information about operators and their properties. I list all ...
8
votes
Which operators are missing from the official precedence table?
We can read the Front End resource as I did for List of symbols without built-in meaning.
UnicodeCharacters.tr itself contains the parsing precedence information, ...
8
votes
Iterated differential operator
One can use Composition (which should be the true meaning of the product of operators) with (pure) Function:
...
7
votes
Custom operator form for system functions?
A true operator would use SubValues but here's a position-coded pseudo-operator form "constructor" using UpValues that can be applied to most or all system functions:
...
7
votes
Element-wise test on list elements
Check Positive.
For {0.6, 1.2}>1, you may write:
Positive[{0.6, 1.2}-1]
7
votes
Accepted
Hadamard Lemma and commutators algebra
One should really use commutator rather than Commutator for future-proofing concerns, but I have some bad habits...
...
7
votes
Difference between = and :=
You need to understand the difference of "Set" and "Set Delay" :
Let's make an example which illustrates this clearly.
I have a function:
f[x1_,x2_]:= x1+x1*x2
...
7
votes
How to define a differential operator in Mathematica?
(From my answer to the linked question)
Install the DifferentialOperator paclet with:
...
7
votes
Accepted
Define an operator for long equations
Define
x = {a, b, c, d};
l = {1, 2, 3, 4};
DD = l . D[#, {x}]&
and then use prefix notation to approximate your expression:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
operators × 277calculus-and-analysis × 37
function-construction × 34
functions × 31
matrix × 30
symbolic × 24
differential-equations × 17
syntax × 17
linear-algebra × 14
physics × 14
list-manipulation × 13
vector × 12
algebraic-manipulation × 10
custom-notation × 10
simplifying-expressions × 9
differentials × 9
pattern-matching × 8
vector-calculus × 8
replacement × 7
functional-style × 7
pure-function × 7
algebra × 7
evaluation × 6
tensors × 6
symbols × 6