octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63950] trapz inconsistent results and error m


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #63950] trapz inconsistent results and error messages with empty inputs
Date: Tue, 21 Mar 2023 13:18:07 -0400 (EDT)

Update of bug #63950 (project octave):

                 Summary: trapz error with empty inputs => trapz inconsistent
results and error messages with empty inputs

    _______________________________________________________

Follow-up Comment #6:

also worth noting that octave currently allows a superset of matlab allowed
inputs to trapz.  e.g. it allows different domains for X:

Octave:

>> x = reshape(0:15,4,4)
x =

    0    4    8   12
    1    5    9   13
    2    6   10   14
    3    7   11   15

>> y = magic(4)
y =

   16    2    3   13
    5   11   10    8
    9    7    6   12
    4   14   15    1

>> trapz(x(:),y(:))
ans = 127.50

>> trapz(x(:,1),y)
ans =

   24   26   25   27

>> trapz(x,y)
ans =

   24   26   25   27


whereas matlab:

>> trapz(x(:),y(:))
ans =
  127.5000
>> trapz(x(:,1),y)
ans =
    24    26    25    27
>> trapz(x,y)
Error using trapz
X must be a vector. 


so, some of that will play into octave having a different error set and
possibly handling empties for input 1 differently.

I guess this report really boils down to whether Octave's current empty input
handling is:

 1. compatible for valid matlab inputs.  so far seems like it is.

 2. consistent/useful for any other non-error producing input empty input. 
not sure about this.

 3. do any error messages make sense. not sure here either. (e.g., 'x and y
must be have same shape' when trapz(x(:,1),y) is perfectly valid.)



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63950>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]