Solving the heat equation with piecewise IC

1k Views Asked by At

I have the solution to the heat equation, with the BC's and everything but the IC applied. So I am just trying to solve for the coefficients, the solution without the coefficients is $$u(x,t) = \sum_{n=1}^{\infty} A_n\sin(nx)e^{-n^2t}$$ If the initial condition is $u(x,0) = f(x)$ such that $$f(x) = \begin{cases} 0 & 0 < x < \frac{\pi}{3} \\ 100 & \frac{\pi}{3} < x < \frac{2\pi}{3} \\ 0 & \frac{2\pi}{3} < x < \pi \end{cases} $$ I used the formula $$A_m = \frac{2}{\pi}\int_0^\pi f(x)\sin(mx)dx=\frac{200}{m\pi}\bigg[\cos(\frac{\pi}{3}m) - \cos(\frac{2\pi}{3}m)\bigg]$$

I couldn't find a pattern in the coefficients other than all the even indices go to $0$. Also is this even correct? When I try to graph this at $t=0$ it isn't giving me the piecewise function $f(x)$. Is it just that I didn't use enough terms to make it noticeable?

1

There are 1 best solutions below

0
On BEST ANSWER

There is nothing wrong with your computations. The only problem is that $$ \frac{200}{m}\sum_{n=1}^\infty\frac{1}{n}\Bigl(\cos\Bigl(\frac{n\,\pi}{3}\Bigr) - \cos\Bigl(\frac{2\,n\,\pi}{3}\Bigr)\Bigr)\,\sin(n\,x) $$ converges slowly to $f(x)$. Below you have the graphs of the sum for the the first $10$ and $100$ terms. enter image description here

enter image description here