The rework of the function i-$dependencies because of a bug report has
broken the capability of the function depends to handle a subscripted
variable.
Therefore, Victor has committed a function i-$dependencies in
itensor.lisp to overload the in-core function. The time I have done the
work on i-$dependencies it was not my aim to restrict the functionality
of depends. I have overseen this possibility to use the function
depends.
I think we should correct the in-core function i-$dependencies to allow
subscripted variables too. I have marked the additional line in the
following code:
(defun i-$dependencies (l &aux res)
(dolist (z l)
(cond
((atom z)
(merror
(intl:gettext
"depends: argument must be a non-atomic expression; found
~M") z))
((or (eq (caar z) 'mqapply)
(member 'array (cdar z) :test #'eq))
(merror
(intl:gettext
"depends: argument cannot be a subscripted expression; found
~M") z))
(t
(do ((zz z (cdr zz))
(y nil))
((null zz)
(mputprop (caar z) (setq y (reverse y)) 'depends)
(setq res (push (cons (ncons (caar z)) y) res))
(unless (cdr $dependencies)
(setq $dependencies (copy-list '((mlist simp)))))
(add2lnc (cons (cons (caar z) nil) y) $dependencies))
(cond ((not (or (symbolp (cadr zz))
---> ;; Allow subscripted variables too.
---> (member 'array (caadr zz))))
(merror
(intl:gettext "depends: argument must be a symbol;
found ~M")
(cadr zz)))
((and (cadr zz)
(not (member (cadr zz) y)))
(setq y (push (cadr zz) y))))))))
(cons '(mlist simp) (reverse res)))
With this correction to the routine i-$dependencies we get
(%i2) depends(f,x[1])$
(%i3) depends(x,y[a,b])$
(%i4) dependencies;
(%o4) [f(x[1]),x(y[a,b])]
(%i5) diff(f,x[1]);
(%o5) 'diff(f,x[1],1)
(%i6) diff(f,y[a,b]);
(%o6) 'diff(x[1],y[a,b],1)*'diff(f,x[1],1)
Is this the expected behavior for the package itensor?
Dieter Kaiser