Professional Documents
Culture Documents
Command
Description
1. General Commands and Conventions
f (a)
% (previously: )
an;
n-th power of a
sqrt(a);
evalb(a = b);
a[n];
plot(expression, x = a..b);
f := x> expr
definition of subroutine a
assignment
remainder of division of a by b
f rac(x);
igcd(a, b);
igcdex(a, b,0 x0 ,0 y 0 );
x; y;
ithprime(n);
isprime(n);
if actor(n);
Command
Description
3. Sets and Lists: Basic Structure
s := {1, 2, 3, 4, 5};
a := [1, 2, 3, 4, 5];
s := {seq(f, i = 1..5)};
a := [seq(f, i = 1..5)];
nops(a);
a[i]
member(e, a);
member(e, a, p ); p;
type(s, set);
type(a, list);
s := convert(a, set);
a := convert(s, list);
s union t; or union(s, t, . . .)
s intersect t;
s minus t
[op(a), op(b), . . .]
a := [e, op(a)];
a := [op(a), e];
a := subsop(i = e, a);
sort(a);
[select(bool, a)];
map(f, a);
mpl2
Command
Description
5. Character Strings
length(str);
substring(str, m..n);
searchtext(st, str)
convert(expr, string);
type(str, string)
b := true; b := f alse;
evalb(bool)
type(b, boolean)
RET U RN (expr)
mpl3
Command
Description
9. Complex Numbers
z := x + y I;
abs(expr);
argument(expr)
Re(expr); Im(expr);
conjugate(expr);
evalc(expr)
convert(expr, polar)
type(expr, complex)
f := x n + a1 x (n 1) + . . . ;
degree(f, x)
degree of f in x
coef f (f, x, n)
coef f s(f, x)
lcoef f (f, x)
tcoef f (f, x)
collect(f, x)
expand(expr)
sort(f )
subs(x = a, f )
evaluate f (x) at x = a
Eval(f, x = a) mod p;
f mod n;
gcd(f, g, x)
0 0 0 0
gcd(f, g, x, s , t )
f actor(f )
F actor(f ) mod p
factor f modulo p
roots(f )
interp(x, y, t)