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_broyden1_update(self):
      # Check that BroydenFirst update works as for a dense matrix
      jac = nonlin.BroydenFirst(alpha=0.1)
      jac.setup(self.xs[0], self.fs[0], None)
  
      B = np.identity(5) * (-1 / 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]
          B += (df - dot(B, dx))[:, None] * dx[None, :] / dot(dx, dx)
          jac.update(x, f)
          assert_(np.allclose(jac.todense(), B, 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 4 for calling the TestSecant obj's underlying member method code with example usage: obj.test_broyden1_update() without return types