2

I would like to write that some polynomial $p(x)$ is the sum of polynomial $d(x)$ and the remainder of division of polynomial $b(x)$ by polynomial $w(x)$:

$$p(x) = d(x) + b(x)\bmod w(x)$$

But from what I saw in books, this can mean something different which is:

$$p(x) = (d(x) + b(x))\bmod w(x)$$

So, what is a good way to write what I mean?

amWhy
  • 209,954
scdmb
  • 369
  • 3
    When in doubt, add brackets. – Zhen Lin May 24 '11 at 10:09
  • (b mod w) is a shorthand for the set {b+qw ; q polynomial}. Hence d+(b mod w)=(d+b) mod w since both are {d+b+qw ; q polynomial}. – Did May 24 '11 at 10:15
  • @Didier: I think it's clear from context that the OP wants to discuss an operation which returns the remainder. But I agree that the use of $\text{mod}$ for this is an abuse of notation and should be replaced with something else. – Zhen Lin May 24 '11 at 10:37
  • I would write it exactly like you, but add brackets. So $p(x) = (d(x) + b(x)\bmod w(x))$ but $p(x)\not=d(x)+b(x)\mod w(x)$. Notice also, that the spacing is also different. – FUZxxl May 24 '11 at 12:22
  • Write it as $\rm\ p = d + (b\ mod\ w)\ $ to avoid confusion with $\rm p = d + b\ (mod\ w):,\ $ or use $\rm:(b\ rem\ w):.$ – Bill Dubuque Jul 26 '11 at 17:52

1 Answers1

1

Your question is not specific to polynomials, it also occurs for integers. In particular, every programming language has to deal with this question. For instance, just compare the following results (in Python, but you could choose C, Java, C++, etc.). Here % means mod.

7 + 7 % 5 
9

(7 + 7) % 5 
4

7 + (7 % 5) 
9

You conclude that 7 + 7 % 5 was interpreted as 7 + (7 % 5). The reason is that $C$-style languages use precedence levels to avoid ambiguity. In particular, multiplication, division and modulo have higher priority than addition.

That being said, Rule 8 of The Elements of Programming Style states

Parenthesize to avoid ambiguity

which confirms Zhen Li's and Bill Dubuque's comments to your question.

J.-E. Pin
  • 40,163