expm doesn't work correctly.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

expm doesn't work correctly.

che6yoh
Dear Sirs,

I am using octave-0.71.1 installed with gcc-2.3.3 on sun
SPARC(sunOS-4.1.1).

expm doesn't work correctly.
I add two examples of expm strange results.
For simple matrix like a=[1,2;3,4],
the correct answer is given by expm(a);
The trouble seems to be occured when the Jordan form of the
matrix is not diagnal.
 
Is the trouble caused by my installation or a bug of octave?

I am looking forward to getting reply.

I am sorry I sent a mail without my name or address.

Yoshihiro Hashimoto
Dept. of Systems Eng., Nagoya Inst. of Tech.
[hidden email]
[Now]Dept. of Chem. Eng., The Univ. of Leeds
[hidden email]
--------------------------------------------------------------
The mail to [hidden email] will be sent to
[hidden email] automatically.


===============================================================
[EXAMPLE1]

octave:1> f=[0 1 0 0 0;0 0 1 0 0;0 0 0 0 0;0 0 0 0 0;0 0 0 0 0]
f =

 0 1 0 0 0
 0 0 1 0 0
 0 0 0 0 0
 0 0 0 0 0
 0 0 0 0 0

octave:2> g=expm(f)
g =

 1 -1 1 0 0
 0 0 0 0 0
 0 0 0 0 0
 0 0 0 1 0
 0 0 0 0 1

The result of MATLAB is

MATLAB>> g=expm(f)

g =
     1.0000   1.0000   0.5000        0        0
          0   1.0000   1.0000        0        0
          0        0   1.0000        0        0
          0        0        0   1.0000        0
          0        0        0        0   1.0000


[EXAMPLE2]

octave:4> w=[0 0 0 0 0.3;0.3 -0.42 -0.42 -0.3 0;0 0.3 0 0 0;0 0
0.3 0 0;0 0 0 0
 0]
w =

 0 0 0 0 0.3
 0.3 -0.42 -0.42 -0.3 0
 0 0.3 0 0 0
 0 0 0.3 0 0
 0 0 0 0 0

octave:5> v=expm(w)
v =

 (0.408248, 0) (0.408248, 0) (0.408248, 0) (0.5, 0) (-0.5, 0)
 (2.84938e-16, -0.402859) (-0.00663493, 0.00348261) (0.545972, 0.286576) (0.302438, -2.87586e-16) (-0.302438, 2.56773e-16)
 (-2.74237e-16, 0.552394) (0.545972, -0.286576) (-0.211754, -0.111148) (-0.302438, 3.94334e-16) (0.302438, -3.52084e-16)
 (0.408248, 0.181901) (0.196494, 0.111148)
(-0.0530224,-0.242117) (0.802438, 1229853e-16) (-0.802438, -1.1594e-16)
 (0, 0) (0, 0) (0, 0) (0, 0) (0, 0)

v must be a real matrix.