# I PDE Heat Eq

1. Jan 6, 2017

### joshmccraney

Hi PF!

I'm wondering if my solution is correct. The PDE is $h_t = h_{zz}$ subject to $h_z(0,t)=0$, $h(1,t)=-1$, and let's not worry about the initial condition now. To solve I want homogenous boundary conditions, so lets set $v = h+1$. Then we have the following: $v_t = v_{zz}$ subject to $v_z(0,t)=0$, $v(1,t)=0$. To solve take separation of variables where $v = T(t)Z(z) \implies T'/T= Z''/Z = -\lambda \implies Z''+\lambda Z = 0$. Guess $Z = A \cos \sqrt{\lambda} z+B\sin \sqrt{\lambda} z$. Then $Z'(0)=0 \implies B=0$. Thus $Z = \cos \sqrt{\lambda} z$. $Z(1)=0 \implies \cos \sqrt{\lambda} = 0 \implies \sqrt{\lambda} = \pi/2+n\pi:n\in0,1,2...$. Thus, $Z = \cos((\pi/2+n\pi)z)$. Yet this doesn't look right. Any ideas?

2. Jan 6, 2017

In what way?

3. Jan 7, 2017

### Staff: Mentor

$$\sqrt{\lambda}=(2n-1)\frac{\pi}{2}\tag{n=1,2,3,...}$$

4. Jan 11, 2017

### joshmccraney

I was looking for a solution that worked much better with the initial condition I am working with (square wave $h(z,0) = 1/2 - \sum 2/(\pi n) \sin(n \pi /2) \cos(n \pi z/2)$). The issue is, if I use $$Z=\cos((\pi/2+n\pi)z)\implies\\ T = \exp(-(\pi/2+ n\pi)^2t) \implies\\ h(z,0) = -1 + \sum A_n \left( \cos(n\pi z)\cos(\pi/2z)-\sin(n\pi z)\sin(\pi/2z) \right) \implies \\ -1 + \sum A_n \left( \cos(n\pi z)\cos(\pi/2z)-\sin(n\pi z)\sin(\pi/2z) \right) = 1/2 - \sum 2/(\pi n) \sin(n \pi /2) \cos(n \pi z/2)$$ which doesn't seem to work. However, if I make the ansatz based on the initial condition I can see that a good guess is $A_n Z = 2/(\pi n) \sin(n \pi /2) \cos(n \pi z/2)$. Then I can superimpose the exponential $\exp(\lambda_1 t)$ and try this guess at the PDE, ultimately giving $$h(z,t) = 1/2 - \sum 2/(\pi n) \sin[n \pi /2] \cos[n \pi z/2] \exp[-n^2 \pi^2 t/4]:n\in 1,2,3...$$ which works out perfectly. But the question remains: why did the first method fail?

5. Jan 29, 2017

### Orodruin

Staff Emeritus
Hint: $\sin(\pi n/2) = 0$ for odd n.

6. Jan 30, 2017

### Staff: Mentor

So, the first method doesn't fail.

7. Feb 2, 2017

### joshmccraney

I think matching the Fourier coefficients for $A_n$ fails since the constants prior to the sum are unequal: $1/2\neq-1$. However, after more thinking of the problem, I reformulated the initial condition so this works. I'd specify further if anyone is actually interested but I doubt the details would be of interest. Thank you all for your help and input!