Message Boards Message Boards

0
|
2498 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Recognize the norm of a vector using Assumptions?

Posted 5 years ago

Hi,

In my recent calculations for theoretical physics homework I have to do some bigger matrix multiplications. It would be nice if Mathematica could recognize for example Sqrt[b1^2+b2^2+b3^2] as the norm of my vector B or some other name I gave it an advance.

I tried working with Assumptions and (Full-)Simplify but it didn't help in any way. Thank you for some help! Nicolai

POSTED BY: Nicolai Anger

Here are some ideas:

myNorm[x_] := \[LeftDoubleBracketingBar]x\[RightDoubleBracketingBar];
sqrtToNorm =
  {Sqrt[b1^2 + b2^2 + b3^2] -> myNorm[B],
   Sqrt[c1^2 + c2^2 + c3^2] -> myNorm[C]};
normToSqrt = Map[Reverse, sqrtToNorm];
Sqrt[b1^2 + b2^2 + b3^2] +
  Sqrt[c1^2 + c2^2 + c3^2] /. sqrtToNorm
% /. normToSqrt
Norm[{b1, b2, b3}] /. Abs -> Identity /.
 sqrtToNorm
Sqrt[a^2 + b^2 + c^2] /.

 Sqrt[x_^2 + y_^2 + z_^2] :> myNorm[{x, y, z}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract