====== Chop ======
###
Numerics inside a computer is not exact. Quanty represents numbers by doubles, which can store numbers with about 16 digits accuracy. The fact that you only have 16 digits can lead to number-loss and situations where numbers that should be zero are close to zero but not exactly zero. An example in base 10: If you represent $1/3$ by $0.3333333333333333$ then $1-3\times0.3333333333333333 = 0.00000000000000001$. In Quanty you can remove these small numbers with the command //Chop()//.
###
###
For an operator //O//, //O.Chop()// or //O.Chop($\epsilon$)// Removes small (smaller than $\epsilon$) numbers from the operator. The standard value (when the argument is omitted) for $\epsilon = 2.2 \times 10^{−15}$. //O.Chop()// returns //nil// and changes the value of //O//.
###
===== Example =====
###
We define:
$$O=3.4+1.2a^{\dagger}_{0}\,a^{\phantom{\dagger}}_{0}+(2.5+0.0000000001I)a^{\dagger}_{1}\,a^{\phantom{\dagger}}_{2},$$
and remove the small complex part with the command //Chop()//
###
==== Input ====
NF=3
NB=0
O = NewOperator(NF,NB,{{3.4},{0,-0,1.2},{1,-2,2.5+0.0000000001*I}})
print(O)
O.Chop(0.00001)
print(O)
==== Result ====
Operator: Operator
QComplex = 2 (Real==0 or Complex==1 or Mixed==2)
MaxLength = 2 (largest number of product of lader operators)
NFermionic modes = 3 (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 0
QComplex = 0 (Real==0 or Complex==1)
N = 1 (number of operators of length 0)
| 3.400000000000000E+00
Operator of Length 2
QComplex = 1 (Real==0 or Complex==1)
N = 2 (number of operators of length 2)
C 0 A 0 | 1.200000000000000E+00 0.000000000000000E+00
C 1 A 2 | 2.500000000000000E+00 1.000000000000000E-10
Operator: Operator
QComplex = 0 (Real==0 or Complex==1 or Mixed==2)
MaxLength = 2 (largest number of product of lader operators)
NFermionic modes = 3 (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 0
QComplex = 0 (Real==0 or Complex==1)
N = 1 (number of operators of length 0)
| 3.400000000000000E+00
Operator of Length 2
QComplex = 0 (Real==0 or Complex==1)
N = 2 (number of operators of length 2)
C 0 A 0 | 1.200000000000000E+00
C 1 A 2 | 2.500000000000000E+00
===== Available methods =====
{{indexmenu>.#1}}