The Series[]
command is useful for reformatting algebraic expressions and getting rid of higher-order terms:
In[1]:= Series[ a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4, {x, 0, 2}]
Out[2]:= a0 + a1*x + a2*x^2 + O(X^3)
Now suppose we have a variable which also has indices (e.g. $x_i$ with $i=1, ..., N$), and we want to find expansion of a term up to some order of the variable which neglects the indices. For instance, given an expression \begin{equation} a_0 + a_1 x_1 + a_2 x_2 + a_{11} x_1^2 + a_{12} x_1 x_2 + a_{22} x_2^2 + a_{111} x^3 + etc. \end{equation} I'd like to have an expansion which to lowest orders $k$ gives \begin{align} k=0&: a_0 + O(x_i)\\ k=1&: a_0 + a_1 x_1 + a_2 x_2 + O(x_i^2) \\ k=2&: a_0 + a_1 x_1 + a_2 x_2 + a_{11} x_1^2 + a_{12} x_1 x_2 + a_{22} x_2^2 + O(x_i^3) \\ \end{align}
Is there any command to do this?
f[x_] := a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4; Table[Series[a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4, {x, 0, k}], {k, 0, 5}]
$\endgroup$