code: def test_optimize_new_scipy():
      opt = Optimizer(
          fun=func, x0=np.array([1.0, 1.0, 1.0]), method="Powell"
      )
  
      npt.assert_array_almost_equal(opt.xopt, np.array([0, 0, 0]))
      npt.assert_almost_equal(opt.fopt, 0)
  
      opt = Optimizer(
          fun=func,
          x0=np.array([1.0, 1.0, 1.0]),
          method="L-BFGS-B",
          options={
              "maxcor": 10,
              "ftol": 1e-7,
              "gtol": 1e-5,
              "eps": 1e-8,
          },
      )
  
      npt.assert_array_almost_equal(opt.xopt, np.array([0, 0, 0]))
      npt.assert_almost_equal(opt.fopt, 0)
      npt.assert_equal(opt.evolution, None)
  
      npt.assert_equal(opt.evolution, None)
  
      opt = Optimizer(
          fun=func,
          x0=np.array([1.0, 1.0, 1.0]),
          method="L-BFGS-B",
          options={
              "maxcor": 10,
              "ftol": 1e-7,
              "gtol": 1e-5,
              "eps": 1e-8,
          },
          evolution=False,
      )
  
      npt.assert_array_almost_equal(opt.xopt, np.array([0, 0, 0]))
      npt.assert_almost_equal(opt.fopt, 0)
  
      opt.print_summary()
  
      opt = Optimizer(
          fun=func2,
          x0=np.array([1.0, 1.0, 1.0, 5.0]),
          method="L-BFGS-B",
          options={
              "maxcor": 10,
              "ftol": 1e-7,
              "gtol": 1e-5,
              "eps": 1e-8,
          },
          evolution=True,
      )
  
      npt.assert_equal(opt.evolution.shape, (opt.nit, 4))
  
      opt = Optimizer(
          fun=func2,
          x0=np.array([1.0, 1.0, 1.0, 5.0]),
          method="Powell",
          options={"xtol": 1e-6, "ftol": 1e-6, "maxiter": 1e6},
          evolution=True,
      )
  
      npt.assert_array_almost_equal(opt.xopt, np.array([0, 0, 0, 0.0]))
  
file_path: dipy/dipy/core/tests/test_optimize.py
imports: import numpy
  import scipy.sparse
  import numpy.testing
  from dipy.core.optimize import Optimizer, sparse_nnls, spdot
  import dipy.core.optimize
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 3 for calling a global function with example usage: test_optimize_new_scipy() without return types