0
$\begingroup$

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?

$\endgroup$
4
  • 1
    $\begingroup$ v12.3 and v13.1 find the solution without difficulty, which version are you in? $\endgroup$
    – xzczd
    Commented Jul 6, 2022 at 2:34
  • $\begingroup$ Mathematica gives an infinite sum as solution. I tried, in vain, to plot the solution, doesn't evaluate! $\endgroup$ Commented Jul 6, 2022 at 9:08
  • $\begingroup$ @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. ) $\endgroup$
    – xzczd
    Commented Jul 7, 2022 at 2:50
  • $\begingroup$ Thanks: //Activate solved the problem $\endgroup$ Commented Jul 7, 2022 at 6:03

1 Answer 1

1
$\begingroup$

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

When using your inputs

In[75]:= heqn = D[u[x, t], t] == D[u[x, t], {x, 2}] - D[u[x, t], {x, 1}];
ic = u[x, 0] == Piecewise[{{x, 0 <= x <= 0.5}, {1 - x, 0.5 <= x <= 1}}];
bc = {u[0, t] == 0, u[1, t] == 0};
sol = DSolve[{heqn, bc, ic}, u[x, t], {x, t}]

The ouput came as

enter image description here

Cheers

$\endgroup$
2
  • $\begingroup$ Works for me as well, (After I deleted the "In[75]:=" ). It took 4.1 seconds on my 2.4GHz i9. (Mathematica Version 12.3 on Windows 10) $\endgroup$ Commented Jul 6, 2022 at 17:53
  • $\begingroup$ My version is 12.0,could it be that version too low? $\endgroup$ Commented Jul 7, 2022 at 2:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.