Question: what are the rules for using _Z inside a proc?

Is one not supposed to make _Z local variable?  If not, then how to insure the global _Z do not have some value assigned to it?

In this example below, I build some integral. I used local _Z for upport limit. But now Maple generate internal error.

If I do not declare _Z as local, and leave it global, then no error is generated.

But if I also declare _Z inside the proc as global _Z, then the error also goes away.

So is one always supposed to use _Z as global? 

The strange thing _Z is protected, so I cant assign to it value from global space. Message says Try declaring `local _Z`; see ?protect for details. but when I do that, I still get an error. 

So is the bottom line here is that one should not declare _Z local to a proc, and just assume it is always global symbol that has no assigned value to it, and that will always be safe to do?  I do not assign value to _Z inside my proc. Just wanted to use it for upper limit, as symbol.

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

foo:=proc()
 local _Z;
 local F,G,H,n;
 F:=x;G:=x;G:=x;n:=4;
 -RootOf(Intat(F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)/(-
         tau*F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)+F^(-n-1)*H^(-2*n+1)*(-G*F
         *n*H)^n*n^(-n)+tau^n),tau = _Z)-Int(-G,x)+C1)/G*H;
end proc:

foo()

Error, (in RootOf) expression independent of, _Z

boo:=proc()
 local F,G,H,n;
 F:=x;G:=x;G:=x;n:=4;
 -RootOf(Intat(F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)/(-
         tau*F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)+F^(-n-1)*H^(-2*n+1)*(-G*F
         *n*H)^n*n^(-n)+tau^n),tau = _Z)-Int(-G,x)+C1)/G*H;
end proc:

boo();

-RootOf(Intat(x^3/(H^3*tau^4-tau*x^3+x^3), tau = _Z)-(Int(-x, x))+C1)*H/x

boo2:=proc()
 global _Z;
 local F,G,H,n;
 F:=x;G:=x;G:=x;n:=4;
 -RootOf(Intat(F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)/(-
         tau*F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)+F^(-n-1)*H^(-2*n+1)*(-G*F
         *n*H)^n*n^(-n)+tau^n),tau = _Z)-Int(-G,x)+C1)/G*H;
end proc:

boo2()

-RootOf(Intat(x^3/(H^3*tau^4-tau*x^3+x^3), tau = _Z)-(Int(-x, x))+C1)*H/x

_Z:=5;

Error, attempting to assign to `_Z` which is protected.  Try declaring `local _Z`; see ?protect for details.

local _Z;
foo();

Warning, A new binding for the name `_Z` has been created. The global instance of this name is still accessible using the :- prefix, :-`_Z`.  See ?protect for details.

_Z

Error, (in RootOf) expression independent of, _Z

 

 

Download using_Z_inside_proc_august_28_2024.mw

Please Wait...