Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to compute the exact solution of the heat equation but I got an error.

u(x,t) (equation of transmition of heat) is the solution of this differential equation:

$$du/dt - \alpha d^2u/dx^2 = 0$$ $$u(x,0) = g(x) = 1/(1+x^2)^{0.25}$$ $$ u(-10,t) = u(10,t) = 0$$ $\alpha = 2/10$

I computed:

pde = D[u[x, t], t] - 0.2 D[u[x, t], {x, 2}] == 0
DSolve[pde, u[x, 0] == 1/(1 + x^2)^0.25`, u[-10, t] == 0, u[10, t] == 0, u[x, t], {x, t}]

However, I got an error: DSolve::dsvar: u[-10,t]==0 cannot be used as a variable. >>

What am I doing wrong? Thanks for your help.

share|improve this question

closed as off-topic by bobthechemist, Sjoerd C. de Vries, ciao, Michael E2, m_goldberg Mar 25 '14 at 3:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – bobthechemist, Sjoerd C. de Vries, ciao, Michael E2, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

Hello. You are putting your constraints u[-10,t]==0 and the other one as second and third arguments to DSolve and that's not what the docs say –  Rojo Mar 24 '14 at 21:29
How can I solve this particular equation satisfying all the conditions? –  Triana Mar 24 '14 at 21:31
"The heat equation is parabolic, but it is not considered here because it has a nonvanishing non-principal part, and the algorithm used by DSolve is not applicable in this case." Directly from the tutorials in the docs. –  Sektor Mar 24 '14 at 21:54
And the link: reference.wolfram.com/mathematica/tutorial/… –  Sjoerd C. de Vries Mar 24 '14 at 22:17
You could solve this numerically with NDSolve, but the boundary conditions are inconsistent with the initial condition at t=0. If you replace them by u[10,t] == u[10,t] (periodic boundary conditions), the numerical approach will work after correcting the syntax. –  Jens Mar 25 '14 at 0:41

1 Answer 1

up vote 4 down vote accepted

Numerical approach according to Jens' comment :

pde = D[u[x, t], t] - 0.2  D[u[x, t], {x, 2}] == 0;
g[x_] := 1/(1 + x^2)^0.25;
sol = NDSolve[{pde, u[x, 0] == g[x], u[-10, t] == u[10, t] == g[10]}, 
                 u[x, t], {x, -10, 10}, {t, 0, 20}]

Plot3D[u[x, t] /. sol, {x, -10, 10}, {t, 0, 20}, 
   AxesLabel -> {Style["x", Italic, Red, 20], Style["t", Italic, Red, 20]}]

enter image description here

share|improve this answer

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