Bill Allombert on Fri, 30 Jan 2004 19:38:38 +0100


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

Re: Preparing PARI 2.3


On Wed, Jan 28, 2004 at 02:06:35AM +0100, Bill Allombert wrote:
> --- Add substpol() and reinstate old subst behaviour.

Here a patch that do just that.

Cheers,
Bill.
Index: doc/usersch3.tex
===================================================================
RCS file: /home/cvs/pari/doc/usersch3.tex,v
retrieving revision 1.295
diff -u -r1.295 usersch3.tex
--- doc/usersch3.tex	28 Jan 2004 17:11:00 -0000	1.295
+++ doc/usersch3.tex	30 Jan 2004 18:05:34 -0000
@@ -5822,8 +5822,15 @@
 \noindent If $x$ is a power series, $z$ must be either a polynomial, a power
 series, or a rational function.
 
-The ``variable'' $y$ is in fact allowed to be any polynomial, in which case,
-the substitution is done as per the following script:
+\syn{gsubst}{x,y,z}, where $y$ is the variable number.
+
+\subsecidx{substpol}$(x,y,z)$:
+replace the ``variable'' $y$ by the argument $z$ in the ``polynomial''
+expression $x$. Every type is allowed for $x$, but the same behavior
+as \kbd{subst} above apply.
+
+The difference with \kbd{subst} is that $y$ is allowed to be any polynomial
+here. The substitution is done as per the following script:
 \bprog
    subst_poly(pol, from, to) =
    { local(t = 'subst_poly_t, M = from - t);
@@ -5833,17 +5840,15 @@
 @eprog
 \noindent For instance
 \bprog
-? subst(x^4 + x^2 + 1, x^2, y)
+? substpol(x^4 + x^2 + 1, x^2, y)
 %1 = y^2 + y + 1
-? subst(x^4 + x^2 + 1, x^3, y)
+? substpol(x^4 + x^2 + 1, x^3, y)
 %2 = x^2 + y*x + 1
-? subst(x^4 + x^2 + 1, (x+1)^2, y)
+? substpol(x^4 + x^2 + 1, (x+1)^2, y)
 %3 = (-4*y - 6)*x + (y^2 + 3*y - 3)
 @eprog
 
-\syn{gsubst}{x,v,z}, where $v$ is the number of the variable $y$ for regular
-usage. Also available is \tet{gsubst0}$(x,y,z)$ where $y$ is a \kbd{GEN}
-polynomial.
+\syn{gsubstpol}$(x,y,z)$.
 
 \subsecidx{taylor}$(x,y)$: Taylor expansion around $0$ of $x$ with respect
 to\label{se:taylor}
Index: src/basemath/gen3.c
===================================================================
RCS file: /home/cvs/pari/src/basemath/gen3.c,v
retrieving revision 1.116
diff -u -r1.116 gen3.c
--- src/basemath/gen3.c	28 Jan 2004 12:16:07 -0000	1.116
+++ src/basemath/gen3.c	30 Jan 2004 18:05:39 -0000
@@ -1358,7 +1358,7 @@
 }
 
 GEN
-gsubst0(GEN x, GEN T, GEN y)
+gsubstpol(GEN x, GEN T, GEN y)
 {
   pari_sp av;
   long d, v;
Index: src/functions/polynomials/subst
===================================================================
RCS file: /home/cvs/pari/src/functions/polynomials/subst,v
retrieving revision 1.1
diff -u -r1.1 subst
--- src/functions/polynomials/subst	26 Jun 2003 18:50:22 -0000	1.1
+++ src/functions/polynomials/subst	30 Jan 2004 18:05:41 -0000
@@ -1,7 +1,7 @@
 Function: subst
 Section: polynomials
-C-Name: gsubst0
-Prototype: GGG
+C-Name: gsubst
+Prototype: GnG
 Help: subst(x,y,z): in expression x, replace the variable y by the
  expression z
 
Index: src/headers/paridecl.h
===================================================================
RCS file: /home/cvs/pari/src/headers/paridecl.h,v
retrieving revision 1.306
diff -u -r1.306 paridecl.h
--- src/headers/paridecl.h	29 Jan 2004 16:36:05 -0000	1.306
+++ src/headers/paridecl.h	30 Jan 2004 18:05:45 -0000
@@ -1000,7 +1000,7 @@
 GEN     gshift(GEN x, long n);
 GEN     gshift3(GEN x, long n, long flag);
 GEN     gsubst(GEN x, long v, GEN y);
-GEN     gsubst0(GEN x, GEN v, GEN y);
+GEN     gsubstpol(GEN x, GEN v, GEN y);
 GEN	gsubst_expr(GEN pol, GEN from, GEN to);
 GEN     gtopoly(GEN x, long v);
 GEN     gtopolyrev(GEN x, long v);
--- /dev/null	Sat Mar  1 19:52:54 2003
+++ src/functions/polynomials/substpol	Fri Jan 30 18:54:34 2004
@@ -0,0 +1,7 @@
+Function: substpol
+Section: polynomials
+C-Name: gsubstpol
+Prototype: GGG
+Help: substpol(x,y,z): in expression x, replace the polynomial y by the
+ expression z, using remainder decomposition of x.
+