Remix.run Logo
reikonomusha 2 days ago

EML can represent the real absolute value, so long as we agree with the original author's proviso that we define log(0) and exp(-∞), by way of sqrt(x^2) as f(x) = exp((1/2)log x). Traditionally, log(0) isn't defined, but the original author stipulated it to be -∞, and that all arithmetic works over the "extended reals", which makes

    abs(0)
    = f(0)            ; by defn
    = exp(1/2 log 0)  ; by defn
    = exp(-∞/2)       ; log 0 rule
    = exp(-∞)         ; extended real arith
    = 0               ; exp(-∞) rule
If we don't agree with this, then abs() could be defined with a hole punched out of the real line. The logarithm function isn't exactly elegant in this regard with its domain restrictions. :)
throwaway81523 a day ago | parent [-]

It's ok for elementary functions to have singularities, like 1/x at x=0. But I'm not sure what happens with your version of abs, since the log function has branches. log(1) is any of 0, 2*pi*i, 4*pi*i, etc.