aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.DS_Storebin12292 -> 12292 bytes
-rw-r--r--hw8/.DS_Storebin0 -> 6148 bytes
-rw-r--r--hw8/10-17-new.jl2
-rw-r--r--hw8/10-3-new.jl32
4 files changed, 2 insertions, 32 deletions
diff --git a/.DS_Store b/.DS_Store
index 41619b5..ac2da04 100644
--- a/.DS_Store
+++ b/.DS_Store
Binary files differ
diff --git a/hw8/.DS_Store b/hw8/.DS_Store
new file mode 100644
index 0000000..a03a3d4
--- /dev/null
+++ b/hw8/.DS_Store
Binary files differ
diff --git a/hw8/10-17-new.jl b/hw8/10-17-new.jl
index 1353618..a655553 100644
--- a/hw8/10-17-new.jl
+++ b/hw8/10-17-new.jl
@@ -68,6 +68,8 @@ anim = @animate for t in 0:dt:0.25
plot!(x[2:end-1], real(tmp), xlabel = "x", label = "real")
# plot the imaginary
plot!(x[2:end-1], imag(tmp), xlabel = "x", label = "imag")
+ endpoint_1 = 0.0
+ endpoint_2 = barrier_width
plot!([endpoint_1, endpoint_1], [0, 2], label = "", line = :dash, color = :red)
plot!([endpoint_2, endpoint_2], [0, 2], label = "barrier (width = $barrier_width)", line = :dash, color = :red)
end
diff --git a/hw8/10-3-new.jl b/hw8/10-3-new.jl
index fb819b8..42e7162 100644
--- a/hw8/10-3-new.jl
+++ b/hw8/10-3-new.jl
@@ -8,41 +8,9 @@ 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