I'm defining my function y, which is a function of x and t, below, as just y. Mathematica likes that fine, and prints graphs as I want. Below is the code Im using, which Mathematica is fine with:
ClearSystemCache[]
h=1; l=10; v=1;
y=Sum[(8h/(n^2Pi^2))(2Sin[n Pi/4]-Sin[n Pi/2])Sin[n Pi x/l]Cos[n Pi v*t/l],{n,1,40,1}];
y2=Table[Plot[y,{x,0,10}, AxesLabel->{"x","y[x,t]"}],{t,0,2l/v,.02l/v}]; ListAnimate[y2]
However, the following code, which just uses y[x,t] in place of y in the definition for y, which should be okay, produces an error msg:
ClearSystemCache[]
h=1; l=10; v=1;
y[x_,t_]=Sum[(8h/(n^2Pi^2))(2Sin[n Pi/4]-Sin[n Pi/2])Sin[n Pi x/l]Cos[n Pi v*t/l],{n,1,40,1}];
y2=Table[Plot[y,{x,0,10}, AxesLabel->{"x","y[x,t]"}],{t,0,2l/v,.02l/v}];
ListAnimate[y2]
Why is this?