0

Let $a$ be a real number . The positive part of $a$, denoted by $a^+$ is given by expression $$a^+ = \text{if } a\geq 0 \text{ then $a$ else } 0$$ The negative part of $a$, denoted by $a^-$ is given by expression $$a^- = \text{if } a\geq 0 \text{ then $0$ else } -a$$ Both $a^+$ and $a^-$ are non negative and the following relationship hold $$ a = a^+ - a^-$$ Above is the text from my compiler optimization book and I cannot understand the relationship explained. How can $a$ be a real number and have positive and negative parts?

  • 1
    Well, what you wrote doesn't really make sense. If, say, $a=-1$ then we'd get $a^+=0$ and $a^-=-a=1$. But then it is not the case that $a=a^++a^-$. My guess is: Either you meant to write that $a^-=a$ for $a<0$ or you meant $a=a^+-a^-$. – lulu Sep 27 '20 at 21:37
  • It should be $a=a^+-a^-$. – José Carlos Santos Sep 27 '20 at 21:39
  • Sorry about that, I have updated it to $ a = a^+ - a^-$. I cannot understand the relationship and what it is trying to say. – Swornim Baral Sep 27 '20 at 21:42

2 Answers2

0

If, for instance, $a=3$, then $a^+=3$, $a^-=0$, and indeed $a=a^+-a^-$.

And if, say, $a=-\pi$, then $a^+=0$, $a^-=\pi$, and indeed $a=a^+-a^-$.

0

Although $a=a^+-a^-$ (with a minus sign) is true for a real number, in fact one of $a^+$ or $a^-$ is always $0$.

It would make more sense for a function to have $f(x)=f^+(x)-f^-(x)$ with similar definitions you gave, and note that with a plus sign this is : $|f(x)|=f^+(x)+f^-(x)$.

This is used in particular for Lebesgue integral where it is convenient to deal with positive functions (see for instance https://math.stackexchange.com/a/3775854/399263)

zwim
  • 28,563