I wonder if anyone could solve the equation below (analytically) for $p(x,t)$?
$$\dfrac{\partial p(x,t)}{\partial t} = \dfrac{\partial (u(x) p(x,t))}{\partial x}$$
The conditions are as follows:
\begin{align} u(x) &= \cos \bigg( \frac{2 \pi x}{l} \bigg) + \frac{d}{2} \cos \bigg( \frac{4 \pi x}{l} \bigg) \\ p(x,0) &= \delta(x) \end{align}
$$\dfrac{\partial p(x,t)}{\partial t} = \dfrac{\partial (u(x) p(x,t))}{\partial x} \quad\to\quad \dfrac{\partial p}{\partial t}-u\dfrac{\partial p}{\partial x}= u'p \quad\text{where}\quad u'=\frac{du}{dx}$$ Solving thanks to the method of characteristics :
System of characteristic differential equations $\quad \frac{dt}{1}=\frac{dx}{-u}=\frac{dp}{u'p}$
First characteristic curve, from $\frac{u'dx}{u}+\frac{dp}{p}=0\quad\to\quad up=c_1$
Second characteristic curve, from $\frac{dt}{1}=\frac{dx}{-u} \quad\to\quad t+\int\frac{dx}{u}=c_2$
General solution on the form of implicit equation $\Phi\left(c_1\:,\:c_2\right)=0$ where $\Phi$ is any differentiable function of two variables : $$\Phi\left(up\:,\:t+\int\frac{dx}{u}\right)=0$$ An equivalent form of any relationship between the two variable is the explicit equation $\quad up=F\left(t+\int\frac{dx}{u}\right)$ where $F$ is any differentiable function. $$p(x,t)=\frac{1}{u(x)}F\left(t+\int\frac{dx}{u(x)}\right)$$
At this step, since the wording of the question was changed, the answer also is changed :
Suppose that the initial condition be : $$p(x,0)=g(x)\qquad\text{with }g(x)\text{ a given function}.$$ One have to determine the function $F$ which satisfies the equation : $\frac{1}{u(x)}F\left(\int\frac{dx}{u(x)}\right)=g(x)$ $$F\left(\int\frac{dx}{u(x)}\right)=g(x)u(x)$$ Let $X(x)=\int\frac{dx}{u(x)} \qquad\to\qquad x=$inverse function of $\int\frac{dx}{u(x)}=G(X)$
Since $u(x)$ is a given function, $G(X)$ is given. This doesn't mean that $G(X)$ is known on a closed form. This is not the case if the antiderivative of $\frac{dx}{u(x)}$ is not known on a closed form. Moreover, a closed form might not be known for the inverse function.
$$F(X)=g\left(G(X)\right)u\left(G(X)\right)$$
On a pure formal form, the solution of the problem is : $$p(x,t)=\frac{1}{u(x)}g\left(G\left(t+\int\frac{dx}{u(x)}\right)\right)u\left(G\left(t+\int\frac{dx}{u(x)}\right)\right)$$ where $g$ , $u$ , $G$ , are functions given or derived from given functions. As already pointed out, this doesn't mean that one can express all of them on closed form.
For example, in case of $p(x,0)=\delta(x) \quad\to\quad g(x)=\delta(x)$. But we also need to express $G(x)$ which involves the inverse function of $\int \frac{dx}{\cos \bigg( \frac{2 \pi x}{l} \bigg) + \frac{d}{2} \cos \bigg( \frac{4 \pi x}{l} \bigg)}$.
The main difficulty comes more from the kind of function $u(x)$ specified than from the initial condition.