Fourier Series Solution 13.3.5

Coefficients to represent the even extension

f[x_]=x^3+1

a[j_,L_]=(2/L) Integrate[f[x] Cos[j Pi x/L],{x,0,L}]

fk[x_,k_,L_]:=Sum[ a[j,L] Cos[j  Pi x/L],{j,1,k}]

Plot[{f[x],fk[x,1,3]},{x,0,3}]

Plot[{f[x],fk[x,3,3],fk[x,5,3]},{x,0,3}]

azero[L_]=(1/L) Integrate[f[x],{x,0,L}]

Plot[{f[x],fk[x,5,3]+azero[3],fk[x,20,3]+azero[3]},{x,0,3}]

Plot[{f[x],fk[x,5,3]+azero[3],fk[x,20,3]+azero[3]},{x,-3,3}]

Plot[{f[x],fk[x,5,3]+azero[3],fk[x,20,3]+azero[3]},{x,-6,6}]

B[t_,j_,L_]=E^((-j^2 Pi^2/L^2-1) t)

Bzero[t_] = E^(-t)

solution

u[x_,t_,k_,L_]:=Sum[ a[j,L]B[t,j,L]  Cos[j  Pi x/L],{j,1,k}]+azero[3]  Bzero[t]

Plot3D[u[x,t,10,3],{x,0,3},{t,0,2},PlotRange->All]

Plot3D[u[x,t,10,3],{x,0,3},{t,0,4},PlotRange->All]

Plot3D[u[x,t,10,3],{x,0,3},{t,0,20},PlotRange->All]

Plot[{1-t,u[0,t,100,3]},{t,0,0.1}]