Skip to main content
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, ..., ...
jose's user avatar
  • 6,683
22 votes

Having the derivative be an operator

Update I've created a paclet. Install with: ...
Carl Woll's user avatar
  • 132k
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 <...
Szabolcs's user avatar
  • 236k
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 ...
Αλέξανδρος Ζεγγ's user avatar
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: ...
xzczd's user avatar
  • 68.4k
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 ...
Leonid Shifrin's user avatar
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 ...
Ronald Monson's user avatar
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 ...
Carl Woll's user avatar
  • 132k
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 ...
Carl Woll's user avatar
  • 132k
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 ...
xzczd's user avatar
  • 68.4k
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 ...
user293787's user avatar
10 votes
Accepted

Change Operator Precedence of --> operator

How about overloading the LongRightArrow with a special rule for Part[...] as the second argument? ...
LLlAMnYP's user avatar
  • 11.5k
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 ...
LLlAMnYP's user avatar
  • 11.5k
10 votes
Accepted

Iterated differential operator

Clear["Global`*"] Defining the operator recursively, ...
Bob Hanlon's user avatar
  • 163k
10 votes
Accepted

How can I direct sum matrices into the middle of one another another?

...
kglr's user avatar
  • 401k
10 votes

What operator is this?

It's StandardForm of UndirectedEdge. It's also mentioned in e.g. document of Graph.
xzczd's user avatar
  • 68.4k
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 ...
Mr.Wizard's user avatar
  • 273k
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: ...
Sjoerd Smit's user avatar
  • 24.8k
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 "...
Daniel Huber's user avatar
  • 56.4k
9 votes

Can I use == to compare two list element wise?

You could create a listable version of Equal: ...
MarcoB's user avatar
  • 67.7k
8 votes

Change Operator Precedence of --> operator

You could give LongRightArrow a HoldRest attribute and manipulate the right hand side. Perhaps something like: ...
Greg Hurst's user avatar
  • 36.8k
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 ...
Robert Jacobson's user avatar
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, ...
Mr.Wizard's user avatar
  • 273k
8 votes

Iterated differential operator

One can use Composition (which should be the true meaning of the product of operators) with (pure) Function: ...
Αλέξανδρος Ζεγγ's user avatar
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: ...
alancalvitti's user avatar
  • 15.2k
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]
Jake Pan's user avatar
  • 526
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... ...
evanb's user avatar
  • 6,551
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 ...
henry's user avatar
  • 2,510
7 votes

How to define a differential operator in Mathematica?

(From my answer to the linked question) Install the DifferentialOperator paclet with: ...
Carl Woll's user avatar
  • 132k
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: ...
Roman's user avatar
  • 49.8k

Only top scored, non community-wiki answers of a minimum length are eligible