Karim BELABAS on Fri, 26 Oct 2001 12:34:04 +0200 (MEST)


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

Re: pari-2.2.1.alpha released


On Thu, 18 Oct 2001, Ilya Zakharevich wrote:
> On Thu, Oct 18, 2001 at 05:59:03PM +0200, Karim BELABAS wrote:
> >   * subst(P, x^n, y) now works [it's not possible to substitute arbitrary
> >   algebraic expressions, only monic monomials].
>
> Is it desirable to do The Right Thing?  make
>
>   subst(P, Q, y)
>
> a shortcut for
>
>   { subst_poly(pol, from, to) =
>     local(t);
>     subst(lift(Mod(pol,from-'t)),'t,to)
>   }

Sure. Just wanted to know first whether the modification had adverse effects
or not: in particular, the prototype used to be 'GnG' [expecting a variable
number as 2nd argument] and is now 'GGG' [can be anything; it's up to gsubst0
to check it].

> if the existing algorithms cannot do it (only taking into account the
> ordering of variables, so lift will always work w.r.t. 't).

They can't do it for the time being. In fact, they really implement the
change

  subst(P, x, x^(1/n))  [when it makes sense]

and not

  subst(P, x^n, x)  [which would always make sense]

(12:28) gp > subst_poly(x^3,x^2,t)
%1 = t*x
(12:29) gp > subst(x^3,x^2,t)
  ***   impossible substitution in gdeflate.

Of course your solution uses the second model, and is much more general.
It is also slower.

(12:31) gp > for (i=1,10000,subst_poly(x^10+x^6+x^4, x^2, y))
time = 1,400 ms.
(12:31) gp > for (i=1,10000,subst(x^10+x^6+x^4, x^2, y))
time = 570 ms.

Anyway, it probably makes sense to do The Right Thing ...

> [ BTW, why do I need to put ticks on t? ]

Because local(t) initializes t = 0, hence subst_poly without ticks would expand
to
  subst(lift(Mod(pol,from)), 0, to)

You probably want to use

  local (t = 't)

and remove the ticks.

> Why I cannot lift(...,'t)? ]

Not sure I understand this.

Cheers,

    Karim.
-- 
Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
--
PARI/GP Home Page: http://www.parigp-home.de/