an=2/T Integrate[Cos[2π n t/T],{t,0,T/2}]

bn=2/T Integrate[Sin[2π n t/T],{t,0,T/2}]

a0=1/T Integrate[ 1,{t,0,T/2}]

b[n_]:=((2 ((Sin[((n π)/2)])^2))/(n π))

f[t_]:=1/2+Sum[b[n] Sin[2π n t/T],{n,1,500}]

T=1;

f[t]

Plot[f[t],{t,-2,2}]

Simplify[(2/L)Integrate[x Sin[n π x/L],{x,0,L/2}]+
(2/L)Integrate[(L-x)Sin[n π x/L],{x,L/2,L}]]

B[n_]:=((8 L ((Sin[((n π)/4)])^2) Sin[((n π)/2)])/((n^2) (π^2)))

c=1;L=1;

u[x_,t_]=Sum[B[n]Sin[n π x/L] Exp[-(c n π/L)^2t],{n,1,500}];

Plot[Evaluate[u[x,0]],{x,0,L},PlotRange->{0,0.5}]

Plot3D[Evaluate[u[x,t]],{x,0,L},{t,0,0.3},PlotRange->All]

Animate[
Plot[Evaluate[u[x,t]],{x,0,L},PlotRange->{0,0.5}],
{t,0,0.3}]

u[0.3,0.1]

Plot[u[0.25,t],{t,0,1},PlotRange->All]

Solucion numerica

α=1;L=1;

Clear[L]

L

sol1=NDSolve[{(∂_t)u[x,t]-α(∂_x)(∂_x)u[x,t]==0,
u[x,0]==10(x^2),u[0,t]==0,u[L,t]==10Sin[t]+10},u,
{x,0,L},{t,0,20}]

sol1[[1]]

u[0.2,2]/.sol1[[1]]

x^a-2x b/.x->y

Plot3D[Evaluate[u[x,t]/.sol1[[1]]],{x,0,L},{t,0,10},PlotRange->All]

Animate[
Plot[Evaluate[u[x,t]/.sol1[[1]]],{x,0,L},PlotRange->{0,20}],
{t,0,20}]

lista={a,b,c,d,e,f}

lista[[3]]

Plot3D[x(x-3)y(y-4),{x,0,3},{y,0,4}]

Lx=3;Ly=4;α=1;

sol2=NDSolve[{(∂_t)u[x,y,t]-α((∂_x)(∂_x)u[x,y,t]+(∂_y)(∂_y)u[x,y,t])==0,
u[x,y,0]==x(x-Lx)y(y-Ly),
u[x,0,t]==0,
u[x,Ly,t]==0,
u[0,y,t]==0,
u[Lx,y,t]==0},
u,
{x,0,Lx},{y,0,Ly},{t,0,20}]

Animate[
ContourPlot[Evaluate[u[x,y,t]/.sol2[[1]]],
{x,0,Lx},{y,0,Ly},PlotRange->{0,5},ColorFunctionScaling->False],
{t,0,2}]