Bill Allombert on Mon, 04 Nov 2013 12:01:27 +0100

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

Re: qfr.disc?

On Mon, Nov 04, 2013 at 02:50:20AM -0500, Charles Greathouse wrote:
> 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?

disc was renamed to poldisc in PARI 1.99. Maybe it was an historical mistake.

We could also allow norm(q)=Vec(q)[1].

> 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.

"non-vector types" ?

? 1.disc
  *** _.disc: incorrect type in disc (t_INT).
? x.disc
  *** _.disc: incorrect type in disc (t_POL).

The issue is that member functions are not supposed to do computations but instead
to return components from the object.

But more to the point, the types t_QFI, t_QFR and t_QUAD are more or less