-----Robert Dodie wrote: -----
>i.e. renaming the summation index to avoid a name
>collision, causes problems 26 and 27 to yield the expected
>results.
Might be useful:
(%i3) load("makedummy")$
(%i4) makedummy(x,x + xo + xoo);
(%o4) xooo
(%i5) makedummy(i, sum(f(i),i,io,ioo));
(%o5) iooo
Barton
;; Author: Barton Willis
;; University of Nebraska at Kearney
;; Copyright (C) 2006, Barton Willis
;; This is free software; you can redistribute it and/or modify it under
;; the terms of the GNU General Public License,
;; http://www.gnu.org/copyleft/gpl.html.
;; This software has NO WARRANTY, not even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(defmspec $makedummy (x)
(setq x (margs x))
(let (($listconstvars nil) ($listdummyvars t) (dummy (first x)))
(if (not (symbolp dummy)) (merror "The first argument to 'makedummy'
must be a symbol"))
(setq x (mapcan #'(lambda (s) (margs ($listofvars s))) (rest x)))
(setq x (append x (mapcar #'meval-atoms x))) ;; let's be really sure
it's a dummy variable.
(while (or (member dummy x :test #'eq) ($member dummy $values)
($constantp dummy))
(setq dummy ($concat dummy '$o)))
dummy))