Karim Belabas on Thu, 27 Jul 2006 13:14:43 +0200


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

Re: divisors/factor problem in 2.4.0 (development CHANGES-1.1570)


* Phil Carmody [2006-07-27 09:17]:
> In some contexts, divisors(3)=[1], and factor(3)=[;] alas.
> Not had time to check other versions or anything.
> Once you have a value that refuses to factor, it 'infects' all other values it
> touches (so factor(round(broken*210.0))=[;] too).
> 
> Divisors() not including the constant factors I can live with, but being unable
> to put them back manually is shall we say more of an inconvenience.
> 
> 
> bash-3.1$ gp
>          GP/PARI CALCULATOR Version 2.4.0 (development CHANGES-1.1570)
>            i686 running linux (ix86/GMP-4.1.4 kernel) 32-bit version
>     compiled: Jul 22 2006, gcc-4.1.2 20060613 (prerelease) (Debian 4.1.1-5)
>                  (readline v5.1 enabled, extended help enabled)
> ...
> parisize = 4000000, primelimit = 500000
> ? pdiv
> %60 = [1, x, x^2, x^3]
> ? poly=3*x^3
> %61 = 3*x^3
> ? pdiv=divisors(poly)
> %62 = [1, x, x^2, x^3]
> ? const=poly/pdiv[length(pdiv)]
> %63 = 3
> ? cdiv=divisors(const)
> %64 = [1]
> ? factor(const)
> %65 = [;]

1) Try factor(%63). 'const' is a t_POL, whereas %63 has been simplified
to integerhood. See

  http://www.math.u-bordeaux.fr/~belabas/pari/doc/faq.html#gpsimplify

2) It is indeed inconsistant that factor() throws away the 'unit' part
for t_POL inputs, but not for t_INTs or Gaussian integers
( compare factor(-3), factor(-3*x), and factor(3*I) ).
It is not clear how the interface can be changed so as to remain usable
and break a minimal amount of scripts.

The trivial change would return [ C, F ]  (content + current factorization),
such that C * factorback(F) = input in all cases, but this would break 100%
of current scripts. Presumably a new function name would be needed.

  factorcomplete ?

(not that elegant...)

Cheers,

    K.B.
-- 
Karim Belabas                  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]