aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2024-05-07 20:32:57 -0400
committersotech117 <michael_foiani@brown.edu>2024-05-07 20:32:57 -0400
commit6376bee4e22d7b6e9ebe575dc12bef748f578dcf (patch)
tree8394f28713b906d7c4a2fce0bdf44cbe2998602f
parent5d7a9ddfc13d8eec746005fad54cabaca15c6449 (diff)
move animations for link
-rw-r--r--.DS_Storebin14340 -> 12292 bytes
-rw-r--r--hw8/10-3-energy-levels.pngbin0 -> 51999 bytes
-rw-r--r--hw8/10-3-new.jl90
-rw-r--r--hw8/10-3-potentials.pngbin0 -> 31519 bytes
-rw-r--r--hw8/animations/10-17-tunnelling-0.025-200.0.mp4 (renamed from hw8/10-17-tunnelling-0.025-200.0.mp4)bin1268128 -> 1268128 bytes
-rw-r--r--hw8/animations/10-17-tunnelling-0.025-40.0.mp4 (renamed from hw8/10-17-tunnelling-0.025-40.0.mp4)bin1308178 -> 1308178 bytes
-rw-r--r--hw8/animations/10-17-tunnelling-0.025.mp4 (renamed from hw8/10-17-tunnelling-0.025.mp4)bin1268128 -> 1268128 bytes
-rw-r--r--hw8/animations/10-17-tunnelling-0.05-200.0.mp4 (renamed from hw8/10-17-tunnelling-0.05-200.0.mp4)bin1251259 -> 1251259 bytes
-rw-r--r--hw8/animations/10-17-tunnelling-0.05-40.0.mp4 (renamed from hw8/10-17-tunnelling-0.05-40.0.mp4)bin1127725 -> 1127725 bytes
-rw-r--r--hw8/animations/10-17-tunnelling-0.05.mp4 (renamed from hw8/10-17-tunnelling-0.05.mp4)bin326530 -> 326530 bytes
-rw-r--r--hw8/animations/10-17-tunnelling-0.1.mp4 (renamed from hw8/10-17-tunnelling-0.1.mp4)bin289775 -> 289775 bytes
-rw-r--r--hw8/vo1600widith025tunneled.pngbin0 -> 1187184 bytes
-rw-r--r--hw8/vo1600width025center.pngbin0 -> 1135847 bytes
-rw-r--r--hw8/vo1600width05.pngbin0 -> 1369117 bytes
-rw-r--r--hw8/vo4000withd025tunelling.pngbin0 -> 1160983 bytes
-rw-r--r--hw8/vo40kwidth05center.pngbin0 -> 862124 bytes
16 files changed, 90 insertions, 0 deletions
diff --git a/.DS_Store b/.DS_Store
index 1d1ed19..41619b5 100644
--- a/.DS_Store
+++ b/.DS_Store
Binary files differ
diff --git a/hw8/10-3-energy-levels.png b/hw8/10-3-energy-levels.png
new file mode 100644
index 0000000..7ce6d0f
--- /dev/null
+++ b/hw8/10-3-energy-levels.png
Binary files differ
diff --git a/hw8/10-3-new.jl b/hw8/10-3-new.jl
new file mode 100644
index 0000000..fb819b8
--- /dev/null
+++ b/hw8/10-3-new.jl
@@ -0,0 +1,90 @@
+using Plots
+using LinearAlgebra
+
+m = 1
+hbar = 1
+xmin = -6.5
+xmax = 6.5
+N = 2000
+x = collect(range(xmin, stop = xmax, length = N + 1)) # one extra, want 1000 spaces
+dx = x[2] - x[1]
+println("dx = ", dx)
+p = 0.0
+V0 = 2 * p^2 / (2.0 * m)
+sig = 0.25
+x0 = 2.0 # a bit away to not interfere with the walls
+
+# setup the potential barrier
+# V = 0 .* x
+# # println("V = ", length(V))
+# for i in 1:length(V)
+# V[i] = abs(x[i])^n
+# end
+
+# make the initial wavefunction
+psi0 = exp.(-((x[2:end-1] .+ x0) .^ 2) / (2 * sig^2)) .* exp.(1.0im * p * x[2:end-1])
+
+C = sum(abs2.(psi0) .* dx)
+psi0 = psi0 / sqrt(C)
+# plot(x[2:end-1], abs.(psi0), xlabel = "x", ylabel = "Re(psi)", title = "Initial wavefunction", legend = :none)
+
+# # make the Hamiltonian
+# A = (hbar^2 / (2 * m * dx^2))
+# # main diagonal
+# d = A * ones(N - 1) + V[2:end-1] # add potential
+# # upper and lower diagonals
+# dl = (A / -2.0) * ones(N - 2)
+# du = (A / -2.0) * ones(N - 2)
+# H = Tridiagonal(dl, d, du)
+
+# # diagonalize matrix
+# E, psi = eigen(H)
+# psi1 = psi[:, 1]
+
+# print the energy levels
+# println("Energy levels: ", E[1:10])
+
+function get_energy_levels_for_n(n, pot_plot)
+ V = 0 .* x
+ for i in 1:length(V)
+ V[i] = abs(x[i])^n
+ end
+ # plot the potential
+ println("Plotting potential for n = ", n)
+ plot!(pot_plot, x, V, xlabel = "x", ylabel = "V(x)", title = "Potential V(x) = |x|^n", label = "n = $n")
+ println("Calculating energy levels for n = ", n)
+ # make the Hamiltonian
+ A = (hbar^2 / (2 * m * dx^2))
+ # main diagonal
+ d = A * ones(N - 1) + V[2:end-1] # add potential
+ # upper and lower diagonals
+ dl = (A / -2.0) * ones(N - 2)
+ du = (A / -2.0) * ones(N - 2)
+ H = Tridiagonal(dl, d, du)
+
+ println("Diagonalizing matrix for n = ", n)
+
+ # diagonalize matrix
+ E, psi = eigen(H)
+
+ println("Energy levels for n = ", n, ": ", E[1:10])
+ return E
+end
+
+po = plot!()
+energy_levels = []
+n_max = 19
+for n in 1:n_max
+ E = get_energy_levels_for_n(n, po)
+ push!(energy_levels, E)
+end
+savefig(po, "hw8/10-3-potentials.png")
+
+# plot the energy levels
+pl = plot(title = "Energy levels for n = 1 to $n_max", xlabel = "n", ylabel = "Energy")
+for i in 1:5
+ plot!(pl, 1:n_max, [E[i] for E in energy_levels], label = "Energy Level $i", marker = :circle)
+end
+savefig(pl, "hw8/10-3-energy-levels.png")
+
+
diff --git a/hw8/10-3-potentials.png b/hw8/10-3-potentials.png
new file mode 100644
index 0000000..6d1d324
--- /dev/null
+++ b/hw8/10-3-potentials.png
Binary files differ
diff --git a/hw8/10-17-tunnelling-0.025-200.0.mp4 b/hw8/animations/10-17-tunnelling-0.025-200.0.mp4
index 49b9c9f..49b9c9f 100644
--- a/hw8/10-17-tunnelling-0.025-200.0.mp4
+++ b/hw8/animations/10-17-tunnelling-0.025-200.0.mp4
Binary files differ
diff --git a/hw8/10-17-tunnelling-0.025-40.0.mp4 b/hw8/animations/10-17-tunnelling-0.025-40.0.mp4
index 9b80be7..9b80be7 100644
--- a/hw8/10-17-tunnelling-0.025-40.0.mp4
+++ b/hw8/animations/10-17-tunnelling-0.025-40.0.mp4
Binary files differ
diff --git a/hw8/10-17-tunnelling-0.025.mp4 b/hw8/animations/10-17-tunnelling-0.025.mp4
index 49b9c9f..49b9c9f 100644
--- a/hw8/10-17-tunnelling-0.025.mp4
+++ b/hw8/animations/10-17-tunnelling-0.025.mp4
Binary files differ
diff --git a/hw8/10-17-tunnelling-0.05-200.0.mp4 b/hw8/animations/10-17-tunnelling-0.05-200.0.mp4
index 25ebb7d..25ebb7d 100644
--- a/hw8/10-17-tunnelling-0.05-200.0.mp4
+++ b/hw8/animations/10-17-tunnelling-0.05-200.0.mp4
Binary files differ
diff --git a/hw8/10-17-tunnelling-0.05-40.0.mp4 b/hw8/animations/10-17-tunnelling-0.05-40.0.mp4
index 9b3124f..9b3124f 100644
--- a/hw8/10-17-tunnelling-0.05-40.0.mp4
+++ b/hw8/animations/10-17-tunnelling-0.05-40.0.mp4
Binary files differ
diff --git a/hw8/10-17-tunnelling-0.05.mp4 b/hw8/animations/10-17-tunnelling-0.05.mp4
index b247200..b247200 100644
--- a/hw8/10-17-tunnelling-0.05.mp4
+++ b/hw8/animations/10-17-tunnelling-0.05.mp4
Binary files differ
diff --git a/hw8/10-17-tunnelling-0.1.mp4 b/hw8/animations/10-17-tunnelling-0.1.mp4
index f2ba8b9..f2ba8b9 100644
--- a/hw8/10-17-tunnelling-0.1.mp4
+++ b/hw8/animations/10-17-tunnelling-0.1.mp4
Binary files differ
diff --git a/hw8/vo1600widith025tunneled.png b/hw8/vo1600widith025tunneled.png
new file mode 100644
index 0000000..24ac63f
--- /dev/null
+++ b/hw8/vo1600widith025tunneled.png
Binary files differ
diff --git a/hw8/vo1600width025center.png b/hw8/vo1600width025center.png
new file mode 100644
index 0000000..bd46722
--- /dev/null
+++ b/hw8/vo1600width025center.png
Binary files differ
diff --git a/hw8/vo1600width05.png b/hw8/vo1600width05.png
new file mode 100644
index 0000000..463f894
--- /dev/null
+++ b/hw8/vo1600width05.png
Binary files differ
diff --git a/hw8/vo4000withd025tunelling.png b/hw8/vo4000withd025tunelling.png
new file mode 100644
index 0000000..0b651d2
--- /dev/null
+++ b/hw8/vo4000withd025tunelling.png
Binary files differ
diff --git a/hw8/vo40kwidth05center.png b/hw8/vo40kwidth05center.png
new file mode 100644
index 0000000..f248e95
--- /dev/null
+++ b/hw8/vo40kwidth05center.png
Binary files differ