.. jupyter-execute::

    k = 50
    n = 2 * k + 1

    E = sps.eye(n, format='lil')
    E[0, 0] = E[-1, -1] = 0.5
    E = E.tocsc()

    d0 = n * [-2 * (n - 1)**2]
    d1 = (n - 1) * [(n - 1)**2]
    A = sps.diags([d1, d0, d1], [-1, 0, 1], format='lil')
    A[0, 0] = A[-1, -1] = -n * (n - 1)
    A = A.tocsc()

    B = np.zeros((n, 2))
    B[:, 0] = 1
    B[0, 0] = B[-1, 0] = 0.5
    B[0, 1] = n - 1

    C = np.zeros((3, n))
    C[0, 0] = C[1, k] = C[2, -1] = 1
