Andriy

270 Reputation

13 Badges

12 years, 196 days

MaplePrimes Activity


These are answers submitted by Andriy


Hello. First of all I'd like to note, that Physics package omits the problem of eigenvalues/eigenvectors finding. It is only linear algebra task and there is no any necessity to duplicate that procedures. You can get what you want by combininig possibilities of LinearAlgebra and Physics packages.

We start from the defining of matrix M:

restart; with(Physics); n := 3; M := Matrix(n, n, shape = hermitian); M[1, 1] := 2; M[1, 2] := -Physics:-`*`(3, sqrt(2)); M[1, 3] := Physics:-`*`(3, sqrt(2)); M[2, 2] := -1; M[2, 3] := -3; M[3, 3] := -1; M

n := 3

 

Matrix(3, 3, {(1, 1) = 2, (1, 2) = -3*sqrt(2), (1, 3) = 3*sqrt(2), (2, 1) = -3*sqrt(2), (2, 2) = -1, (2, 3) = -3, (3, 1) = 3*sqrt(2), (3, 2) = -3, (3, 3) = -1})

(1)

Now we can define a quantum operator that corresponds to the matrix M:

M2 := add(add(M[i, j]*Ket(psi, i).Bra(psi, j), j = 1 .. 3), i = 1 .. 3)

2*Physics:-`*`(Physics:-Ket(psi, 1), Physics:-Bra(psi, 1))-3*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 1), Physics:-Bra(psi, 2))+3*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 1), Physics:-Bra(psi, 3))-3*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 2), Physics:-Bra(psi, 1))-Physics:-`*`(Physics:-Ket(psi, 2), Physics:-Bra(psi, 2))-3*Physics:-`*`(Physics:-Ket(psi, 2), Physics:-Bra(psi, 3))+3*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 3), Physics:-Bra(psi, 1))-3*Physics:-`*`(Physics:-Ket(psi, 3), Physics:-Bra(psi, 2))-Physics:-`*`(Physics:-Ket(psi, 3), Physics:-Bra(psi, 3))

(2)

Now we can bind standard (natural) basis with Ket-vectors in Dirac notations. I hope, it is that you ask, but I think it is a needless step.  

u := `~`[Vector](combinat:-permute([1, `$`(0, n-1)])); pos := table(`~`[`=`](u, [seq(Ket(psi, i), i = 1 .. n)])); u[1] = pos[u[1]]

u := [Vector(3, {(1) = 1, (2) = 0, (3) = 0}), Vector(3, {(1) = 0, (2) = 1, (3) = 0}), Vector(3, {(1) = 0, (2) = 0, (3) = 1})]

 

pos := table([(Vector(3, {(1) = 0, (2) = 0, (3) = 1})) = Ket(psi, 3), (Vector(3, {(1) = 1, (2) = 0, (3) = 0})) = Ket(psi, 1), (Vector(3, {(1) = 0, (2) = 1, (3) = 0})) = Ket(psi, 2)])

 

Vector[column](%id = 18446744074226665822) = Physics:-Ket(psi, 1)

(3)

Your ket-vector |Psi> I denote as K:

K := (pos[u[1]]+(2*I)*pos[u[3]])/sqrt(5)

(1/5)*5^(1/2)*(Physics:-Ket(psi, 1)+(2*I)*Physics:-Ket(psi, 3))

(4)

Now norm of K can be calculated:

NormQstate := proc (V) Bracket(Dagger(V), V) end proc; KNorm := NormQstate(K)

1

(5)

Eigen values and eigen vectors we find with correspondend function of
"LinearAlgebra package. Pay attention that we have twice degenerate eigenvalue -4 so we have to othogonalise the space corresponding to this eigenvalue. "

Command "LinearAlgebra[GramSchmidt] does this operation. Then normalisation of eigenvectors is performed."

v, a := LinearAlgebra[Eigenvectors](M); a := [seq(a[1 .. -1, i], i = 1 .. n)]; a := LinearAlgebra[GramSchmidt](a); a := map(proc (x) options operator, arrow; simplify(x/LinearAlgebra[VectorNorm](x, 2), radical) end proc, a)

v, a := Vector(3, {(1) = 8, (2) = -4, (3) = -4}), Matrix(3, 3, {(1, 1) = sqrt(2), (1, 2) = -(1/2)*sqrt(2), (1, 3) = (1/2)*sqrt(2), (2, 1) = -1, (2, 2) = 0, (2, 3) = 1, (3, 1) = 1, (3, 2) = 1, (3, 3) = 0})

 

a := [Vector(3, {(1) = sqrt(2), (2) = -1, (3) = 1}), Vector(3, {(1) = -(1/2)*sqrt(2), (2) = 0, (3) = 1}), Vector(3, {(1) = (1/2)*sqrt(2), (2) = 1, (3) = 0})]

 

a := [Vector(3, {(1) = sqrt(2), (2) = -1, (3) = 1}), Vector(3, {(1) = -(1/2)*sqrt(2), (2) = 0, (3) = 1}), Vector(3, {(1) = (1/3)*sqrt(2), (2) = 1, (3) = 1/3})]

 

[Vector[column](%id = 18446744074226642806), Vector[column](%id = 18446744074226634990), Vector[column](%id = 18446744074226635590)]

(6)

Eigenvectors in Dirac notations:

aQvectors := [seq(add(a[j][i]*pos[u[i]], i = 1 .. n), j = 1 .. n)]

[(1/2)*2^(1/2)*Physics:-Ket(psi, 1)-(1/2)*Physics:-Ket(psi, 2)+(1/2)*Physics:-Ket(psi, 3), -(1/3)*3^(1/2)*Physics:-Ket(psi, 1)+(1/3)*6^(1/2)*Physics:-Ket(psi, 3), (1/6)*2^(1/2)*3^(1/2)*Physics:-Ket(psi, 1)+(1/2)*3^(1/2)*Physics:-Ket(psi, 2)+(1/6)*3^(1/2)*Physics:-Ket(psi, 3)]

(7)

Checking block:

simplify(`~`[Physics[`.`]](Dagger(aQvectors), aQvectors)); Dagger(aQvectors[1]).aQvectors[2], Dagger(aQvectors[1]).aQvectors[3], Dagger(aQvectors[2]).aQvectors[3]; k := 1; eq[k] := simplify(collect(expand(M2.aQvectors[k] = v[k]*aQvectors[k]), Ket)); evalb(eq[k]); k := 2; eq[k] := simplify(collect(expand(M2.aQvectors[k] = v[k]*aQvectors[k]), Ket)); evalb(eq[k]); k := 3; eq[k] := simplify(collect(expand(M2.aQvectors[k] = v[k]*aQvectors[k]), Ket)); evalb(eq[k])

[1, 1, 1]

 

0, (1/12)*12^(1/2)-(1/6)*3^(1/2), 0

 

4*2^(1/2)*Physics:-Ket(psi, 1)-4*Physics:-Ket(psi, 2)+4*Physics:-Ket(psi, 3) = 4*2^(1/2)*Physics:-Ket(psi, 1)-4*Physics:-Ket(psi, 2)+4*Physics:-Ket(psi, 3)

 

true

 

(4/3)*3^(1/2)*Physics:-Ket(psi, 1)-(4/3)*2^(1/2)*3^(1/2)*Physics:-Ket(psi, 3) = (4/3)*3^(1/2)*Physics:-Ket(psi, 1)-(4/3)*2^(1/2)*3^(1/2)*Physics:-Ket(psi, 3)

 

true

 

-(2/3)*2^(1/2)*3^(1/2)*Physics:-Ket(psi, 1)-2*3^(1/2)*Physics:-Ket(psi, 2)-(2/3)*3^(1/2)*Physics:-Ket(psi, 3) = -(2/3)*2^(1/2)*3^(1/2)*Physics:-Ket(psi, 1)-2*3^(1/2)*Physics:-Ket(psi, 2)-(2/3)*3^(1/2)*Physics:-Ket(psi, 3)

 

true

(8)

A probabilities to find a system described by vector K in states a[i] (i=1..n) LinearAlgebra[Norm](`<|>`(a[i], psi))^2/`<|>`(psi, psi) and the sum of that prababilities sum(LinearAlgebra[Norm](`<|>`(a[i], psi))^2, i = 1 .. 3) = 1:

w := seq(abs(Bracket(Dagger(K), aQvectors[i]))^2/KNorm, i = 1 .. n); `+`(w)

3/10, 3/5, 1/10

 

1

(9)

and finaly, the standard deviation: `&utri;`(A)[psi] = (`<|>`(psi, A^2, psi)-`<|>`(psi, A, psi)^2)^(1/2)

eval(M2^2); eval(M2.M2); (%Bracket('K', 'M2'^2, 'K')-%Bracket('K', 'M2', 'K')^2)^(1/2) = simplify((Bracket(Dagger(K), M2.M2, K)-Bracket(Dagger(K), M2, K)^2)^(1/2))

Physics:-`^`(2*Physics:-`*`(Physics:-Ket(psi, 1), Physics:-Bra(psi, 1))-3*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 1), Physics:-Bra(psi, 2))+3*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 1), Physics:-Bra(psi, 3))-3*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 2), Physics:-Bra(psi, 1))-Physics:-`*`(Physics:-Ket(psi, 2), Physics:-Bra(psi, 2))-3*Physics:-`*`(Physics:-Ket(psi, 2), Physics:-Bra(psi, 3))+3*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 3), Physics:-Bra(psi, 1))-3*Physics:-`*`(Physics:-Ket(psi, 3), Physics:-Bra(psi, 2))-Physics:-`*`(Physics:-Ket(psi, 3), Physics:-Bra(psi, 3)), 2)

 

28*Physics:-`*`(Physics:-Ket(psi, 3), Physics:-Bra(psi, 3))-12*Physics:-`*`(Physics:-Ket(psi, 3), Physics:-Bra(psi, 2))+12*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 3), Physics:-Bra(psi, 1))-12*Physics:-`*`(Physics:-Ket(psi, 2), Physics:-Bra(psi, 3))+28*Physics:-`*`(Physics:-Ket(psi, 2), Physics:-Bra(psi, 2))-12*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 2), Physics:-Bra(psi, 1))+12*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 1), Physics:-Bra(psi, 3))-12*2^(1/2)*Physics:-`*`(Physics:-Ket(psi, 1), Physics:-Bra(psi, 2))+40*Physics:-`*`(Physics:-Ket(psi, 1), Physics:-Bra(psi, 1))

 

(%Bracket(K, M2^2, K)-%Bracket(K, M2, K)^2)^(1/2) = (6/5)*21^(1/2)

(10)

NULL


Download answer.mw

f := () -> `+`(args):

A better idea is to output the result in TextArea component rather than MathContainer component.

It can be done with the following string of code:

str := cat(sprintf("a[0]=%e\n", a[0]), seq(sprintf("a[%a] = %e,     b[%a]=%e\n", i, a[i], i, b[i]), i = 1 .. Nmax)):
DocumentTools:-SetProperty(TextArea0, value, str):

where Nmax is defined.

You should not use any CAS for such type of tasks.


Let alpha>0.

int(exp(I*alpha*x)/x,x=-infinity..infinity,CauchyPrincipalValue)=

int(cos(alpha*x)/x+I*sin(alpha*x)/x,x=-infinity..infinity,CauchyPrincipalValue)

int(cos(alpha*x)/x,x=-infinity..infinity,CauchyPrincipalValue)=0 (hope, you understand why)

Now

int(I*sin(alpha*x)/x,x=-infinity..infinity,CauchyPrincipalValue)=

=I*int(sin(alpha*x)/x,x=-infinity..infinity)= {y = alpha*x, alpha>0}

=I*int(sin(y)/y,y=-infinity..infinity)=I*Pi.

Hense:

alpha>0:

int(exp(I*alpha*x)/x,x=-infinity..infinity,CauchyPrincipalValue)=I*Pi;

alpha<0

int(exp(I*alpha*x)/x,x=-infinity..infinity,CauchyPrincipalValue)=-I*Pi;

How does it concern Maple?

Please delete this question. It contains a mistake. Sorry.

Please delete this question. It contains a mistake. Sorry.

Thank you, guys! Your answers helped me. Correct region description is:

if -(4*pi)/3/sqrt(3)<x<-(2*pi)/3/sqrt(3) then -sqrt(3)*(x+4*pi/3/sqrt(3))<y<sqrt(3)*(x+4*pi/3/sqrt(3))

if -(2*pi)/3/sqrt(3)<x<(2*pi)/3/sqrt(3) then -2*pi/3<y<2*pi/3

if (2*pi)/3/sqrt(3)<x<(4*pi)/3/sqrt(3) then -sqrt(3)*(4*pi/3/sqrt(3)-x)<y<sqrt(3)*(4*pi/3/sqrt(3)-x)

Markiyan Hirnyk

I tried to upload a picture (png and jpg) of my region (hexagon) but unsuccesfully both times. Though there are empty places in my previous posts.

Hi guys! Thank you for answers!

 

I've used the Jarekkk's solution as it fits my situation the best and it is exactly what I need. pagan's solution was practically the same.

Thank you chenyulue for explanation the difference between expression and function. However, I don't agree with you that my problem was mixing the operators with expressions. I've used operators and expressions properly, IMHO.

Thanks again.

Page 1 of 1