I am trying to solve the wave PDE using the Fourier method and I need to animate the plots of the partial sum of order 45 -- U45(x,t) with initial conditions U45(x,t0), {t0, 0, 12, .2}.
I am confused: should I define the function f[x, t, k_] or should I do it as f[x, k_] and later access the 't'.
a[k_] :=
Piecewise[{
{2/(k*π) Integrate[Cos[(k*π*x)/6] (2 - x) Sin[π*x]^2, {x, 1, 3}], k != 0},
{1/6 Integrate[(2 - x) Sin[π*x]^2, {x, 1, 3}], k == 0}}]
f[x, t, k_] :=
a[0]*t + Sum[a[i] Cos[(i*π*x)/6] Sin[(i*π*t)/6], {i, k}]
sol = f[x, t, 45];
Anyway, the above is the piece of code I've written so far. Tried a dozen different Plot3D combinations, but the error I receive tells me I can not replace t. I am open to everything tutorials, papers, tips, plain solutions, everything.
