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

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

[Octave-bug-tracker] [bug #59403] integral2 and quad2d functions do not


From: Luis Kao
Subject: [Octave-bug-tracker] [bug #59403] integral2 and quad2d functions do not catch incorrect dimensions for matrix multiplication
Date: Thu, 5 Nov 2020 11:25:08 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36

Follow-up Comment #4, bug #59403 (project octave):

After seeing the comments and checking the documentation again, I would like
to provide some extra arguments.

----

If the user's intention is to do matrix multiplication, they will expect a
matrix output. For example


function z = f(x,y)
  z = sinc(x) * sinc(y);
endfunction

x = [1 2; 3 4];
y = [5 6; 7 8];

f(x, y)
    =>   2.0836e-49  -3.7300e-50
         2.0836e-49  -3.7300e-50


And since that's the form of the original function, I suspect that they would
want a matrix output from integral2/quad2d as well.


Another thing is that the documentation says
>     F is a function handle, inline function, or string containing the
>     name of the function to evaluate.  The function F must be of the
>     form z = f(x,y) where X is a vector and Y is a scalar.  It should
>     return a vector of the same length and orientation as X.

I don't know the implementation reason why Y should be a scalar, but it seems
like current behaviors of integral2/quad2d disagree with the documentation.


function z = f(x,y)
  disp("Y isscalar:");
  isscalar(y)
  z = sinc(x) * sinc(y);
endfunction

integral2(@f, -1, 1, -1, 1);


The result from the script above is

Y isscalar:
ans = 0
Y isscalar:
ans = 0
Y isscalar:
ans = 0
Y isscalar:
ans = 0


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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