bugGNU Octave - Bugs: bug #42181, slash operator on underdetermined...

 
 

bug #42181: slash operator on underdetermined system gives "minimum norm solution" instead of "basic solution"

Submitted by:  Hartmut <hardy>
Submitted on:  Thu 24 Apr 2014 07:49:37 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Wont FixAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.8.1Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Tue 29 Apr 2014 07:52:09 PM UTC, comment #7:

If it's for pedagogical purposes, I think this would be a great time to explain to students why the Moore-Penrose pseudoinverse is the best thing you can do in general for both over-determined and under-determined systems. It's nice that a single concept generalises to both cases. A discussion of least squares regression or the SVD could also be beneficial. This is, for example, how Strang's linear algebra text approaches the topic.

It's also a good opportunity to explain to students how Matlab isn't the infallible word of God and why Octave made a better choice here. A good way to help students stop using Matlab is to ensure that they don't deify it. It's flawed software just like everything else.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Fri 25 Apr 2014 08:42:15 PM UTC, comment #6:

My usecase is actually no specific calculation with Octave's solvers. But to teach a course on how to use Matlab and Octave for data analysis and simulations (using the Octave software, and thus doing a bit of advertisement for Octave). And therefore I try to only teach things that will work identically in Matlab as well as in Octave.

For this specific "usecase" Octave is "better" when it is more Matlab compatible. Regardless if this compatibility makes sense on real computaionals issues.

But in this "usecase" I can more or less live with small incompatibilities that give a significant benefit on "real" computational issues.

Hartmut <hardy>
Fri 25 Apr 2014 03:29:03 PM UTC, comment #5:

> Is the missing warning message also intentional?


Oh, yes, it is, Octave's definition matches the Moore-Penrose pseudoinverse, i.e. b*pinv(A) is almost the same as b/A.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Fri 25 Apr 2014 03:26:44 PM UTC, comment #4:

Well, first of all, even though I would hate doing it, my question is sincere: do we really have to mimic Matlab behaviour here? I can't think of a case where it's better than Octave's output. What was your case?

Mind you, we have had people who want Octave to be wasteful with memory (e.g. no special memory-saving diagonal matrix type) just because Matlab also wastes memory in a particular instance. So it could be that even if Matlab does something stupid, we have to mimic it exactly in Octave.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Fri 25 Apr 2014 08:18:44 AM UTC, comment #3:

Sorry, I wasn't aware of this behavior being intentional. Just mark this issue as "wont't fix".

Maybe a small note in the doc file would keep people like me from reporting this behavior as an incompatibility bug. E.g. "If the system is not square, or if the coefficient matrix is singular, a minimum norm solution is computed." (as it reads today) plus: "(This differs intentionally from the Matlab behavior for underdetermined systems.)"

Is the missing warning message also intentional?

Hartmut <hardy>
Thu 24 Apr 2014 05:40:15 PM UTC, comment #2:

This is intentional:

http://wiki.octave.org/Faq#Solvers_for_singular.2C_under-_and_over-determined_matrices

Matlab seems stupid here. Do we have to mimic all the stupidity and nothing but the stupidity?

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Thu 24 Apr 2014 07:54:42 AM UTC, comment #1:

Addendum:
Matlab issues a warning message, when it returns a result for an underdetermined linear system (see http://www.mathworks.de/de/help/matlab/ref/mrdivide.html ).
This would be another bit to increase Octave's Matlab compatibility.

Hartmut <hardy>
Thu 24 Apr 2014 07:49:37 AM UTC, original submission:

Here is a little script that shows the current Octave behavior (version 3.8.1):

This is an UNDERdetermined system of linear equations to be solved with the slash operator.

Octave does what it says in the documentation, it returns a "minimum norm solution". In this case [0.16 0.33 0.16].

Matlab returns a different result. In this case [0 0.5 0]. This is not automatically bad, since the system is underdetermined, and therefor has many solutions. But the Matlab result has an additional property (well documented in its help, e.g. at http://www.mathworks.de/de/help/matlab/math/systems-of-linear-equations.html#bt7ov7u ): Matlab returns "a basic solution, which has at most m nonzero components for an m-by-n coefficient matrix".

And in this sense the Octave result is incompatible to Matlab. The matrix A is a 3*2 coefficient matrix, thus a good Matlab result should contain no more than 2 nonzero components. But the Octave result has 3 nonzero components.

Hartmut <hardy>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by hardy (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 29 Apr 2014 07:52:09 PM UTCjordighStatusNeed Info=>Wont Fix
      Open/ClosedOpen=>Closed
    Thu 24 Apr 2014 05:40:15 PM UTCjordighStatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1