Suppose we want to find out the maximum degree to which the variable occurs in the expression , ignoring cases where is inside a non-polynomial function.
The default command to use for this is degree, but it requires that its argument is a polynomial. The expression is not a polynomial because of the occurrence of , so straightforward application of the degree command will fail.
Using frontend freezes the sine function. As a consequence, degree now succeeds: all it sees is a polynomial.
>
|
|
Here is another example. Suppose we want to expand the square in the following expression .
Straightforward application of the expand command also expands the trigonometric expressions, which we may not want to happen.
If we apply frontend, it freezes the trigonometric expressions. The expand command then sees something of the form and expands it to , not knowing or caring that represents and represents . Afterwards, frontend substitutes the original trigonometric expressions for the variables.
>
|
|
| (6) |
In the final example, we use the indets command to find the indeterminates in the expression . We examine several variations of how to call indets to get various results.
>
|
|
| (7) |
By default, indets returns all subexpressions of that are not sums, products, or constants.
| (8) |
Let's examine what frontend does to . We can do this with the following frontend call, in which we use print for the procedure p:
We see that frontend replaces each of the four terms with a (new) variable called O. This means that in the following call, indets simply sees a sum of four variables, and returns these variables. frontend then replaces the original four terms for them.
>
|
|
| (10) |
If we specify that frontend should not freeze any subexpressions of type radical, then will not be frozen. Let's examine this again by using print as the procedure p.
>
|
|
This means that in the following call, indets sees the unfrozen expression plus three variables O. It returns the three Os, , and itself. Then frontend substitutes the three original other terms for the Os and returns the result, as follows:
>
|
|
| (12) |
Finally, in the following call, we specify that frontend should not freeze any subexpressions that contain the expression . This means the term by itself, but also the term .
>
|
|
| (13) |
Consequently, in the corresponding indets call, the expressions and are frozen as new variables O, and indets can not look inside the expressions to find the separate variables and . It does, however, see the expression , and it recognizes it as a constant that is not to be included in the set of indeterminates. It also sees the variable , which is also returned.
>
|
|
| (14) |