# 1D Heat diffusion

1. Apr 25, 2008

### Big-T

I have trying solving this PDE for some random boundary values, and were wondering if someone could verify my calculations?

$$$\begin{array}{l} T_t = DT_{xx} \\ T\left( {0,t} \right) = 0,T(\pi ,t) = 0,T(x,0) = \frac{1}{4}\left( {\left( {x - \frac{\pi }{2}} \right)^2 + \frac{{\pi ^2 }}{4}} \right) \\ T = T\left( {x,t} \right) = \sum\limits_{n = 1}^\infty {a_n \left( t \right)\sin \left( {nx} \right)} \\ T_{xx} = - n^2 \sum\limits_{n = 1}^\infty {a_n \left( t \right)\sin \left( {nx} \right)} \\ T_t = \sum\limits_{n = 1}^\infty {a_n '\left( t \right)\sin \left( {nx} \right)} \\ \Rightarrow \sum\limits_{n = 1}^\infty {a_n '\left( t \right)\sin \left( {nx} \right)} = \sum\limits_{n = 1}^\infty {\left( { - n^2 a_n \left( t \right)} \right)\sin \left( {nx} \right)} \\ \Rightarrow a_n '\left( t \right) = - n^2 a_n \left( t \right) \\ \Rightarrow a_n \left( t \right) = C_n \left( x \right)e^{ - n^2 t} \\ T = \sum\limits_{n = 1}^\infty {C_n \left( x \right)e^{ - n^2 t} \sin \left( {nx} \right)} \\ \end{array}$$ $$\begin{array}{l} C_n = \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)\sin \left( {nx} \right)dx} \\ = \frac{1}{{2\pi }}\int\limits_0^\pi {\left( {x^2 - \pi x} \right)\sin \left( {nx} \right)dx} \\ = \frac{1}{{2\pi }}\left[ {\mathop {\frac{1}{{n^2 }}\sin \left( {nx} \right)\left( {2x + \pi } \right)}\limits_{ = 0} - \frac{1}{{n^3 }}\cos \left( {nx} \right)\left( {n^2 \left( {x^2 + \pi x} \right) - 1} \right)} \right]_0^\pi \\ = \frac{1}{{\pi n^3 }}\left( {1 - n^2 \pi ^2 } \right) \\ T\left( {x,t} \right) = \sum\limits_{n = 1}^\infty {\pi ^{ - 1} n^{ - 3} \left( {1 - n^2 \pi ^2 } \right)e^{ - n^2 t} \sin \left( {nx} \right)} \\ \end{array}$$$

2. Apr 25, 2008

### exk

Well your third initial condition is not satisfied by the answer as far as I can tell (the T(x,0)). Was the T(x,t)=a(t)*sin(nx) given or is that something you came up with?

The other thing that's sort of bothering me is in line 8. The integration really isn't dealing with anything relating to an f(x) there as far as I can tell so my question is why is it C(x) rather than C(t)?

The rest looks ok to me.

3. Apr 25, 2008

### Big-T

The reason I'm asking is that this is the first time I have attempted to solve such an equation, I have not taken any courses dealing with this subject.

The T(x,t) is a Fourier series "guess" for a solution of the equation, this is allowed because Fourier's theorem says that every function may be represented by an infinite number of harmonics, (i.e. sin(pi*n*x/L)).

I think it is C(x) because when integration a_n(t), the constant of integration is actually a function of x, since we are dealing with partial derivation.

4. Apr 25, 2008

### exk

Well the fourier series would be of the form found here http://en.wikipedia.org/wiki/Fourier_series and would involve a cos() term as well.

I don't think there is any specific reason that the constant should be a function of x, it could just be a constant.

5. Apr 30, 2008

### Big-T

Yes, it would have involved some cos() terms, but with these spesific boundary conditions, all the cosines vanish, and only the sines are left behind.

As for the constant of integration, you're probably right.