-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparticle_potential.nb
46 lines (39 loc) · 2.05 KB
/
particle_potential.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(*Mathematica 9.0*)
Clear["Global`*"];
SaveDefinitions -> True;
(*Mathematica doesn't like constants while plotting so we let unnecessary constants to be 1. This will not affect the analytical solution.*)
\[HBar] = e = x0 = m0 = 1.;
\[Omega] = 1;
V[x_] := Piecewise[{{(1/2) m0 \[Omega]^2 (Abs[x] - x0)^2,
Abs[x] >= x0}, {0, Abs[x] <= x0}}];
Plot[V[x], {x, -5, 5}, PlotRange -> Automatic,
PlotLegends -> "Expressions"]
(*The above code gives a graph which is symmetric along y-axis*)
s = DSolve[{-(1/2) \[CapitalPsi]''[x] + (1/2) (x^2 - 1) \[CapitalPsi][
x] == En \[CapitalPsi][x]}, \[CapitalPsi][x], x];
Flatten[s] // TraditionalForm
FullSimplify[
Series[\[CapitalPsi][x] /. s /. C[1] -> 1 /. C[2] -> 1, {x,
Infinity, 0}]]]
(*This will give the solutions as linear combinations of parabolic cylindrical functions D of order -1-En and En.*)
d[x_] := ParabolicCylinderD[En, Sqrt[2] x]
d'[x]/d[x] /. x -> 1 // FullSimplify // TraditionalForm
(*The above part simplifies hermite polynomial as 1-[H_(En+1) (1)]/[H_(En) (1)]*)
HermiteH[En + 1, 0]/HermiteH[En, 0] // FullSimplify // TraditionalForm
(*This simplies even more and gives an expression in terms of a gamma function*)
(*Approximate plots of Even and odd parity*)
Plot[{ArcTan[(HermiteH[x + 1, 1]/HermiteH[x, 1])],
ArcTan[(HermiteH[x + 1, 0]/HermiteH[x, 0]) + 1]}, {x, 0, 10},
PlotStyle -> {Thick, Dashed}, PlotLegends -> {"Odd", "Even"}]
(*The code below plots odd and even parity wave functions*)
swe = ParametricNDSolveValue[{-(1/2) \[CapitalPsi]''[
x] + (1/2) (x^2 - 1) \[CapitalPsi][x] ==
En \[CapitalPsi][x], \[CapitalPsi][0.] ==
0., \[CapitalPsi][1.] == 1.}, \[CapitalPsi], {x, -10, 10}, {En}];
soln = Quiet@Map[FindRoot[swe[En][1], {En, #}] &, {1, 3}] ;
eigen = soln /. Rule[_, x_] -> x // Flatten ;(*Odd eigen value*)
Sort[eigen];
Plot[Evaluate@{Table[Re[swe[En][x]], {En, eigen}]}, {x, 0, 4},
PlotRange -> Automatic]
Print[ TimeUsed[] "secs was used to compute the results."]
(*You can omit the above Print[] line. I use it because of my ancient celeron laptop*)