MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Tensors in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37510] Tensors in Mathematica
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Sat, 2 Nov 2002 03:30:39 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Liquo.Song at vanderbilt.edu  posted a message with the vague subject 
  "[mg37469] Is Mathematica capable of doing this?"

In that post the author want to know if he/she can define a new object,
Tensor, which will act like Complex. The he/she could implement a sort of
multiplication of tensors.
----------------

Yes this can be done, except in Mathematica we don't have "objects".  Below
I define TensorQ[expr] which returns True if expr is a tensor and otherwise
returns False.

In[1]:=
  TensorQ[expr_]:=MatchQ[expr,_List?(Length[Dimensions[#]]===Depth[#]-1&)]

You don't explain how tensors are multiplied, and I know very little about
tensors.  Hence I won't implement tensor multiplication, but in the next
line I define a function that is only defined when it's two arguments are
tensors.  This function indicates if the two tensors have the same
dimensions.

In[2]:=
SameDimensionsQ[t1_?TensorQ, t2_?TensorQ]:=
(Dimensions[t1]===Dimensions[t2])

------------
It certainly is possible to implement super/sub-scripts to represent indices
for a tensor.  However, I won't try to implement it because I know very
little about tensors.

You can find some stuff about tensors and Mathematica at:
http://mathworld.wolfram.com/Tensor.html 

Also did you check the tensor package at:
http://home.earthlink.net/~djmp/Mathematica.html

----------
Regards,
    Ted Ersek

Download my latest Mathematica Tips, Tricks from 
http://www.verbeia.com/mathematica/tips/Tricks.html
  or from 
http://www.mathsource.com/Content/General/Tutorials/0212-331




  • Prev by Date: Re: Integer Solutions
  • Next by Date: Re: When does Integrate give incorrect results?
  • Previous by thread: AW: machine-size problem again?
  • Next by thread: Re: Tensors in Mathematica