Quantum well
Solving Schrodinger equation in real-time
Download original notebookInitial parameters
v0 = 8.; hb = 1.; d = 1.; m = 1.;
Operator
V = (*TB[*)Piecewise[{{(*|*)0(*|*),(*|*)-d<=#<d(*|*)},{(*|*)v0(*|*),(*|*)True(*|*)}}](*|*)(*1:eJxTTMoPSmNkYGAo5gESAZmpyanlmcWpTvkVmUxAAQBzVQdd*)(*]TB*) &; op[u_[x_]] := - hb^2/(2 m) u''[x] + V[x] u[x];
Controls
controls = EventHandler[InputGroup[<| "m" -> InputRange[0.1, 5, 1.0, 1.0, "Label"->"Mass"], "V" -> InputRange[0.1, 10, 1.0, 8.0, "Label"->"V0"], "d" -> InputRange[0.1, 2, 0.5, 1.0, "Label"->"d"] |>], Function[values, v0 = values["V"]; m = values["m"]; d = values["d"]; vplot = Table[{x,V[x]}, {x,-2,2,0.05}]; {ev, ef} = NDEigensystem[{op[u[x]], DirichletCondition[u[x] == 0, True]}, u[x], {x, -2, 2}, 6]; xaxis = Table[i, {i,-2,2,0.025}]; yaxis = Table[Evaluate[ef + ev], {x, xaxis}] // Transpose; ]]; controls // EventFire;
Graphical output
Row[ { Graphics[ { Table[ With[{i = i, color = ColorData[97][i]}, {color, Line[{xaxis, yaxis[[i]]} // Transpose ] // Offload} ] , {i, Length[yaxis]} ] , AbsoluteThickness[2] , Line[vplot // Offload] } , Axes -> True , PlotRange -> {{-2, 2}, {0, 16}} , ImageSize -> {350, 350} ] , controls } ]
(*GB[*){{(*VB[*)(FrontEndRef["88343d8d-6429-47ba-ad68-6d5bc17aeccd"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKW1gYmxinWKTompkYWeqamCcl6iammFnomqWYJiUbmiemJienAAB94BYP"*)(*]VB*)(*|*),(*|*)(*VB[*)(EventObject[<|"Id" -> "9f1cd6cf-3c45-4198-ab48-a15dd669c1ce", "Initial" -> <|"m" -> 1., "V" -> 8., "d" -> 1.|>, "View" -> "036730f0-8219-4c21-9547-2ecc0b0186e7"|>])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKGxibmRsbpBnoWhgZWuqaJBsZ6lqampjrGqUmJxskGRhamKWaAwBrcBSt"*)(*]VB*)}}(*]GB*)