Formula for absolute value which is defined for abs(0)

107 Views Asked by At

Is there an equation f(x) for absolute value, that is defined for every defined value of x, without using separate equation for different ranges.

It should be defined without using a conditional check.

3

There are 3 best solutions below

0
On BEST ANSWER

Because of the convention that $\sqrt{x}$ is always non-negative, we have $$|x|=\sqrt{x^2}$$ for all $x\in \mathbb R$.

You can also use $$|x|=x\cdot sign(x)$$ for all $x\in \mathbb R$.

0
On

One equation for the absolute value functions is:

$$ f:\mathbb{R}\to\mathbb{R}_{\geq 0}, $$

given by

$$ f(x)= \begin{cases} \begin{aligned} x&\text { if }x\geq 0\\ -x&\text { if }x< 0 \end{aligned} \end{cases}. $$

So, for instance, $f(5)=5$ since $5\geq 0$, while $f(-4.7)=-(-4.7)=4.7$, since $-4.7<0$.

0
On

An absolute value can be written as: $$|x|= \begin{cases} \begin{aligned} x&\text { if }x\geq 0\\ -x&\text { if }x< 0 \end{aligned} \end{cases}$$

OR

$$|x| = \sqrt{x^2}$$ = The above notation describes the principal root of $x^2$ (Positive)