Andriy

270 Reputation

13 Badges

12 years, 230 days

MaplePrimes Activity


These are replies submitted by Andriy

@Carl Love 

Ok, thank you. The last: what means `if` enclosed in slanted single quotes?
Btw

nn:= ()-> if([args]::list(integer), ap(args).am(args), 'procname'(args)):

(without slanted single quotes)
works well too

@Carl Love 

Ok, thank you. The last: what means `if` enclosed in slanted single quotes?
Btw

nn:= ()-> if([args]::list(integer), ap(args).am(args), 'procname'(args)):

(without slanted single quotes)
works well too

@Carl Love 

Your code:

.....

nn:= ()-> `if`([args]::list(integer), ap(args).am(args), 'procname'(args)):   # minor correction
#
Setup(op = {am, ap, nn}):

N:= proc(f)
local i,j,sigma;
     Sum(Sum(Sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f)
end proc:
#Setup(op = N):


phi := Ket(psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1):
f := 2:
N(f).phi;
type(N, Library:-PhysicsType:-ExtendedQuantumOperator);
type(nn, Library:-PhysicsType:-ExtendedQuantumOperator);

output:

 

false
false

However if

N:= proc(f)
local i,j,sigma;
     sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f)
end proc:

Then output is



false

false.

The result is correct. Great! However, the fact that nn and N are not quantum operators disturbs me. Therefore I'll uncomment two strings with Setup(op = {am, ap, nn}): and Setup(op = N): for more reliability.

Could you explain me the string

nn:= ()-> `if`([args]::list(integer), ap(args).am(args), 'procname'(args)):
Of couse I'll try do it myself but I will not reject your help.

@Carl Love 

Your code:

.....

nn:= ()-> `if`([args]::list(integer), ap(args).am(args), 'procname'(args)):   # minor correction
#
Setup(op = {am, ap, nn}):

N:= proc(f)
local i,j,sigma;
     Sum(Sum(Sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f)
end proc:
#Setup(op = N):


phi := Ket(psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1):
f := 2:
N(f).phi;
type(N, Library:-PhysicsType:-ExtendedQuantumOperator);
type(nn, Library:-PhysicsType:-ExtendedQuantumOperator);

output:

 

false
false

However if

N:= proc(f)
local i,j,sigma;
     sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f)
end proc:

Then output is



false

false.

The result is correct. Great! However, the fact that nn and N are not quantum operators disturbs me. Therefore I'll uncomment two strings with Setup(op = {am, ap, nn}): and Setup(op = N): for more reliability.

Could you explain me the string

nn:= ()-> `if`([args]::list(integer), ap(args).am(args), 'procname'(args)):
Of couse I'll try do it myself but I will not reject your help.

@Carl Love 

does't work.

@Carl Love 

does't work.

Hi ecterrab

I still have some questions.
Here is the first one

restart;
with(Physics); 
Setup(mathematicalnotation = true);
Physics:-Setup(anticommutativeprefix = psi);

am := proc (i, j, sigma) local k::posint;
if [i, j, sigma]::(Not(list(posint))) then return 'procname(args)' end if; k := 6*i-8+2*j+sigma;
Annihilation(psi, k, notation = explicit)
end proc;

ap := proc (i, j, sigma)
local k::posint;
if [i, j, sigma]::(Not(list(posint))) then return 'procname(args)' end if;
k := 6*i-8+2*j+sigma;
Creation(psi, k, notation = explicit)
end proc;

nn := proc (i, j, sigma)
if [i, j, sigma]::(Not(list(posint))) then return 'procname(args)' end if;
ap(i, j, sigma).am(i, j, sigma)
end proc;

Setup(op = {am, ap, nn});

N := sum(add(add(nn(i, j, sigma), sigma = 1 .. 2), j = 1 .. 3), i = 1 .. f);

and you will get a predictible result:

Then execute

i:=7:
N;

And the result is an error:

Error, (in sum) summation variable previously assigned, second argument evaluates to 7 = 1 .. f

Sum behaves very strange. It perceives external 'i' to be an internal index 'i'. Is it intended behaviour?

Hi ecterrab

I still have some questions.
Here is the first one

restart;
with(Physics); 
Setup(mathematicalnotation = true);
Physics:-Setup(anticommutativeprefix = psi);

am := proc (i, j, sigma) local k::posint;
if [i, j, sigma]::(Not(list(posint))) then return 'procname(args)' end if; k := 6*i-8+2*j+sigma;
Annihilation(psi, k, notation = explicit)
end proc;

ap := proc (i, j, sigma)
local k::posint;
if [i, j, sigma]::(Not(list(posint))) then return 'procname(args)' end if;
k := 6*i-8+2*j+sigma;
Creation(psi, k, notation = explicit)
end proc;

nn := proc (i, j, sigma)
if [i, j, sigma]::(Not(list(posint))) then return 'procname(args)' end if;
ap(i, j, sigma).am(i, j, sigma)
end proc;

Setup(op = {am, ap, nn});

N := sum(add(add(nn(i, j, sigma), sigma = 1 .. 2), j = 1 .. 3), i = 1 .. f);

and you will get a predictible result:

Then execute

i:=7:
N;

And the result is an error:

Error, (in sum) summation variable previously assigned, second argument evaluates to 7 = 1 .. f

Sum behaves very strange. It perceives external 'i' to be an internal index 'i'. Is it intended behaviour?

@Carl Love 

I have decided that it is a typo as I can't understand this construction:

N:= (i,j,sigma,f)-> sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f):

Ok. I try the following:

restart:
with(Physics):
Setup(mathematicalnotation= true):
Setup(anticommutativeprefix= Psi):

am:= (i,j,sigma)-> Annihilation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):
ap:= (i,j,sigma)-> Creation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):
nn:= ap.am:

N:= (i,j,sigma,f)-> sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f):  # ???

psi := Ket(Psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0):
f := 2:
N(i,j,sigma,f).psi;

and it gives an error. What values of i, j, sigma actually I have to pass to function N in order to calculate action of N on psi?

@Carl Love 

I have decided that it is a typo as I can't understand this construction:

N:= (i,j,sigma,f)-> sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f):

Ok. I try the following:

restart:
with(Physics):
Setup(mathematicalnotation= true):
Setup(anticommutativeprefix= Psi):

am:= (i,j,sigma)-> Annihilation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):
ap:= (i,j,sigma)-> Creation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):
nn:= ap.am:

N:= (i,j,sigma,f)-> sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f):  # ???

psi := Ket(Psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0):
f := 2:
N(i,j,sigma,f).psi;

and it gives an error. What values of i, j, sigma actually I have to pass to function N in order to calculate action of N on psi?

The command

N:= Sum(Sum(Sum('nn'(i, j, sigma), sigma= 1..2), j= 1 ..3), i= 1 ..f);

defines operator N but I don't know how to use it in particular calculations:

....

psi := Ket(Psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0):
f:=2;
N.psi;

Output:

Error, (in Creation) invalid input: too many and/or wrong type of arguments passed to Creation; first unused argument is 6*i-8+2*j+sigma

 

However if

N := f -> Sum(Sum(Sum('nn'(i, j, sigma), sigma = 1 .. 2), j = 1 .. 3), i = 1 .. f);

then

psi := Ket(Psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0):
f:=2;
N(f).psi;

gives 


without error but no calculations are made.

The command

N:= Sum(Sum(Sum('nn'(i, j, sigma), sigma= 1..2), j= 1 ..3), i= 1 ..f);

defines operator N but I don't know how to use it in particular calculations:

....

psi := Ket(Psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0):
f:=2;
N.psi;

Output:

Error, (in Creation) invalid input: too many and/or wrong type of arguments passed to Creation; first unused argument is 6*i-8+2*j+sigma

 

However if

N := f -> Sum(Sum(Sum('nn'(i, j, sigma), sigma = 1 .. 2), j = 1 .. 3), i = 1 .. f);

then

psi := Ket(Psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0):
f:=2;
N(f).psi;

gives 


without error but no calculations are made.

@Carl Love 

nn:= ap.am: is a nice feature!

Trying to check your suggestion:

restart:
with(Physics):
Setup(mathematicalnotation= true):
Setup(anticommutativeprefix= Psi):

am:= (i,j,sigma)-> Annihilation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):
ap:= (i,j,sigma)-> Creation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):
nn:= ap.am:

N:= f -> sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f):

psi := Ket(Psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0):
f := 2:
N(f).psi;

Output:
Error, (in Creation) invalid input: too many and/or wrong type of arguments passed to Creation; first unused argument is 6*i-8+2*j+sigma

A special thanks for grammar correction!

@Carl Love 

nn:= ap.am: is a nice feature!

Trying to check your suggestion:

restart:
with(Physics):
Setup(mathematicalnotation= true):
Setup(anticommutativeprefix= Psi):

am:= (i,j,sigma)-> Annihilation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):
ap:= (i,j,sigma)-> Creation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):
nn:= ap.am:

N:= f -> sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f):

psi := Ket(Psi, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0):
f := 2:
N(f).psi;

Output:
Error, (in Creation) invalid input: too many and/or wrong type of arguments passed to Creation; first unused argument is 6*i-8+2*j+sigma

A special thanks for grammar correction!

@Alejandro Jakubi 

It is sad.

to developers:
Some quotations from the Wikipedia http://en.wikipedia.org/wiki/Maple_%28software%29
"In 2003, the current "standard" interface was introduced with Maple 9. This interface is primarily written in Java (although portions, such as the rules for typesetting mathematical formulae, are written in the Maple language). The Java interface was criticized for being slow..."

"Between the mid 1995 and 2005 Maple lost significant market share to competitors due to a weaker user interface..."

The memory leak causes leak of customers.

 

First 6 7 8 9 10 Page 8 of 10