# Evaluating (Analytical solution) heat equation in Mathematica [closed]

I want to find the analytical solution of the following PDE in Mathematica

$\frac{\partial u}{\partial t} = D_1\frac{\partial^2 u}{\partial x^2} - D_2 u$,

with inital condition $u(x,0) =u_0$ and

boundary conditions $u(-t, t) =u_1, u(k-t,t)=u_2$,

where $D_1, D_2, u_0, u_1, u_2$ and $k$ are constants.

• You must have previously assigned a value to one of your variable. Evaluate Clear[u, x, t], or restart the kernel, and everything will work fine. – MarcoB Jan 18 '17 at 17:22
• I restarted the kernel, it works fine. Thank you MarcoB. – Tapan Jan 18 '17 at 21:25

eqn = D[u[x, t], t] == D[u[x, t], {x, 2}];