Consider the following diffusion equation: $$\frac{\partial}{\partial t}y(x,t)=D\frac{\partial^2}{\partial x^2}y(x,t)+Cy(x,t)$$ where both $D$ and $C$ are constants
Solve the equation over the interval, $\frac{L}{2}\le x \le \frac{L}{2}$ subjected to the following boundary conditions: $$y(-\frac{L}{2},t)=y(\frac{L}{2},t)=0$$
1) Analytically, determine the critical length of the system ($C,D=1.0$), beyond which always lead to an exponentially increasing solution.
2) Implement a numerical finte difference method in order to solve this equation.
For the analytical part, i tried solving this using the separations of variables:
$$y(x,t)=v(x)q(t)$$ Substitute $C,D=1$ into the diffusion equation and substituting the separation of variable into the diffusion equation and dividing though by $v(x)q(t)$:
$$\frac{1}{q(t)}\frac{\partial q}{\partial t}=\frac{1}{v(x)}\frac{\partial^2v}{\partial x^2}+1$$
I am quite confused at this part, and do not know if this is the correct method to solve this equation, if so, how do i proceed.
Before applying separation of variables, make the substitution $y(x,t)=u(x,t)e^{t}$. Then the PDE is $$\frac{\partial (ue^t)}{\partial t}=\frac{\partial^2 (ue^t)}{\partial x}^2+ue^t,$$ which is $$\frac{\partial u}{\partial t}e^t+ue^t=e^t \frac{\partial^2 u}{\partial x^2}+ue^t,$$ and so $$\frac{\partial u}{\partial t}=\frac{\partial^2 u}{\partial x^2}.$$ We now recognize that $u$ solves the heat equation, whose solutions are well-understood and can be solved by separation of variables if necessary. Then multiply by $e^t$ to get $y$.