Search code examples
maple

how to expand (cross-multiply) two taylor polynomials in maple 13


> eq1 := taylor(exp((1/2)*lambda*gamma*B), lambda = 0, 3);
print(`output redirected...`); # input placeholder
               1                  1      2  2       2    /      3\
           1 + - gamma B lambda + - gamma  B  lambda  + O\lambda /
               2                  8                               
> eq2 := taylor(exp((1/2)*lambda*A), lambda = 0, 3);
print(`output redirected...`); # input placeholder
                     1            1  2       2    /      3\
                 1 + - A lambda + - A  lambda  + O\lambda /
                     2            8                        
> eq3 := eq1*eq2;
print(`output redirected...`); # input placeholder
  /    1                  1      2  2       2    /      3\\ /    1         
  |1 + - gamma B lambda + - gamma  B  lambda  + O\lambda /| |1 + - A lambda
  \    2                  8                               / \    2         

       1  2       2    /      3\\
     + - A  lambda  + O\lambda /|
       8                        /
> expand(eq1, eq2);
print(`output redirected...`); # input placeholder
               1                  1      2  2       2    /      3\
           1 + - gamma B lambda + - gamma  B  lambda  + O\lambda /
               2                  8                               
> expand(eq3);
print(`output redirected...`); # input placeholder
  /    1                  1      2  2       2    /      3\\ /    1         
  |1 + - gamma B lambda + - gamma  B  lambda  + O\lambda /| |1 + - A lambda
  \    2                  8                               / \    2         

       1  2       2    /      3\\
     + - A  lambda  + O\lambda /|
       8                        /

> expand(eq1*eq2);
print(`output redirected...`); # input placeholder
  /    1                  1      2  2       2    /      3\\ /    1         
  |1 + - gamma B lambda + - gamma  B  lambda  + O\lambda /| |1 + - A lambda
  \    2                  8                               / \    2         

       1  2       2    /      3\\
     + - A  lambda  + O\lambda /|
       8                        /

Hi.. not at all sure if the above will make sense.. (I`d put this text at the top of the question, instead of code first, but the formating does strange things)

Im (trying to) use maple 13 (its what I have access to) to expand two taylor polynomials. and it isnt working. Im sure there must be some simple command I can use, but I haven`t found it. I have also tried a few of these possibilities: http://www.maplesoft.com/support/help/Maple/view.aspx?path=expand . perhaps you folks can help?


Solution

  • You need to convert those two series data structures eq1 and eq2 to polynomials before you can add them or expand their product.

    eq1 := taylor(exp((1/2)*lambda*gamma*B), lambda = 0, 3):
    eq2 := taylor(exp((1/2)*lambda*A), lambda = 0, 3):
    
    p1:=convert(eq1,polynom):
    p2:=convert(eq2,polynom):
    
    p1+p2;
    expand(p1*p2);