0
$\begingroup$

I have a matrix expression which, when expanding with the Series[] command, returns

$$\left( \begin{array}{cc} 1-\frac{1}{2}t^2+\frac{1}{8}t^4-O[t^5] & t-\frac{1}{4}t^3+O[t^5] \\ -t+\frac{1}{4}t^3+O[t^5] & 1-\frac{1}{2}t^2+\frac{1}{8}t^4-O[t^5] \end{array} \right)$$

I would like to use the SeriesCoefficient[] command on this matrix to return the element-wise series coefficients in matrix form - i.e.:

$$n=0~\rightarrow~ \left(\begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array}\right)$$

$$n=1~\rightarrow~ \left(\begin{array}{cc} 0 & 1 \\ -1 & 0 \end{array}\right)$$

$$n=2~\rightarrow~ \left(\begin{array}{cc} -\frac{1}{2} & 0 \\ 0 & -\frac{1}{2} \end{array}\right)$$

and so on. How would I do this? Simply running SeriesCoefficient[Matrix[t],n] doesn't give me anything.

$\endgroup$

marked as duplicate by march, Community Jul 26 '16 at 17:26

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.

  • $\begingroup$ Try this: Table[1/n! D[Series[mat, {t, 0, 4}] // Normal, {t, n}] /. t -> 0, {n, 0, 4}]. (I know this is a duplicate of a recent question. Let me see if I can find it.) $\endgroup$ – march Jul 26 '16 at 15:33
  • 1
    $\begingroup$ @march, don't forget to scale by the factorial. ;) $\endgroup$ – J. M. will be back soon Jul 26 '16 at 15:33
  • $\begingroup$ @J.M. Right you are! (I'm going to find that duplicate, in any case.) $\endgroup$ – march Jul 26 '16 at 15:34
  • $\begingroup$ A related question. $\endgroup$ – J. M. will be back soon Jul 26 '16 at 15:35
  • $\begingroup$ @J.M. While that wasn't the one I was thinking of, that is certainly a good candidate for marked-as-duplicate. It even has the answer by Jens that I quoted here (I have seen Jens use it before, and I learned it from them anyway). $\endgroup$ – march Jul 26 '16 at 15:40
0
$\begingroup$

Seems easy enough:

m = {
   { 1 - 1/2 t^2 + 1/8 t^4 - O[t]^5, t - 1/4 t^3 + O[t]^5           },
   { -t + 1/4 t^3 + O[t]^5,          1 - 1/2 t^2 + 1/8 t^4 - O[t]^5 }
  };

Table[
 n -> Map[SeriesCoefficient[#, n] &, m, {2}],
 {n, 0, 2}
]
{0 -> {{1, 0}, {0, 1}}, 1 -> {{0, 1}, {-1, 0}}, 2 -> {{-(1/2), 0}, {0, -(1/2)}}}

More playfully:

Map[Thread @ SeriesCoefficient[#, {0, 1, 2}] &, m, {2}] ~Transpose~ {3, 2, 1}
$\endgroup$
  • 1
    $\begingroup$ SeriesCoefficient[m, {t, 0, 3}] works directly in M9+, no need to use Map. $\endgroup$ – Carl Woll Jun 1 '17 at 1:06
  • $\begingroup$ @CarlWoll Thank you. $\endgroup$ – Mr.Wizard Jun 1 '17 at 1:14

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