Differences

This shows you the differences between two versions of the page.

Link to this comparison view

documentation:language_reference:objects:wavefunction:methods:normalize [2016/09/25 13:58] – created Maurits W. Haverkortdocumentation:language_reference:objects:wavefunction:methods:normalize [2016/10/10 09:41] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Normalize ======
  
 +###
 +for a wavefunction //psi// the method //Normalize()// will change the overall prefactor of the wavefunction such that $\langle \psi | \psi \rangle=1$. 
 +###
 +
 +===== Example =====
 +
 +###
 +We can define the following function:
 +$$
 +|\psi\rangle = \left(a^{\dagger}_0 a^{\dagger}_1 + a^{\dagger}_0 a^{\dagger}_2 + (1+I) a^{\dagger}_1 a^{\dagger}_2 \right)|0\rangle.
 +$$
 +after normalization it becomes
 +$$
 +|\psi\rangle = \left(\frac{1}{\sqrt{4}} a^{\dagger}_0 a^{\dagger}_1 + \frac{1}{\sqrt{4}} a^{\dagger}_0 a^{\dagger}_2 + (1+I)\frac{1}{\sqrt{4}} a^{\dagger}_1 a^{\dagger}_2 \right)|0\rangle.
 +$$
 +###
 +
 +==== Input ====
 +<code Quanty Example.Quanty>
 +NF=3
 +NB=0
 +psi = NewWavefunction(NF, NB, {{"110",1},{"101",1},{"011",(1+I)}})
 +print(psi)
 +print("The norm of psi is ",psi*psi)
 +psi.Normalize()
 +print(psi)
 +print("The norm of psi is ",psi*psi)
 +</code>
 +
 +==== Result ====
 +<file Quanty_Output>
 +WaveFunction: Wave Function
 +QComplex                  1 (Real==0 or Complex==1)
 +N                =          3 (Number of basis functions used to discribe psi)
 +NFermionic modes =          3 (Number of fermions in the one particle basis)
 +NBosonic modes            0 (Number of bosons in the one particle basis)
 +
 +#      pre-factor             +I  pre-factor         Determinant
 +     1.000000000000E+00         0.000000000000E+00       110
 +     1.000000000000E+00         0.000000000000E+00       101
 +     1.000000000000E+00         1.000000000000E+00       011
 +
 +
 +The norm of psi is 4
 +
 +WaveFunction: Wave Function
 +QComplex                  1 (Real==0 or Complex==1)
 +N                =          3 (Number of basis functions used to discribe psi)
 +NFermionic modes =          3 (Number of fermions in the one particle basis)
 +NBosonic modes            0 (Number of bosons in the one particle basis)
 +
 +#      pre-factor             +I  pre-factor         Determinant
 +     5.000000000000E-01         0.000000000000E+00       110
 +     5.000000000000E-01         0.000000000000E+00       101
 +     5.000000000000E-01         5.000000000000E-01       011
 +
 +
 +The norm of psi is 1
 +</file>
 +
 +===== Available methods =====
 +{{indexmenu>.#1}}
Print/export