Failure in using the int2d function / 6 argument form returns error message


I would like to use the “int2d” function to numerically calculate a double integral.
Unfortunately, the equation is a bit cumbersome and Scilab gives me the following error message, indicating that I have exceeded the number of evaluations allowed by Mevals:

“int2d: Means termination because the number of function evaluations has exceeded MEVALS.”

After some information obtained on the scilab site, I realized that it was possible to define the number of evaluations, by adding the parameters in vector form.
So I’ll enter an example, keeping it simple to start with, and copying the parameters given by default on the scilab site as they are:

function z = f(O,Zm)
z = O+Zm;

I = int2d(0,1,0,1,f,[1.d-10, 1, 50, 4000, 1]);

Note that the formalism respects the last example given on the following page: int2d - Definite 2D integral by quadrature method

So, it respects the form:

[I, err] = int2d(xmin, xmax, ymin, ymax, f, params)

Scilab sends the following error message:

int2d: Wrong size for input argument #6: 5 expected.

However, the number of arguments is indeed 6 in the example, counting params of course.

Whatever form I try to give afterwards, replacing parentheses with apostrophes, commas with spaces… Scilab doesn’t want to know anything and refuses the last form. It’s interesting to note that the form [I, err] = int2d(X, Y, f, params) returns me a result (but useless since it’s an example, I have to use the 6 argument form for the equation in question).

Is this a software programming error? How can I add this parameter? I really need this because without it int2d will fail to perform the calculation and will get stuck.

Thank you for your time,


Welcome on Scilab’s discourse!

Thanks for having described the problem you are facing. It looks like a bug in the parsing of arguments. Can you create an issue at Issues · scilab / scilab · GitLab? You won’t have to give a lenghly description (you can include a link to this post), however, the code of a short failing example would be nice.