# 15. abs() | Wrong definition of absolute function?

#1

The description before the instructions says:
"The abs() function always returns a positive value, ..."
-> this would exclude the return of "0" since its not:
"The abs() function always returns a [not/non negative] value..."
or am i wrong ?

Just wondering

#2

Try it out, instead of setting it to -42 set it to 0.

``````absolute = abs(0)

print absolute``````

Prints 0

#3

I mean yes, it works with 0 but isnt the definition still wrong?

#4

Not really. Since 0 is technically not a negative or positive number, it will return 0. For example, if you have 0\$ , you have neither an excess(positive) or debt(negative). So you have 0\$. Same thing here, it will return 0.

(There are almost always exceptions. 0 being one of them)

#5

Hmm since i learned that the mathmatical defintion of an absoulte function is that the return is "not negative" since this means x>=0,
where as "positive" means x>0.

#6

The definition of absolute value is the distance from 0. Since 0 is no distance from 0, it will return 0. Since -42 is 42 away from 0 it returns 42.

#7

Isn't this definition just a way to think of the absoulte value/function ?
You can check the definition of the absoulte value/function in wikipedia for example and it says "non-negative".

#8

Wikipedia is not always the best source to go to because it can be edited by anyone, and therefore can be unreliable at times. Check out this Varsity Tutors link

https://www.varsitytutors.com/hotmath/hotmath_help/topics/absolute-value.html

#9

Well nowdays Wikipedia is more reliable then it used to be. But still i belive the wording in the description is incorrect, because the absolute value function is:
f(x) = |x|, where f(x) â‰¥ 0 for all values of x
f(x)â‰¥0 <- this means non-negative result.
But positive results mean f(x) >0.
I am not arguing with you personally but just trying to clear up the "error" in the description.

#10

I agree with you there, Wikipedia has gotten more reliable but you wouldn't use it for a research paper or for school so I try and stay away from it
So you're saying it should be:
f(x) = |x|, where f(x) â‰¥= 0 for all values of x (positive)
f(x)â‰¥= 0 <- (negative).
Right?

#11

No i mean that
f(x)â‰¥ 0 means non-negative (0 can be a result)
and
f(x)> 0 means positive (0 cant be a result)
but because the result of an absolute value function can be 0, it has to be "a non-negative result" and not "a positive result" .

#12

Ah, I see what you mean now. Excluding 0, the abs() function always returns a positive number. Right? But since 0 is neither positive nor negative the 'positive result' definition still works since 0 is neither and therefore excluded.

#13

No the "positive result" definition is wrong since it excludes 0 as a result where as "non-negative result" has 0 and all positive results

#14

NonÂ·negÂ·aÂ·tive: either positive or equal to zero.

Positive numbers are numbers that are greater than zero.

Zero is neither positive nor negative, but is a non-negative number

I see what you mean. Honestly, it doesn't really matter because most automatically assume that 0 is 'not positive' and the opposite of 'not positive' is negative, so absolute value gets 'positive result' slapped on it. If you wanted to be that technical, then yes, you would be correct.

:))

#15

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.