# How to solve this initial boundary value problem for heat conduction equation?

I want to solve the following PDE:

heqn=D[u[x,t],t]==D[u[x,t],{x,2}]-D[u[x,t],{x,1}];


with the initial conditions:

ic=u[x,0]==Piecewise[{{x,0<= x<= 0.5},{1-x,0.5<= x<= 1}}];


and boundary conditions:

bc={u[0,t]== 0,u[1,t]== 0};


I want to get the analytic solution,but when I use DSolve :

sol=DSolve[{heqn,bc,ic},u[x,t],{x,t}]


there's return nothing.I am wondering how to get the analytic solution?

• v12.3 and v13.1 find the solution without difficulty, which version are you in? Commented Jul 6, 2022 at 2:34
• Mathematica gives an infinite sum as solution. I tried, in vain, to plot the solution, doesn't evaluate! Commented Jul 6, 2022 at 9:08
• @UlrichNeumann How did you try? Something like approxsol=u[x,t]/.sol[[1]]/.Infinity->20//Activate; Plot3D[approxsol,{x,0,1},{t,0,1},PlotRange->All] should work. (This solution is mentioned in document of DSolve BTW. ) Commented Jul 7, 2022 at 2:50
• Thanks: //Activate solved the problem Commented Jul 7, 2022 at 6:03

Your inputs are fine, maybe just wait for a few more seconds or so and the output will appear because it worked for me.

In[75]:= heqn = D[u[x, t], t] == D[u[x, t], {x, 2}] - D[u[x, t], {x, 1}];