Analytical solution

u[t_,x_,n_]:=Sum[(Subscript[b, k]) Sin[k x] Exp[-(k^2) t],{k,1,n}]

Verify PDE for n=4 terms

u4[t_,x_]=u[t,x,4]

FullSimplify[D[u4[t,x],t] == D[u4[t,x],{x,2}] ]

FullSimplify[D[u[t,x,100],t] == D[u[t,x,100],{x,2}] ]

Initial condition

f[x_]=Sin[x] Exp[-2(((x-(π/2)))^2)];

Plot[f[x],{x,0,π}]

b[k_]=Integrate[Sin[k x] f[x],{x,0,π}]

FullSimplify[N[b[1]]]

Table[(Subscript[b, k])=Re[N[b[k]]],{k,1,50}]

ListPlot[%]

ListPlot[Map[Log[Abs[#]]&,%%[[1;;;;2]] ] ]

(Subscript[b, 1])

Plot[Table[u4[t,x],{t,0,10}],{x,0,π},PlotRange->All]