The Crank-Nicolson method with a geometric mean:
def CN_logistic(u0, dt, Nt): u = np.zeros(Nt+1) u[0] = u0 for n in range(0, Nt): u[n+1] = (1 + 0.5*dt)/(1 + dt*u[n] - 0.5*dt)*u[n] return u