Clear["Global`*"];

Function to find the general coefficient for the function (Sin^2)(kx) in an infinite square well of length a.

f[n_, m_]=Simplify[Integrate[Sin[n*π*x/a]*((Sin[m*π*x/a])^2),{x,0,a},Assumptions->{{n,m}∈Integers,{n,m}>0}],Assumptions->{{n,m}∈Integers,{n,m}>0}]

Function to find the general coefficient for the function (Sin^2)(Pi*x) in an infinite square well of length 1.

cn[n_]=Simplify[4*Integrate[Sin[n*π*x]*((Sin[π*x])^2),{x,0,1},Assumptions->{n∈Integers,n>0}]/Sqrt[3],Assumptions->{n∈Integers,n>0}]

Play a game where each partial sum remains normalized so we can use one set of axes

RawWF[i_]:=Sum[cn[n]*Sin[n*π*x],{n,1,i,2}];

WFNorms=Table[Sqrt[Integrate[RawWF[l]*RawWF[l],{x,0,1}]],{l,1,15,2}];

NormWF=Table[RawWF[l]/WFNorms[[(l+1)/2]],{l,1,15,2}];

Manipulate[Plot[{NormWF[[NumEigenstates]],Sqrt[8/3]*((Sin[π*x])^2)},{x,0,1},PlotRange->{0,2},PlotStyle->{{Thick,Blue},Dashed}],{NumEigenstates,1,8,1}]

Now, let's see what happens as a function of time.

tscale=100;

tscale is the time scale for manipulate

RawWFRe[i_]:=Sum[cn[n]*Sin[n*π*x]*Cos[n*n*Pi*t*2/tscale],{n,1,i,2}];

RawWFIm[i_]:=Sum[cn[n]*Sin[n*π*x]*Sin[-n*n*Pi*t*2/tscale],{n,1,i,2}];

We know that the probability density from a single energy eigenstate does not have any time dependence so let's start with a sum of the lowest two energy eigenstates which is the best fit to the original wave function ((sin^2)(π x/a) where we are using a=1).

S2PD2[x_,t_]=Simplify[(((RawWFRe[3])^2)+((RawWFIm[3])^2))/((WFNorms[[2]])^2)]

Manipulate[Plot[{S2PD2[x,t],(8/3)*((Sin[π*x])^4)},{x,0,1},PlotRange->{0,2.85},PlotStyle->{{Thick,Blue},Dashed}],{t,0,tscale,0.1}]

S2PD3[x_,t_]=Simplify[(((RawWFRe[5])^2)+((RawWFIm[5])^2))/((WFNorms[[3]])^2)];

So a linear combination of two energy eigenstates doesn' t stay as the original wave function, how about eight?

S2PD8[x_,t_]=Simplify[(((RawWFRe[15])^2)+((RawWFIm[15])^2))/((WFNorms[[8]])^2)];

Manipulate[Plot[{S2PD8[x,t],(8/3)*((Sin[π*x])^4)},{x,0,1},PlotRange->{0,2.85},PlotStyle->{{Thick,Blue},Dashed}],{t,0,tscale,0.1}]