class_docstr: Check that some Jacobian approximations satisfy the secant condition
class_docstr_tok: ["Check","that","some","Jacobian","approximations","satisfy","the","secant","condition"]
code: def test_broyden2_update(self):
      # Check that BroydenSecond update works as for a dense matrix
      jac = nonlin.BroydenSecond(alpha=0.1)
      jac.setup(self.xs[0], self.fs[0], None)
  
      H = np.identity(5) * (-0.1)
  
      for last_j, (x, f) in enumerate(zip(self.xs[1:], self.fs[1:])):
          df = f - self.fs[last_j]
          dx = x - self.xs[last_j]
          H += (dx - dot(H, df))[:, None] * df[None, :] / dot(df, df)
          jac.update(x, f)
          assert_(
              np.allclose(jac.todense(), inv(H), rtol=1e-10, atol=1e-13)
          )
  
imports: from __future__ import division, print_function, absolute_import
  from numpy.testing import assert_
  import pytest
  from scipy._lib.six import xrange
  from scipy.optimize import nonlin, root
  from numpy import diag, dot
  from numpy.linalg import inv
  import numpy
  from .test_minpack import pressure_network
label_desc: Use image node_id 5 for calling the TestSecant obj's underlying member method code with example usage: obj.test_broyden2_update() without return types