This repository was archived by the owner on Nov 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·71 lines (57 loc) · 2.91 KB
/
run.py
File metadata and controls
executable file
·71 lines (57 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import matplotlib.pyplot as plt
from numpy import array, floor
from functions import buildSpectralDensities, computeGap, getStateList, casimirEstimate
#################################
### Set the following parameters:
#################################
mu = 1
cutoff = 50
system = "strip" #### can set this either to "strip" or "AdS"
#################################
#################################
#################################
gap = computeGap(mu,system)
if system == "strip":
print("\nWe are studying the 2d QFT of a particle of mass {0} on a strip of length L=1.\nThe cutoff (in units of L) is {1}.\nAt zero coupling, the mass gap is {2}.\n".format(mu, cutoff, gap))
gapPrediction = [ 1/gap, -1/(2*gap**3)]
plotTitle = "Spectral densities for the vacuum and first excited state on the strip"
elif system == "AdS":
print("\nWe are studying the 2d QFT of a particle of mass {0} on AdS_2 of radius R=1.\nThe cutoff (in units of R) is {1}.\nAt zero coupling, the scaling dimension of the 1st boundary state is {2}.\n".format(mu, cutoff, gap))
gapPrediction = [ 1/(gap-1/2), -1/(2*(gap-1/2)**3) ]
plotTitle = "Spectral densities for the vacuum and first excited state on AdS"
else:
print("Wrong geometry.\n")
#################################
### Print a list of all relevant states:
#################################
print("We are taking the following states into account:\n\n",getStateList(mu,cutoff,system),"\n")
#################################
### Compute the spectral densities:
#################################
print("Computing and plotting the spectral densities...\n")
(vacSpectralDensity, exSpectralDensity) = buildSpectralDensities(mu,cutoff,system,shift = False)
### try setting shift = True...
#################################
### Plotting the spectral densities:
#################################
[xv, wv] = array([[t[0],t[1]] for t in vacSpectralDensity]).transpose()
[xe, we] = array([[t[0],t[1]] for t in exSpectralDensity]).transpose()
plt.title(plotTitle)
binList = list(range(0,int(floor(cutoff))))
plt.xlim((0,cutoff))
plt.xlabel(r'Energy $E$')
plt.ylabel(r'$\rho(E)$')
plt.hist(xv, bins = binList, weights=wv, alpha = 0.5, label = "vacuum")
plt.hist(xe, bins = binList, weights=we, alpha = 0.5, label = "excited")
plt.legend()
plt.show()
#################################
### Comparing results to theory:
#################################
casimirEnergy = -sum([ t[1]/t[0] for t in vacSpectralDensity ])
firstEnergy = -sum([ t[1]/(t[0]-gap) for t in exSpectralDensity ])
difference = firstEnergy - casimirEnergy
if system == "strip": # for AdS, the Casimir energy diverges
print("The computed Casimir energy is {0},\ncompared to the theoretical value of {1}.\n".format(casimirEnergy, casimirEstimate(mu)))
print("The computed 2nd order contribution to the gap E_1 - E_0 is {0},\ncompared to the theoretical value of {1}.\n".format(difference, gapPrediction[1]))
#################################