collect
¶
Collect: rearrange a scalar expression so that a target vector appears on the left side of Dot.
This is a preprocessing step for integration by parts (ibp), which
only matches Dot(target, ...) on the left.
Uses
- Dot commutativity: Dot(a, b) = Dot(b, a)
- Scalar triple product: Dot(a, Cross(b, c)) = Dot(b, Cross(c, a))
- Orthogonal invariance: Dot(Ra, Rb) = Dot(a, b) for R in SO3
collect(expr, vec)
¶
Collect expr with respect to vec.
Rearranges so vec appears on the left of every Dot that contains it.