We’re rewarding the question askers & reputations are being recalculated! Read more.
2 edited tags
| link
source | link

Hessian matrix product in Taylor expansion of vector function

I am trying to get the 2nd order coefficient of the Taylor expansion at $\pmb{x}=\pmb{0}$ of

f[{x1_, x2_}] = {{c1 x1^2 + c2 x1 x2 + c3 x2^2}, {d1 x1^2 + d2 x1 x2 + d3 x2^2}}

enter image description here

so, taking these notes into account, I calculated the Hessian matrix,

x1 /: Dt[x1, x2] = 0;
x2 /: Dt[x2, x1] = 0;

H = Dt[f[{x1, x2}], {{x1, x2}, 2},Constants -> {c1, c2, c3, d1, d2, d3}]
(* {{{{2*c1, c2}, {c2, 2*c3}}}, {{{2*d1, d2}, {d2, 2*d3}}}} *)

enter image description here

and, as described in the notes, multiplied it by $\pmb{x^T}$ on the left and $\pmb{x}$ on the right

X = {{x1}, {x2}}

(* {{{{2*c1*x1^2 + c2*x2*x1 + 2*d1*x2*x1 + d2*x2^2}, {c2*x1^2 + 2*c3*x2*x1 + d2*x2*x1 + 2*d3*x2^2}}}} *)

enter image description here

but the result is not as expected, as it should be equal to $\pmb{f}$ (ignoring the 1/2 factor).

I think I followed Mathematica's matrix/vector product rules, so what am I missing?

Note: I am aware there are other simpler solutions such as

Normal[Series[f[{(x1 - 0) t, (x2 - 0) t}], {t, 0, 2}]] /. t -> 1
(* {c1 x1^2+c2 x1 x2+c3 x2^2,d1 x1^2+d2 x1 x2+d3 x2^2} *)

but I still want to know what I might have done wrong.