Integrate[Cos[((n π)/L)z]Cos[((n π)/L)z],{z,0,L}]

Integrate[Cos[((n π)/L)z]Cos[((m π)/L)z],{z,0,L}]

Integrate[Cos[((n π)/L)z],{z,0,L}]

((2 u0)/L)Integrate[Cos[((n π)/L)z],{z,a,b}]

((2 u0)/L)Integrate[Cos[((n π)/L)z],{z,a,b}]

A[n_]:=If[n==0,((b-a)/L)u0,((2 u0 (-Sin[((a n π)/L)]+Sin[((b n π)/L)]))/(n π))]

A[0]

A[1]

M=10;
u=Sum[A[n]Cos[((n π)/L)z]Exp[-(g+(n^2)(π^2)cD)t],{n,0,M}]

M=10;
u=Sum[A[n]Cos[((n π)/L)z]Exp[-(g+(n^2)(π^2)cD)t],{n,0,M}]/.{u0->1,L->1,a->0.3,b->0.7,g->0,cD->0.1}

M=100;
u=Sum[A[n]Cos[((n π)/L)z]Exp[-(g+(n^2)(π^2)cD)t],{n,0,M}]/.{u0->1,L->1,a->0.3,b->0.7,cD->0.1,g->0};

Plot[u/.{t->0},{z,0,1},PlotRange->{-0.1,1.1}]

NIntegrate[u/.{t->0},{z,0,1}]

NIntegrate[u/.{t->1},{z,0,1}]

lp=Table[{vz,u/.{t->0,z->vz}},{vz,0,1,0.005}];

ListPlot[lp,Joined->True,PlotRange->{-0.05,1.05}]

llp=Table[Table[{vz,u/.{t->vt,z->vz}},{vz,0,1,0.005}],{vt,0,0.5,0.005}];

ListPlot[llp[[101]],Joined->True,PlotRange->{-0.05,1.05}]

Manipulate[Plot[Sin[a x],{x,0,2π}],{a,0,5}]

Manipulate[ListPlot[llp[[Floor[j]]],Joined->True,PlotRange->{-0.05,1.05}],{j,1,101}]