I am trying to solve the following: $$ i\frac{\partial\psi}{\partial t}=\beta\frac{\partial^{2}\psi}{\partial x^{2}}+ig\psi $$
For a specific anzats : $\psi=a\cdot e^{-bx^{2}}$ where $a,b$ are functions of time.
I need to get expressions for $a(t)$ and $b(t)$
if needed, my initial condition is $\psi(x,0)=e^{-x^2}$
Evaluating derivatives on both sides, equating and dividing by the exponent I reach the following expression:
$$ i\left(\dot{a}-x^{2}\dot{b}\cdot a\right)=\beta\left(4ab^{2}x^{2}-2ab\right)+ig\cdot a $$
Now I am kind of stuck, I am not sure what to do:
Tried to split this into 2 equations - real and imaginary parts. After substitutions I got this: $$ \begin{array}{c} \dot{a}-x^{2}\dot{b}\cdot a=g\cdot a\\ \beta\left(4ab^{2}x^{2}-2ab\right)=0 \end{array}$$
Solving the bottom for $a*x^2$ and substituting into the top gives me : $$ \frac{\dot{a}}{a}-\frac{1}{2}\frac{\dot{b}}{b}=g $$
Which as far as I understand leads me nowhere.
You make the ansatz $\psi = a(t)e^{-b(t)x^2}$ and arrive at $$\dot{a}-x^{2}\dot{b}\cdot a=g\cdot a~~~\text{and}~~~\beta\left(4ab^{2}x^{2}-2ab\right)=0.$$ Now since $a,b$ are only be functions of time we must require $\dot{b}\cdot a = 0$ and $4ab^2 = 0$ to kill the $x$-dependent terms as otherwise $a,b$ will depend on $x$ which contradicts the assumption you have made when deriving this equation. This leads to $a\propto e^{gt}$ and $b = 0$ giving the solution $\psi \propto e^{gt}$ which cannot match the given initial condition. There are no other solutions corresponding to this ansatz.
As for solving the PDE it's useful to take $\psi = e^{gt}\phi$ to get $i\phi_t = \beta\phi_{xx}$ which is a free particle Schrodinger equation. We can solve this using Fourier transforms to get that the solution having $\psi(x,0) = e^{-x^2}$ is
$$\psi(x,t) = \frac{e^{gt}}{2\sqrt{\pi}}\int e^{-\frac{k^2}{4}}e^{i(kx+\beta k^2 t)} {\rm d}k$$ This integral can be evaluated in terms of the error-function if needed (complete the square in the exponential). This solution is not a physical solution in the sense that $\int |\psi(x,t)|^2{\rm d}x$ is not conserved in time (it grows $\propto e^{2gt}$ due to having an imaginary potential $V = ig$).