I am doing some calculation with summation and the Kronecker symbol. Here are my steps :
$Assumptions =
k1 ∈ Reals && k2 ∈ Reals && k3 ∈ Reals && p1 ∈ Reals && p2 ∈ Reals && p3 ∈ Reals
k = {k1, k2, k3};
p = {p1, p2, p3};
d[i_, j_] := KroneckerDelta[i, j]
proj[i_, j_, k1_, k2_, k3_] :=
d[i, j] -
(d[i, 1]*k1 + d[i, 2]*k2 + d[i, 3]*k3)*
(d[j, 1]*k1 + d[j, 2]*k2 + d[j, 3]*k3)/
(k1^2 + k2^2 + k3^2)
test1 = proj[i, j, k1, k2, k3]*proj[i, j, p1, p2, p3];
test2 = Sum[Sum[test1, {i, 1, 3}], {j, 1, 3}]
test2 // Expand
To explain the steps:
1) I define →k and →p with real components.
2) I define a projector Pij(→k)=δij−kikjk2.
3) I compute a summation on the repeated subscript.
After the last step, I have a relatively big expression, the product of k and p components. It looks like 3−aa+b+c−ba+b+c−ca+b+c+...−...
Now the question: why doesn't Mathematica make the simplification because, as anyone can see, the preceding expression can be simplified to 2+...−...
Is the problem linked to the Expand
operation? How can I make the simplification I want?. I thought of using /.
to do it, but that doesn't work either.
I hope someone will understand my question!
Answer
You have to explicitly tell Mathematica to simplify expressions. You can do this using Simplify
or FullSimplify
Simplify@test2
(2 k2 k3 p2 p3 + 2 k1 p1 (k2 p2 + k3 p3) +
k1^2 (2 p1^2 + p2^2 + p3^2) + k2^2 (p1^2 + 2 p2^2 + p3^2) +
k3^2 (p1^2 + p2^2 + 2 p3^2))/((k1^2 + k2^2 + k3^2) (p1^2 + p2^2 +
p3^2))
Comments
Post a Comment