From 6376bee4e22d7b6e9ebe575dc12bef748f578dcf Mon Sep 17 00:00:00 2001 From: sotech117 Date: Tue, 7 May 2024 20:32:57 -0400 Subject: move animations for link --- .DS_Store | Bin 14340 -> 12292 bytes hw8/10-17-tunnelling-0.025-200.0.mp4 | Bin 1268128 -> 0 bytes hw8/10-17-tunnelling-0.025-40.0.mp4 | Bin 1308178 -> 0 bytes hw8/10-17-tunnelling-0.025.mp4 | Bin 1268128 -> 0 bytes hw8/10-17-tunnelling-0.05-200.0.mp4 | Bin 1251259 -> 0 bytes hw8/10-17-tunnelling-0.05-40.0.mp4 | Bin 1127725 -> 0 bytes hw8/10-17-tunnelling-0.05.mp4 | Bin 326530 -> 0 bytes hw8/10-17-tunnelling-0.1.mp4 | Bin 289775 -> 0 bytes hw8/10-3-energy-levels.png | Bin 0 -> 51999 bytes hw8/10-3-new.jl | 90 ++++++++++++++++++++++++ hw8/10-3-potentials.png | Bin 0 -> 31519 bytes hw8/animations/10-17-tunnelling-0.025-200.0.mp4 | Bin 0 -> 1268128 bytes hw8/animations/10-17-tunnelling-0.025-40.0.mp4 | Bin 0 -> 1308178 bytes hw8/animations/10-17-tunnelling-0.025.mp4 | Bin 0 -> 1268128 bytes hw8/animations/10-17-tunnelling-0.05-200.0.mp4 | Bin 0 -> 1251259 bytes hw8/animations/10-17-tunnelling-0.05-40.0.mp4 | Bin 0 -> 1127725 bytes hw8/animations/10-17-tunnelling-0.05.mp4 | Bin 0 -> 326530 bytes hw8/animations/10-17-tunnelling-0.1.mp4 | Bin 0 -> 289775 bytes hw8/vo1600widith025tunneled.png | Bin 0 -> 1187184 bytes hw8/vo1600width025center.png | Bin 0 -> 1135847 bytes hw8/vo1600width05.png | Bin 0 -> 1369117 bytes hw8/vo4000withd025tunelling.png | Bin 0 -> 1160983 bytes hw8/vo40kwidth05center.png | Bin 0 -> 862124 bytes 23 files changed, 90 insertions(+) delete mode 100644 hw8/10-17-tunnelling-0.025-200.0.mp4 delete mode 100644 hw8/10-17-tunnelling-0.025-40.0.mp4 delete mode 100644 hw8/10-17-tunnelling-0.025.mp4 delete mode 100644 hw8/10-17-tunnelling-0.05-200.0.mp4 delete mode 100644 hw8/10-17-tunnelling-0.05-40.0.mp4 delete mode 100644 hw8/10-17-tunnelling-0.05.mp4 delete mode 100644 hw8/10-17-tunnelling-0.1.mp4 create mode 100644 hw8/10-3-energy-levels.png create mode 100644 hw8/10-3-new.jl create mode 100644 hw8/10-3-potentials.png create mode 100644 hw8/animations/10-17-tunnelling-0.025-200.0.mp4 create mode 100644 hw8/animations/10-17-tunnelling-0.025-40.0.mp4 create mode 100644 hw8/animations/10-17-tunnelling-0.025.mp4 create mode 100644 hw8/animations/10-17-tunnelling-0.05-200.0.mp4 create mode 100644 hw8/animations/10-17-tunnelling-0.05-40.0.mp4 create mode 100644 hw8/animations/10-17-tunnelling-0.05.mp4 create mode 100644 hw8/animations/10-17-tunnelling-0.1.mp4 create mode 100644 hw8/vo1600widith025tunneled.png create mode 100644 hw8/vo1600width025center.png create mode 100644 hw8/vo1600width05.png create mode 100644 hw8/vo4000withd025tunelling.png create mode 100644 hw8/vo40kwidth05center.png diff --git a/.DS_Store b/.DS_Store index 1d1ed19..41619b5 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/hw8/10-17-tunnelling-0.025-200.0.mp4 b/hw8/10-17-tunnelling-0.025-200.0.mp4 deleted file mode 100644 index 49b9c9f..0000000 Binary files a/hw8/10-17-tunnelling-0.025-200.0.mp4 and /dev/null differ diff --git a/hw8/10-17-tunnelling-0.025-40.0.mp4 b/hw8/10-17-tunnelling-0.025-40.0.mp4 deleted file mode 100644 index 9b80be7..0000000 Binary files a/hw8/10-17-tunnelling-0.025-40.0.mp4 and /dev/null differ diff --git a/hw8/10-17-tunnelling-0.025.mp4 b/hw8/10-17-tunnelling-0.025.mp4 deleted file mode 100644 index 49b9c9f..0000000 Binary files a/hw8/10-17-tunnelling-0.025.mp4 and /dev/null differ diff --git a/hw8/10-17-tunnelling-0.05-200.0.mp4 b/hw8/10-17-tunnelling-0.05-200.0.mp4 deleted file mode 100644 index 25ebb7d..0000000 Binary files a/hw8/10-17-tunnelling-0.05-200.0.mp4 and /dev/null differ diff --git a/hw8/10-17-tunnelling-0.05-40.0.mp4 b/hw8/10-17-tunnelling-0.05-40.0.mp4 deleted file mode 100644 index 9b3124f..0000000 Binary files a/hw8/10-17-tunnelling-0.05-40.0.mp4 and /dev/null differ diff --git a/hw8/10-17-tunnelling-0.05.mp4 b/hw8/10-17-tunnelling-0.05.mp4 deleted file mode 100644 index b247200..0000000 Binary files a/hw8/10-17-tunnelling-0.05.mp4 and /dev/null differ diff --git a/hw8/10-17-tunnelling-0.1.mp4 b/hw8/10-17-tunnelling-0.1.mp4 deleted file mode 100644 index f2ba8b9..0000000 Binary files a/hw8/10-17-tunnelling-0.1.mp4 and /dev/null differ diff --git a/hw8/10-3-energy-levels.png b/hw8/10-3-energy-levels.png new file mode 100644 index 0000000..7ce6d0f Binary files /dev/null and b/hw8/10-3-energy-levels.png 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 Binary files /dev/null and b/hw8/10-3-potentials.png differ diff --git a/hw8/animations/10-17-tunnelling-0.025-200.0.mp4 b/hw8/animations/10-17-tunnelling-0.025-200.0.mp4 new file mode 100644 index 0000000..49b9c9f Binary files /dev/null and b/hw8/animations/10-17-tunnelling-0.025-200.0.mp4 differ diff --git a/hw8/animations/10-17-tunnelling-0.025-40.0.mp4 b/hw8/animations/10-17-tunnelling-0.025-40.0.mp4 new file mode 100644 index 0000000..9b80be7 Binary files /dev/null and b/hw8/animations/10-17-tunnelling-0.025-40.0.mp4 differ diff --git a/hw8/animations/10-17-tunnelling-0.025.mp4 b/hw8/animations/10-17-tunnelling-0.025.mp4 new file mode 100644 index 0000000..49b9c9f Binary files /dev/null and b/hw8/animations/10-17-tunnelling-0.025.mp4 differ diff --git a/hw8/animations/10-17-tunnelling-0.05-200.0.mp4 b/hw8/animations/10-17-tunnelling-0.05-200.0.mp4 new file mode 100644 index 0000000..25ebb7d Binary files /dev/null and b/hw8/animations/10-17-tunnelling-0.05-200.0.mp4 differ diff --git a/hw8/animations/10-17-tunnelling-0.05-40.0.mp4 b/hw8/animations/10-17-tunnelling-0.05-40.0.mp4 new file mode 100644 index 0000000..9b3124f Binary files /dev/null and b/hw8/animations/10-17-tunnelling-0.05-40.0.mp4 differ diff --git a/hw8/animations/10-17-tunnelling-0.05.mp4 b/hw8/animations/10-17-tunnelling-0.05.mp4 new file mode 100644 index 0000000..b247200 Binary files /dev/null and b/hw8/animations/10-17-tunnelling-0.05.mp4 differ diff --git a/hw8/animations/10-17-tunnelling-0.1.mp4 b/hw8/animations/10-17-tunnelling-0.1.mp4 new file mode 100644 index 0000000..f2ba8b9 Binary files /dev/null and b/hw8/animations/10-17-tunnelling-0.1.mp4 differ diff --git a/hw8/vo1600widith025tunneled.png b/hw8/vo1600widith025tunneled.png new file mode 100644 index 0000000..24ac63f Binary files /dev/null and b/hw8/vo1600widith025tunneled.png differ diff --git a/hw8/vo1600width025center.png b/hw8/vo1600width025center.png new file mode 100644 index 0000000..bd46722 Binary files /dev/null and b/hw8/vo1600width025center.png differ diff --git a/hw8/vo1600width05.png b/hw8/vo1600width05.png new file mode 100644 index 0000000..463f894 Binary files /dev/null and b/hw8/vo1600width05.png differ diff --git a/hw8/vo4000withd025tunelling.png b/hw8/vo4000withd025tunelling.png new file mode 100644 index 0000000..0b651d2 Binary files /dev/null and b/hw8/vo4000withd025tunelling.png differ diff --git a/hw8/vo40kwidth05center.png b/hw8/vo40kwidth05center.png new file mode 100644 index 0000000..f248e95 Binary files /dev/null and b/hw8/vo40kwidth05center.png differ -- cgit v1.2.3-70-g09d2