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.
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.
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$.
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$.
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)
abs(x)/xin my mind when I typed the question. I have updated the question with the actual equation, that I intended to write. – Joyce Babu Jul 27 '16 at 19:08