Vincent Delecroix on Tue, 30 Jul 2019 00:17:02 +0200


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

Re: real/imag for t_QUAD


Thanks Karim and Bill for your replies! I did not look further than
the simple '?real' and '?imag'.

Now, the real question: how can I convert a t_QUAD to a t_COMPLEX (in
the usual sense) with the pari library? greal/real_i and gimag/imag_i
have the same behavior as in GP.

Cheers
Vincent

Le 29/07/2019 à 23:52, Bill Allombert a écrit :
On Mon, Jul 29, 2019 at 11:29:50PM +0200, Vincent Delecroix wrote:
Bonjour,

I am confused by the behavior of the GP functions real and imag called
on quadratic numbers

? w1 = quadgen(-23);
? real(w1)
%10 = 0
? imag(w1)
%11 = 1

According to the (ambiguous?) documentation of these functions, the
return values are supposed to be the real and imaginary parts. I would
have expected an answer closer to 0.5 and and 2.3979. But perhaps my
notion of real and imaginary part is not up to date.

See ??t_QUAD:
Quadratic numbers (t_QUAD):
....
    Since  the  order is Z + wZ,  any other element can be input as z =
x+y*w for some integers x and y. In fact, you may work in its fraction
field Q(sqrt{d}) and use t_FRAC values for x and y.

    The member function z.disc retrieves the discriminant d; x and y are
obtained via real(z) and imag(z) respectively.

Cheers,
Bill.