RE: Is Mathematica capable of doing this?
- To: mathgroup at smc.vnet.net
- Subject: [mg37481] RE: [mg37469] Is Mathematica capable of doing this?
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 1 Nov 2002 01:42:57 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Liguo, I think it is a "dragon's egg" and certainly not the best way to learn Mathematica. Basically you would have to Unprotect and add new definitions to Times and that would be only the start of it because how are you going to distinguish between superscripts and powers? How are you going to handle mixed up and down indices? How are you going to get nice output formatting? There are many nice tensor packages out there. The moderator of this group has the original powerful tensor package. As a way of learning some tensor calculus I have been working with Renan Cabrera on a package called Tensorial. It can be obtained at my web site below. It is oriented toward learning the basic mechanics and reproducing textbook problems. You can have any symbols for tensor labels or indices. The index domain can be any range of numbers or a set of symbols. For example, {0,1,2,3} or {t,x,y,z} for relativity problems. You can have colored indices to distinguish different coordinate frames. Here is how one would do your two problems in Tensorial. Needs["TensorCalculus`Tensorial`"] SetMetric[{x, g}, IdentityMatrix[3]] DefineTensorShortcuts[{T, g}, 2] guu[u, v]Tdd[v, k] % // MetricSimplify (formatted output) (formatted output, but Tud[u,k] in shortcut notation.) guu[u, v]Tdd[u, v] % // IndexEinstein (formatted output) (formatted output but Tdd[1,1] + Tdd[2,2] + Tdd[3,3] in shortcut notation.) The DefineTensorShortcuts statement defines T and g as labels of second order tensors. The various up and down index configurations can be specified by appending "u"'s or "d"'s to the tensor label. So, for example, gud[i,j] is the shortcut for g with the first index i up, and the second index j down. Isn't that easier than maneuvering between superscripts and subscripts? MetricSimplify automatically carries our the raising or lowering of indices with the metric tensor. IndexEinstein automatically carries out summations on paired up and down indices. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Liguo Song [mailto:Liguo.Song at vanderbilt.edu] To: mathgroup at smc.vnet.net Dear MathGroup, I am in the process of learning to use Mathematica. Here are a couple of questions that I want to ask the group. 1) Can I define a new object, Tensor, which will act like Complex? So, two Times[TensorA, TensorB] or TensorA*TensorB will invoke proper Times function to handle it. 2) If the answer to the above question is yes, then can I use super/sub-scripts to represent the indices for the Tensor, and carry out the calculation based on these indices? Such as, g^uv*T_vk will get T^u_k, which essentially raises the first index of T_vk. Another example would be g^uv*T_uv will get a scalor T. I know there are couple of Tensor analysis packages, comercial and free, out there. But, all the free packages I looked through won't be able to do this. And, figuring out how to do stuff is the best to learn how to use Mathematica. Maybe, I am pursuing a dragon egg here. But, I'd still like to hear about how well Mathematica can do to imitate this behavior. Thanks for any input on this. Liguo