[Maxima] itensor & components
Viktor T. Toth
vttoth at vttoth.com
Tue Jun 16 11:13:16 CDT 2009
Guenhael,
No, you cannot assign a matrix of matrices to a rank-4 tensor using components(). The matrix form of components() is strictly for rank-2 tensors. However, you can accomplish what you want (if I understood your problem correctly) by defining the tensor using a functional form:
(%i1) load(itensor);
(%o1) /usr/share/maxima/5.15.0/share/tensor/itensor.lisp
(%i2) x:matrix([x1,x2],[x3,x4]);
[ x1 x2 ]
(%o2) [ ]
[ x3 x4 ]
(%i3) y:matrix([x,x],[x,x]);
[ [ x1 x2 ] [ x1 x2 ] ]
[ [ ] [ ] ]
[ [ x3 x4 ] [ x3 x4 ] ]
(%o3) [ ]
[ [ x1 x2 ] [ x1 x2 ] ]
[ [ ] [ ] ]
[ [ x3 x4 ] [ x3 x4 ] ]
(%i4) T(l1,l2,[l3]):=if length(l1)=4 and length(l2) = 0 and length(l3) = 0 and numberp(l1[1]) and numberp(l1[2]) and numberp(l1[3]) and numberp(l1[4]) then y[l1[1],l1[2]][l1[3],l1[4]] else apply(nounify(T),append([l1,l2],l3))$
(%i5) T([a,b,c,d],[]);
(%o5) T([a, b, c, d], [])
(%i6) T([1,2,1,2],[]);
(%o6) x2
Viktor
-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Guénhaël
Sent: Monday, June 15, 2009 6:23 PM
To: maxima at math.utexas.edu
Subject: [Maxima] itensor & components
Hi,
I’m a newbie and have some questions about itensor.
First, if I write for example:
x: matrix ([17, 3], [-8, 11])$y: matrix ([x, x], [x, x]);
And I would like to assign each terms of “y” to the components of a tensor like this (but it doesn’t work in this case):
components(T([i,j,k,l],[]),y)$
In a second time I did some formal calculs and obtain a function f of T([i,j,k,l],[]).
I can see each value of each term of f([i,j,k,l],[]) by writing for example:
f([1,2,3,3],[]);
But I would prefer to be able to write all the terms in one time in the same form of “y”.
Thanks by advance.
Guenhael.
More information about the Maxima
mailing list