Re: Matrix Series
- To: mathgroup at smc.vnet.net
- Subject: [mg32150] Re: [mg32138] Matrix Series
- From: BobHanlon at aol.com
- Date: Sat, 29 Dec 2001 18:00:28 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 12/29/01 12:59:24 AM, mark.coleman at dri-wefa.com writes:
>Consider the familiar series expansion
>
> Log[x] = (x-1) -1/2*(x-1)^2 + 1/3*(x-1)^3 - 1/4*(x-1)^4 + ....
>
>I am interested in having Mathematica (v4.1) numerically evaluate an m-term
>matrix counterpart to this expansion, e.g.,
>
> Q[X_,m_] := (X-I) - 1/2*(X-I)^2 + 1/3*(X-I)^3 - 1/4*(X-I)^4 + ....
>1/m*(X-I)^m
>
>
>where X is an nxn real matrix and I is the nxn identity matrix, and m is
>some positive integer.
>
>I've been struggling with the built-in Series[] function, but it is not
>obvious to me how to generalize it to handle matrix arguements. My other
>alternative is to just to use the 'MatrixPower' function and build-up
>the (alternating-sign) sequence of series coefficients in a Table[]
>command, as I only need the numerical result. But my curiosity has been
>piqued and I was wondering if there is someother way to do this.
Q1[mat_?(MatrixQ[#, NumericQ]&),
m_Integer?Positive] :=
Module[
{n, x = N[mat-IdentityMatrix[Length[mat]]]},
Sum[-(-1)^n * MatrixPower[x, n]/n,
{n, 1, m}]];
Q2[mat_?(MatrixQ[#, NumericQ]&),
m_Integer?Positive] :=
Module[
{n, x = N[mat-IdentityMatrix[Length[mat]]]},
n=1; Plus @@ NestList[-n#.x/((n++)+1)&, x, m-1]];
matrixSeries[
mat_?(MatrixQ[#, NumericQ]&),
func_,
{x_Symbol, x0_?NumericQ, m_Integer?Positive}] :=
Module[{funcx0 = (func /. x -> x0),s,
i = IdentityMatrix[Length[mat]]},
s = Normal[Series[func, {x, x0, m}]] - funcx0;
(s /. {Power -> MatrixPower, x -> X+x0-x0*i})+funcx0*i];
X = {{.1,.2,.3,.1, -.1},{-.1,.3,.4,.1, .2},{.2,.4,.5,.1, -.2}, {-.2,.1,.5,.1,
\
-.2}, {-.2,.1,.1,.1, -.2}};
m= 8;
matrixSeries[X,Log[x],{x,1,m}] ==
Q1[X, m] == Q2[X, m]
True
m = 8;
matrixSeries[X,Exp[x],{x,0,m}] ==
Module[{n},n=1;
Plus @@ NestList[#.X/(n++)&, IdentityMatrix[Length[X]], m]] ==
Sum[MatrixPower[X, n]/n!,{n, 0, m}]
True
Bob Hanlon
Chantilly, VA USA