Warning: ... is implicitly declared local
Maple provides this warning when you define a function using a variable which you do not declare as local or global, but which Maple assumes is local. Maple makes this assumption for any undeclared variable that is assigned a value in the procedure, or is the index variable in a for loop. Any other undeclared variable is assumed to be global, and no warning is given for it.
If you have no objection to the variable being local, you can ignore the warning. It is generally a good idea for index variables in for loops to be local, because you usually don't need or want to refer to these variables outside the loop. However, in some cases you do want the variable to be global. In particular, a common situation would be where you use a procedure to set the values of some global variables. Or you may want to have access to the values of some variables from another procedure which this one calls, without using a formal parameter. In these cases, you should use the global declaration to make the variables global.
The variable y is assigned a value in the procedure, and therefore is taken to be local.
> foo:= proc(x) y:= x+1 end;
Warning, `y` is implicitly declared local
Since it is local, the procedure has no effect on the global variable y :
> foo(3): y;
If the procedure is to be used to assign a value to y , that variable should be declared global.
> foo:= proc(x) global y; y:= x+1 end;
> foo(3): y;
In this example, in order for both procedures a and b to have access to variable y (without passing that name as a formal parameter) , it must be declared global in both procedures.
> a:= proc(x) global y; y:= 1; b(x); y end;
> b:= proc(x) global y; y:= y + x end;
Index variable in a for loop:
> foo:= proc(x) for j from 1 to x do print(`Hello`,j) od end;
Warning, `j` is implicitly declared local
See also: procedure , for , Local procedures don't access local variables
Maple Advisor Database R. Israel, 1997