(*Define the potential: Infinite Square Well*)
v[x_,a_,V_]:=({{\[Piecewise], ({{-V, -a<x<a}, {0, Abs[x]>a}})}})

(*Define Constants needed for Eigenfunctions*)
ℏ=1;
m=1;
κ[e_]:=Sqrt[-2*m*e/ℏ]
l[e_,V_]:=Sqrt[(e+V)*2*m]/ℏ
F[e_,V_,a_]:=Exp[κ[e]*a]*Cos[l[e,V]*a]/Sqrt[a+(1/κ[e])]
d[e_,V_,a_]:=1/Sqrt[a+(1/κ[e])]
c[a_]:=1/Sqrt[a]
g[e_,V_,a_]:=Exp[κ[e]*a]*Sin[l[e,V]*a]/Sqrt[a]
e[n_,a_,V_]:=((n^2 *π^2*ℏ^2)/(8*m*a^2))-V;

(*Define the wave functions; Eigenfunction Solutions*)
ψ2[x_,a_,V_,n_]:=({{\[Piecewise], ({{-g[e[n,a,V],V,a]*Exp[κ[e[n,a,V]]*x], x<-a}, {c[a]*Sin[l[e[n,a,V],V]*x], -a<x<a}, {g[e[n,a,V],V,a]*Exp[-κ[e[n,a,V]]*x], x>a}})}})
ψ1[x_,a_,V_,n_]:=({{\[Piecewise], ({{F[e[n,a,V],V,a]*Exp[κ[e[n,a,V]]*x], x<-a}, {d[e[n,a,V],V,a]*Cos[l[e[n,a,V],V]*x], -a< x< a}, {F[e[n,a,V],V,a]*Exp[-κ[e[n,a,V]]*x], x>a}})}})

(*Create a Plot for Potential: Infinite Square Well*)
Manipulate[Plot[{ψ1[x,a,V,n]+e[n,a,V],ψ2[x,a,V,n]+e[n,a,V],e[n,a,V],v[x,a,V]},{x,-10,10},PlotStyle->{Thick,Thick,Dashed,Thick},Exclusions->None,PlotLegends->{"Even Solutions","Odd Solutions","Energy Levels","Potential Well"}],{{a,2,"Well Width"},1,5},{{V,10,"Potential Depth"},0,10},{{n,0,"Energy Level"},0,10} ]