# Taylor expansion in higher dimensions with non-commutative tensor products [closed]

I would like to perform Taylor expansion of functions

$$f:\mathbb{R}^n \rightarrow \mathbb{R}^n$$

I was wondering how I can force Mathematica to handle the non-commutativity of the resulting tensor products. Following is an example:

Suppose $x, \delta \in \mathbb{R}^n; h \in \mathbb{R}$

$$f(x+h\delta) = f(x) + h f'(x)\delta+ \frac{h^2}{2} f''(x) \,\,\,(\delta, \delta)\quad ...$$

In the above expansion, $f'(x)$ is the Jacobian acting on $\delta$; $f''(x)$ is a 3-tensor acting on the vectors $\delta$ and $\delta$.

• What are non-commutative tensor products you talking about? – yarchik Apr 3 '17 at 14:06
• I think he means products between tensors $\delta$ of different orders. – Mirko Aveta Apr 3 '17 at 14:40
• You have to specify $f$, $x$, and $\delta$ as Arrays with the correct dimensions to let Series know the structure. It won't deduce it on its own for arbitrary symbolic objects. – Jens Apr 3 '17 at 16:50
• @Jens Can you show me a quick example? – mod0 Apr 3 '17 at 18:11

Although I don't know for sure if a solution with explicitly specified dimensions is what you're looking for, here is a way to get the results in that case:

δ = Array["δ", 3];
x = Array["x", 3];
f = Table["f"[i] @@ ##, {i, 3}] &;

f[x]


The components of the vectors are labeled by integers, e.g., f is the first component of the function f, and it depends on the argument x which has 3 components itself. To distinguish component names from the variables containing the vectors, I use Strings "x", "f". You could also choose completely different names, but strings are nice if you don't plan to assign values to the symbolic components.

With these definitions for the variable x, offset δ and function f as 3-vectors, we can now do the Taylor expansion. To collect the desired tensors, I first get the SeriesCoefficient for each order n (here from 0 to 2). That's a 3-vector. Then do the n-th vectorial derivative of that coefficient vector with D[..., {δ, n}]. See also my answer here. This notation causes D to return the tensor of the correct rank, as you can see from the output of Dimensions:

tensors =
Table[D[SeriesCoefficient[f[x + h δ], {h, 0, n}], {δ, n}], {n, 0, 2}];

Map[Dimensions, tensors]


$\{\{3\},\{3,3\},\{3,3,3\}\}$

To verify that this is indeed the correct set of tensors, let's see if the formula in the question is reproduced to the order I have chosen here (2):

Simplify[
Normal[Series[f[x + h δ], {h, 0, 2}]] ==
tensors[] + h tensors[].δ + h^2/2 tensors[].δ.δ]


True

• Thanks! I have accepted your answer. I will see if I can make this work with my needs – mod0 Apr 4 '17 at 17:23