Bug in matrix operation using MatrixExp?

• To: mathgroup at smc.vnet.net
• Subject: [mg29218] Bug in matrix operation using MatrixExp?
• From: "SANCHEZ DE LEON, Guillermo" <gsl at fab.enusa.es>
• Date: Tue, 5 Jun 2001 04:21:49 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```I have tested the Mathematica function: MatrixExp. I think that this function has a
bug. Here is an example (I avoid the outputs because they are to long):

The below function evaluate MatrixExp[A1 t] but using Laplace Transform
(n=dimension (nxn), it is a square matrix):

ExpMatrixLT[n_,A1_]:=
Module[{B,R,P},B=s IdentityMatrix[n]- A1 ;R=Inverse[B];P= Apart[R];
InverseLaplaceTransform[ P,s,t]]

In this example I define A as follow:

model1 ={{-3.`,1,1},{2,-1,0},{0.3`,0,-2}};

Now I evaluate the exponetial matrix using the Mathematica: MatrixExp[A t] , with A
= model1

MatrixExp[model1 t];

(*I test the solution for t= 0, it should be a Identity matrix*)

Chop[%/.t->  0,10^-6] (*Solution fine*)

(*I test the solution for t= 1*)

%%/.t-> 1

{{0.19698899325524824`,0.22096628734547427`,
0.13291291316188164`},{0.44193257469094854`,0.6125055556911189`,
0.17610674836718532`},{0.03987387394856449`,0.02641601225507779`,
0.1537951580499446`}}

Now I apply  the same computation but using ExpMatrixLT[n,A1]

ExpMatrixLT[3,model1 ];

Chop[%/.t->10^-6] (*Solution fine*)

%%/.t -> 1
{{0.19698899325524835`,0.22096628734547444`,
0.13291291316188178`},{0.4419325746909489`,0.6125055556911194`,
0.1761067483671854`},{0.03987387394856454`,0.02641601225507781`,
0.15379515804994467`}} (*Solution fine, it the same that I obteined
using ExpMatrix*)

But when the matrix dimension increase the problems start

In this example it is define A1 as follow:

model2 = {{-34.9897, 0.347, 8.32, 0.0347, 0.000019, 0.092, 0.00019, 0,
0.00038,
0.0693, 0, 0.000493, 0.0693, 0, 0.0000821}, {0.245, -0.347, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0,
0, 0, 0}, {10.5, 0, -8.32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1.63, 0, 0, -0.0347, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0.0735, 0, 0,
0, -0.000019, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0}, {0.367, 0, 0, 0, 0, -0.09893, 0, 0, 0, 0, 0,
0,
0, 0, 0},
{0, 0, 0, 0, 0, 0.00693, -0.00019, 0, 0, 0, 0, 0, 0, 0, 0},
{2.94, 0, 0, 0, 0, 0, 0, -0.099, 0, 0, 0, 0, 0, 0, 0}, {0.0122, 0, 0, 0,

0, 0, 0, 0,
-0.00038, 0, 0, 0, 0, 0, 0}, {2.04, 0, 0, 0, 0, 0, 0, 0, 0, -0.1386,
0.0173, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0693, -0.0173, 0, 0, 0, 0}, {0, 0, 0, 0,
0,
0, 0, 0, 0, 0, 0,
-0.000493, 0, 0, 0}, {1.63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.1386,
0.0173, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0693, -0.02308, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.00578, -0.0000821}};

MatrixExp[model2 t];

%/.t->  0 (*Wrong solution*)

%%/.t-> 1(*Wrong solution*)

but with ExpMatrixLT the computation is slower but the solution look likes
OK.

ExpMatrixLT[15,model2 ];

Chop[%/.t->0,10^-6] (*solution OK*)

%%/.t-> 1 (*solution OK*)

I will appreciate comments. Am I in a mistake or MatrixExp work wrong in
these case?. Thanks

```

• Prev by Date: Inverse Interpolating Functions
• Next by Date: Re: Classifying by Inequalities???
• Previous by thread: RE: Inverse Interpolating Functions
• Next by thread: I am looking for references