Robert M. Corless
Department of Applied Mathematics
University of Western Ontario
London, Canada

Copyright 2001 by Robert M. Corless
All rights reserved

Programming in Maple 

Программирование в Maple

Local vs. global vs. environment variables 

Локальные - глобальные - текущие переменные

Environment variables 

Текущие переменные

> restart;
> fu := proc( x ) bah( x ); EnvMyJunk := 3; bah( x ); end proc:
> bah := proc( y )
if type(_EnvMyJunk,posint) and _EnvMyJunk=5 then
WARNING( "It's 5, I tell you!" )
elif type(_EnvMyJunk,posint) and _EnvMyJunk=3 then
WARNING( "Look out, it's 3!" )
else
WARNING( "Everything's cool, it's not 3." )
end if;
end proc:
> _EnvMyJunk := 5;

_EnvMyJunk := 5

> fu( blort );

Warning, It's 5, I tell you!

Warning, Look out, it's 3!

> _EnvMyJunk;

5

> restart;
> p := x^3 + x + 1;

p := x^3+x+1

> alias( alpha=RootOf(p,x) );

alpha

> residue( 1/p, x=alpha );

0

> series( 1/p, x=alpha, 2 );

series(1/(alpha+1+alpha^3)+(-1/(alpha+1+alpha^3)^2*...

> Testzero := x -> evalb(Normalizer(x)=0);

Testzero := proc (x) options operator, arrow; evalb...

> Normalizer := x -> normal(simplify(x));

Normalizer := proc (x) options operator, arrow; nor...

> series( 1/p, x=alpha, 2 );

series(1/(alpha+1+alpha^3)+(-1/(alpha+1+alpha^3)^2*...

> forget( series );
> series( 1/p, x=alpha, 2 );

series(1/(1+3*alpha^2)*(x-alpha)^(-1)+O(1),x=-(-alp...

> residue( 1/p, x=alpha );

0

> forget( residue );
> residue( 1/p, x=alpha );

1/(1+3*alpha^2)

С официального разрешения                    © 2002 Waterloo Maple, Inc

 
Hosted by uCoz