Let's consider the following function I've already mentioned in my previous question:
rot[i](f) := sum(sum(sum(sum(
G[r,i]*G[q,j]*W[i,j,k]*('diff(f[k], y[q]) + sum(K[k,q,m]*f[m], m, 1, N)),
r, 1, N),
j, 1, N),
k, 1, N),
q, 1, N) $
It kind of works in general, but what if original expression f already contains symbols r, j, and so on? In this case it doesn't do the right thing. The only solution I've found so far is to use some unique prefix for these symbols or at least start their names with underscores: r → __r, j → __j. But I hope there should be a more idiomatic solution. Is there anything?
Unfortunately, in Maxima all symbols are effectively global -- the
xin some expression is the same symbol as thexinf(x) := .... So there is no general way to ensure that function arguments are distinguished from other symbols of the same name. Some functions attempt to make their arguments local, e.g.,sumtreats the index variable specially, butintegratedoes not.I made an attempt to make a lexical block construct which would make it possible to distinguish symbols of the same name. It is called
blexand I think a web search should find it, if not, let me know and I'll post a link.