Answer
$q=E_0C+(q_0-E_0C)\cos(\frac{t}{\sqrt LC})$
Work Step by Step
Since $\frac{du}{dt}$, we obtain:
$$\frac{du}{dt}=\frac{du}{dq}\frac{dq}{dt}=u\frac{du}{dt}$$
$$\frac{d^2q}{dt^2}+\frac{1}{LC}q=\frac{E_0}{L}$$
and we also have:
$$u\frac{du}{dq}+\frac{q}{LC}=\frac{E_0}{L}$$
Hence:
$$udu+(\frac{q}{LC}-\frac{E_0}{L})dq=0$$
Integrating both sides:
$$\frac{1}{2}u^2+\frac{1}{2}q^2.\frac{1}{LC}-\frac{E_0q}{L}+c_1=0$$
Since $u(q_0)=0$, we have:
$$0+\frac{1}{2}q_0^2.\frac{1}{LC}-\frac{E_0q_0}{L}+c_1=0$$
Solve for $c_1$:
$$ \rightarrow c_1=\frac{E_0q_0}{L}-\frac{1}{2LC}q_0^2$$
Hence here,
$$u=\sqrt \frac{2E_0q}{L}-\frac{q^2}{LC}-\frac{2E_0q_0}{L}+\frac{q_0^2}{LC}$$
$$u=\frac{1}{\sqrt LC}\sqrt -q^2+2E_0Cq-(E_0C)^2+q^2_0+(E_0C)^2-2E_0q_0C$$
$$u=\frac{1}{\sqrt LC}\sqrt (q_0-E_0C)^2-(q-E_0C)^2$$
$$\rightarrow \frac{dq}{dt}=\frac{1}{\sqrt LC}\sqrt (q_0-E_0C)^2-(q-E_0C)^2$$
$$\rightarrow \frac{dq}{\sqrt (q_0-E_0C)^2-(q-E_0C)^2}=\frac{1}{\sqrt LC}$$
Integrating both sides:
$$\sin^{-1}(\frac{q-E_0C}{q_0-E_0C})=c_2+\frac{t}{\sqrt LC}$$
Since $q(0)=0 \rightarrow c_2=\frac{\pi}{2}$
Thus, the solution is given by:
$$q=E_0C+(q_0-E_0C)\sin(\frac{\pi}{2}+\frac{t}{\sqrt LC})$$
$$q=E_0C+(q_0-E_0C)\cos(\frac{t}{\sqrt LC})$$