1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2020 - Samuel GOUGEON - Le Mans Université
4 // This file is hereby licensed under the terms of the GNU GPL v2.0,
5 // pursuant to article 5.3.4 of the CeCILL v.2.1.
6 // This file was originally licensed under the terms of the CeCILL v2.1,
7 // and continues to be available under such terms.
8 // For more information, see the COPYING file which you should have received
9 // along with this program.
11 function M = polyint(M, cstes)
12 // M : array (from scalar to hypermatrix) of polynomials with real or
13 // complex coefficients
14 // Cstes: Integration constants (real or complex): scalar, array of size
15 // size(M), or list of mixed scalar or sized(M) arrays or
16 // undefined elements (valued as 0).
22 M = [ -1+%z, 1+2*%z+%z^2 ; 2-%z^3, 6]
23 mprintf("\n%s", "polyint(M)")
25 mprintf("\n%s", "polyint(M, 1)")
27 mprintf("\n%s", "polyint(M, [1 2 ; 3 4])")
28 I = polyint(M, [1 2 ; 3 4])
41 msg = _("%s: Argument #%d: Polynomial expected.\n")
42 error(msprintf(msg, "polyint",1))
44 if ~isdef("cstes","l")
47 if and(type(cstes)<>[1 15])
48 msg = _("%s: Argument #%d: numbers or list of numbers expected.\n")
49 error(msprintf(msg, "polyint",2))
51 if type(cstes) <> 15 then
54 for i = 1:length(cstes)
58 msg = _("%s: Argument #%d(%d): Decimal or complex number expected.\n")
59 error(msprintf(msg, "polyint",2,i))
61 if length(k)<>1 & or(size(k)<>s)
62 msg = _("%s: Argument #%d(%d): Array of size [%s] expected.\n")
63 ts = strcat(msprintf("%d\n",s(:))," ")
64 error(msprintf(msg, "polyint", 2, i, ts))
82 d = max(max(degree(M),0))
88 M = inv_coeff(c, d, varn(M))