scipy How to write a Jacobian function for optimize.minimize

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


  1. import numpy as np
  2. from scipy.optimize import _minimize
  3. from scipy import special
  4. import matplotlib.pyplot as plt


Note the underscore before 'minimize' when importing from scipy.optimize; '_minimize' Also, i tested the functions from this link before doing this section, and found I had less trouble/it worked faster, if I imported 'special' separately. The Rosenbrock function on the linked page was incorrect - you have to configure the colorbar first; I've posted alternate code but think it could be better.

Further examples to come.

See here for an explanation of Hessian Matrix

Got any scipy Question?