I don't think there are any errors in what you're doing. It has to do with
how Maxima treats (or doesn't treat) differentiation with respect to a
function (as opposed to a symbol) and how that changes when certain packages
are loaded. Consider the following example:
diff(y,x);
diff(f(x),f(x));
diff(f(y),f(x));
depends(y,x)$
diff(y,x);
diff(f(x),f(x));
diff(f(y),f(x));
The outputs are 0, 1, 0, dy/dx, 1, df(y)/df(x), which makes sense. Now load
pdiff and repeat the above. You get 0, 1, 0, dy/dx, 1, 0. This is probably
not correct.
Now (in a clean session) load itensor, and repeat the above. You get 0, 1,
df(y)/df(x), 0, 1, df(y)/df(x). This is important: in itensor, indexed
objects (i.e., tensors) look like functions, and the derivative of an
indexed object with respect to the same indexed object will not be zero just
because the indices differ! E.g., diff(X([i],[]),X([j],[])) is not 0 but a
Kronecker-delta. For this reason, itensor actually redefines diff, to ensure
that the diff of a function with respect to the same function (with
different arguments) is not automatically simplified to zero. Since in
standard Maxima, you aren't supposed to be differentiating with respect to a
function in the first place, this is not likely to cause too many problems.
However, this behavior seems to be incompatible with what pdiff is doing. If
you load both packages and rerun the above script, you again get 0, 1,
df(y)/df(x), 0, 1, 0.
I suspect that this is closely related to, if it's not the actual cause of
the problem you are experiencing. Curiously, correct behavior is restored if
we make the indices used in the tensor being differentiated depend on
something (not necessarily on any particular symbol that appears in the
independent variable). For instance, try
load(itensor);
load(pdiff);
diff(f(X([i],[])),X([j],[]));
depends(i,XXX);
diff(f(X([i],[])),X([j],[]));
So I definitely think there's a bug (or two) lurking in here, I'm not sure
if it's in pdiff or itensor or both. I suspect pdiff (because of the first
example above) but I may be wrong.
Viktor
-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of Derek Thomas
Sent: Tuesday, April 19, 2011 9:31 PM
To: maxima at math.utexas.edu
Subject: Using pdiff and itensor together
I'm trying to use pdiff with itensor and I've observed some strange
behavior. If I try to differentiate a function of a tensor where the
argument and the differential have the same index, pdiff perfoms as
expected:
load(pdiff);
load(itensor);
diff(f(X([i],[])),X([i],[]));
output> 'kdelta([i],[i])*pderivop(f,1)(X([i],[]))
If the indices are different, then this is what I get:
diff(f(X([i],[])),X([j],[]));
output> 'diff(f(X([i],[])),X([j],[]),1)
Any help in resolving my errors or the inconsistent behavior would be
greatly appreciated. Thanks,
Derek
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima