From help-octave-request Tue May 25 12:11:28 1993 Subject: expm doesn't work correctly. From: che6yoh at sun dot leeds dot ac dot uk To: help-octave Date: Tue, 25 May 93 17:37:25 BST 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. hasimoto at coral dot system dot nitech dot ac dot jp [Now]Dept. of Chem. Eng., The Univ. of Leeds che6yoh at sun dot leeds dot ac dot uk -------------------------------------------------------------- The mail to hasimoto at coral dot system dot nitech dot ac dot jp will be sent to che6yoh at sun dot leeds dot ac dot uk 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.