t> CALLING MAPLE COMMANDS
b>
t> Command Names
b>
t> Learning about Maple expressions and other data types, such as lists
t> and sets, has lead up to their most common use - as parameters in
t> commands.  As mentioned earlier, Maple has many (over 2000) built-in
t> commands stored in the Maple Library. Each command is called in the
t> following manner:
b>
t>      commandname(parameter1, parameter2, ...);
b>
t> The command names have been chosen to best represent the functionality
t> of the command and, at the same time, to take the least amount of typing
t> possible.  For example, the command for integration by parts is called
t> intparts, and the command for changing variables is called changevar.
t> Some command names are as short as one character long (e.g., D), while
t> others are well over ten characters long (e.g., completesquare). The
t> large majority of Maple commands are written entirely in lowercase
t> letters. One major point to never forget is that Maple is *case
t> sensitive*. That means that "diff", "Diff", and "DiFf" are all
t> different in Maple - whether they are used as command names or variable
t> names, Maple considers them three separate entities.
b>
c1>
t> Parameter Sequences
b>
t> Each Maple command takes a parameter sequence as input. This sequence
t> may contain several numbers, expressions, sets, or lists, or it may
t> contain no parameters at all. Regardless of how many parameters are
t> specified, always make sure to enclose the parameter in parentheses,
t> (). Other types of brackets will cause the input to be interpreted not
t> as parameters, but as something very different.
b>
t> Any type of Maple element that we have learned about (and a few that we
t> haven't) can be used as a parameter. Other command calls can be used as
t> input as well; these commands are evaluated and their results are
t> inserted in the parameter sequence. Some commands have restrictions on
t> what type of elements they accept as input, and with most commands the
t> ordering of parameters is also important. As well, all
t> commands have a minimum number of parameters that they can be called
t> with (e.g., int must have at least two parameters, an expression and a
t> variable of integration). Many commands, though, can handle more than
t> their minimum number of parameters. These "extra" parameters can
t> represent many things, including options controlling the functioning of
t> the command.
b>
c1>
t> The following are example of calls to Maple commands:
b>
c1>
x> diff(3*x^2+2*x-6, x);
x> diff(3*x^2+2*x-6, x, x);
x> isprime(10889);
x> int(int(x^2*y^3, x), y);
t> Questions
b>
c2> 
q> The second last command that was entered, isprime(10889);, tested an integer 
q> for primality. Use the command ithprime to discover the 1000th prime number.
a> ithprime(1000);
b>
c2>
q> The max command takes a sequence of values (of any length) and returns the
q> maximum value in that sequence. Use max to find the maximum of the values
q> 7/22, 157/50, and Pi.
a> max(7/22, 157/50, Pi);
eoq>
c1>
t> Where's That Command?
b>
t> It is not always sufficient to simply know the name of a command that
t> you want to enter - sometimes you have to explicitly load the command
t> from some part of the Maple library. Because Maple is very forgiving in
t> its nature, it will let you call a command that has not been loaded or
t> does not exist, and will simply echo the input back at you as to say,
t> "OK, I'll let you use that command name, even though it doesn't mean
t> anything to me right now." Following are a few examples of such
t> behavior.
b>
c1>
x> INT(x^2, x);
x> factors(3*x^2+6*x+3);
x> mean(1, 2, 3, 4, 5, 6);
b>
t> When this happens, check to make sure that you have spelled the command
t> correctly (including proper lowercase and uppercase letters) and loaded
t> the function into Maple's memory.
b>
c1>
t> Automatically Loaded and readlib Defined Functions
b>
t> When Maple starts up, it does not have any commands entirely loaded
t> into memory. There are however, many standard commands that have
t> pointers to their locations loaded. When you call one of them for the
t> first time, Maple knows automatically from where to load it.
t> Other functions that reside in the library are not automatically
t> loaded, but must first be explicitly loaded in with the Maple command
t> readlib (read from the library). If you try entering a command that is
t> in the standard library but it does not seem to work, try doing a
t> readlib of it first.
b>
t> The following are some examples of both automatically loaded and
t> readlib defined functions.
b>
c1>
b>
x> expand((x-2)*(x+5));
x> factors(3*x^2+6*x+3);
c1>
x> readlib(factors);
x> factors(3*x^2+6*x+3);
b>
t> Once a command has been loaded into memory, it does not need to be
t> reloaded during the current Maple session.
b>
c1>
t> Functions in Packages
b>
t> Maple contains over a dozen specialized sets of commands called
t> packages (e.g., linalg, liesymm, etc.). The routines in these packages
t> are not loaded automatically, and cannot be accessed with the readlib
t> command.  The first method to access these commands is to use the
t> "with" command to load in pointers to all the commands in a package.
t> Then, when any of the commands in that package are called, they are
t> automatically loaded into memory. Another way is to call the command
t> with its package name prepended to it. A few examples will illustrate
t> these methods.
b>
c1>
x> with(combinat);
x> numbperm([1,2,3,4]);
c1>
x> stats[mean]([1,2,3,4,5,6]);
eof>

