no way to compare when less than two revisions

Differences

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


Previous revision
Last revision
documentation:language_reference:functions:chop [2016/10/10 09:41] – external edit 127.0.0.1
Line 1: Line 1:
 +====== Chop ======
  
 +###
 +Chop(//a//) replaces approximate real numbers in //a// that are close to zero by the exact integer 0. Chop(//a//, $\epsilon$) replaces numbers smaller in absolute magnitude than $\epsilon$ by 0. Chop uses a default tolerance of $\epsilon=10^{-10}$. Chop works on Real and Complex numbers as well as on operators and wavefunctions. 
 +###
 +
 +===== Input =====
 +
 +  * //a// : object that will be chopped, all types allowed
 +  * $\epsilon$ : real number setting the boundary between zero and finite
 +
 +===== Output =====
 +
 +  * //a'// : object of same type as //a//
 +
 +===== Example =====
 +
 +###
 +A small test script of chop is:
 +###
 +
 +==== Input ====
 +<code Quanty Chop.Quanty>
 +dofile("../definitions.Quanty")
 +
 +Opp = Opp1 + 0.000001*Opp2
 +print(Opp)
 +Opp3 = Chop(Opp,0.001)
 +print(Opp3)
 +
 +psi = psi1 + 0.00001 * psi2
 +print(psi)
 +psi3 = Chop(psi,0.001)
 +print(psi3)
 +
 +a = 0.000001 + 0.3 * I
 +b = Chop(a,0.001)
 +print("a = ",a,"\nChop(a) = ",b)
 +</code>
 +
 +==== Result ====
 +<file Quanty_Output Chop.out>
 +
 +Operator: Lx
 +QComplex                  1 (Real==0 or Complex==1 or Mixed==2)
 +MaxLength        =          2 (largest number of product of lader operators)
 +NFermionic modes =          6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
 +NBosonic modes            0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)
 +
 +Operator of Length   2
 +QComplex      =          1 (Real==0 or Complex==1)
 +N                      8 (number of operators of length   2)
 +C  3 A  1 |  7.071067811865476E-01 -7.071067811865476E-07
 +C  1 A  3 |  7.071067811865476E-01  7.071067811865476E-07
 +C  2 A  0 |  7.071067811865476E-01 -7.071067811865476E-07
 +C  0 A  2 |  7.071067811865476E-01  7.071067811865476E-07
 +C  5 A  3 |  7.071067811865476E-01 -7.071067811865476E-07
 +C  3 A  5 |  7.071067811865476E-01  7.071067811865476E-07
 +C  4 A  2 |  7.071067811865476E-01 -7.071067811865476E-07
 +C  2 A  4 |  7.071067811865476E-01  7.071067811865476E-07
 +
 +
 +
 +Operator: Lx
 +QComplex                  0 (Real==0 or Complex==1 or Mixed==2)
 +MaxLength        =          2 (largest number of product of lader operators)
 +NFermionic modes =          6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
 +NBosonic modes            0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)
 +
 +Operator of Length   2
 +QComplex      =          0 (Real==0 or Complex==1)
 +N                      8 (number of operators of length   2)
 +C  3 A  1 |  7.071067811865476E-01
 +C  1 A  3 |  7.071067811865476E-01
 +C  2 A  0 |  7.071067811865476E-01
 +C  0 A  2 |  7.071067811865476E-01
 +C  5 A  3 |  7.071067811865476E-01
 +C  3 A  5 |  7.071067811865476E-01
 +C  4 A  2 |  7.071067811865476E-01
 +C  2 A  4 |  7.071067811865476E-01
 +
 +
 +
 +WaveFunction: Wave Function
 +QComplex                  0 (Real==0 or Complex==1)
 +N                =          3 (Number of basis functions used to discribe psi)
 +NFermionic modes =          6 (Number of fermions in the one particle basis)
 +NBosonic modes            0 (Number of bosons in the one particle basis)
 +
 +#      pre-factor         Determinant
 +     3.162277660168E-01       110000
 +     9.486832980505E-01       100010
 +     1.000000000000E-05       010010
 +
 +
 +
 +WaveFunction: Wave Function
 +QComplex                  0 (Real==0 or Complex==1)
 +N                =          2 (Number of basis functions used to discribe psi)
 +NFermionic modes =          6 (Number of fermions in the one particle basis)
 +NBosonic modes            0 (Number of bosons in the one particle basis)
 +
 +#      pre-factor         Determinant
 +     9.486832980505E-01       100010
 +     3.162277660168E-01       110000
 +
 +
 +a = (1e-06 + 0.3 I)
 +Chop(a) = (0 + 0.3 I)
 +
 +</file>
 +
 +===== Table of contents =====
 +{{indexmenu>.#1}}
Print/export