Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Input and Output / Formatting Functions  /
PrecedenceForm

  • PrecedenceForm[ expr , prec ] prints with expr parenthesized as it would be if it contained an operator with precedence prec.
  • prec must be an integer. See notes for Infix.
  • Example: a + PrecedenceForm[b c, 10].
  • PrecedenceForm acts as a "wrapper", which affects printing, but not evaluation.
  • See the Mathematica book: Section 2.8.16.

    Further Examples

    Here is an expression with a new infix operator.

    In[1]:=

    Out[1]=

    Parentheses are added around the expression depending on the size of the second argument of PrecedenceForm.

    In[2]:=

    Out[2]=

    In[3]:=

    Out[3]=

    In[4]:=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.