Kevin Ryde on Sun, 20 Sep 2015 13:58:45 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

discriminant of quad


On reading most of the docs I couldn't tell the best way to get back the
discriminant of a t_QUAD.

The closest I found was charpoly() after some dividing.  In the code I
see poldisc(w) does it for complex and quad, or w.disc member func for
quad.  Are they meant for use that way?

I struck this when using some sqrt3i=quadgen(-12) complex numbers and
had the urge to pick out the imaginary part inclusive of its quad factor
sqrt3=quadgen(12), so for example my_imag(123+456*sqrt3i) == 456*sqrt3.
Perhaps there's a direct imag() variant like that.  Of course knowing
I'm sqrt3 everywhere it could be hard coded but a little generality is
nice.