Gerhard Niklasch on Thu, 10 Sep 1998 00:28:32 +0200 (MET DST)

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

Re: Another bug?

In response to
> Message-Id: <>
> Date: Wed, 9 Sep 1998 18:16:18 -0400
> From: Igor Schein <>
> Hi, 
> ? factor(250*x-54*x^7)
> [3*x^2 - 5 1]
> [x 1]
> [9*x^4 + 15*x^2 + 25 1]

Look closely at the leading coefficients...  factorback() is correct.

> Where is the scalar gone?

Factorization of polynomials implicitly works over the _field_ of
coefficients, not over the _ring_ they generate, and throws the
content away.  Compute it and split it off explicitly if you need it.

One of the side effects of _not_ dragging explicit strong typing
around with every object... In a system like Magma, polynomials would
always `know' exactly to which ring they belong.  PARI's polynomials
don't;  there's no difference in the internal representation between
f = 250*x-54*x^7 considered as an element of Z[X], or of Q[X], or even
of Q(sqrt(15))[x] for that matter  (factornf will happily accept a
polynomial with coefficients in Q to be factored) -- although  f  has
different factorizations in each of the three cases.  factor() defaults
to Q[x] if the coefficients can be regarded as elements of Q.

See ??factor or The Fine Manual for an example and some further
explanation. :)

Cheers, Gerhard