Next: Question 3: Can Up: Some Maple Questions and Previous: Question 1: I'm

Question 2: I have an expression in three variables () and three symbolic parameters (). I want to find the coefficients of and but Maple seems to treat the expression as a polynomial in six variables. I tried using collect but Maple puts a precedence on the variables. I want them equally weighted. Do I have to write a program to do this?

Answer: No you don't have to write a program to do this. You're using the right function collect but you need to use the distributed option. Here's an example:


> expr:=56*y*r*z+r^2*s*3*y*t*x+r*s*y^2+r**2*x**2+2*r*x*s*y+
> s*r^3*x*z+2*s*y*t*z+t**2*z**2+2*r*x*t*z+s**2*y**2;
                          2                2    2  2                  3
    expr := 56 y r z + 3 r  s y t x + r s y  + r  x  + 2 r x s y + s r  x z

                        2  2                2  2
         + 2 s y t z + t  z  + 2 r x t z + s  y

> collect(expr,[x,y,z]);
       2  2                2                      3           2         2
      r  x  + ((2 r s + 3 r  s t) y + (2 r t + s r ) z) x + (s  + r s) y

                                   2  2
           + (56 r + 2 s t) z y + t  z

> collect(expr,[x,y,z],distributed);
                             2  2    2  2     2         2 
       (56 r + 2 s t) z y + r  x  + t  z  + (s  + r s) y   

                        2                        3
         +  (2 r s + 3 r  s t) x y + (2 r t + s r ) z x

Now it's much easier to see the coefficient of is . Maple has a lot of powerful features that are available as options to standard functions. Always watch for options when reading help pages.
Related help pages include: collect, coeff, coeffs.


gagin@thsun1.jinr.ru