Math Help - need help with this problem (heat equation)

1. need help with this problem (heat equation)

Can anyone give me hints of how to solve this problem?

Problem: Solve the heat equation du/dt=d^(2)u/dx^(2), 0<x<4,t>0, with the conditions: u(0,t)=u(4,t)=0 for all t>=0, and u(x,0)=f(x), where f(x)=x for 0<=x<=2 and f(x)=4-x for 2<=x<=4.

2. You have:

$\frac{\partial u}{\partial t}=\frac{\partial^2 u}{\partial x^2},\quad 0\leq x\leq 4,\quad t>0$

$u(0,t)=0 \quad u(4,t)=0$

$u(x,0)=f(x)=\begin{cases} x & 0\leq x\leq 2 \\
4-x & 2\leq x \leq 4\
\end{cases}
$

Then this reduces to finding the Fourier Sine series of $f(x)$ right? Or rather the odd-extension of the function which I've drawn in the first plot below. Suppose that's all you had to do, find $\text{FSS}\, f(x)$. Can you do that? Then we can solve the PDE and it should look like the second plot.

.

3. Originally Posted by shawsend
You have:

$\frac{\partial u}{\partial t}=\frac{\partial^2 u}{\partial x^2},\quad 0\leq x\leq 4,\quad t>0$

$u(0,t)=0 \quad u(4,t)=0$

$u(x,0)=f(x)=\begin{cases} x & 0\leq x\leq 2 \\
4-x & 2\leq x \leq 4\
\end{cases}
$

Then this reduces to finding the Fourier Sine series of $f(x)$ right? Or rather the odd-extension of the function which I've drawn in the first plot below. Suppose that's all you had to do, find $\text{FSS}\, f(x)$. Can you do that? Then we can solve the PDE and it should look like the second plot.

.
do I have to solve FSS also with -2<=x<=0 for f(x)=x and -4<=x<=-2 for f(x)=4-x

4. Originally Posted by chihahchomahchu
do I have to solve FSS also with -2<=x<=0 for f(x)=x and -4<=x<=-2 for f(x)=4-x
No. Look carefully at the plot of the odd extension. The leg from -4 to -2 is not defined by 4-x. Make sure you have the odd extension defined properly, then integrate over the entire interval (-4,4) taking the proper leg of the graph in each interval correctly. You want:

$FS f(x)=1/2 a_0+\sum_{n=1}^{\infty} a_n \cos(n\pi x/L) +b_n \sin(n\pi x/L)$

Right? I know it's a mess. Just take it a little at a time. You know since it's an odd function, the cosine terms will drop out right? I'll do one anyway on the interval (2,4):

$a_1=1/4\int_2^4 (4-x)\cos(\pi x/4)dx$

You need to calculate these correctly over the appropriate interval determined by the value of f(x) so that means the $a_1$ part actually has three terms right? Try calculating the coefficient $b_1$ on each of the three intervals. Also, since it's odd, probably a way to combine the integrals to make the calculations easier. I just did them all in Mathematica.