Subject: More questions about Maxima's tensor functions
From: Viktor T. Toth
Date: Wed, 16 Nov 2005 07:37:17 -0500
Good questions.
In the most general sense, when you have a tensor equation expressed in
compact (indexed) form, and you eventually wish to compute tensor
components, the approach would be to use the itensor package first to
manipulate the equation without regard to tensor components (e.g., carry out
summations, simplify indexed expressions, etc.) Then, you'd use the
ic_convert function to convert the itensor expression into a ctensor
program, which you could then use to compute individual tensor components.
(Of course ctensor is primarily a package for Riemannian geometry, but the
methods it uses are also applicable to other tasks.)
Unfortunately, itensor cannot deal very well with indexed expression inside
the denominator, the exponent, or as function arguments. Differentiation
with respect to an indexed expression is also problematic. Having said that,
Maxima can still help you, it's just necessary to work around these
limitations.
For instance, instead of defining W, you can use itensor to define logW as
follows:
load(itensor);
load(ctensor);
EQ:logW([],[])=c2*E([i,j],[])*kdelta([],[i,j])$
ishow(EQ)$
Now you can use the ic_convert function to convert EQ into a ctensor
program. It is then also necessary to replace the itensor kdelta with
ctensor's kdelt function (yes, perhaps it should be done automagically, but
it isn't) and then evaluate it:
ic_convert(EQ);
subst('kdelt(i,j),'kdelta[i,j],%);
%,eval,kdelt;
Now you can carry out the exponentiation:
W:c1*exp(%);
Finally, you can build a ctensor-style expression by hand to get your sigma
matrix:
S:zeromatrix(dim,dim);
for i thru dim do for j thru dim do S[i,j]:diff(W,E[i,j]);
Note that I set S explicitly to a matrix first, in order to ensure that it
is treated as a matrix, not as a list, when indices in square brackets are
used.
And, needless to say, you may want to set dim to something other than the
default 4 first, before carrying out these steps.
I hope I understood your problem correctly and this is of some use to you.
Viktor
-----Original Message-----
From: maxima-admin@math.utexas.edu [mailto:maxima-admin at math] On
Behalf Of Glenn Ramsey
Sent: Tuesday, November 15, 2005 6:35 PM
To: maxima@math.utexas.edu
Subject: More questions about Maxima's tensor functions
Hi,
I have some more questions about using the the tensor functions in Maxima.
The calculations I want to do don't seem to be covered in the examples
and I'm wondering if this isn't an appropriate way to be attempting to
use it.
What I want to do is to define an function of the form:
W(E_11, E_12, E_13, ...) := c1 *exp(c2*(E_11)^2 + c2*(E_22)^2 +....)
where the function is defined in terms of the individual components of a
tensor for which numerical values are known. (This is a strain energy
function used in finite deformation elasticity and E is the Green's
strain tensor.)
Then I want to calculate a stress tensor S_ij = del(W)/del(E_ij) by
taking the partial derivatives this function with respect to each
component of E, from which I can calculate a force to be used in a
minimisation routine to estimate the parameters c1, c2, ... .
Is it possible define the function as a tensor and then have Maxima
generate the tensor of partial derivatives?
I could do this by creating a matrix where each element is defined
individually eg: matrix([diff(W,E_11,1),diff(W,E_12,1), ... ]), but it
would be nice to be able to do it without having to define each element,
since that would be less error prone and less tedious if I want to try a
number of different W functions.
Glenn
--
Glenn Ramsey 07 8627077
http://www.componic.co.nz
_______________________________________________
Maxima mailing list
Maxima@math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima