I think the problem is that the components command you issued in your
example in line (%i14), which is needed there, also has an unwanted side
effect in (%o17). If you remove the components definition of x and
re-express the final result, it'll work as expected.
To elaborate a little more, if x is not a coordinate, just an arbitrary
vector that you wish to differentiate the inner product of, this is how you
might want to do it:
(%i1) load(itensor);
(%o1) /usr/share/maxima/5.21.0/share/tensor/itensor.lisp
(%i2) imetric(g);
(%o2) done
(%i3) ishow(contract(diff(x([],[j])*g([i,j],[])*x([],[i]),x([],[k]))))$
(%t3) 2 x
k
If x is a coordinate, then I think what you did first is the technically
correct approach as it would guarantee that the metric also gets
differentiated if necessary. Of course you explicitly declared the metric
constant, which is fine:
(%i4) coord(x);
(%o4) done
(%i5) declare(g,constant);
(%o5) done
(%i6) ishow(contract(idiff(x([],[j])*g([i,j],[])*x([],[i]),k)))$
(%t6) 2 x
k
Yes, you could achieve the same thing using the contraction operator |.
However, in this case as you observed, you need to specify the components of
the covariant vector x in terms of its contravariant counterpart and the
metric:
(%i7) components(x([j],[]),g([i,j],[])*x([],[i]));
(%o7) done
(%i8) ishow(rename(contract(idiff(x([i],[])*x([],[i]),k))))$
%1
(%t8) 2 x g
%1 k
So why did itensor not contract the result? That's because of the components
command, which tells it to express the covariant form of x in terms of the
contravariant form and the metric! This would be the case even if you just
typed in x_k by hand:
(%i9) ishow(x([k]))$
%2
(%t9) x g
%2 k
So we need to REMOVE the components definition to get the result in the
desired form:
(%i10) remcomps(x);
(%o10) done
(%i11) ishow(contract(%t8))$
(%t11) 2 x
k
I hope this helps.
Viktor
-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of Niitsuma Hirotaka
Sent: Thursday, July 29, 2010 10:50 PM
To: maxima at math.utexas.edu
Subject: diff(innerproduct(x,x),x) =2x in itensor
I try to get result
diff(innerproduct(x,x),x) = 2x
using itensor
The following definition works
---------------
(%i1) load(itensor)$
(%i2) coord(x)$
(%i6) imetric(g)$
(%i9) declare(g,constant)$
(%i10) ishow(idiff( x([],[j])*g([i,j],[])*x([],[i]), k))$
i j j i
(%t10) x g kdelta + x g kdelta
i j k i j k
(%o10) x([], [i]) g([i, j], []) kdelta([k], [j])
+ x([], [j]) g([i, j], []) kdelta([k],
[i])
(%i11) ishow(contract(%));
(%t11) 2 x
k
(%o11) 2 x([k], [])
---------------
But,
---------------
(%i12) ishow(idiff( x([i])|x,k));
(%i13) ishow(contract(%));
%1
(%t13) x + x x
k %1,k
(%o13) x([k], []) + x([], [%1]) x([%1], [], k)
---------------
And
----------------
(%i14) components(x([j],[]),g([i,j],[])*x([],[i]));
(%i15) ishow(idiff( x([i],[])*x([],[i]), k));
(%i17) ishow(contract(rename(expand(%))));
%2
(%t17) 2 x g
%2 k
(%o17) 2 x([], [%2]) g([%2, k], [])
---------------
2x^i g_{ik} maybe also collect, but not equal 1st result.
I think this is not right way dealing inner-product.
But I can not find appropriate example in demo(tensor) and manual.
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima