As a homework question, I am asked to numerically solve the PDE on $x \in [-3, 3]$ and $t \in [0, 0.5]$ with the spectral method.
$$ \frac{\partial p}{\partial t} = (12x^2-4) p + \left[4x(x^2-1)+0.1\right] \frac{\partial p}{\partial x} + \frac{1}{\beta} \frac{\partial^2 p}{\partial x^2} \\ $$
with the initial condition $p(x,0)=\frac{1}{\sqrt{2\pi}} \exp(-\frac{x^2}{2})$ and zero boundary condition $p(-3,t)=p(3,t)=0$.
Attempt: By the Chebyshev expansion of the first kind $p(x, t) = \sum_{n=0}^N \tau_n(t) T_n(x)$,
\begin{equation} \begin{aligned} \frac{\partial p}{\partial t} =& (12x^2-4) p + \left[4x(x^2-1)+0.1\right] \frac{\partial p}{\partial x} + \frac{1}{\beta} \frac{\partial^2 p}{\partial x^2} \\ \sum_{n=0}^N \tau_n'(t) T_n(x) =& (12x^2-4) \sum_{n=0}^N \tau_n(t) T_n(x) + \left[4x(x^2-1)+0.1\right] \sum_{n=0}^N \tau_n(t) T_n'(x) - \frac{1}{\beta} \sum_{n=0}^N \tau_n(t) T_n''(x) \\ =& \left(2T_0(x) + 6T_2(x)\right) \sum_{n=0}^N \tau_n(t) T_n(x) + \left(0.1T_0(x) - T_1(x) + T_3(x)\right) \sum_{n=0}^N \tau_n(t) T_n'(x) - \frac{1}{\beta} \sum_{n=0}^N \tau_n(t) T_n''(x) \\ \end{aligned} \end{equation}
Ideally, this would yield one ODE for each $\tau_n(t)$ by the uniqueness of Chebyshev expansion, but the polynomials $12x^2-4$ and $4x(x^2-1)+0.1$ mess everything up.
Since I need a numerical result, I don't think I am supposed to perform the multiplication of Chebyshev polynomials by hand. What should I do next?


So this is the discretisation of time that I meant to suggest in the comments: \begin{equation*} \frac{p(x,t)-p(x,t-\Delta t)}{\Delta t} = \left(12 x^{2} - 4\right) p(x,t) +\left(4 x \left(x^{2}- 1\right)+ 0.1\right)\frac{\partial p(x,t)}{\partial x} +\frac{1}{\beta} \frac{\partial^{2} p(x,t)}{\partial x^{2}}. \end{equation*} That becomes \begin{equation*} Ap=b \end{equation*} with \begin{equation*} A = 1-\left(12 x^{2} - 4\right)\Delta t -\left(4 x \left(x^{2}- 1\right)+ 0.1\right)\Delta t\frac{\partial}{\partial x} -\frac{1}{\beta} \Delta t\frac{\partial^{2}}{\partial x^{2}} \end{equation*} \begin{equation*} b(x) = p(x,t-\Delta t). \end{equation*} In Python the code might look something like
Edit: it seems the Chebyshev-Gauss-Lobatto points can be worked out more easily than by transcribing that routine from Numerical Recipes. This page says :
Edit 2: I was asked in the comments to make a plot ... here it is
produced by