I want to simplify the function below by using FullSimplify:
Function = (6 P1y P1z P2y P2z + 6 P1x P2x (P1y P2y + P1z P2z) + P1x^2 (4 P2x^2 + P2y^2 + P2z^2) + P1y^2 (P2x^2 + 4 P2y^2 + P2z^2) + P1z^2 (P2x^2 + P2y^2 + 4 P2z^2));
The result should be
3*(P1x P2x + P1y P2y + P1z P2z)^2 +(P1x^2 + P1y^2 + P1z^2) (P2x^2 + P2y^2 + P2z^2)
But, it does not come out like that.
Or, perhaps I can define some functions as
X = (P1x P2x + P1y P2y + P1z P2z)^2 %(p1 * p2)^2 Y = (P1x^2 + P1y^2 + P1z^2) (P2x^2 + P2y^2 + P2z^2) % |p1|^2 *|p2|^2
If we call the function again, I would expect that
3X + Y
But, it does not work.
What is actually the proper way to use Simplify in this case? Thank you very much.