logoalt Hacker News

traeslast Wednesday at 7:25 AM2 repliesview on HN

abs(x) = sqrt(x*x), no?


Replies

throwaway81523last Wednesday at 8:40 AM

I think the issue might be the branch cut in the sqrt function. Per the wiki article, elementary functions have to be differentiable in the complex plane at all but a finite number of points.

gus_massalast Wednesday at 2:55 PM

The origianl article use complex numbers, in particular to get sin and cos from eml:

> e^{iφ} = cosφ + i sin φ

So x may be a complex number and sqrt(x*x) is a complex number that sometimes is equal to x and sometimes to -x depending on how lucky you were selecting the branches of sqrt.