Charles Greathouse on Mon, 04 Nov 2013 08:51:05 +0100

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


I recently had a script with some t_QFR objects and wanted to take their discriminants. At the time I just did [a,b,c]=Vec(q); b^2-4*a*c but now I see that the inaptly-named poldisc() handles them. I wonder if it would make sense to allow q.disc directly?

As it stands poldisc() handles not only polynomials but most other types, while the member function .disc already handles t_QUAD and other non-vector types.

If this change is advisable*, here is the (brief) change to language/members.c:

member_disc(GEN x) /* discriminant */
  long t; GEN y = get_nf(x,&t);
  if (y) return nf_get_disc(y);
    case typ_Q  : return quad_disc(x);
    case typ_ELL: return ell_get_disc(x);
    default     : return poldisc0(x);

* This seems to fit the PARI philosophy as I understand it:
The basic principles which govern PARI is that operations and functions should, firstly, give
as exact a result as possible, and secondly, be permitted if they make any kind of sense.

Charles Greathouse
Case Western Reserve University