Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
share|improve this question
1  
To get what you want you need to put the TensorExpand inside the Series as Series[TensorExpand[<tensor expression>]]. –  Stephen Luttrell May 16 at 16:02
    
Thanks - that solved it! –  Edward Hughes May 17 at 9:44

1 Answer 1

up vote 3 down vote accepted

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] *)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.