Griffiths Example 2.2

Define Ψ(x,t)=(Subscript[Σc, n])(Subscript[ψ, n])(x)(Subscript[ϕ, n])(t)(the linear combination of eigenfunctions),and Ψ(x,0) (the initial wave function).

f[x_,t_,m_]:=(Sqrt[30])((((2/π)))^3)(Sum[(1/(n^3))Sin[n π x] Exp[-I t*(n^2)],{n,1,m,2}]);
g[x_]:=(Sqrt[30])x(1-x)

Graph (Subscript[Σc, n])(Subscript[ψ, n])(x)(Subscript[ϕ, n])(t) and Ψ(x,0), with the ability to change the end term in the linear combination.

Manipulate[
Plot[
{g[x],f[x,0,m]},{x,0,1},
PlotRange->{{0,1},{0,1.5}},
Ticks->{  {{1,"a"}},{ {1.5,""}}},
PlotStyle->{{Blue,Thickness[0.01]},{Orange,Thickness[0.005]}},
AxesLabel->{x,"ψ"},
ImageSize->800,
LabelStyle->({FontSize->16,FontFamily->"Times"})
],
{{m,1,"n"},Range[1,19,2],Setter}
]

Graph ((||Ψ(x,t)||)^2) and ((||Ψ(x,0)||)^2).

Manipulate[
Plot[
{g[x]*g[x],Conjugate[f[x,t,m]]*f[x,t,m]},{x,0,1},
PlotRange->{{0,1},{0,2.5}},
Ticks->{  {{1,"a"}},{ {2.5,""}}},
PlotStyle->{{Blue,Thickness[0.01]},{Orange,Thickness[0.005]}},
AxesLabel->{x,"\[LeftBracketingBar]Ψ(\[RightBracketingBar]^2)"},
ImageSize->800,
LabelStyle->({FontSize->16,FontFamily->"Times"})
],
{{m,1,"n"},Range[1,19,2],Setter},
{{t,0,"τ"},0,(π/4),0.01,Appearance->"Labeled"}
]