# Need a code to construct an antisymmetric tensor with Mathematica 6.

 P: 17 Hello! I'm doing a code in Mathematica 6.0 in order to calculate a contraction of indices with the Levi-Civita tensor (in six dimensions) and an antiSymmetric tensor A[m,n,p] (it has 3 indices running from 1 to 6). For example in order to turn A into an antisymmetric tensor, I wrote something like this in the code: Input: A[m, n, p] := 1/6 (A[m, n, p] - A[m, p, n] - A[n, m, p] + A[n, p, m] + A[p, m, n] - A[p, n, m]); But it seems that mathematica doesnt take it into account because at the end of the final computation, the output shows this kind of things: 2 b (-A[5, 4, 6] B[1, 2, 3] + A[5, 6, 4] B[1, 2, 3] + A[6, 4, 5] B[1, 2, 3] - A[6, 5, 4] B[1, 2, 3] - A[3, 5, 6] B[1, 2, 4] + A[3, 6, 5] B[1, 2, 4] + A[5, 3, 6] B[1, 2, 4] - A[5, 6, 3] B[1, 2, 4] ) (B is another antisymmetric tensor and b is a constant). So , as you see, the first 3 terms should be together because of the antisymmetric property of A, but they arent. The expression is already simplified by mathematica. Anybody knows how can i fix the code? thank you in advance.
 PF Gold P: 706 As for your code: A[m, n, p] := 1/6 (A[m, n, p] - A[m, p, n] - A[n, m, p] + A[n, p, m] + A[p, m, n] - A[p, n, m]); This appears to be an infinitely recursive function definition. As soon as you evaluate A[1,2,3] you'll see it says \$RecursionLimit::reclim: Recursion depth of256 bexceeded.
 P: 17 yes it does. I want to teach Mathematica to recognize the antisymmetric property. For example: A[4,5,6] = - A[4,6,5] = A[6,4,5]= . . . I can do it manually , of course, but it takes to long.
 PF Gold P: 706 Need a code to construct an antisymmetric tensor with Mathematica 6. A simple example: A={{0,-1},{0,1}} MatrixForm[A] -A Transpose[A] I'm not entirely sure whether the following is relevant to tensors or not, but it is very curious how you can use a matrix exponent to get rotation and lorentz transformation matrices: Clear["Global*"] Print["A"] A = {{0, -\[Theta]}, {\[Theta], 0}} MatrixForm[A] Print["Antisymmetric?"] -A == Transpose[A] Print["MatrixExp:"] MatrixForm[MatrixExp[A]] Print["B:"] B = {{\[Theta], 0}, {0, \[Theta]}} Print["Antisymmetric?"] -B == Transpose[B] Print["Symmetric?"] B == Transpose[B] Print["MatrixExp[B]:"] MatrixForm[MatrixExp[B]] Print["c"] c = {{0, t, 0, 0}, {t, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}} MatrixForm[c] Print["MatrixExp[c]:"] MatrixForm[MatrixExp[c]] But I think what you're wanting to do is handle a six by six by six tensor, and swap the indices out. Starting a little simpler, you could do a three-by-three-by-three m = {{{111, 112, 113}, {121, 122, 123}, {131, 132, 133}}, {{211, 212, 213}, {221, 222, 223}, {231, 232, 233}}, {{311, 312, 313}, {321, 322, 323}, {331, 332, 333}}} MatrixForm[m] m[[1]][[2]][[3]] (*First Row, Second Column, Third... Book?*) MatrixForm[n = Transpose[m]] n[[1]][[2]][[3]] (*First Row, Second Column, Third... Book?*) Now, the Transpose function just transposes the row and the column but we need access to other transpositions; to swap the row with the book, or the column with the book. You might figure out how to do it. I think the relevant help would be under nested lists... Now that I look at the help file, Under Nested Lists, I see a link to tensors, and then to LeviCevitaTensors in the Mathematica Help file. It appears that running LeviCivitaTensor[6] actually creates an extremely large 6 x 6 x 6 x 6 x 6 x 6 tensor. LeviCivitaTensor[4] MatrixForm[%]`
 P: 17 Ok doolin thank you for your time. I've seen the link to tensor in the mathematica help file. I'll try to use what you write above and figure it out the swap between row and the book.
 P: 17 I didnt probe it yet but I think this might help: Antisymmetrize[f_] := Module[{p = Permutations[f]}, Signature[f]Signature/@ p . p] .
 PF Gold P: 706 I wonder, do you have the LeviCivitaTensor command in Mathematica 6? I'm running Mathematica 7.
PF Gold
P: 706
 Quote by gda Ok doolin thank you for your time. I've seen the link to tensor in the mathematica help file. I'll try to use what you write above and figure it out the swap between row and the book.
I'd be happy to spend more time on it, because I'm learning too. There's a lot I don't know.
• I'd like to see a problem in fluid dynamics that could be solved with tensors. I assume it has to do with bulk-modulus, shear-modulus, young's modulus, stress, and strain.
• I'd like to see a unit analysis of Einstein Field Equations
• I'd like to see how Schwarzschild metric is a solution to the Einstein Field Equations. i.e. how exactly it fits in there and solves it.
• I'd like to get some clarity on covariant and contravariant. How does popping the index up to the top, or down on the bottom actually affect the shape of the Array? As far as I can tell one 3x3x3 array should have about the same shape as another 3x3x3 array.
• I'd like to get a clear understanding of "Christoffel Connection Coefficients."

I think using Mathematica (or any programming language) could really help explain these ideas. These are nice tools we can use, so we don't have to be as smart as Einstein to understand everything.

Of course the use of a computer prevents us from using any ambiguously defined, or undefinable concepts. That might be a problem if we find that General Relativity relies heavily on these. Humans can "deal" with that, but not computers.
PF Gold
P: 706
 Quote by gda I didnt probe it yet but I think this might help: Antisymmetrize[f_] := Module[{p = Permutations[f]}, Signature[f]Signature/@ p . p] .
By the way, thanks for that. I'm not entirely sure what the significance is, but it is notationally, at least, very descriptive (with the help files).
 P: 95
 PF Gold P: 706 If you find the relative computational capabilities of the average computer vs. the smartest human depressing, remember... A computer can perform billions or trillions of floating-point-operations per second, but it is utterly incapable of formulating an opinion of whether such calculations are interesting, relevant, applicable, or worthwhile.
P: 17
 Quote by Sam Gralla http://www.xact.es/xTensor/index.html
thanks sam. I'm going to see what this package is capable of.
P: 17
 Quote by JDoolin A computer can perform billions or trillions of floating-point-operations per second, but it is utterly incapable of formulating an opinion of whether such calculations are interesting, relevant, applicable, or worthwhile.
yeah it's true. They are just nothing but a sophisticated calculator :D.

Anyway, if you write this in mathematica (I'm using 6.0)

Antisymmetrize[f_] := Module[{p = Permutations[f]}, Signature[f]Signature/@ p . p] .

it will antisymmetrize your operation, i.e Antisymmetrize[f[a,b,c]] will give you f[a,b,c]-f[b,a,c]+....
 PF Gold P: 706 Right. I think I can see what it is doing. It gives you all permutations of {a,b,c} and then gives a positive sign for abc, bca, cab, (shift operations) and a negative sign for acb, bac, cba (swap operations). I can see what it's doing, but I can't seem to fathom why it's doing it; other than obviously it is programmed to do so. Is there a simple question that someone might ask that would motivate me to antisymmetrize a function of three variables?
P: 95
 Quote by gda thanks sam. I'm going to see what this package is capable of.
If you're planning to do any serious tensor work with Mathematica I don't think this package has a competitor. It's 1) really good, 2) free, and 3) well maintained and has an amazing "google group" where people discuss issues and answer questions people might have. This is by far the most popular tensor analysis package for GR, at least among the younger crowd.

 Related Discussions Special & General Relativity 7 Advanced Physics Homework 5 Advanced Physics Homework 4 Differential Geometry 4 Special & General Relativity 3