From f3dd4403222bedb3cdfbd33f6cdcef0c2d93bbce Mon Sep 17 00:00:00 2001 From: noah Date: Wed, 1 Feb 2023 16:23:56 -0600 Subject: [PATCH] Part 5: Bose-Einstein condensation in variable dimensionality --- Schrick-Noah_Project-2.R | 53 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/Schrick-Noah_Project-2.R b/Schrick-Noah_Project-2.R index d0dd747..7c77b20 100644 --- a/Schrick-Noah_Project-2.R +++ b/Schrick-Noah_Project-2.R @@ -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))