I am wondering how to handle the following situation: I do have vectors of known dimension that I would like to handle symbolically. I suppose I can do something like
avec = Array[a,2];
bvec = Array[b,2];
Now in my equations there are also scalars that represent the norms of these vectors, i.e.
A == Norm[avec]
So suppose I write an expression like
expr = A avec.(avec + bvec)
What I would like Mathematica to do is:
- Whenever
avec.avec
is encountered, replace this by A^2 - Whenever
avec.bvec
is encountered, leave this symbolic, don't expand into the elements of the vectors.
How can I achieve this?
avec . avec
byA^2
rather than byA
! $\endgroup$