# Taylor expansion of function of vectors—simplifying the output

I've got a real-valued function of several vectors $f(u,v,w)$ formed by taking scalar products of linear combinations of the vectors,

I want to Taylor expand around small $v$ by writing

$$f(u,\delta v, w) = A + B\delta + O(\delta^2)$$

for small real $\delta$. When I do this in Mathematica, the output gives me terms like $v(1.u)$ rather than simplifying this to $v.u$.

Note that I have put into my assumptions that $u,v,w$ are all vectors. My Mathematica code is below.

$Assumptions = (p|q|r|P|m|n) ∈ Vectors[4]  (p|q|r|P|m|n) ∈ Vectors[4, Complexes]  FullSimplify[ TensorExpand[ Series[((n + q).(n + q)(p + q + δ r).(p + q + δ r))/ (P.P(p + δ r).(p + δ r) - (p + n + δ r).(p + n + δ r)(p + q + δ r).(p + q + δ r)), {δ,0,1}]], {p.p == 0, q.q == 0, r.r == 0, n.n == 0, m.m == 0, δ ∈ Reals}]  -(n.q/n.p) + (r n.q (2 (1.n + 1.p + n.1 + p.1) p.q - (1.p + p.1) P.P) δ)/(4 (n.p)^2 p.q) + O[δ]^2  - To get what you want you need to put the TensorExpand inside the Series as Series[TensorExpand[<tensor expression>]]. – Stephen Luttrell May 16 '14 at 16:02 Thanks - that solved it! – Edward Hughes May 17 '14 at 9:44 ## 1 Answer Since it solved the problem, I'll promote my comment to an "official" answer. To get the behaviour that you require you need to put the TensorExpand inside the Series thus: $Assumptions = (p | q | r | P | m | n) \[Element] Vectors[4]

(* (p | q | r | P | m | n) \[Element] Vectors[4, Complexes] *)

FullSimplify[
Series[TensorExpand[((n + q).(n + q) (p + q + \[Delta] r).(p +
q + \[Delta] r))/(P.P (p + \[Delta] r).(p + \[Delta] r) - (p \
+ n + \[Delta] r).(p + n + \[Delta] r) (p + q + \[Delta] r).(p +
q + \[Delta] r))], {\[Delta], 0, 1}], {p.p == 0, q.q == 0,
r.r == 0, n.n == 0, m.m == 0, \[Delta] \[Element] Reals}]

(* SeriesData[\[Delta], 0, {-Dot[n, p]^(-1) Dot[n, q],
Rational[1, 2] Dot[n, p]^(-2) Dot[n, q] Dot[p, q]^(-1) (
2 Dot[p, q] (Dot[n, r] + Dot[p, r]) - Dot[p, r] Dot[P, P])}, 0, 2, 1] *)

-