On Mon, 13 Jan 2003, Richard Fateman wrote:
> >>You can try this, which is, I think, computationally pretty harmless
> >>except it will use up some symbol space until the next garbage
> >>collection:
> >
> > (defun fpolysum (e)
> > (let ((varlist nil) (genvar nil))
> > (let ((a (fpoly1 (setq e ($expand ($ratdisrep ($rat e *var*))))))
> >
> > and I get the right result for
> >
> > taylor(sum(M^K*sum(L^K,L,1,D),K,1,INF),M,0,2),simpsum;
> >
> > (I didn't run any tests...)
> >
> > Is this a bug fix?
>
> It enforces a correct correspondence between varlist and genvars.
> Somewhere else there is a bug which gets them out of synchrony.
OK, ho do I find the bug? I think we are close, I usually forget things if
I don't pursue them in time...
Is it possible to trace and watch genvar and varlist somehow? (that is,
each time either of them is changed, print the function name of the
function lisp is executing and the values of genvar and varlist)
> >>... what is returned from fpolysum is nil??
> It looked like the program always returned nil.
no, I believe that it returns the sum if it can compute it (which is
adsum'd then by combin.lisp/sum), if it can't, it returns 0 and adusum's
the exp. (or similar stuff)
> >>PS. it would be nice to know what is supposed to be done here. There
> >>are various other programs like $ratexpand that expand polynomials. Or
> >>is it not really a polynomial? RJF
>
> ratexpand produces an expanded version of a polynomial really fast. However,
> on things like quotients or non-poly forms, it doesn't do the same
> thing as expand. if what is needed here can be done by ratexpand, it
> would be faster.
fpolysum is currently only called by combin.lisp/sum, which checks whether
or not the (fpoly? expression *var*) is true. asum.lisp/fpoly? seems to
return true if and only if expression is a polynomial, so it following you
it should be safe to replace ($expand ($ratdisrep ($rat e *var*))) by a
$ratexpand equivalent. Could you tell me what this would be?
Martin
PS: thanks to
> In clmacs.lisp, you'll find a macro definition for "if"
> (eval-when (compile load eval)
> (defmacro if (test &rest args)
> (cond ((> (length args) 2)
> ;(format t
> ;"~%Warning: Too many args for if:~% ~a"
> ;(cons 'if (cons test args)))
> `(lisp::if ,test ,(car args) (progn ,@ (cdr args))))
> (t `(lisp:if ,test ,@ args))))
> Possibly, the apparent 4 argument "if" in hayat is non-bogus.
(it certainly isn't)
> Barton
we do understand the strange if in hayat...