# Plotting series solution to the heat equation [closed]

I am trying to plot a solution to the heat equation

$u(x,t) = \sum_1^\infty \frac{8(-1)^(n+1)}{\pi^2 n^2} \sin(n \pi x) \exp(-n^2 \pi^2)$

I am using the following from another answer here on Mathematica. I am trying to plot it from x=[0,1]. I am trying the following, but it does not seem to produce a plot

f[x_, t_, nm_] := SUM[(8 (-1)^(n + 1)/(Pi^2*n^2))*Sin[n* Pi *x]*Exp[-n^2 Pi^2*t], {n, 1, nm}];

Plot[Table[f[x, t, 150], {t, {0, 0.01, 0.1, 0.5, 1, 10}}] // Release, {x, 0, 1, 0.05}]

-

## closed as too localized by Jens, Artes, Verbeia♦Jan 26 '13 at 22:42

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

It produces a plot for me: Wolfram Mathematica 9. I think you mistyped the SUM. The correct is Sum. –  m0nhawk Jan 26 '13 at 20:19
In addition to what @m0nhawk said, you also have a syntax error in Plot. Replace // Release, {x, 0, 1, 0.05} by // Evaluate, {x, 0, 1} –  Jens Jan 26 '13 at 20:23

You have several syntax (and non-syntax) errors. Check for them:

f[x_, t_, nm_] := Sum[(8 (-1)^(n + 1)/(Pi^2*n^2))*Sin[n*Pi*x]*Exp[-n^2 Pi^2*t], {n, 1,nm}];
Plot[Evaluate@Table[f[x, t, 150], {t, {0, 0.01, 0.1, 0.5, 1, 10}}], {x, 0, 1}, PlotRange -> Full]


You may find this list of tips on syntax useful.

Edit

Perhaps you could use the following:

Plot3D[f[x, t, 30], {t, 0, .3}, {x, 0, 1}, PlotRange -> Full,
AxesLabel -> {"Time", "x", "Temp"},
LabelStyle -> Directive[12, Bold]]


-
@Verbeia Hey! That's a very good idea! –  belisarius Jan 26 '13 at 22:45
Do you guys know how I can plot legends automatically so that it will indicate appropriate time for my solution. –  l3win Jan 31 '13 at 0:07