1 /* First load the necessary file:*/
3 /* The function EXPANDWRT expands its first argument
4 with respect to its other arguments. All products of
5 these other arguments appear explicitly in the result.
6 First we create an expression to work on: */
9 /* Positive integer powers of similar factors are also
11 exp2:(a*b+c+d)^2*(a+b);
13 /* By default, EXPANDWRT expands the arguments of operators,
14 in analogy to EXPAND:*/
15 expandwrt((a+sin((log(a)+b)*(a+b)))*(a+b),a);
16 /* But by setting EXPANDWRT_NONRAT:FALSE, the expansion of
17 such arguments is inhibited. */
18 expandwrt_nonrat:false$
19 expandwrt((a+sin((log(a)+b)*(a+b)))*(a+b),a);
20 /* By default, denominators are not processed at all: */
21 exp3:(a*b+c+d)*(a+b)/(c+a)^2;
23 /* But by setting the switch EXPANDWRT_DENOM to TRUE,
24 the denominator will also be processed: */
27 expandwrt_denom:false$
28 /* Operator names appearing in the argument list have the
30 exp4:(a.b+c)*(a+c.d+e.f+g);
32 /* Notice that the expansion returned is not necessarily
33 "minimal" with respect to the variables specified in the
34 argument list. That is, there may be more than one term
35 in the result proportional to the same product of powers
36 of the variables specified in the argument list: */
37 exp5:(gamma(x)*a+b)*(gamma(x)*c+d+2*e^2);
38 expandwrt(exp5,gamma(x));
39 /* The function EXPANDWRT_FACTORED works on factored
40 or partially factored expressions. The expansion occurs
41 only among those factors that contain occurrences of the
42 variables in the argument list of EXPANDWRT_FACTORED. Note
46 expandwrt_factored(exp6,a,b);
47 /* Another example: */