diff options
author | sotech117 <michael_foiani@brown.edu> | 2024-05-07 20:32:57 -0400 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2024-05-07 20:32:57 -0400 |
commit | 6376bee4e22d7b6e9ebe575dc12bef748f578dcf (patch) | |
tree | 8394f28713b906d7c4a2fce0bdf44cbe2998602f | |
parent | 5d7a9ddfc13d8eec746005fad54cabaca15c6449 (diff) |
move animations for link
-rw-r--r-- | .DS_Store | bin | 14340 -> 12292 bytes | |||
-rw-r--r-- | hw8/10-3-energy-levels.png | bin | 0 -> 51999 bytes | |||
-rw-r--r-- | hw8/10-3-new.jl | 90 | ||||
-rw-r--r-- | hw8/10-3-potentials.png | bin | 0 -> 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) | bin | 1268128 -> 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) | bin | 1308178 -> 1308178 bytes | |||
-rw-r--r-- | hw8/animations/10-17-tunnelling-0.025.mp4 (renamed from hw8/10-17-tunnelling-0.025.mp4) | bin | 1268128 -> 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) | bin | 1251259 -> 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) | bin | 1127725 -> 1127725 bytes | |||
-rw-r--r-- | hw8/animations/10-17-tunnelling-0.05.mp4 (renamed from hw8/10-17-tunnelling-0.05.mp4) | bin | 326530 -> 326530 bytes | |||
-rw-r--r-- | hw8/animations/10-17-tunnelling-0.1.mp4 (renamed from hw8/10-17-tunnelling-0.1.mp4) | bin | 289775 -> 289775 bytes | |||
-rw-r--r-- | hw8/vo1600widith025tunneled.png | bin | 0 -> 1187184 bytes | |||
-rw-r--r-- | hw8/vo1600width025center.png | bin | 0 -> 1135847 bytes | |||
-rw-r--r-- | hw8/vo1600width05.png | bin | 0 -> 1369117 bytes | |||
-rw-r--r-- | hw8/vo4000withd025tunelling.png | bin | 0 -> 1160983 bytes | |||
-rw-r--r-- | hw8/vo40kwidth05center.png | bin | 0 -> 862124 bytes |
16 files changed, 90 insertions, 0 deletions
Binary files differ diff --git a/hw8/10-3-energy-levels.png b/hw8/10-3-energy-levels.png Binary files differnew file mode 100644 index 0000000..7ce6d0f --- /dev/null +++ b/hw8/10-3-energy-levels.png 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 Binary files differnew file mode 100644 index 0000000..6d1d324 --- /dev/null +++ b/hw8/10-3-potentials.png diff --git a/hw8/10-17-tunnelling-0.025-200.0.mp4 b/hw8/animations/10-17-tunnelling-0.025-200.0.mp4 Binary files differindex 49b9c9f..49b9c9f 100644 --- a/hw8/10-17-tunnelling-0.025-200.0.mp4 +++ b/hw8/animations/10-17-tunnelling-0.025-200.0.mp4 diff --git a/hw8/10-17-tunnelling-0.025-40.0.mp4 b/hw8/animations/10-17-tunnelling-0.025-40.0.mp4 Binary files differindex 9b80be7..9b80be7 100644 --- a/hw8/10-17-tunnelling-0.025-40.0.mp4 +++ b/hw8/animations/10-17-tunnelling-0.025-40.0.mp4 diff --git a/hw8/10-17-tunnelling-0.025.mp4 b/hw8/animations/10-17-tunnelling-0.025.mp4 Binary files differindex 49b9c9f..49b9c9f 100644 --- a/hw8/10-17-tunnelling-0.025.mp4 +++ b/hw8/animations/10-17-tunnelling-0.025.mp4 diff --git a/hw8/10-17-tunnelling-0.05-200.0.mp4 b/hw8/animations/10-17-tunnelling-0.05-200.0.mp4 Binary files differindex 25ebb7d..25ebb7d 100644 --- a/hw8/10-17-tunnelling-0.05-200.0.mp4 +++ b/hw8/animations/10-17-tunnelling-0.05-200.0.mp4 diff --git a/hw8/10-17-tunnelling-0.05-40.0.mp4 b/hw8/animations/10-17-tunnelling-0.05-40.0.mp4 Binary files differindex 9b3124f..9b3124f 100644 --- a/hw8/10-17-tunnelling-0.05-40.0.mp4 +++ b/hw8/animations/10-17-tunnelling-0.05-40.0.mp4 diff --git a/hw8/10-17-tunnelling-0.05.mp4 b/hw8/animations/10-17-tunnelling-0.05.mp4 Binary files differindex b247200..b247200 100644 --- a/hw8/10-17-tunnelling-0.05.mp4 +++ b/hw8/animations/10-17-tunnelling-0.05.mp4 diff --git a/hw8/10-17-tunnelling-0.1.mp4 b/hw8/animations/10-17-tunnelling-0.1.mp4 Binary files differindex f2ba8b9..f2ba8b9 100644 --- a/hw8/10-17-tunnelling-0.1.mp4 +++ b/hw8/animations/10-17-tunnelling-0.1.mp4 diff --git a/hw8/vo1600widith025tunneled.png b/hw8/vo1600widith025tunneled.png Binary files differnew file mode 100644 index 0000000..24ac63f --- /dev/null +++ b/hw8/vo1600widith025tunneled.png diff --git a/hw8/vo1600width025center.png b/hw8/vo1600width025center.png Binary files differnew file mode 100644 index 0000000..bd46722 --- /dev/null +++ b/hw8/vo1600width025center.png diff --git a/hw8/vo1600width05.png b/hw8/vo1600width05.png Binary files differnew file mode 100644 index 0000000..463f894 --- /dev/null +++ b/hw8/vo1600width05.png diff --git a/hw8/vo4000withd025tunelling.png b/hw8/vo4000withd025tunelling.png Binary files differnew file mode 100644 index 0000000..0b651d2 --- /dev/null +++ b/hw8/vo4000withd025tunelling.png diff --git a/hw8/vo40kwidth05center.png b/hw8/vo40kwidth05center.png Binary files differnew file mode 100644 index 0000000..f248e95 --- /dev/null +++ b/hw8/vo40kwidth05center.png |