# Series: two varibles, how to eliminate the (product) higher order

I have a function of $f(x,y)$, where $x,y$ are very small numbers. I want to series expand it to the $3$rd power. However I don't want the terms such that $x^2y^2$, $xy^3$ etc. because I would reckon this as $4$th power. How do I tell mathematica to do this.

As a concrete example, consider the following input:

ClearAll["Global*"]
δE =
x^2 (Sqrt[1 + x^2] -
x) (2 - (Sqrt[1 + x^2] - x)/(Sqrt[1 + y^2] - y)) +
2/3 ((Sqrt[1 + y^2]^3 - y^3) - (Sqrt[1 + x^2]^3 - x^3)) -
y^2 (Sqrt[1 + y^2] - y);
Series[δE, {x, 0, 3}, {y, 0, 3}] // Simplify


In the output, I need only the terms $y^3/3-yx^2+2x^3/3$ kept.

• Try // Normal // Simplify – user9660 Oct 28 '15 at 15:16
• @Lou This won't eliminate the higher orders. – an offer can't refuse Oct 28 '15 at 15:17
• Well then, this should work: Expand[Fold[(#1.{x, y} + #2) &, Take[CoefficientArrays[Normal[series], {x, y}], {4, 1, -1}]]]. – J. M. will be back soon Oct 28 '15 at 15:21
• Redefine x -> x t and y-> y t and use Series with regard to t upto third order. After taking Normal, you can then replace t -> 1 again. – Sungmin Oct 28 '15 at 15:23
• – user9660 Oct 28 '15 at 15:28

Bound to be a better way, but this will do it

Sum[
UnitStep[3 - (n + m)] SeriesCoefficient[δE, {x, 0, n}, {y, 0,
m}] x^n y^m, {n, 0, 3}, {m, 0, 3}]
(* (2 x^3)/3 - x^2 y + y^3/3 *)


As pointed out in the comment by @Sungmin. A very simple way to do this is following:

δEt =
Series[δE /. {x -> x t, y -> y t}, {t, 0, 3}] // Normal;
δEt /. {t -> 1}

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

vars = {x, y};
point = {0, 0};

f[vars_] = x^2 (Sqrt[1 + x^2] -x) (2 - (Sqrt[1 + x^2] - x)/(Sqrt[1 + y^2] - y)) + 2/3 ((Sqrt[1 + y^2]^3 - y^3) - (Sqrt[1 + x^2]^3 - x^3)) -
y^2 (Sqrt[1 + y^2] - y);

taylorPolynom // Expand
(2 x^3)/3 - x^2 y + y^3/3
`