## 270 Reputation

12 years, 176 days

## How to test if a variable is a dot-produ...

Maple

Hi. I need to test if a variable is a dot-product of "anything"-s (usually it is quantum operators).
I try the following

`restart; with(Physics); Physics:-Setup(mathematicalnotation = true); Physics:-Setup(anticommutativeprefix = psi); ap1 := Physics:-Creation(psi, 1, notation = explicit); am1 := Physics:-Annihilation(psi, 1, notation = explicit); ap2 := Physics:-Creation(psi, 2, notation = explicit); am2 := Physics:-Annihilation(psi, 2, notation = explicit);z1 := ap1.am1.ap2:type(z1, ('`.`')(anything));`

and get

false

whereas

`z2 := a*b*c; type(z2, (':-`*`')(anything));`

returns

true

I studied ?type,structured and other sources but didn't find any answer.

## Is there a Maple-function that returns a...

Maple

Hello
Is there a Maple-function that returns a number of transpositions needed to transform a list into a list with some particular order? Actually, I need just a parity of a number of transpositions. All elements of a list are different.

For example, one needs 4 (even) transpositions to transform a list [w,x,y,z] into a list [y,x,z,w]:
[w,x,y,z]->[w,y,x,z]->[y,w,x,z]->[y,x,w,z]->[y,x,z,w]

Thank you

## How to construct a type for an expressio...

Maple

I am trying the following:

`restart; with(Physics); with(Library); Setup(mathematicalnotation = true); Setup(op = A);assume(n::integer);type(A^n, Physics:-`^`(PhysicsType:-ExtendedQuantumOperator, integer));type(A^n, PhysicsType:-ExtendedQuantumOperator^integer);`

the result is

false
false

However, I expected to get true in both cases. How to construct correct type for A^n?
Thank you.

## How to check whether an expression is a ...

Maple

I do the following:

`restart; z := x + y; type(z, specfunc(name, `+`));`

However the result is 'false'. How to correct my type checking?

## A problem with Setup(algebrarules = [......

Maple

Hi
I am trying to define commutation rules between operators a1, a2, b1, b2.

`restart; with(Physics); with(Library); Setup(mathematicalnotation = true); Setup(op = {a1, a2, b1, b2}); alias(A = %AntiCommutator); algebra := [A(a1, a1) = 0, A(a2, a2) = 0, A(a1, a2) = 0, A(b2, a1) = 0, A(a1, b1) = 1, A(a2, b2) = 1];Setup(algebrarules = algebra); `

However, the command Setup(algebrarules = algebra); causes an error. What is wrong? Noteworthy that if commutator is considered instead of anticommutator alias(A = %Commutator); then correct result follows.
Thank you.

 1 2 3 4 5 6 7 Page 2 of 8
﻿