Re: Matrix Exponential
- To: mathgroup at smc.vnet.net
- Subject: [mg34137] Re: Matrix Exponential
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sun, 5 May 2002 04:48:46 -0400 (EDT)
- References: <ab064n$1nv$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Kyriakos, I get the following M={{-1.85-1.993*I,-0.438-0.741*I},{-0.00919+0.01696*I,-10.8+0.938*I}}; MatrixExp[M] {{-0.0644759 - 0.143675 I, -0.0115505 + 0.00858763 I}, {0.000298193 + 0.000122957 I, 0.000017144 - 0.0000126169 I}} This agrees with what I get from some code for a general function of a matrix that I posted a while ago: MatrixReplace[Exp[x], x -> M] {{-0.0644759 - 0.143675 I, -0.0115505 + 0.00858763 I}, {0.000298193 + 0.000122957 I, 0.000017144 - 0.0000126169 I}} The code is PolyMatrixReplace[poly_,var_,matr_]:= With[{Id=IdentityMatrix[Length[matr]]},(Fold[#1.matr+#2*Id&,0*matr,#1]&)[ Reverse[CoefficientList[poly,var]]]] MatrixReplace[expr_,x_\[Rule]A_]:= Module[{evals,order,eset,df,data,interpol}, evals=Eigenvalues[A];order=Count[evals,#1]&; eset=Union[evals]; df=Derivative[#1][Function[x,expr]]&; data=({#1,Table[df[k-1][#1],{k,order[#1]}]}&)/@eset; interpol=InterpolatingPolynomial[data,x]; PolyMatrixReplace[interpol,x,A] ] -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Kyriakos Chourdakis" <k.chourdakis at qmul.ac.uk> wrote in message news:ab064n$1nv$1 at smc.vnet.net... > > Dear all, > > I am computing a few complex matrix exponentials for some Fourier > transforms, and I keep getting the same kind of result that I cannot > understand. As an example: > > ============================= > A) I can get the eigenvalues of the matrix..... > IN: > {{-1.850-1.993 \[ImaginaryI], -0.438-0.741 > \[ImaginaryI]},{-0.00919+0.01696 \[ImaginaryI],-10.80+0.938 > \[ImaginaryI]}} // Eigenvalues > OUT: > {-10.8017 + 0.937514 \[ImaginaryI], -1.84831 - 1.99251 \[ImaginaryI]} > ============================= > B) I can also get the eigenvectors of the matrix......... and they are > apparently distinct. > IN: > {{-1.850-1.993 \[ImaginaryI], -0.438-0.741 > \[ImaginaryI]},{-0.00919+0.01696 \[ImaginaryI],-10.80+0.938 > \[ImaginaryI]}} // Eigenvectors > OUT: > {{0.0196355 + 0.0888622 \[ImaginaryI], 0.99585+ 0.\[ImaginaryI]}, > {0.999998+0.\[ImaginaryI], -0.00148745 + 0.00140766 \[ImaginaryI]}} > ============================= > C) But not the exponential, although they are related. > IN: > {{-1.850-1.993 \[ImaginaryI], -0.438-0.741 > \[ImaginaryI]},{-0.00919+0.01696 \[ImaginaryI],-10.80+0.938 > \[ImaginaryI]}} // MatrixExp > OUT: > Dot::"inf": "Input matrix contains an infinite entry." > Dot::"inf": "Input matrix contains an infinite entry." > \[Infinity]::"indet": "Indeterminate expression (0.+0.\[ImaginaryI]) > ComplexInfinity encountered." > Dot::"mindet": "Input matrix contains an indeterminate entry." > Inverse::"inf": "Input matrix contains an infinite entry." > {{Indeterminate, Indeterminate},{0.00477109+ > 0.00196731\[ImaginaryI],0.000017144-0.0000126169\[ImaginaryI]}}.Inverse[{{Co mplexInfinity, > 0}, {0, 1}}] > ============================= > > I am not sure which one of the many dubious ways Mathematica uses for > its MatrixExp calculations. > Could someone enlighten me? I have observed that it happens as the > element differences become larger, although in the above example I would > not say they are that large. Is it that matrices need some rebalancing > before they are inserted in the MatrixExp[] function? > > Best > > Kyriakos. > _______________________________________ > Kyriakos Chourdakis > Lecturer in Financial Economics > University of London > Queen Mary > London E1 4NS > URL: http://www.qmul.ac.uk/~te9001 > Tel Wk: +44 207 7882 5086 > Tel Mb: +44 793 140 1304 > _______________________________________ > >