Suppose I have
A = a vecA
B = b vecB
where a
and b
are supposed to be arbitrary scalars and vecA={vA1,vA2}
and vecB={vB1,vB2}
are vectors, i.e. lists (I guess from a mathematica point of view the difference is that a and b have Head Symbol
, whereas vec1 and vec2 have head List
?).
Now imagine an arbitrary function of two arguments f[A,B]
. What I would like to do is to pull out the scalars and multiply them:
f[A,B] -> a * b * g[vecA,vecB]
where g[vecA,vecB] is again an arbitrary function that only works on vectors (lists). How can I achieve that?
The background is that I would like to process (simplify, rearrange, expand in series, etc.) expressions that mix scalars and vectors and contain inner products of such mixtures without explicitly expanding the inner products into the components of the vectors. Such that I can later on easily replace occurrences of some inner products. See also my (not yet really solved) question: Symbolically associate vectors and their norms My current take on this is to use
Inner[f,A,B]
instead of Dot[A,B]
such that the inner product is not explicitly expanded into components. However I do need to pull out the scalars somehow..