class_docstr: Distribution of electrons on a sphere.
  
  Problem no 2 from COPS collection [2]_. Find
  the equilibrium state distribution (of minimal
  potential) of the electrons positioned on a
  conducting sphere.
  
  References
  ----------
  .. [1] E. D. Dolan, J. J. Mor'{e}, and T. S. Munson,
         "Benchmarking optimization software with COPS 3.0.",
          Argonne National Lab., Argonne, IL (US), 2004.
class_docstr_tok: ["Distribution","of","electrons","on","a","sphere",".","Problem","no","2","from","COPS","collection","[","2","]","_",".","Find","the","equilibrium","state","distribution","(","of","minimal","potential",")","of","the","electrons","positioned","on","a","conducting","sphere",".","References","--","--","--","--","--","..","[","1","]","E.","D.","Dolan",",","J.","J.","Mor","'","{","e","}",",","and","T.","S.","Munson",",","``","Benchmarking","optimization","software","with","COPS","3.0",".","``",",","Argonne","National","Lab.",",","Argonne",",","IL","(","US",")",",","2004","."]
code: def constr(self):
      def fun(x):
          x_coord, y_coord, z_coord = self._get_cordinates(x)
          return x_coord**2 + y_coord**2 + z_coord**2 - 1
  
      if self.constr_jac is None:
  
          def jac(x):
              x_coord, y_coord, z_coord = self._get_cordinates(x)
              Jx = 2 * np.diag(x_coord)
              Jy = 2 * np.diag(y_coord)
              Jz = 2 * np.diag(z_coord)
              return csc_matrix(np.hstack((Jx, Jy, Jz)))
  
      else:
          jac = self.constr_jac
  
      if self.constr_hess is None:
  
          def hess(x, v):
              D = 2 * np.diag(v)
              return block_diag(D, D, D)
  
      else:
          hess = self.constr_hess
  
      return NonlinearConstraint(fun, -np.inf, 0, jac, hess)
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  import pytest
  from scipy.linalg import block_diag
  from scipy.sparse import csc_matrix
  from numpy.testing import TestCase, assert_array_almost_equal, assert_array_less, assert_allclose, assert_
  from pytest import raises
  from scipy.optimize import NonlinearConstraint, LinearConstraint, Bounds, minimize, BFGS, SR1
  from scipy._lib._numpy_compat import suppress_warnings
label_desc: Use image node_id 7 for calling the Elec obj's underlying member method code with example usage: obj.constr() and returns: NonlinearConstraint, unknown, csc_matrix, block_diag