Karim Belabas on Mon, 29 Jul 2019 23:49:58 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: real/imag for t_QUAD |
* Vincent Delecroix [2019-07-29 23:32]: > 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. Hi Vincent, (23:45) gp > ??real real(x): [...] In the case where x is a quadratic number, this is the coefficient of 1 in the "canonical" integral basis (1,omega). (23:45) gp > ??imag imag(x): [...] When x is a quadratic number, this is the coefficient of omega in the "canonical" integral basis (1,omega). This is an old design bug, can't change it now. :-( What you expected can be obtained by wC = w1 * 1. then real(wC) / imag(wC). Cheers, K.B. -- Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 Universite de Bordeaux Fax: (+33) (0)5 40 00 21 23 351, cours de la Liberation http://www.math.u-bordeaux.fr/~kbelabas/ F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP] `