Crank-Nicolson for quadratic PDE I would like to solve the equation
$$\partial_t u = C(t)\cdot u-u^2$$
using the Crank-Nicolson approach. That resulted in the equations
$$\begin{align}
\frac{u_1-u_0}{\Delta t}&=0.5\left((C_1u_1-u_1^2)+(C_0u_0-u_0^2)\right)\\
u_1\left(1-\frac{\Delta t}{2}C_1+\frac{\Delta t}{2}u_1\right)&=u_0\left(1+\frac{\Delta t}{2}C_0-\frac{\Delta t}{2}u_0\right)
\end{align}$$
Without the square part the solution would be easy, but I am lost with the $u_1$ in the left bracket. How can I fix that? Or is the Crank-Nicolson-Approach not usable for that problem?
 A: This is not an answer to the question asking for Crank-Nicolson approach. This a comment but too long to be edited in the comments section.
The exact analytic solution below may be used to compare with the approximative results from numerical method.
Comment :
Only one variable $t$ appears in the equation :
$$\partial_t u = C(t)\cdot u-u^2$$
Thus this is a PDE reduced to an ODE :
$$\frac{du}{dt}=C(t)u(t)-\big(u(t)\big)^2$$
To solve this Riccati ODE the change of function is :
$$u(t)=\frac{1}{y(t)}\frac{dy}{dt}$$
$$u'=\frac{y''}{y}-\frac{(y')^2}{y^2}=C(t)\frac{y'}{y}-\left(\frac{y'}{y}\right)^2$$
$$y''=C(t)y'\quad\implies\quad \frac{y''}{y'}=C(t)$$
$$y'=c_1e^{\int C(t)dt}$$
$$y=c_1\int\left(e^{\int C(t)dt}\right)dt+c_2$$
$$u(t)=\frac{c_1e^{\int C(t)dt}}{c_1\int\left(e^{\int C(t)dt}\right)dt+c_2}$$
The exact solution is
$$\boxed{u(t)=\frac{e^{\int C(t)dt}}{\int\left(e^{\int C(t)dt}\right)dt+c}}$$
$c=\frac{c_2}{c_1}=$constant (to be determined according to some initial condition not specified in the wording of the question).
