def test_NewtonRoot(self):
        fun = lambda x, return_g=True: np.sin(x) if not return_g else ( np.sin(x), sdiag( np.cos(x) ) )
        x = np.array([np.pi-0.3, np.pi+0.1, 0])
        xopt = Optimization.NewtonRoot(comments=False).root(fun,x)
        x_true = np.array([np.pi,np.pi,0])
        print 'Newton Root Finding'
        print 'xopt: ', xopt
        print 'x_true: ', x_true
        self.assertTrue(np.linalg.norm(xopt-x_true,2) < TOL, True)
dataset/ETHPy150Open simpeg/simpeg/tests/base/test_optimizers.py/TestOptimizers.test_NewtonRoot/original