I'm trying to use Mathematica to solve a multidimensional partial differential equation using Laplace tranforms. The PDE is as follows:

$$ \frac{{\partial T}}{{\partial t}} = \frac{{{\partial ^2}T}}{{\partial {x^2}}} $$


$$T(0,t)=T(1,t)=0$$ $$T(x,0)=\sin(\pi x)$$

Here is my progress so far:

In[172] := D[T[x, t], t] - D[T[x, t], {x, 2}]
Out[172] = Derivative[0, 1][T][x, t] - Derivative[2, 0][T][x, t]

In[169] := LaplaceTransform[D[T[x, t], t] - D[T[x, t], {x, 2}], {t, x}, {t ,s}]
Out[169] = LaplaceTransform[Derivative[0, 1][T][x, t], {t, x}, {t, s}] - LaplaceTransform[Derivative[2, 0][T][x, t], {t, x}, {t, s}]

In[170] := ClearAll[x, t, eqn]
           eqn = D[T[x, t], t] - D[T[x, t], {x, 2}]
Out[171] = Derivative[0, 1][T][x, t] - Derivative[2, 0][T][x, t]

But I'm really not sure if I'm on the right track. I'm not terribly concerned with solving the problem completely, but rather I'm held up on the syntax of converting the partial differential equation to "Mathematica form", and how to proceed with Mathematica.

Thank you.

  • $\begingroup$ Are you taking the Laplace transform only in the variable t? If so, do LaplaceTransform[expr, t, s] instead, where expr is your expression involving the derivatives. $\endgroup$
    – march
    Jan 19, 2016 at 4:15
  • $\begingroup$ I suppose maybe I'm confused about that.. I thought I would take it in the variable t, treating x as an additional parameter so that I would have T(x,s) instead of T(x,t). Can you confirm that In[172] and In[169] from my code block are correct, by chance? Or... Out[171].. I think that seemed to be my most correct... $\endgroup$
    – Matt
    Jan 19, 2016 at 4:30
  • $\begingroup$ 171 and 172 are the same. They look correct. The Laplace transform is basically not evaluating because the syntax is wrong, I think. Hold on. $\endgroup$
    – march
    Jan 19, 2016 at 4:42

1 Answer 1


First, define the equation and take LaplaceTransform, implementing the initial condition along the way:

eqn = D[T[x, t], t] - D[T[x, t], {x, 2}] == 0
LaplaceTransform[eqn, t, s] /. T[x, 0] -> Sin[π x]

enter image description here

In the second term, we actually can interchange the order of integration and differentiation to see that it's just D[LaplaceTransform[T[x, t], t, s], {x, 2}]. Therefore, we replace the transformed function with a dummy:

eqn2 = s tT[x, s] - D[tT[x, s], {x, 2}] - Sin[π x] == 0;

We can then solve this analytically:

func = tT[x, s] /. First@DSolve[{eqn2, tT[0, s] == 0, tT[1, s] == 0}, tT[x, s], x]
(* Sin[π x]/(π^2 + s) *)

Finally, then

InverseLaplaceTransform[func, s, t]
(* E^(-π^2 t) Sin[π x] *)

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.