Comment

Comment by palotasb

> abs(x) = x*sign(x)

True in 1 dimension, but not in higher dimensions, because, as you say:

> how would you define sign(x) in a higher dimension?

abs(x) is generally defined as distance of x from zero.

The fact that sqrt(x^2) or x*sign(x) happen to give the same result in 1 dimension doesn't necessarily imply that they can be applied in higher dimensions as-is to result in abs(x) with the same meaning. Although sqrt(x^2) is close, but the way to generalize it is sqrt(sum(x[i]^2)).

parent palotasb 2 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton