## Check Matrix argument when entering a procedure...

Hello,

To check my arguments in a procedure I need something like

myproc := proc(M :: Matrix(square, rational)

, N :: Matrix(shape=triangular[lower, unit], datatype = rational
, O :: Matrix(shape = square, dimension = 5

)

end proc;

How does that work in Maple? What is the correct Syntax? I tried many different things that doesn't fit.

## How to Test Input Typed to a Procedure to Determi...

Trying to write a generat purpose procedure insteat of having 3 or 4 different named procceduers.

Need to determine the input types of say A,B,C

Proc(A,B,C)

1) A,B,C could be for the form 3/2 , 5x-7 , x^2-sqrt(x+3)  i.e numbers or formulas

2) A,B,C could be 2 elenent lists [2,3]  , [5x-6y,8x+2] ,[2,sqrt(3)]  i.e 2D points

3) A,B,C could be 3 element lists as above    i.e 3D points

4) A,B,C could be 2D vectors

5) A,B,C could be 3D vectors

A, B, C will not be of mixed types but would be good to check A, B, C for consistency and if not retrun an error

Looking to calculate output based on

If type 1) ......

elif type 2).....

.

.

elif type 5)...

end if

return.....

end proc

## Type check of parameters, take II...

The issue Type check of parameters was resolved using the depends modifier. As far as I can tell, this modifier is not allowed for expected or keyword parameters, though. Thus the issue seems to reemerge for these types of parameters. Consider the following test example:

`createModule := proc(V::Vector)   local dim := LinearAlgebra:-Dimension(V);   module()      export f,g,h;      f := proc( x::depends('Vector'(dim))              ) x end proc;      g := proc( x::expects('Vector'(dim)) := something ) x end proc;      h := proc({x::        'Vector'(dim)  := something}) x end proc;   end moduleend proc:createModule(Vector(4)):-f(    Vector(4));createModule(Vector(4)):-g(    Vector(4));createModule(Vector(4)):-h(x = Vector(4));`

The function f is just a restatement of the already resolved issue, compare the above link, while the functions g and h are for the expected and keyword parameter cases, respectively. The problem remains the same: the variable dim is not evaluated for g and h. What to do? Does there exist a solution equally satisfactory as the one for f?

## Type check of parameters...

Consider the following two test procedures for creation of the same module:

`createModule1 := proc(dim::posint)    module()        export det;        det := (x::Matrix(1..dim,1..dim)) -> Determinant(x);    end moduleend proc:`

and

`createModule2 := proc(A::Matrix(square))    local dim;    dim := RowDimension(A);    module()        export det;        det := (x::Matrix(1..dim,1..dim)) -> Determinant(x);    end moduleend proc:`

as well as the following code lines calling these:

`createModule1(       2 ):-det(IdentityMatrix(2));createModule2(Matrix(2)):-det(IdentityMatrix(2));`

The first line executes unproblematically, while for the second line an error results concerning the dimensionality check 1..dim,1..dim of the matrix. Why is dim available/initialized in the first version, while not in the second?

## How to check whether an expression is a sum of var...

I do the following:

`restart; z := x + y; type(z, specfunc(name, `+`));`

However the result is 'false'. How to correct my type checking?

## Type Declaration in Procedure...

`{[n,N]::positive:=1}`