Hi!
> You can try this, which is, I think, computationally pretty harmless
> except it will use up some symbol space until the next garbage
> collection:
> (let ((varlist nil)(genvar nil)(a (fpoly1 ....)) ... ??....)
Ok, I replaced
(defun fpolysum (e)
(let ((a (fpoly1 (setq e ($expand ($ratdisrep ($rat e *var*))))))
with
(defun fpolysum (e)
(let ((varlist nil) (genvar nil))
(let ((a (fpoly1 (setq e ($expand ($ratdisrep ($rat e *var*))))))
(which is probably what you meant)
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? I have the feeling that there is a bug hiding
somewhere. In particular, I do not understand why it MAY happen that
genvar contain rubbish. I may be overexact, but I would believe that
genvar should be cleaned up after use...
> ... what is returned from fpolysum is nil??
I do not understand this sentence. Please explain.
> 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
I do not understand this question either. Please explain. (sorry, I'm
afraid I'm being annoying)
Another question: In hayat.lisp I find
(defun tsprsum (f l type)
(if (mfree f tvars) (newsym f)
(let ((li (ncons (car l))) (hi (caddr l)) (lv (ncons (cadr l))) a aa
($maxtayorder () )) ;; needed to determine when terms
are 0
(if (and (numberp (car lv)) (numberp hi) (greaterp (car lv) hi))
(if (eq type '%SUM) (taylor2 0) (taylor2 1))
(if (eq type '%SUM) (setq type () ))
(do ((m (f* ([max-trunc]) (^ 2 $taylordepth))) (k 0 (f1+ k))
(ans ;(mlet li lv (taylor2 (meval f)))
(taylor2 (MAXIMA-SUBSTITUTE (car lv) (car li) f))))
((equal hi (car lv)) ans)
(rplaca lv (m1+ (car lv)))
;; A cheap heuristic to catch infinite recursion when
;; possible, should be improved in the future
(if (> k m) (exp-pt-err)
(setq a ;(mlet li lv (taylor2 (setq aa (meval f))))
(taylor2 (MAXIMA-SUBSTITUTE (car lv) (car li)
f))))
(if type
(if (and (1p (car a)) (1p (cdr a)) (not (1p aa)))
(return ans)
(setq ans (pstimes a ans)))
(if (and (rczerop a) (not (signp e aa)))
(return ans)
(setq ans (psplus ans a)))))))))
I do not understand the very first "if" statement, it seems to have 4
arguments:
(and (numberp ... ... hi))
(if (eq type '%SUM) (taylor2 0) (taylor2 1))
(if (eq type '%SUM) (setq type () ))
(do ... )
???
Did I miss something?