Gerhard Niklasch on Sat, 29 Aug 1998 10:35:50 +0200 (MET DST)


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

Re: bug of deriv


In response to
> Message-Id: <19980829165829F.ohgisi@payila.dj.kit.ac.jp>
> Date: Sat, 29 Aug 1998 16:58:29 +0900 (JST)
> From: Kiyoshi Ohgishi <ohgisi@payila.dj.kit.ac.jp>

> I found that the function "deriv" doesn't work as I expected.
[...]
> ? deriv(x*y,y)
> %1 = 0

The following patch should cure the problem.  (ATTN Karim: it should
also apply cleanly to your pre-2.0.12 snapshot.)

Thanks for discovering this,
Gerhard


bash$ diff -u src/basemath/gen3.c.orig src/basemath/gen3.c
--- src/basemath/gen3.c.orig	Sat Aug 29 10:28:48 1998
+++ src/basemath/gen3.c	Sat Aug 29 10:29:16 1998
@@ -1245,15 +1245,15 @@
       {
         y = cgetg(lx+1,t_POL);
         for (i=2; i<=lx; i++) y[i] = lderiv((GEN)x[i],v);
-        v = vx;
+	y[1] = evallgef(lx+1) | evalvarn(vx);
       }
       else
       {
         if (lx<3) return gzero;
         y = cgetg(lx,t_POL);
         for (i=2; i<lx ; i++) y[i] = lmulsg(i-1,(GEN)x[i+1]);
+	y[1] = evallgef(lx) | evalvarn(v);
       }
-      y[1] = evallgef(lx) | evalvarn(v);
       return normalizepol(y);
 
     case t_SER: