Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to have abstract matrices M and S to get out the coefficients of matrix power series however it treats M and S as numbers even if i checked that M.S - S.M != 0. I attach my code below:

$Assumptions = {Element[M, Matrices[{3, 3}]], Element[S, Matrices[{3, 3}]]}
Series[Simplify[(1 - a*(M + S))^(-1)], {a, 0, 3}]

How can i cure this to get out proper result?

Thanks in advance for reply.

share|improve this question
add comment

3 Answers 3

Be explicit and do it in two steps. The first step is just the series computation with the matrix expression M+S replaced by a single variable:

f = Series[(1 + t x)^(-1), {t, 0, 3}]

$1-x t+x^2 t^2-x^3 t^3+O[t]^4$

We need to describe how to expand powers of x. This can be done recursively:

power[a_, n_Integer] /; n > 1 := Distribute[a . power[a, n - 1]];
power[a_, 1] := a;

After a power is expanded, we also need to collect sequences of like terms into (matrix) powers. This solution does it explicitly by post-processing the result of Split applied to such a sequence:

collect[a__] := With[{l = Power[First[#], Length[#]] & /@ Split[{a}]},
   If[Length@l == 1, First@l, Dot @@ l]];

Apply these rules to the series, remembering also to expand x itself when not wrapped inside Power:

f /. {Power[x, n_] :> power[m + s, n], x -> m + s} /. Dot[a__] :> Dot[collect[a]]

$(1+(-m-s) t+(m.m+m.s+s.m+s.s) t^2+ \\ (-m.m.m-m.m.s-m.s.m-m.s.s-s.m.m-s.m.s-s.s.m-s.s.s) t^3+ \\ O[t]^4)$

For some reason the second replacement does not work (MMA 8.0). It appears to work with almost any head except Dot! Here's a workaround:

f /. {Power[x, n_] :> power[m + s, n], x -> m + s} /.  x_[a__] /; x === Dot :> x[collect[a]]

$1+(-m-s) t+(m^2+s^2+m.s+s.m) t^2+ \\ (-m^3-s^3-m.s^2-m^2.s-s.m^2-s^2.m-m.s.m-s.m.s) t^3+O[t]^4$

share|improve this answer
2  
This approach will not work on series in which negative powers appear (such as Series[WeierstrassP[t x, {g2, g3}], {t, 0, 1}]), nor should it be expected to: there is no general way to expand negative powers of $m+s$. –  whuber Apr 26 '13 at 14:24
4  
That's because Dot[a__] evaluates to a__, try with HoldPattern@Dot[a__] –  Rojo Apr 26 '13 at 14:29
1  
@Rojo Thank you! I was hoping some expert would explain this one. –  whuber Apr 26 '13 at 14:33
add comment

There is a new function as of version 9 :

Series[MatrixFunction[(1 - a*(#))^(-1) &, bigM + bigS], {a, 0, 3}] 

output

While the output does not look very pretty it will behave correctly.

share|improve this answer
    
+1 Didn't know the function! –  Silvia Apr 26 '13 at 14:30
    
Trying to get your result explicitly with it - no luck so far. –  b.gatessucks Apr 26 '13 at 14:33
    
Yep, definitely not pretty. But, it works. –  rcollyer Apr 26 '13 at 14:33
    
Re "not look very pretty": What exactly does it look like? –  whuber Apr 26 '13 at 14:34
3  
@whuber Added the output (rated PG). –  b.gatessucks Apr 26 '13 at 14:37
add comment

Is

$$\begin{split} 1+&(M+S) \, a\\ +&(M\cdot S+S\cdot M+M\cdot M+S\cdot S) \, a^2\\ +&(M\cdot M\cdot S+M\cdot S\cdot M+M\cdot S\cdot S\\ &+S\cdot M\cdot M+S\cdot M\cdot S+S\cdot S\cdot M+M\cdot M\cdot M+S\cdot S\cdot S) \, a^3\\ +&O\left(a^4\right) \end{split}$$

what you're expecting for? If yes, please continue read.

First we define a temporary matrix $A$:

A /: Times[A, A] := CircleTimes[A, A]
A /: Power[A, n_ /; IntegerQ[n] && Positive[n]] := CircleTimes @@ ConstantArray[A, n]
A /: Times[A, CircleTimes[M__]] := CircleTimes[A, M]
A /: Times[CircleTimes[M__], A] := CircleTimes[M, A]

Then we substitute $M+S$ with $A$ and expand the series as normal way:

tempSeries = Series[1/(1 - a  A), {a, 0, 3}]

$1+A\, a+A\otimes A\, a^2+A\otimes A\otimes A\,a^3+O\left(a^4\right)$

Then substitute $M+S$ back and do some replacement and transformation like Distribute etc.

tempSeries /. A -> M + S /.
  CircleTimes[M__] :> Distribute[CircleTimes[M]] /.
 CircleTimes -> Dot

Now we get the result shown at beginning.

share|improve this answer
    
Thanks, this looks straightforward. –  grelade Apr 26 '13 at 14:31
    
@grelade You are welcome. –  Silvia Apr 26 '13 at 14:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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