LL=1

Ex 1

ff[x_]:=x(1-x)

ff[0]

ff[LL]

Clear[bb]; bb[n_]=FullSimplify[(2/LL)Integrate[ff[x]*Sin[((n Pi)/LL)x],{x,0,LL}] ]

Table[bb[n],{n,1,20}]

Clear[bb]; bb[n_]=FullSimplify[(2/LL)Integrate[ff[x]*Sin[((n Pi)/LL)x],{x,0,LL}],n∈Integers ]

Clear[uu];uu[x_,t_,jj_]:=Sum[(8/((Pi^3)(((2 j-1))^3)))Exp[-((((((2 j-1)Pi)/LL)))^2)t]Sin[(((2 j-1)Pi)/LL)x],{j,1,jj}]

Plot[{ff[x],uu[x,0,3]},{x,0,1},PlotStyle->{{Thickness[0.01],Black},{Thickness[0.003],Red}}]

Manipulate[Plot[{ff[x],uu[x,t,3]},{x,0,1},PlotStyle->{{Thickness[0.01],Black},{Thickness[0.003],Red}},PlotRange->{0,1/3}],{t,0,.5}]

Ex 2

ff1[x_]:=1

ff1[0]

ff1[LL]

Clear[bb1]; bb1[n_]=FullSimplify[(2/LL)Integrate[ff1[x]*Sin[((n Pi)/LL)x],{x,0,LL}] ]

Table[bb1[n],{n,1,20}]

Clear[bb1]; bb1[n_]=FullSimplify[(2/LL)Integrate[ff1[x]*Sin[((n Pi)/LL)x],{x,0,LL}],n∈Integers ]

Clear[uu1];uu1[x_,t_,jj_]:=Sum[(4/((Pi^1)(((2 j-1))^1)))Exp[-((((((2 j-1)Pi)/LL)))^2)t]Sin[(((2 j-1)Pi)/LL)x],{j,1,jj}]

Plot[{ff1[x],uu1[x,0,50]},{x,0,1},PlotStyle->{{Thickness[0.01],Black},{Thickness[0.003],Red}},PlotRange->{0,2}]

Manipulate[Plot[{ff1[x],uu1[x,t,30]},{x,0,1},PlotStyle->{{Thickness[0.01],Black},{Thickness[0.003],Red}},PlotRange->{0,2}],{t,0,.5}]