Differences

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

Link to this comparison view

documentation:language_reference:objects:wavefunction:methods:randomize [2016/09/25 13:57] – created Maurits W. Haverkortdocumentation:language_reference:objects:wavefunction:methods:randomize [2016/10/10 09:41] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Randomize ======
  
 +###
 +for a wavefunction //psi// the method //Randomize()// will change all prefactors to random numbers. Real functions stay real, complex stay complex. Randomize does not add determinants to the basis.
 +###
 +
 +===== Example =====
 +
 +###
 +We can define the following function:
 +$$
 +|\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.
 +$$
 +Randomization will turn $\psi$ into
 +$$
 +|\psi\rangle = \left(\alpha a^{\dagger}_0 a^{\dagger}_1 + \beta a^{\dagger}_0 a^{\dagger}_2 + \gamma a^{\dagger}_1 a^{\dagger}_2 \right)|0\rangle.
 +$$
 +with $\alpha$, $\beta$, and $\gamma$ random complex numbers.
 +
 +
 +###
 +
 +==== Input ====
 +<code Quanty Example.Quanty>
 +NF=3
 +NB=0
 +psi = NewWavefunction(NF, NB, {{"110",sqrt(1/4)},{"101",sqrt(1/4)},{"011",(1+I)*sqrt(1/4)}})
 +print(psi)
 +psi.Randomize()
 +print(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
 +     5.000000000000E-01         0.000000000000E+00       110
 +     5.000000000000E-01         0.000000000000E+00       101
 +     5.000000000000E-01         5.000000000000E-01       011
 +
 +
 +
 +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
 +     4.123403010817E-01        -6.670525008798E-02       110
 +     5.285982509213E-02        -4.533726157538E-01       101
 +    -7.307037171865E-01         2.885430185954E-01       011
 +</file>
 +
 +===== Available methods =====
 +{{indexmenu>.#1}}
Print/export