def update_Fpsi_jacobian(Fpsi_jacobian, df_dpsi, dx):
    """
    Updates the sparse matrix from `get_Fpsi_jacobian`, for solving the
    one-dimensional electrostatic Poisson equation,

        psi'' = -f,

    under Dirichlet (fixed potential) boundary conditions:

        psi[0] = a
        psi[-1] = b

    Arguments
    ---------
    Fpsi_jacobian : csr_matrix
        Jacobian matrix to update (from `get_Fpsi_jacobian`).
    df_dpsi : vector of length N
        Derivative of the source term with respect to psi [V cm**-3].
    dx : float
        Grid spacing [cm].
    """
    N = df_dpsi.size
    dx2 = dx * dx
    Fpsi_jacobian.data[2::3] = -2 + df_dpsi[1:-1] * dx2
