Part 5: Bose-Einstein condensation in variable dimensionality

This commit is contained in:
Noah L. Schrick 2023-02-01 16:23:56 -06:00
parent c9a67f0347
commit f3dd440322

View File

@ -25,7 +25,7 @@ findZeroBisect <- function(func, xl, xr, tol, maxsteps=1e6){
# Solve 1a
fun.a <- function(x) {x^2-2}
fun.a.string <- "x^2-2=0"
sqrt2.estimate <- findZeroBisect(fun.a.string,1,2,1e-6)
sqrt2.estimate <- findZeroBisect(fun.a,1,2,1e-6)
# Plot 1a
if (!require("ggplot2")) install.packages("ggplot2")
library(ggplot2)
@ -189,3 +189,54 @@ fb.estimate <- implicitFF(8000, 0.0001, 0)
# 4c
fc.estimate <- implicitFF(9000, 0.0001, 0)
## Part 5: Bose-Einstein condensation in variable dimensionality
# a:
g <- 10000
d <- 2
l <- 0
func.five <- function(u){
(-10000/(2*pi)) +
(u/2) *
sqrt((u^2)-((d+2*l)^2)/4) +
(((d+2*l)^2)/16) *
log((u-sqrt((u^2)-((d+2*l)^2)/4))/(u+sqrt((u^2)-((d+2*l)^2)/4)))
}
func.five.string <- "function"
func.five.estimate <- findZeroBisect(func.five,50,75,1e-6)
# Plot
ggplot(data.frame(x=seq(1,80,.1)), aes(x)) +
stat_function(fun=func.five, aes(col=func.five.string)) +
geom_hline(aes(yintercept=0, col = "y=0"), show.legend=TRUE)+
geom_vline(aes(xintercept=func.five.estimate[1],
col = "bisection estimate"), show.legend=TRUE)+
ggtitle("zeroth-order dimensional perturbation theory approximation for the chemical potential of the Gross-Pitaevskii equation in d dimensions") +
xlab("x") + ylab("y") +
theme(text = element_text(size=20), plot.title = element_text(hjust = 0.5))
# b:
g <- 10000
d <- 2
l <- 1
func.five <- function(u){
(-10000/(2*pi)) +
(u/2) *
sqrt((u^2)-((d+2*l)^2)/4) +
(((d+2*l)^2)/16) *
log((u-sqrt((u^2)-((d+2*l)^2)/4))/(u+sqrt((u^2)-((d+2*l)^2)/4)))
}
func.five.string <- "function"
func.five.estimate <- findZeroBisect(func.five,50,75,1e-6)
# Plot
ggplot(data.frame(x=seq(5,80,.1)), aes(x)) +
stat_function(fun=func.five, aes(col=func.five.string)) +
geom_hline(aes(yintercept=0, col = "y=0"), show.legend=TRUE)+
geom_vline(aes(xintercept=func.five.estimate[1],
col = "bisection estimate"), show.legend=TRUE)+
ggtitle("zeroth-order dimensional perturbation theory approximation for the chemical potential of the Gross-Pitaevskii equation in d dimensions") +
xlab("x") + ylab("y") +
theme(text = element_text(size=20), plot.title = element_text(hjust = 0.5))