Pascal4QM

478 Reputation

13 Badges

8 years, 133 days

MaplePrimes Activity


These are answers submitted by Pascal4QM

As Edgardo said, Physics is the best environment to perform non-commutative algebra (and indeed, the only way in Maple). In addition, one can define quantum operator, the most general non commutative object, or one can refine the definition with hermitian or unitary operators. A value might also be assigned to the op and used whenever it is required. Here are a few example.

NULL

NULL

restart; with(Physics); interface(imaginaryunit = I)

Setup(quantumoperators = {A, B}, hermitianoperators = {H}, unitaryoperators = {U})

[hermitianoperators = {H}, quantumoperators = {A, B, H, U}, unitaryoperators = {U}]

(1)

A and B do not commute by default

A*B-A*B

Physics:-`*`(A, B)-Physics:-`*`(B, A)

(2)

Library:-Commute(A, B)

false

(3)

For the inverse, just use

Inverse(A)

Physics:-Inverse(A)

(4)

It is always possible to assign a value. Note however the lower case "matrix"

A := matrix(2, 2, [[1, a], [a, 0]])

array( 1 .. 2, 1 .. 2, [( 1, 1 ) = (1), ( 1, 2 ) = (a), ( 2, 1 ) = (a), ( 2, 2 ) = (0)  ] )

(5)

A

A

(6)

B := matrix(2, 2, [[1, b], [b, 0]])

array( 1 .. 2, 1 .. 2, [( 1, 1 ) = (1), ( 1, 2 ) = (b), ( 2, 1 ) = (b), ( 2, 2 ) = (0)  ] )

(7)

Using `*` operator leave the product unevaluated

A*B

Physics:-`*`(A, B)

(8)

Library:-RewriteInMatrixForm(Physics[`*`](A, B))

Physics:-`.`(array( 1 .. 2, 1 .. 2, [( 1, 1 ) = (1), ( 1, 2 ) = (a), ( 2, 1 ) = (a), ( 2, 2 ) = (0)  ] ), array( 1 .. 2, 1 .. 2, [( 1, 1 ) = (1), ( 1, 2 ) = (b), ( 2, 1 ) = (b), ( 2, 2 ) = (0)  ] ))

(9)

Or use the `.` operator

A.B

array( 1 .. 2, 1 .. 2, [( 1, 1 ) = (a*b+1), ( 1, 2 ) = (b), ( 2, 1 ) = (a), ( 2, 2 ) = (a*b)  ] )

(10)

Hermintian and unitary op are known

Dagger(H)

H

(11)

U*Dagger(U)

Physics:-`*`(U, Physics:-Dagger(U))

(12)

Simplify(Physics[`*`](U, Physics[Dagger](U)))

1

(13)

NULL

Download Matrix_op.mw

Hi,

You could try :

Physics:-Version(1409)

1409 is the last version for M2022.2

Hi,

Maple result seems correct to me. The point is that the returned sum is a Dirac comb. Writting the result as a sum of exp or a sum of Dirac is a matter of choice depending of what you need. Using convert/exp might help:

restart

with(Physics)

with(inttrans)

interface(imaginaryunit = I)

interface(version)

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

(1)

delta__t := `assuming`([proc (t) options operator, arrow; Sum(Dirac(t-k*T__0), k = -infinity .. infinity) end proc], [T__0 > 0])

proc (t) options operator, arrow; Sum(Dirac(t-Physics:-`*`(k, T__0)), k = -infinity .. infinity) end proc

(2)

fourier(delta__t(t), t, omega)

Sum(exp(-I*T__0*k*omega), k = -infinity .. infinity)

(3)

Considering the Dirac comb

Sum(Dirac(omega-k), k = -infinity .. infinity)

Sum(Dirac(-omega+k), k = -infinity .. infinity)

(4)

One has the relation

convert(Sum(Dirac(-omega+k), k = -infinity .. infinity), exp) = Sum(Dirac(-omega+k), k = -infinity .. infinity)

Sum(exp((2*I)*Pi*k*omega), k = -infinity .. infinity) = Sum(Dirac(-omega+k), k = -infinity .. infinity)

(5)

And finally

subs(omega = -omega*T__0/(2*Pi), Sum(exp((2*I)*Pi*k*omega), k = -infinity .. infinity) = Sum(Dirac(-omega+k), k = -infinity .. infinity))

Sum(exp(-I*T__0*k*omega), k = -infinity .. infinity) = Sum(Dirac((1/2)*omega*T__0/Pi+k), k = -infinity .. infinity)

(6)

Note that the reciprocal conversion is not (yet) supported

Sum(exp((2*I)*Pi*k*omega), k = -infinity .. infinity)

Sum(exp((2*I)*Pi*k*omega), k = -infinity .. infinity)

(7)

convert(Sum(exp((2*I)*Pi*k*omega), k = -infinity .. infinity), Dirac)

Error, unrecognized conversion: Dirac

 

NULL

Download DiracComb.mw

Hi,

For deriving an equation in Physics, Fundiff is often the good approach. This should give the result:

restart

with(Physics)

CompactDisplay(Y(t))

Y(t)*`will now be displayed as`*Y

(1)

ex := (1/2)*m*((diff(Y(t), t))^2+(diff(w(Y(t), t), t))^2)

(1/2)*m*((diff(Y(t), t))^2+((D[1](w))(Y(t), t)*(diff(Y(t), t))+(D[2](w))(Y(t), t))^2)

(2)

RR := Intc(ex, t)

Int((1/2)*m*((diff(Y(t), t))^2+((D[1](w))(Y(t), t)*(diff(Y(t), t))+(D[2](w))(Y(t), t))^2), t = -infinity .. infinity)

(3)

Fundiff(RR, Y)

(1/2)*m*(-2*(diff(diff(Y(t), t), t))*(D[1](w))(Y(t), t)^2+(-2*(diff(Y(t), t))^2*(D[1, 1](w))(Y(t), t)-4*(D[1, 2](w))(Y(t), t)*(diff(Y(t), t))-2*(D[2, 2](w))(Y(t), t))*(D[1](w))(Y(t), t)-2*(diff(diff(Y(t), t), t)))

(4)

NULL

Download FundiffTest.mw

Hi,

In order to have `*` redefined, you need first to define quantum operators for instance. Then [a,b] has the same meaning whether Physics is loaded or not. I guess you'd like to use the commutator. For that purpose, just use "Commutator":

restart

with(Physics)

Setup(quantumoperators = {A, B})

[quantumoperators = {A, B}]

(1)

R := Commutator(A, B)

Physics:-Commutator(A, B)

(2)

Expand(R)

Physics:-`*`(A, B)-Physics:-`*`(B, A)

(3)

NULL

Download CommutatorTest.mw

Hi,

In your case, you should rather use Setup(anticommutativeprefix = {x, y}), not "noncommutativeprefix". Then, it is unnecessary to specify "algebrarules={%AntiCommutator(x,x)=0, %AntiCommutator(y,y)=0}" as it will be automatically the case.

Finally, Maple's result:

AntiCommutator(x,y)=0

seems correct to me. As x and y anticommute, x*y + y*x = x*y - x*y = 0.

Hi,

A possible way is to define a formal differential operator within the Physics package. It can be define with an arbitrary function and trigged at will. For an exemple, have look at:

https://www.mapleprimes.com/posts/208710-Quantum-Commutation-Rules-Basics

Of course, it must be adapted to your need.

Hi,

Using "Component", it is possible to reconstruct a Vector:

V := Vector([seq(Component(q_, k), k = 1 .. 3)])

 

Component2Vector.mw

 

Try -3 - (-5) or  4*(-10), It should work as expected.

 However, I agree that an expression like -3 - -5 should work without parentheses in Maple, mathematically the expression is correct, surprising. Entering -3-+-5 or 4*-10 in Matlab gives the expected result.

Hi,

I think that using the new Physics:-Latex with alias, there is even no need for replacing.
 

restart

sol := dsolve(diff(x(t), `$`(t, 3)) = x(t))

x(t) = _C1*exp(t)+_C2*exp(-(1/2)*t)*sin((1/2)*3^(1/2)*t)+_C3*exp(-(1/2)*t)*cos((1/2)*3^(1/2)*t)

(1)

alias(seq(c[k] = _C || k, k = 1 .. 3))

c[1], c[2], c[3]

(2)

latex(x(t) = _C1*exp(t)+_C2*exp(-(1/2)*t)*sin((1/2)*3^(1/2)*t)+_C3*exp(-(1/2)*t)*cos((1/2)*3^(1/2)*t))

x \left( t \right) ={\it \_C1}\,{{\rm e}^{t}}+{\it \_C2}\,{{\rm e}^{-{
\frac {t}{2}}}}\sin \left( {\frac {\sqrt {3}t}{2}} \right) +{\it \_C3}
\,{{\rm e}^{-{\frac {t}{2}}}}\cos \left( {\frac {\sqrt {3}t}{2}}
 \right)

 

Physics:-Latex(x(t) = _C1*exp(t)+_C2*exp(-(1/2)*t)*sin((1/2)*3^(1/2)*t)+_C3*exp(-(1/2)*t)*cos((1/2)*3^(1/2)*t))

x \left(t \right) =
c_{1} {\rm e}^{t}+c_{2} {\rm e}^{-\frac{t}{2}} \sin \left(\frac{\sqrt{3} t}{2}\right)+c_{3} {\rm e}^{-\frac{t}{2}} \cos \left(\frac{\sqrt{3} t}{2}\right)

 

``


 

Download PhysicsLatexTest.mw

 

Hi,

use add instead of sum, it should work.

You might define a differential operator
 

 

restart; with(Physics); with(Physics[Vectors]); interface(imaginaryunit = I)

Setup(differentialoperators = {[N_, [x, y, z]]})

[differentialoperators = {[N_, [x, y, z]]}]

(1)

CompactDisplay(f(x, y, z))

` f`(x, y, z)*`will now be displayed as`*f

(2)

N_ := proc (f) options operator, arrow; %Nabla(f) end proc

proc (f) options operator, arrow; %Nabla(f) end proc

(3)

N_^4*f(x, y, z)

Physics:-`*`(Physics:-`^`(N_, 4), f(x, y, z))

(4)

Library:-ApplyProductsOfDifferentialOperators(Physics[`*`](Physics[`^`](N_, 4), f(x, y, z)))

%Nabla(%Nabla(%Nabla(%Nabla(f(x, y, z)))))

(5)

value(%Nabla(%Nabla(%Nabla(%Nabla(f(x, y, z))))))

diff(diff(diff(diff(f(x, y, z), x), x), x), x)+2*(diff(diff(diff(diff(f(x, y, z), x), x), y), y))+2*(diff(diff(diff(diff(f(x, y, z), x), x), z), z))+diff(diff(diff(diff(f(x, y, z), y), y), y), y)+2*(diff(diff(diff(diff(f(x, y, z), y), y), z), z))+diff(diff(diff(diff(f(x, y, z), z), z), z), z)

(6)

NULL

``


 

Download DiffOp.mw

Hi,

With Physics package, to get this feature, V should be declared as a quantum operator. Also, use Dagger instead of Transpose, or V_^*.

restart;
with(Physics);
with(Physics[Vectors]);
Setup(quantumoperators = V);
V_*Dagger(V_);

This question is related:

https://www.mapleprimes.com/questions/229481-Noncommutative-Product-Of-Matrices#answer268293

 

Hi,

L := [1, 2, 3, 4, 5];
                      L := [1, 2, 3, 4, 5]

add(L);
                               15

 

Hi,

I have the same sometime. Just enter "restart" and this should load the last version, even if the message is the same. Otherwise, just close your worksheet and reopen it, it should work fine.

1 2 3 4 Page 1 of 4