Karim Belabas on Fri, 06 Nov 2015 16:44:08 +0100


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

Re: real polynomials


* John Cremona [2015-11-06 15:46]:
> I am so embarrassed at having such trivially elementary questions, so
> let me first say that I do not ask on the list until spending at least
> an hour experimenting and reading the library reference manual.
> 
> If I have a rational polynomial f created by
> 
> GEN f = mkpoln(ncoeffs,g0,g1,g2,g3,g4);
> 
> where the g0, ..., g4 are rationals, and then I do
> 
> GEN fdash = derivpol(f);
> GEN g = ggcd(f,fdash);
> 
> I get a run-time error:
> 
>   ***   incorrect type in Q_divi_to_int (t_FRAC).
> 
> which I do not understand.  Obstacles to debugging include (1) not
> knowing how to output a GEN;  (2) asking for the type (or "typ") of a
> GEN gives a number (both the above have type 10) when I was expecting
> t_POL or similar.

You might be interested in

  http://pari.math.u-bordeaux1.fr/Events/PARI2013/talks/sources.pdf

(p. 7 in particular).

You could e.g. add the following to ~/.gdbinit

define gi
  call output((GEN)$arg0)
end

define gt
  call output(type0((GEN)$arg0))
end



Then, under gdb, we see:

(gdb) gt gen_0
"t_INT"

(gdb) gi gen_0
0

[...]
> Clearly I should not have given up so easily the first time I tried
> programming with the pari library which was some time in the
> mid-1990s....

Just ask here :-)  (and maybe check out gp2c as well).


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 69 50
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`