Ilya Zakharevich on Tue, 2 Jul 2002 06:57:06 -0400


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

Re: polcoeff() mystery


On Mon, Jul 01, 2002 at 07:49:27PM +0200, Karim BELABAS wrote:
> > As one can see, z and temp have the same value,
> 
> No. They evaluate to the same printed output.
> 
> > but the results of c() are different!  Moreover, x and temp give the same \x
> 
> They don't. The history objects obtained from x and temp give the same \x.
> 
> But, assuming factory settings, the history result is obtained after
> simplify() has been applied to the result of the command evaluation.

>   ? install(voir, "vGD,-1,L,")  \\ library routine underlying \x
>   ? voir(temp)
> [&=00a5d58c] POL(lg=3,CLONE):15000003  (+,varn=9,lgef=3):40090003  00a5d5ac
>   coef of degree 0 = [&=00a5d5ac] POL(lg=4):14000004 (+,varn=10,lgef=4):400a0004  00a5d5a4  00a5d598
>     coef of degree 0 = [&=00a5d5a4] INT(lg=2):02000002  (0,lgef=2):00000002
>     coef of degree 1 = [&=00a5d598] INT(lg=3):02000003  (+,lgef=3):40000003 00000001

> Type coercion is nearly inexistent in PARI, you have to force it with
> simplify().

What the time coercion has to do with simplify()???  Why is not it
documented that polcoeff() uses a very pessimized algorithm and *does
not* return what I asked it to do?

? x^2+y*x+z
%1 = x^2 + y*x + z
? \x
[&=00485374] POL(lg=5,CLONE):15000005  (+,varn=0,lgef=5):40000005  00485388  004853ac  004853d0  
  coef of degree 0 = [&=00485388] POL(lg=4):14000004  (+,varn=2,lgef=4):40020004  00485398  004853a0  
    coef of degree 0 = [&=00485398] INT(lg=2):02000002  (0,lgef=2):00000002  
    coef of degree 1 = [&=004853a0] INT(lg=3):02000003  (+,lgef=3):40000003  00000001  
  coef of degree 1 = [&=004853ac] POL(lg=4):14000004  (+,varn=1,lgef=4):40010004  004853bc  004853c4  
    coef of degree 0 = [&=004853bc] INT(lg=2):02000002  (0,lgef=2):00000002  
    coef of degree 1 = [&=004853c4] INT(lg=3):02000003  (+,lgef=3):40000003  00000001  
  coef of degree 2 = [&=004853d0] INT(lg=3):02000003  (+,lgef=3):40000003  00000001  

So when I ask for coef of degree 0, I would expect to get

  coef of degree 0 = [&=00485388] POL(lg=4):14000004  (+,varn=2,lgef=4):40020004  00485398  004853a0  
    coef of degree 0 = [&=00485398] INT(lg=2):02000002  (0,lgef=2):00000002  
    coef of degree 1 = [&=004853a0] INT(lg=3):02000003  (+,lgef=3):40000003  00000001  

...

What other PARI functions return "unsimplified" results?

Ilya