654 Reputation

13 Badges

13 years, 339 days

MaplePrimes Activity

These are questions asked by itsme

I'm trying to do some manipulation of expressions that contain products of scalars and non-commuting operators (as defined by the physics package). The worksheet below shows this on a particular example. I can imagine a long/tedious way to do this, but perhaps the two key steps outlined below might be easily handled by some pattern-matching maple trickery, that is obvious to the pros here? 

In short, I need to convert expressions of the general form:


expr:=alpha*Sx*Sz^2 + beta*Sy*Sz + gamma*Sz*Sy*Sx  + Sx + beta^2;

to something like:

expr3:=alpha*f([Sx,Sz, Sz]) + beta*f([Sy,Sz]) + gamma*f([Sz, Sy, Sx]) + f([Sx]) + beta^2;

... with the caveat that the 'Sk' are operators (and their products could be of an arbitrary length).


The context here (for those who care) is basically to use the nice handling of non-commutative algebra of the Physics package to write down some Heisenberg equations of motion for a given system, and then approximate those using a cummulant expansion (this is in practice really tedious to do by hand in even simple systems, but arguably the most painful part is trivially done by the physics' package nice handling and sorting of the non commuting oprators). That, in essence requires one to transform larger products of non-commuting operators into smaller products (so say approximating an expectation value of 3-operator product as a sum of 2-operator peoducts and single operators). 

If anyone has ideas how best to approach this in the maple-ish way, please let me know.




Init related stuff


[`*`, `.`, Annihilation, AntiCommutator, Antisymmetrize, Assume, Bra, Bracket, Check, Christoffel, Coefficients, Commutator, CompactDisplay, Coordinates, Creation, D_, Dagger, Decompose, Define, Dgamma, Einstein, EnergyMomentum, Expand, ExteriorDerivative, Factor, FeynmanDiagrams, FeynmanIntegral, Fundiff, Geodesics, GrassmannParity, Gtaylor, Intc, Inverse, Ket, KillingVectors, KroneckerDelta, LeviCivita, Library, LieBracket, LieDerivative, Normal, NumericalRelativity, Parameters, PerformOnAnticommutativeSystem, Projector, Psigma, Redefine, Ricci, Riemann, Setup, Simplify, SortProducts, SpaceTimeVector, StandardModel, SubstituteTensor, SubstituteTensorIndices, SumOverRepeatedIndices, Symmetrize, TensorArray, Tetrads, ThreePlusOne, ToContravariant, ToCovariant, ToFieldComponents, ToSuperfields, Trace, TransformCoordinates, Vectors, Weyl, `^`, dAlembertian, d_, diff, g_, gamma_]



{%Commutator(Sx, Sy) = I*Sz, %Commutator(Sy, Sz) = I*Sx, %Commutator(Sz, Sx) = I*Sy}


Setup(mathematicalnotation=true, hermitianoperators = {Sx, Sy, Sz}, algebrarules=algebra_rules);

[algebrarules = {%Commutator(Sx, Sy) = I*Sz, %Commutator(Sy, Sz) = I*Sx, %Commutator(Sz, Sx) = I*Sy}, hermitianoperators = {Sx, Sy, Sz}, mathematicalnotation = true]



Say i have an expression like this below. In principle, each term could be a product:

(scalar) * (some prodcut of opertors)

with some arbitrary number of operators.

expr:=alpha*Sx*Sz^2 + beta*Sy*Sz + gamma*Sz*Sy*Sx  + Sx + beta^2;

alpha*Physics:-`*`(Sx, Physics:-`^`(Sz, 2))+beta*Physics:-`*`(Sy, Sz)+gamma*Physics:-`*`(Sz, Sy, Sx)+Sx+beta^2


would like apply ave(expr) and end up with:

expr2:=alpha*ave(Sx*Sz^2) + beta*ave(Sy*Sz) + gamma*ave(Sz*Sy*Sx)+ ave(Sx)   + beta^2;

alpha*ave(Physics:-`*`(Sx, Physics:-`^`(Sz, 2)))+beta*ave(Physics:-`*`(Sy, Sz))+gamma*ave(Physics:-`*`(Sz, Sy, Sx))+ave(Sx)+beta^2


so basically need a rule that forces:

Next, given expr2, would like to be able to apply some transformation to all the ave(XXX) functions.
for simplicity let's assume that I would like a following transformation:

ave(A*B*C ....)->f([A, B, C, ...])

with each of A, B, C here being an operator.

However the crucial point is that if there are powers of operators, each one should get its own entry in the list. So for example:

ave(A*B^2)->f([A, B, B]).
So applying this transformation to expr2, should give:

expr3:=alpha*f([Sx,Sz, Sz]) + beta*f([Sy,Sz]) + gamma*f([Sz, Sy, Sx]) + f([Sx]) + beta^2;

alpha*f([Sx, Sz, Sz])+beta*f([Sy, Sz])+gamma*f([Sz, Sy, Sx])+f([Sx])+beta^2




Is there a reason why maple can't directly integrate over iterable objects (lists, vectors, matrices, etc.)?
From a first glance I would think doing 

int(<sin(x), cos(x)>, x=0..2)

should be equivalent to:

map(int, <sin(x), cos(x)>, x=0..2)

Is there a good reason why this would be a bad idea?  (for whatever it's worth, that's what mathematica does by default).


using the Physics package version:

  The "Physics Updates" version in the MapleCloud is 899 and is the same as the version installed in this computer, created 2021, January 2, 19:51 hours Pacific Time.


I end up with:

      usecolor = false,
      powersoftrigonometricfunctions= computernotation,
      leavespaceafterfunctionname = true,
      cacheresults = false

resluting in an error:

Error, module does not export `ModuleApply`


Maybe some changes in the interface in the latest version?





Recently i'm noticing that mathematica is basically a mind-reader with their FullSimplify function, whereas maple even with simple expressions does not show what I would consider optimal (I agree this will be somewhat subjective).

Here is a trivial example:
ex1:=(2*sqrt(N__s) + N__s + 1)/(2*N__s + 2);

none of these are any help
simplify(ex1, size);
simplify(ex1, symbolic);
simplify(ex1, sqrt);
simplify(ex1, sqrt, symbolic);

The ideal expression I would like to see here is:
1/2 + sqrt(N__s)/(N__s + 1)

Am I doing it all wrong (suppose I don't know of this simple form beforehand)?

Mathematica gets it right - see the following screenshot:

I'm finding this a lot... especially when hyperbolic functions and sqrt's are involved ("symbolic" option helps sometimes, but often the expressions are still not what I would consider "simplifed").

does maple provide a way to programatically get the name of the "current" worksheet file?

I'm looking for something analogous to

which gives the directory the worksheet file is in.



1 2 3 4 5 6 7 Last Page 1 of 12