Problem on integration by parts in the heat equation

71 Views Asked by At

I have the given heat equation problem I struggle to solve:

$$u_t-3u_{xx}=0\\ u_x(0,t)=u_x(3,t)=0\\ u(x,0)=4\cos3\pi x$$

Here we have Neumann condition on x, and $L=3$, so we can readily make the ansatz $$u(x,t)=\cos\frac{n\pi x}{3}\ u(t)$$.

Solving for $u(t)$:

$$u_{xx}=-\bigg(\frac{n\pi}{3}\bigg)^2\cos\frac{n\pi x}{3}\ u(t), \\ u_t=\cos\frac{n\pi}{3}u_t$$ Insert in the PDE and solve:

$$\cos\frac{n\pi}{3}u_t+\bigg(\frac{n\pi}{\sqrt{3}}\bigg)^2\cos\frac{n\pi x}{3}u(t)=0$$

$$u_t+\bigg(\frac{n\pi}{\sqrt{3}}\bigg)^2 u=0$$

$$\frac{u_t}{u}=-\bigg(\frac{n\pi}{\sqrt{3}}\bigg)^2 $$

$$u(t)=Ce^{-(\frac{n\pi}{\sqrt{3}})^2t} $$

Now the solution is:

$$u(x,t)=C\cos\frac{n\pi x}{3}e^{(-\frac{n\pi}{\sqrt{3}})^2t}$$

Use the initial condition to find C, as it is a Fourier coefficient:

$$\alpha_k=\frac{2}{L}\int_0^L f(x)\cos\frac{n\pi x}{L}dx$$

where $f(x)=4\cos3\pi x$, so we have to solve the integral by parts:

$$\alpha_k=\frac{2}{L}\int_0^L f(x)\cos\frac{n\pi x}{L}dx=\frac{2}{3}\int_0^34\cos3\pi x\cos\frac{n\pi x}{3}dx$$

but this gives:

$$\frac{8}{3}\int_0^3 \cos3\pi x\cos\frac{n\pi x}{3}dx=\frac{8}{3}\frac{3}{n\pi}\cos3\pi x\sin\frac{n\pi}{3}x\bigg|_0^3+\frac{8}{3}\frac{9\pi}{n\pi}\int_0^3\sin3\pi x\sin\frac{n\pi x}{3}dx$$

The first term on the RHS is zero, and the second is:

$$\frac{8}{3}\frac{9}{n}\int_0^3\sin3\pi x\sin\frac{n\pi x}{3}dx=0-\frac{8}{3}\frac{9}{n}\int_0^3\cos3\pi x\cos\frac{n\pi x}{3}dx$$.

Set this equal to the top LHS:

$$\frac{8}{3}\int_0^3\cos3\pi x\cos\frac{n\pi x}{3}dx=-\frac{8}{3}\frac{9}{n}\int_0^3\cos3\pi x\cos\frac{n\pi x}{3}dx$$

But this has no solution!

However, Mathematica solves this integration by parts nicely and gets a feasible result. So what went wrong here?

2

There are 2 best solutions below

7
On BEST ANSWER

Correct answer is given in comments of Hans and gpmath, so I'll just show error in original post. $$\alpha_n=\frac{8}{3}\frac{9}{n}\int_0^3\sin3\pi x\sin\frac{n\pi x}{3}dx$$ Using integration by parts again one can get $$\alpha_n=\left.-\frac8{3}\frac9{n}\frac3{n\pi}\sin(3\pi x)\cos\frac{n\pi x}{3}\right|_0^3+\frac8{3}\frac9{n}\frac9{n}\int_0^3\cos(3\pi x)\cos\frac{n\pi x}{3}dx=\frac{81}{n^2}\alpha_n$$ Then $\alpha_n=0$ or $81=n^2$, then $u$ contains only one non-zero term corresponding to $n=9$


General solution is $$u(x,t)=\sum_{n=0}^\infty \alpha_n \cos \frac{n\pi x}{3} \exp \left(\mathbf{-} \left(\frac{n\pi}{\sqrt{3}}\right)^2 t\right)$$

Putting general solution in initial condition gives $$4\cos 3\pi x = \sum_{n=0}^\infty \alpha_n \cos \frac{n\pi x}{3}$$ $\alpha_n$ is coefficient of Fourier expansion of $u(x,0)=4\cos 3\pi x$ corresponding to term $\cos \frac{n\pi x}{3}$. However $\cos 3\pi x$ is already of type $\cos \frac{n\pi x}{3}$ at $n=9$. Then Fourier expansion of $u(x,0)$ contains only one non-zero term. $4\cos 3\pi x = 4 \cos \frac{9\pi x}{3}$, then $\alpha_9=4$ and all other $\alpha_n$ are zero.

8
On

It's just easier. You know that $$u(x,0)=4\cos 3\pi x,$$ so just put $t=0$ in your solution, that is, $n=9$ and $C=4$.