Up to Main Lab Page | Next Lesson - Program Control | Previous Lesson - Plotting |
There are a number of Maple functions which allow use to manipulate expressions in various ways. They are mostly used for polynomials in the dependent expression, but can sometimes be used in more complicated situations.
These functions generally expect an expression as their first argument, since they need to know the name of the free variable. Thus we would call simplify(f(x),x); rather than simplify(f,x). Most of these functions have the syntax function(expression, variable name[, optional arguments]). Many of these functions only find thier real power when dealing with multivariate functions, though some of them are useful for functions of one variable.
Function | Syntax | Explanation |
---|---|---|
expand | expand(expression) | Distributes sums across products and applies certain algebraic rules |
combine | combine(expression) | Combines varibles in an expression using algebraic rules (opposite of expand). |
simplify | simplify(expression) | Simplifies an expression as much as possible. |
When using these functions it is important to realise the mathematical
limitations implicit in them.
You are encouraged to use the Maple online help for these functions.
Expand allows further expression as optional arguments which indicate that this
expression should not be expanded. Some examples:
>expand(x*(x+1)*(x+2));
>expand(x*(x+1)*(x+2), x+1);
>expand(sin(x)*(x+cos(x)));
>expand(sin(a+b)*(a+cos(a+b)));
>expand(sin(a+b)*(a+cos(a+b)), sin(a+b));
>expand(sin(a+b)*(a+cos(a+b)), sin(a+b), cos(a+b));
Another optional argument uses the 'assume property' syntax. Thus we may tell
Maple that the variables are assumed to have some special property.
The syntax is simplify(expression, assume=property), where property is one
of
positive, real, integer, a range (as with the piecewise function)
There are other properties, see help on assume.
Consider the following example:
> g:=sqrt(x^2);
factor | factor(expression) | Tries to factor a polynomial | |
collect | collect(expression, variable) | Collects all occurences of the variable in expression. | |
coeff | coeff(expression, variable, n) | Outputs the coefficient of (variable)n | |
normal | normal(expression) | Puts a rational function in 'Simplified Normal Form' |
Up to Main Lab Page | Next Lesson - Program Control | Previous Lesson - Plotting | Top of this Lesson |