In[]:=
kc=1.44;​​deqn=D[u[x,t],t]kc×D[u[x,t],{x,2}];​​bc1=u[0,t]2.0;​​bc2=u[1,t]0.5;​​ic=u[x,0]2.0-1.5x+Sin[πx];​​sol=DSolve[{deqn,bc1,bc2,ic},u[x,t],{x,t}]​​
Out[]=
u[x,t]2.-1.5x+
∞
∑
K[1]=1
-
0.63662-1.+
K[1]
(-1)

-14.2122t
2
K[1]

Sin[πx]Sin[πxK[1]]
K[1]

​
In[]:=
approxsol=u[x,t]/.sol[[1]]/.{Infinity4}//Activate//Expand
In[]:=
2.`-1.5`x+1.2732395447351628`
-14.212230337568675`t

Sin[πx]Sin[πx]+0.4244131815783876`
-127.91007303811807`t

Sin[3πx]Sin[πx]​​​​​​Animate[Plot[Activate[sol]/.ti,{x,0,1},PlotRange{All,{-5,30}},FrameTrue,FrameLabel{{"u(x,t)",None},{"x",Row[{"time ",i}]}},GridLinesAutomatic,GridLinesStyleLightGray,PlotStyleGreen,BaseStyle14],{i,0,1,.01}]
Out[]=
2.-1.5x+1.27324
-14.2122t

Sin[πx]Sin[πx]+0.424413
-127.91t

Sin[3πx]Sin[πx]
Out[]=
i
​
​
​​​​​​Plot[Evaluate[Table[approxsol,{t,0,4}]],{x,-5,5},PlotRange{{0,1},{0,4}}]
​
​
​
Out[]=
0.0
0.2
0.4
0.6
0.8
1.0
0
1
2
3
4
​
​
​​
​
​
​
​
​​
​
ReplaceAll
:{2.} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.
​
​
ReplaceAll
:{2.} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.
​