(rat)coeff question / some bugs?



On 7 Feb 2003, Wolfgang Jenkner wrote:

> Martin RUBEY <rubey@labri.fr> writes:
> 
> > I think that it is a bad idea that (rat)coeff returns zero, if it can't 
> > make the coefficient explicit, it should rather return 'ratcoeff...:
> > 
> > (C1) ratcoeff((1+x)^k,x,2);
> > 
> > (D1) 				       0
> > (C2) ratcoeff(x^k,x,2);
> > 
> > (D2) 				       0
> 
> But it does make the coefficient explicit (in the CRE representation
> (1+x)^k is just a polynomial in the indeterminate (1+x)^k, but you
> know that).  IMHO the behaviour is perfectly consistent.

well, consistent to what? I think the behaviour is odd.

> You could use POWERSERIES and dig out the coefficients with PART or
> something.

Great idea, thanks (taylor doesn't work for (poly)^k for symbolic k, 
powerseries does)

Some bugs (with questionmark):

1. Powerseries doesn't seem to remove its facts:

(I think this is well discussed that we need to think about keeping /
removing facts generated by programs. However, in this instance, there is 
no user interaction...)

GCL (GNU Common Lisp)  Version(2.5.0) Sun Nov 17 15:58:09 CET 2002
Licensed under GNU Library General Public License
Contains Enhancements by W. Schelter
Maxima 5.9.0rc3 http://maxima.sourceforge.net
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function bug_report()
provides bug reporting information.
(C1) powerseries((1+x)^k,x,0);

                        INF
                        ====              I1
                        \                x
                         >     ------------------------
                        /      BETA(k - I1 + 1, I1 + 1)
                        ====
                        I1 = 0
(D1)                    -------------------------------
                                     k + 1
(C2) facts();

(D2)                          [KIND(I1, INTEGER)]

2. 

(C3)  prederror:false;

(D3)                                 FALSE
(C4)  if (a>0) then c else d;

(D4)                       IF UNKNOWN THEN C ELSE d

while it would be a LOT more useful if it returned

                           if (a>0) then c else d

3. 

declare(f,linear) does not work if f is a function:

(C1) declare(f,linear);

(D1)                                 DONE
(C2) f(x+y,x);

(D2)                          f(1, x) y + f(x, x)
(C3) f(e,x):=g(e,x);

(D3)                          f(e, x) := g(e, x)
(C4) f(x+y,x);

(D4)                              g(y + x, x)
(C5) declare(f,linear);

(D5)                                 DONE
(C6) f(x+y,x);

(D6)                              g(y + x, x)

4. Question:

Why doesn't linearity extend to f(sum(e,i,a,b)) ?


Martin