Levi-Civita Density
- To: mathgroup at smc.vnet.net
- Subject: [mg20780] Levi-Civita Density
- From: Dr Dan <drdanw at my-deja.com>
- Date: Thu, 11 Nov 1999 00:22:51 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Mathematica does not supply a Levi-Cevita density function (aka,
alternating tensor, isotropic tensor rank 3, or that epsilon with 3
subscripts), although the Mathematica book does mention its similarity
to the Signature function.
For your enjoyment, here is a Levi-Cevita density function, complete
with StandardForm input and output. Input form is allowed with either
visible or invisible commas so type
[esc]e[esc][cntl]_i[esc],[esc]j[esc],[esc]k[cntl][space]
or
[esc]e[esc][cntl]_i,j,k[cntl][space]
depending on if you want pretty or fast.
(------------ code follows ----------------)
LeviCivitaDensity::usage = "LeviCivitaDensity[i, j, k] is zero for any
repeated index and 1 or -1 for even or odd permutations of {1,2,3}."
LeviCivitaDensity[i_Integer, j_Integer, k_Integer] :=
Signature[{i, j, k}] /; Positive[i] && i <= 3 &&
Positive[j] && j <= 3 && Positive[k] && k <= 3;
LeviCivitaDensity/: MakeBoxes[LeviCivitaDensity[i_, j_,
k_], StandardForm] := SubscriptBox["\[Epsilon]",
RowBox[{MakeBoxes[i, StandardForm], "\[InvisibleComma]",
MakeBoxes[j, StandardForm], "\[InvisibleComma]",
MakeBoxes[k, StandardForm]}]];
MakeExpression[SubscriptBox["\[Epsilon]",
RowBox[{i_, "\[InvisibleComma]", j_, "\[InvisibleComma]", k_}]],
StandardForm] :=
MakeExpression[RowBox[{"LeviCivitaDensity", "[", i,
",", j, ",", k, "]"}], StandardForm];
MakeExpression[SubscriptBox["\[Epsilon]",
RowBox[{i_, ",", j_, ",", k_}]], StandardForm] :=
MakeExpression[RowBox[{"LeviCivitaDensity", "[", i,
",", j, ",", k, "]"}], StandardForm];
Sent via Deja.com http://www.deja.com/
Before you buy.
- Follow-Ups:
- Re: Levi-Civita Density
- From: Wolfgang Schadow <schadow@netcom.ca>
- Re: Levi-Civita Density