1
$\begingroup$

This question already has an answer here:

I have a function f[x, y, z] that I would like to expand up to a given power of xyz.

For now, I am using Series[f, {x,0,6}, {y,0,6}, {z,0,6}], but that makes an expansion up to power 6 in x, in y and in z, which contains extra terms compared to the expansion I would like.

How can I do it?

$\endgroup$

marked as duplicate by Jens, m_goldberg, Daniel Lichtblau, MarcoB, user9660 Feb 3 '16 at 18:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0
$\begingroup$
taylor = (vars - point).# &;
init := D[f[vars], {vars, j}] /. Thread[vars -> point];
taylorPoly[m_] := Sum[1/j! Nest[taylor, init, j], {j, 0, m}]

Example

vars = {x, y, z};
point = {0, 0, 0};
f[vars_] = Sin[y - x ] + Exp[x - y + 2 z];

taylorPoly[2] // FullSimplify
1/2 (2 + 4 z + (x - y + 2 z)^2)

taylorPoly[3] // FullSimplify
1/6 (6 + (3 + 2 x - 2 y) (x - y)^2 + 12 z + 6 (x - y) (2 + x - y) z + 
   12 (1 + x - y) z^2 + 8 z^3)

taylorPoly[6] // FullSimplify
1/720 ((x - y)^2 (360 + 240 x + 30 x^2 + x^4 - 
      4 (60 + 15 x + x^3) y + 6 (5 + x^2) y^2 - 4 x y^3 + y^4) + 
   12 (x - y) (x (60 + x (20 + x (5 + x))) - 60 (-2 + y) - 
      x (40 + x (15 + 4 x)) y + (20 + 3 x (5 + 2 x)) y^2 - (5 + 
         4 x) y^3 + y^4) z + 
   60 (24 + 24 x + 12 x^2 + 4 x^3 + x^4 - 
      4 (6 + x (6 + x (3 + x))) y + 6 (2 + x (2 + x)) y^2 - 
      4 (1 + x) y^3 + y^4) z^2 + 
   160 (6 + x (6 + x (3 + x)) - 6 y - 3 x (2 + x) y + 3 (1 + x) y^2 - 
      y^3) z^3 + 240 (2 + 2 x + x^2 - 2 (1 + x) y + y^2) z^4 + 
   192 (1 + x - y) z^5 + 64 z^6 + 720 (1 + 2 z))
$\endgroup$

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