# Differential equation for partial derivatives

Given the following PDE with an initial condition and two boundary conditions:

$$\begin{cases} \frac{\partial^2 u}{\partial Z^2} = \frac{\partial u}{\partial T_v} \\ u(Z,0) = u_t(Z) \\ u(0,T_v) = u_i \\ u(2,T_v)=u_f \end{cases}$$ I know that in the particular case in which:

$$u_i = u_f = 0, \; \; \; u_t(Z) = u_0$$ the Fourier series solution is as follows:

$$u(Z,T_V) = \sum_{n=0}^{\infty} \frac{2\,u_0}{m}\,\sin(m\,Z)\,e^{-m^2 T_v}\,, \; \; \; \text{with} \; \; m = \frac{(2\,n+1)\,\pi}{2}\,.$$

Unfortunately, I can not really understand how to get this last solution in Wolfram Mathematica 11 and therefore not even the general solution. Can anyone help me? Thank you!

• Looks like a one-dimensional consolidation problem (or heat transfer). Do you really need to get the analytical solution in Mathematica? This can be solved manually assuming $u(z,t) = G(t) F(z)$. You can easily get a numerical solution using NDSolve and check your calculations. – K.J. Nov 24 '17 at 19:55

Try

ClearAll[u,u0,t,z,L0,n];
pde  = D[u[z,t],t]== D[u[z,t],{z,2}];
bc   = {u[0,t]==0,u[L0,t]==0}
ic   = u[z,0]==u0

sol  = DSolve[{pde,bc,ic},u[z,t],{z,t}] For L=2

 %/.{L0->2,K->n} Version 11.2 on windows.

• Fantastic, just what I wanted! – TeM Nov 24 '17 at 20:46
• Can match the fourier series answer by noting that (-1)^n - 1 is 0 for even n. Avoid calculating the 0 terms by changing n->2n+1 and changing the sum lower limit to n = 0. – Bill Watts Nov 25 '17 at 22:58