argument and abs return type for complex numbers

0 views
Skip to first unread message

Grégory Vanuxem

unread,
5:34 PM (5 hours ago) 5:34 PM
to fricas...@googlegroups.com
Hello,

Any idea why abs(complex(a,b)) return a complex type whereas argument not:

(74) -> abs complex(2.3,3.2)

   (74)  3.9408120990_476062027
                                        Type: Complex(Float)
(75) -> argument complex(2.3,3.2)

   (75)  0.9475969968_6083068824
                                                 Type: Float


Grégory Vanuxem

unread,
5:37 PM (5 hours ago) 5:37 PM
to fricas...@googlegroups.com
To explain, I am unable to overload abs in a descendant domain of the ComplexCategory. It always returns a Complex type and I would like by default a real type.

Waldek Hebisch

unread,
9:18 PM (1 hour ago) 9:18 PM
to fricas...@googlegroups.com
One possible guess is that 'abs' was defined in that way to have
similar signature as in Expression(Complex(INT)). But it is not
clear to me if there is any good reason. Defining 'abs' in
ComplexCategory with signature:

abs : % -> R

requires changes to algebra, but after changes apparently there
is no problem. And changes mostly are simplificantion.

Attached a patch

--
Waldek Hebisch
sum6a1.diff
Reply all
Reply to author
Forward
0 new messages