Re: Is Mathematica capable of doing this?
- To: mathgroup at smc.vnet.net
- Subject: [mg37505] Re: [mg37469] Is Mathematica capable of doing this?
- From: "Hermann Schmitt" <schmitther at netcologne.de>
- Date: Sat, 2 Nov 2002 03:30:26 -0500 (EST)
- References: <NDBBJGNHKLMPLILOIPPOMEFKDEAA.djmp@earthlink.net> <200211010643.BAA11341@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hello, you may use entries with Head "Tensor", e.g. Tensor[xyz], where xyz identifies an specific Tensor. Then you can define functions Plus, Times, ... in the form: Plus[x__Tensor] := ....... x__ Tensor means one ore more expressions with Head "Tensor". Hermann Schmitt ----- Original Message ----- From: "Liguo Song" <Liguo.Song at vanderbilt.edu> To: mathgroup at smc.vnet.net Subject: [mg37505] [mg37493] Re: [mg37469] Is Mathematica capable of doing this? > Thanks for the helpful input. I have been playing with the idea for a while. And > here are my answers for the questions that you brought out. > > First, about the super/sub-scripts. I can easily use a list of True/False for > sub/super-script. I can combine this list with the List that represent the > tensor together to for a new object, Tensor. > > Second, output formatting can be done easily with SubsuperscriptBox[string, sub, > sup], where string represents the name of the Tensor, sub/sup are strings to > represent the scripts for the tensor. Spaces can be used to align the sub and > super-scripts. > > So, it boils down the my first question, how can I define a object, Tensor, > which will behave like Complex? So, I can redefine Times, Plus, Minus, and other > operators to handle Tensor. > > Also, how can I relate a symble to a Function as + relates Plus, * relates to Times? > > Again, thanks for your thoughts on this topic. > > > Liguo > > > David Park wrote: > > 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 > 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 > > > > >