Borrar filtros
Borrar filtros

Check summation from n=0 to 5 |n><n| in MATLAB?

2 visualizaciones (últimos 30 días)
Abu Zar
Abu Zar el 11 de En. de 2023
Respondida: Bjorn Gustavsson el 11 de En. de 2023
D=5;
tmpI=eye(D);
ket0=tmpI(:,1); %|0>
ket1=tmpI(:,2); %|1>
ket2=tmpI(:,3); %|2>
ket3=tmpI(:,4); %|3>
ket4=tmpI(:,5); %|4>
ket5=tmpI(:,6); %|5>
% bra is the transpose of ket
bra0=tmpI(1,:); % <0|
bra1=tmpI(2,:); % <1|
bra2=tmpI(3,:); % <2|
bra3=tmpI(4,:); % <3|
bra4=tmpI(5,:); % <4|

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 11 de En. de 2023
If |n><n| is the same as <n||n> then you should have a look at the help and documentation to dot. That function will not generalize well to the more general <n|G|n>. For that you might get away with the standard vector-matrix-vector products where you'll have to make some discrete version of the operator G. If |n><n| is not the same as <n||n> you might have to explain what it is supposed to be.
HTH

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by