Well said Andrew!

There’s a second twist : last I checked our abs for complex numbers isn’t the Euclidean norm or any Lp norm ..

We could define the Pth power of the lpNorm for any complex a I think.  Though that’s a weaker operation.  

On Tue, Jan 28, 2020 at 7:11 AM Andrew Lelechenko <andrew.lelechenko@gmail.com> wrote:
On Tue, 28 Jan 2020, Dannyu NDos wrote:

> `abs` represents a norm, but its type is wrong

There are two useful meanings of `abs`, which coincide for integers. One is a norm. Another one is to define `abs` as a mapping from a ring R to a factor ring R / U(R), where U(R) is a ring of units, and `signum` as a mapping from R to U(R) such that `abs a * signum a = a`.

> This enables us to implement rings (Num) and fields (Fractional) without
> concerning about norms. For example, Gaussian integers.

For Gaussian integers I find convenient to define `signum z` with a codomain {1, i, -1, -I} (basically, to which quadrant does z belong?) and `abs z` with the first quadrant as a codomain.

Best regards,
Andrew

_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries