Basic Commands

Basic commands for Maple

> x^2-3*x+3;


Two mathematical statements can be placed on the same line. Usually there will be a line of output for each command. For example,

> x^2-3*x+3;subs(x=2,x^2-3*x+3);



> arctan(1);

$\dfrac{1}{4}\pi $

> arctan(1.0);


In the first expression the one is the exact one. Therefore, Maple returns an exact answer. In the second expression, the request to find the inverse tangent of 1.0 signals that the one is not exact, that the number 1.0 is itself an approximation (to something). Hence, it returns an approximation to the answer. Similarly, we have

> sqrt(8); sqrt(8.0);

2 sqrt(2)


"Though not a mathematical command, help is a command we strongly recommend that every

Maple user become familiar with. The Maple help pages are

comprehensive and

very well written."

?topic or ?topic,subtopicor

help(topic) or help(topic,subtopic)

There are other forms, as well. In addition, one can obtain help by selecting the Help+Full Topic Search buttons from the main menu line. Examples:

> ?help;

> help(intro)

gives an excellent introduction to Maple.

> ?least squares;

gives important information on how to compute the least squares approximation of a data set.

> f := sqrt(8);


will assign the value $\sqrt{8}=2\sqrt{2}$ to the variable f. It is very easy to forget the colon in the assignment process. This is one mistake you are likely to make - even more than once.

expand(expr, expr1, expr2, ..., exprn);

where the arguments are mathematical expressions. The primary application of expand is to distribute products over sums. This is done for all polynomials. For quotients of polynomials, only sums in the numerator are expanded --- products and powers are left alone. Expand also knows how to expand most of the mathematical functions, including sin, cos, tan, exp, and others. Examples,

> expand((x+1)*(x+2));


> expand((x+1)/(x+2));


> expand((x^2+1)^7);


We will apply expand to other types of functions in the chapter on basic functions.


simplify(expr, n1, n2, ...);

simplify(expr, assume=prop);

where expr is any expression and n1 , n2,... - (optional) are names or sets or lists. Prop denotes any property, such as "real", or "positive". The simplify function is used to apply simplification rules to an expression. If only one argument is present, then simplify will search the expression for function calls, square roots, radicals, and powers. In the case of two or more arguments where the additional arguments are names, simplify will only invoke the simplification procedures specified by the additional arguments. Examples:

> simplify(4^(1/2)+3);


> simplify((x^a)^b+4^(1/2), power);



where expr is a multivariate polynomial with integer, rational, (complex) numeric, or algebraic number coefficients.

For example consider

> f :=expand((x^2+1)^7);


> factor (f);


This command is remarkably handy. What will it do, if the factorization is more complicated? Consider the expression MATH What will happen if we factor this cubic?

> factor (x^3+x^2+x+1);

But with just a dash of specific information such as the fact we are dealing with complex numbers we obtain

> factor (x^3+x^2+x+1, complex);

Maple has factored the polynomial in the complex plane. Mathematically, any quartic has a factorization into irreducible (over the field of reals) quadratics and has linear factors in the complex plane. Maple will find the quadratic factors, if it can. However if you give integers, the exactness paradigm forces Maple to that end. For example, we have

> factor(x^4+2*x^3+x^2+x+1); Here everything must be exact.


> factor(x^4+2*x^3+x^2+x+1.0); Here numerical answers are allowed; hence Maple finds ONE irreducble quadratic and the other factors.
$\allowbreak $

> factor(x^4+2*x^3+x^2+x+1, complex); All four complex (real) roots are computed.



Try these commands factor(x^5+x^4+2*x^3+x^2+x+1); and factor(x^5+x^4+2*x^3+x^2+x+1, complex);

combine(f, power);

Parameters: f - any expression involving powers are combined by applying the following transformations:

x^y*x^z ==> x^(y+z)

(x^y)^z ==> x^(y*z)

exp(x)*exp(y) ==> exp(x+y)

exp(x)^y ==> exp(x*y)

sqrt(-a) ==> I*sqrt(a)

a^n*b^n ==> (a*b)^n


> combine(x^2*x^3, power);

> combine((x^z)^2, power);

$\allowbreak x^{2z}$

Other key words in the combine function may also yield useful results. For example,

combine(f, exp);

where expressions involving exponentials are combined by applying the following transformations:

exp(x)*exp(y) ==> exp(x+y)

exp(x)^y ==> exp(x*y)

exp(x+n*ln(y)) ==> y^n*exp(x) where n is an integer

Other combine commands are combine(f, ln), combine(expr, radical), and combine(f, trig). Each has obvious connotations.

> Digits:=25;

Digits := 25

> sqrt(2.0);


> 4*arctan(1.0);



Set the number of digits to 1500 and execute the two commands above.

This document created by Scientific Notebook 4.0.