how to tell maple two operators don't commute when expanding in a taylor polynomial

StackOverflow https://stackoverflow.com/questions/21709620

  •  10-10-2022
  •  | 
  •  

سؤال

Let's start with something that works:

restart:
with(Physics):
Setup(noncommutativeprefix = {A, B}):
expand((A+B)^2);

gives

A^2+A*B+B*A+B^2

Maple recognizes the A and B don't commute. Now, let's expand their sum in a taylor series, and expand that:

restart:
with(Physics):
Setup(noncommutativeprefix = {A, B}):
S := convert(taylor(exp((A+B)*delta), delta = 0, 3), polynom);

gives

                         1        2      2
S := 1 + (A + B) delta + - (A + B)  delta 
                         2                

and then

expand(S);

gives

                         1  2      2            2   1  2      2
 1 + delta A + delta B + - A  delta  + A B delta  + - B  delta 
                         2                          2          

Maple no longer recognizes that A and B don't commute. Clearly(?) I don't know how to use maple properly. How do I get maple to recognize that A and B don't commute in this context? there is discussion of this here: http://www.mapleprimes.com/questions/95808-Noncommutative-Operators, in the maple help, and elsewhere, I'm sure..

I should add, (obviously), that the following works, but it gets ugly. there must be a better way:

restart;
unassign(`&*`); define(`&*`, multilinear, zero = 0, identity = 1, flat);
constants := constants, lambda;
No := 3;
S := convert(taylor(exp((A+B)*delta), delta = 0, No), polynom);
                                1        2      2
       S := 1 + (A + B) delta + - (A + B)  delta 
                                2                
S := subs((A+B)^2 = `&*`(A+B, A+B), (A+B)^3 = `&*`(`&*`(A+B, A+B), A+B), (A+B)^4 =     `&*`(`&*`(`&*`(A+B, A+B), A+B), A+B), S);
       S := 1 + (A + B) delta

            1                                          2
          + - (A &* A + A &* B + B &* A + B &* B) delta 
            2                                           
simplify(S);
                         1      2            1      2         
 1 + delta A + delta B + - delta  (A &* A) + - delta  (A &* B)
                         2                   2                

      1      2            1      2         
    + - delta  (B &* A) + - delta  (B &* B)
      2                   2                
definemore(`&*`, `&*`(A, A) = A^2, `&*`(B, B) = B^2, `&*`(A, B) = AB, `&*`(B, A) = BA);
simplify(S);
                        1  2      2   1  2      2   1         2
1 + delta A + delta B + - A  delta  + - B  delta  + - AB delta 
                        2             2             2          

     1         2
   + - BA delta 
     2          

I'm now using maple 17.

Edit: Here is a continuation of the above question, now with edgardo's feedback:

I am trying to perform the following calculation, using Gtaylor:

with(Physics);
Setup(noncommutativeprefix = {A, B});

exp3 := convert(Gtaylor(exp((a-I*b))*delta*B), delta = 0, No), polynom);
exp5 := convert(Gtaylor(exp((a-I*b))*delta*A), delta = 0, No), polynom);
expansion := coeff(simplify(subs(delta = lambda, exp1*exp2*exp1*exp3*exp5*exp3)), lambda, No-1);

not all the code is included. exp5 &3 are examples of what all the other exp's look like. No is set to 5, and and b are fractions. This code works (haven't confirmed with independent code but let's assume it does), but it takes a -very- long time. Is there any way to speed it up?

هل كانت مفيدة؟

المحلول

In brief: a) use Physics:-Gtaylor, not taylor and b) Before proceeding, update your Physics package with the latest version, available for download at the Maplesoft Maple Physics: Research & Development webpage.

In details: Physics is a relatively new package. The taylor command is from before Physics, and uses * and ^ operators that assume commutativity. An important number of developments happen every year towards making the Maple library more aware of the presence of non commutative objects within algebraic expressions, so that their products, powers, simplification, expansion and combination rules, etc happen as expected. A relevant command in this process is Physics:-Check that will tell you, among other things, whether products of non-commutative objects are ill-formed; i.e. expressed using a commutative * operator. Try it with the output of taylor (not Physics:-Gtaylor) and you will see.

Regarding updating Physics: bug fixes and new Physics and Physics-related developments are integrated into the R&D version of the package every week.

Edgardo S. Cheb-Terrab

Physics, Differential Equations and Mathematical Functions, Maplesoft

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top