Skip to main content

Questions tagged [precedence]

For questions about operator precedence.

Filter by
Sorted by
Tagged with
4 votes
1 answer

Forcing Explicit Parentheses in Traditional Form

I have an expression in input form for the Cosine of a dihedral angle: ...
Stuart Poss's user avatar
  • 1,883
3 votes
0 answers

What's the effect of SyntaxForm option in StandardForm boxes of Superscript?

Consider the following sample: ...
xzczd's user avatar
  • 66.7k
1 vote
1 answer

Finding a list of results of an arithmetic operation with a permutations of precendence

Consider 3* 2 + 2 /4*10 With the default precedence for *,+, and / the result is 11. I am curious what the results would be for all six choices for the precedence ...
Craig Carter's user avatar
  • 4,510
2 votes
1 answer

Simplify Map on a list of lists

I have the following example list of matrices: a = {p Table[RandomComplex[], {2}, {2}], q Table[RandomComplex[], {2}, {2}]} where p and q are real variables. I ...
Sid's user avatar
  • 977
2 votes
0 answers

Precedence of @@ vs /@ [closed]

How do I find what I think is called the "precedence" of a given operator. That is, for the following code: ...
Brandon's user avatar
  • 101
11 votes
2 answers

i_:0|1 varies in v12.1: incompatible change or bug?

Just check i_: 0 | 1 // FullForm In v12.0 or earlier the output is Alternatives[Optional[Pattern[i, Blank[]], 0], 1] But in ...
xzczd's user avatar
  • 66.7k
3 votes
1 answer

Why Divide does not give the same answer? [closed]

I saw a question on Facebook $8\div2 (2 + 2)=?$ Consider these inputs. Divide[8, 2 (2 + 2)] 1 $8\div2 (2 + 2)$ using esc+div+esc 16 Why the results are ...
OkkesDulgerci's user avatar
2 votes
1 answer

Operator Precedence in Notation Package

I am trying to use the Notation package to define custom notation for chemical reactions. The natural thing to do is to use a \[LongRightArrow] for the operator....
Kevin Ausman's user avatar
  • 2,277
10 votes
2 answers

Table of precedence values for all System` symbols

Has anyone created a table listing the precedences for all symbols? Also, it would be nice if there were a function that for a given precedence value or interval, returned all the symbols with that ...
Carl Woll's user avatar
  • 131k
5 votes
1 answer

How exactly does Postfix notation work?

I guess I've been using the Postfix notation // wrongly for some time now. I assumed it was a quick way to apply a function to ...
Kvothe's user avatar
  • 4,491
11 votes
4 answers

Change Operator Precedence of --> operator

I am trying to use --> operator with highest precedence ...
Neel Basu's user avatar
  • 961
10 votes
2 answers

Which operators are missing from the official precedence table?

I often use the Operator Input Forms page as a reference for operator precedence as well as which (used or unused) operators exist. However, I just noticed that at least one operator is missing from ...
Martin Ender's user avatar
  • 8,774
19 votes
4 answers

Is it important that the front-end has a built-in parser?

The Notebook interface has a parser that seems aware of all operator-precedences, allowing us to step through the expressions (rather: Box-) hierarchy with Ctrl+. This is extremely convenient, saving ...
masterxilo's user avatar
  • 5,739
3 votes
2 answers

PrecedenceForm with Format

I'd like to format the output of certain operators with Infix-style formatting to have lower precedence than Times. Let's say I ...
jjc385's user avatar
  • 3,473
7 votes
1 answer

How to construct custom operators with precedence?

I need to combine data structures in operations analogous to addition, subtraction, multiplication and division (and more). I need more than one operation of each type, i.e. more than one method of ...
Duns's user avatar
  • 275
9 votes
1 answer

Bug in grouping after editing code?

Bug introduced in 7.0 or earlier and persisting through 11.0 While looking at A question about conditional replacement I think I discovered a bug in the Front End that affects both 7.0.1 and 10.0.1 ...
Mr.Wizard's user avatar
  • 272k
4 votes
3 answers

Notation package: parenthesis placement for SuperscriptBox

The question concerns the Notation package. I want to define notation for the function very similar to the built-in Power[a,b] ...
bcp's user avatar
  • 781
1 vote
0 answers

custom precedence for custom infix operator with InfixNotation [duplicate]

I am trying to define several custom operators with custom precedence to implement geometric algebra. Loading the notation package << Notation` I can ...
Hendrik's user avatar
  • 43
4 votes
1 answer

Why Min cannot be used as constrains of NMinimize?

I met a strange problem when trying to do an optimization. Initialization code, ...
saturasl's user avatar
  • 1,429
76 votes
3 answers

when is f@g not the same as f[g]?

I have always thought that f@g will give the same result as f[g] in all cases, and it is just a matter of style which one to use ...
Nasser's user avatar
  • 145k
35 votes
3 answers

Prefix operator with low precedence

The question is simple, but I will elaborate on the background as well for those interested in the idea: How to define a new operator with specified precedence value? Background Mathematica was ...
István Zachar's user avatar
23 votes
4 answers

Making a symbol's new definitions be tried before all previously defined ones

Is there any way to "close" a package (or a symbol, or a context) in that if a user of the package adds definitions to the symbol they will be tried before the package defined ones, just like what ...
Rojo's user avatar
  • 42.6k