Why do we have a symbol for the absolute value function rather than simply $\sqrt{x^2}$

80 Views Asked by At

I was looking at my calculator and saw the abs() function to which I thought, this function is fairly unnecessary. So I suppose my question is: is abs(x) different from sqrt(x^2) in some way? If they are not different, why is it so common to see abs(x) function on calculators and in programming languages etc.?

Thanks!

3

There are 3 best solutions below

1
On BEST ANSWER

First, abs() just removes the sign from the number, which is computationally a LOT less expensive than squaring and the extracting the square root. Second, extracting square roots causes round off error.

3
On

If $x$ is complex, then $|x|$ denotes the norm of $x$. This coincides with the usual absolute value if $x$ happens to be real. However, $\sqrt{x^2}$ differs from $|x|$ for most complex $x$ -- the former is a complex number, while the latter is always real and nonnegative.

0
On

Generality

"Absolute value", abs(x), |x| can be always seen as an interpretation of distance - values on number line, points in space... The idea of distance makes sense in places where powers and roots do not - graphs, sets, etc. Mathematicians tend to prefer more general and abstract concepts over restricted ones.