Karim BELABAS on Thu, 2 Mar 2000 19:04:50 +0100 (MET)


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

Re: bug in gsincos?


> ? sin(x+x*y)
> [ result ok ]
> ? sin(x+y)
>   ***   incorrect type in gsincos.
> 
> I think the latter result is a bug.  Do not we allow power series with
> coefficients being power series?

The general workhorse for transcendental functions (in charge of adjusting
the "non-transcendental" arguments), assumes the prototype is f(x, prec).

This didn't apply to gsincos (which computes sine and cosine simultaneously),
so the initial adjustment was skipped. That was not always a good idea....

   Karim.

P/S: CVS archive updated.

Index: src/basemath/trans1.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/trans1.c,v
retrieving revision 1.14
diff -c -r1.14 trans1.c
*** src/basemath/trans1.c	2000/02/15 17:09:11	1.14
--- src/basemath/trans1.c	2000/03/02 17:57:10
***************
*** 1571,1576 ****
--- 1571,1590 ----
  	}
        }
        return;
+     /* transc doesn't work for this prototype */
+     case t_QUAD:
+       av = avma; p1=gmul(x,realun(prec)); tetpil = avma;
+       gsincos(p1,s,c,prec);
+       gptr[0]=s; gptr[1]=c;
+       gerepilemanysp(av,tetpil,gptr,2);
+       return;
+ 
+     case t_POL: case t_RFRAC: case t_RFRACN:
+       av = avma; p1=tayl(x,gvar(x),precdl); tetpil=avma;
+       gsincos(p1,s,c,prec);
+       gptr[0]=s; gptr[1]=c;
+       gerepilemanysp(av,tetpil,gptr,2);
+       return;
    }
    err(typeer,"gsincos");
  }
__
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/