following question,
I have an expression that consists of several Minkowski inner products between 2 four vectors written as in Mathematika:
Dotp[{qm[0], qm[1], qm[2], qm[3]},{qn[0], qn[1], qn[2], qn[3]}]
,
Which I want to evaluate explicitly.
The Minkowski inner product I defined as:
Mi = {{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, -1}};
doM = {qm[0], qm[1], qm[2], qm[3]}.Mi.{qn[0], qn[1], qn[2], qn[3]};
doM=qm[0] qn[0] - qm[1] qn[1] - qm[2] qn[2] - qm[3] qn[3];
To evaluate the Minkowski inner products in the Expressions explicitly. For this I wanted to define a replacement rule that acts on
Dotp[{qm[0], qm[1], qm[2], qm[3]},{qn[0], qn[1], qn[2], qn[3]}]
,and gives me
qm[0] qn[0] - qm[1] qn[1] - qm[2] qn[2] - qm[3] qn[3]
.
My current approach to define a rule:
rule1 = {Dotp[{x1_[0], x1_[1], x1_[2], x1_[3]}, {x2_[0], x2_[1], x2_[2], x2_[3]}] :-> {x1_[0], x1_[1], x1_[2], x1_[3]}.Mi.{x2_[0], x2_[1], x2_[2], x2_[3]}}
;
But then I get the error message:
RuleDelayed::rhs: Pattern x1_ appears on the right-hand side of rule Dotp[{x1_[0],x1_[1],x1_[2],q1_[3]},{x2_[0],x2_[1] ,x2_[2],x2_[3]}]:>{x1_[0],x1_[1],x1_[2],x1_[3]}.Mi.{x2_[0],x2_[1],x2_ [2],x2_[3]}
.
My question is, how do I define rule s.t
Dotp[{qm[0], qm[1], qm[2], qm[3]},{qn[0], qn[1], qn [2], qn[3]}:-> qm[0] qn[0] - qm[1] qn[1] - qm[2] qn[2] - qm[3] qn[3]
?
Is a rule even the right approach?
Thanks in advance
{x_ :> x_^2}
. Correct:{x_ :> x^2}
. $\endgroup$