Hacker News new | ask | show | jobs
by adverbly 942 days ago
Have you tested your proposed function against i?

abs(i)

= sqrt(i^2)

= sqrt(-1)

= i

Now, i != 1... so clearly either the abs function you have in mind here is doing something that isn't quite aligned with the goal. If we assume that the goal of the absolute function is to always produce positive real numbers, the function is missing something to deal with imaginary components.

I'm not sure, but based on these cases so far, maybe you just need to "drop the i" in the same way as you need to "drop the negative" in the case of non-imaginary components. Now, "drop the i" is not an actual function so maybe there is something else that you can think of?

EDIT:

Maybe could do this(works for x = i at least...):

abs(x) = sqrt(sqrt((x^2)^2)

Now.. how about quaternions...