FT cviceni 1.10.2013

c[t_,x_,m_]:=x+2/Pi*Sum[(-1)^n*Sin[n*Pi*x]/n*Exp[-n^2*Pi^2*t],{n,1,m}];
Plot3D[c[t, x, 30], {t,0,0.2}, {x,0,1}]
Plot3D[c[t, x, 30], {t,0,0.2}, {x,0,1},AxesLabel->{"t","x","c"}]

(* spatne *)
s=NDSolve[{D[c[t,x],t]==D[c[t,x],x,x],c[0,x]==0,c[t,0]==0,c[t,1]==1},c,{t,0,0.2},{x,0,1}]
s=NDSolve[{D[c[t,x],t]==D[c[t,x],x,x],c[0,x]==0,c[t,0]==0,c[t,1]==1-UnitStep[-t]},c,{t,0,0.2},{x,0,1}]

(* spravne *)
s=NDSolve[{D[c[t,x],t]==D[c[t,x],x,x],c[0,x]==UnitStep[x-1],c[t,0]==0,c[t,1]==1},c,{t,0,0.2},{x,0,1}]
Plot3D[c[t,x]/.s,{t,0,0.2},{x,0,1}, AxesLabel->{"t","x","c"}]

