bugGNU Octave - Bugs: bug #44849, expm() produces incorrect result

 
 

bug #44849: expm() produces incorrect result

Submitter:  None
Submitted:  Wed 15 Apr 2015 06:19:32 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Peter Roopnarine Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.4
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 15 Apr 2015 06:42:27 PM UTC, comment #3: 

Ah your post just crossed mine :-)

OK I'll close with "invalid"  (but remember to upgrade!)

Philip Nienhuis <philipnienhuis>
Group Member
Wed 15 Apr 2015 06:40:46 PM UTC, comment #2: 

I'm afraid you made a typo.
On the page you mentioned, matrix A is defined as:

A = [0,-0.785398,0;0.785398,0,0;0,0,0];

rather than

A = [0,-0.785398,0;0.785398,0,0;0,0,1];  ## See last element!

With the proper A, both Octave-3.8.2 and Octave-4.0.0-rc4 do:

>> A = [0,-0.785398,0;0.785398,0,0;0,0,0];
>> expm(A)
ans =

   0.70711  -0.70711   0.00000
   0.70711   0.70711   0.00000
   0.00000   0.00000   1.00000


With that out of the way, how about the n=47 and n=111 sized matrices? Do you have examples with expected outcomes?

BTW Octave-3.6.4 is quite old. Better upgrade to 3.8.2 at least, or wait a month or so and you'll have 4.0.0.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 15 Apr 2015 06:40:23 PM UTC, comment #1: 

Please cancel. There is an error in the B matrix as entered.

Anonymous
Wed 15 Apr 2015 06:19:32 PM UTC, original submission:  

I ran expm(), the matrix exponentiation function on several large (n=47 and n=111) asymmetric square matrices and received unexpected results (numerically very large). I then compared the output of a much smaller matrix to that given by the Eigen C++ exp() function and the results differ. The Eigen results are, I believe, correct. Here is the Octave code:


B = [0,-0.785398,0;0.785398,0,0;0,0,1];
expm(B)
ans =

   0.70711  -0.70711   0.00000
   0.70711   0.70711   0.00000
   0.00000   0.00000   2.71828

Element (3,3) should be 1.
Here is a link to the Eigen page
http://eigen.tuxfamily.org/dox/unsupported/group__MatrixFunctions__Module.html#matrixbase_exp

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-04-15 philipnienhuis StatusNeed Info Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
    2015-04-15 philipnienhuis StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code