Download Maple Programming Guide

Transcript
124 • 3 Maple Expressions
> type( 1, '{integer, name}' );
(3.481)
> type( x, '{integer, name}' );
(3.482)
The type set(type) matches a set of elements of type type.
> type( {1,2,3,4}, 'set(integer)' );
(3.483)
> type( {x,2,3,y}, 'set({integer, name})' );
(3.484)
Similarly, the type list(type) matches a list of elements of type type.
> type( [ 2..3, 5..7 ], 'list(range)' );
(3.485)
is not of type anything^2.
Note that
> exp(2);
(3.486)
> type( (3.486), 'anything^2' );
(3.487)
Because
is the typeset version of exp(2), it does not match the type anything^2.
> type( exp(2), 'exp'(integer) );
(3.488)
The next example illustrates why you should use unevaluation quotes (') to delay evaluation
when including Maple commands in type expressions.
> type( int(f(x), x), int(anything, anything) );
Error, testing against an invalid type
An error occurs because Maple evaluates int(anything, anything).
> int(anything, anything);
(3.489)